Exploring raycasters and possibly make a little "doom like" game based on it.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
raycaster/components.hpp

74 lines
1.3 KiB

#pragma once
#include "dinkyecs.hpp"
#include "devices.hpp"
#include "combat.hpp"
#include "inventory.hpp"
#include "config.hpp"
namespace components {
struct Player {
DinkyECS::Entity entity;
};
struct Position {
Point location;
};
struct Motion {
int dx;
int dy;
bool random=false;
};
struct Loot {
int amount;
};
struct Tile {
std::string chr;
std::array<uint8_t, 3> foreground;
std::array<uint8_t, 3> background;
uint8_t fg_h = 200;
uint8_t fg_s = 20;
uint8_t fg_v = 200;
uint8_t bg_h = 100;
uint8_t bg_s = 20;
uint8_t bg_v = 0;
};
struct GameConfig {
Config game;
Config enemies;
Config items;
Config tiles;
Config devices;
};
struct EnemyConfig {
int hearing_distance = 10;
};
struct Debug {
bool PATHS=false;
bool LIGHT=false;
};
struct Weapon {
int damage = 0;
};
struct Curative {
int hp = 10;
};
}
DINKY_HAS_COMPONENT(components::Loot, amount);
DINKY_HAS_COMPONENT(Point, x, y);
DINKY_HAS_COMPONENT(components::Position, location);
DINKY_HAS_COMPONENT(components::Weapon, damage);
DINKY_HAS_COMPONENT(components::Curative, hp);
DINKY_HAS_COMPONENT(components::EnemyConfig, hearing_distance);
DINKY_HAS_COMPONENT(components::Tile, chr, foreground, background);
DINKY_HAS_COMPONENT(components::Motion, dx, dy, random);