12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- /*
- * 2D Game Engine
- * Sprite.h:
- * Based on pikuma.com 2D game engine in C++ and Lua course
- * Copyright (c) 2021 986-Studio. All rights reserved.
- *
- * Created by Manoël Trapier on 12/02/2021.
- */
- #ifndef GAMEENGINE_SPRITE_H
- #define GAMEENGINE_SPRITE_H
- #include <SDL.h>
- #include <string>
- struct SpriteComponent
- {
- std::string assetId;
- uint32_t width;
- uint32_t height;
- int32_t zIndex;
- SDL_Rect sourceRect;
- bool isFixed;
- explicit SpriteComponent(std::string assetId = "", int32_t zIndex = 0,
- uint32_t width = 0, uint32_t height = 0,
- bool isFixed = false,
- uint32_t sourceRectX = 0, uint32_t sourceRectY = 0) : assetId(assetId), width(width),
- height(height), zIndex(zIndex),
- isFixed(isFixed)
- {
- this->sourceRect = {
- static_cast<int>(sourceRectX),
- static_cast<int>(sourceRectY),
- static_cast<int>(width),
- static_cast<int>(height),
- };
- };
- };
- #endif /* GAMEENGINE_SPRITE_H */
|