first commit
This commit is contained in:
commit
5c7d1905a9
25 changed files with 4034 additions and 0 deletions
24
include/components/common.hpp
Normal file
24
include/components/common.hpp
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
/**
|
||||
* @file common.hpp
|
||||
* @brief Common/utility components
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
struct Name {
|
||||
std::string value;
|
||||
};
|
||||
|
||||
// Tag component - empty struct marks entities for destruction
|
||||
struct ToDestroy {};
|
||||
|
||||
struct Lifetime {
|
||||
float remaining = 0.0f;
|
||||
};
|
||||
|
||||
struct Health {
|
||||
float current = 100.0f;
|
||||
float max = 100.0f;
|
||||
};
|
||||
21
include/components/input.hpp
Normal file
21
include/components/input.hpp
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/**
|
||||
* @file input.hpp
|
||||
* @brief Input-related components
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
struct PlayerControlled {
|
||||
int player_id = 0;
|
||||
};
|
||||
|
||||
struct InputState {
|
||||
bool move_up = false;
|
||||
bool move_down = false;
|
||||
bool move_left = false;
|
||||
bool move_right = false;
|
||||
bool action_primary = false;
|
||||
bool action_secondary = false;
|
||||
float mouse_x = 0.0f;
|
||||
float mouse_y = 0.0f;
|
||||
};
|
||||
32
include/components/render.hpp
Normal file
32
include/components/render.hpp
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
* @file render.hpp
|
||||
* @brief Rendering-related components
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#include <cstdint>
|
||||
|
||||
struct Color {
|
||||
uint8_t r = 255;
|
||||
uint8_t g = 255;
|
||||
uint8_t b = 255;
|
||||
uint8_t a = 255;
|
||||
};
|
||||
|
||||
struct Sprite {
|
||||
SDL_Texture* texture = nullptr;
|
||||
SDL_FRect src_rect{};
|
||||
int z_order = 0;
|
||||
bool visible = true;
|
||||
};
|
||||
|
||||
struct RectShape {
|
||||
float width = 0.0f;
|
||||
float height = 0.0f;
|
||||
};
|
||||
|
||||
struct CircleShape {
|
||||
float radius = 0.0f;
|
||||
};
|
||||
25
include/components/transform.hpp
Normal file
25
include/components/transform.hpp
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
/**
|
||||
* @file transform.hpp
|
||||
* @brief Transform components for position, velocity, and rotation
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
struct Position {
|
||||
float x = 0.0f;
|
||||
float y = 0.0f;
|
||||
};
|
||||
|
||||
struct Velocity {
|
||||
float x = 0.0f;
|
||||
float y = 0.0f;
|
||||
};
|
||||
|
||||
struct Rotation {
|
||||
float angle = 0.0f;
|
||||
};
|
||||
|
||||
struct Scale {
|
||||
float x = 1.0f;
|
||||
float y = 1.0f;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue