first commit

This commit is contained in:
saarsena@gmail.com 2026-04-02 03:41:50 -04:00
commit 5c7d1905a9
25 changed files with 4034 additions and 0 deletions

View 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;
};

View 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;
};

View 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;
};

View 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;
};