Meteor2D  dev internal
Meteor is a lightweight 2D game engine.
Loading...
Searching...
No Matches
texrendercmd.h
1#pragma once
2#include <SDL.h>
3#include <meteorutils/rect.h>
4#include <2d/texture.h>
5#include <rendering/rendercommand.h>
6
7namespace meteor {
12 public:
18 MTexRenderCmd(ERenderLayer layer, uint8_t sortingOrder);
27 inline void updateRect(SRect rect) { targetRect = rect; }
33 inline void updateSrcRect(SRect rect) { this->srcRect = rect; }
38 inline void updateScale(SVector2 scale) { this->scale = scale; }
43 inline void updatePivot(SVector2 pivot) { this->pivot = pivot; }
48 inline void updateRotation(float rotation) { this->rotation = rotation; }
53 inline void useSourceRect(bool useSrcRect) { this->useSrcRect = useSrcRect; }
57 void render() override;
61 bool isValid() override;
62 private:
63 MTexture* textureTempBuffer = NULL;
64 MTexture* texture;
65 SRect targetRect;
66 SRect srcRect;
67 SVector2 scale;
68 SVector2 pivot;
69 float rotation;
70 bool useSrcRect;
71 bool lockedForRender;
72
73 void swap();
74 };
75}
RenderCommand are responsible for rendering visuals to the screen.
Definition rendercommand.h:10
This a RenderCommand that draws an image on to the screen.
Definition texrendercmd.h:11
MTexRenderCmd(ERenderLayer layer, uint8_t sortingOrder)
Constructor.
void useSourceRect(bool useSrcRect)
Set to true if a part of the texture needs to be rendererd.
Definition texrendercmd.h:53
bool isValid() override
void updateSrcRect(SRect rect)
Update the Rect for image. Src Rect is the rect used for rendering specific parts of the texture.
Definition texrendercmd.h:33
void updateRect(SRect rect)
Update the Rect for rendering.
Definition texrendercmd.h:27
void updatePivot(SVector2 pivot)
Update the pivot of image during render.
Definition texrendercmd.h:43
void render() override
Renders the image to screen.
void bindTexture(MTexture *tex)
Bind a texture to draw.
void updateRotation(float rotation)
Update rotation of the img during render.
Definition texrendercmd.h:48
void updateScale(SVector2 scale)
Update the scale of image during render.
Definition texrendercmd.h:38
This class holds an image that can be rendererd to the screen.
Definition texture.h:12
A struct representing rectangle.
Definition rect.h:8
A structure representing a 2D Vector.
Definition vector2d.h:11