Add debug menu option, misc. tweaks
This commit is contained in:
@@ -93,7 +93,7 @@ ecs_entity_t placeBuilding(Game *game, BuildingType type,
|
||||
Health health = {
|
||||
.startHP = 500.0f,
|
||||
.hp = 500.0f,
|
||||
.lastChanged = 1000.0f,
|
||||
.lastChanged = -1000.0f,
|
||||
};
|
||||
switch (type) {
|
||||
case BUILDING_KEEP:
|
||||
|
||||
@@ -101,7 +101,7 @@ static ParticleEmitter GET_FIREBALL_EMITTER() {
|
||||
.emitterLifetime = 2.0f,
|
||||
.data.minOffset = { -2.0f, -2.0f },
|
||||
.data.maxOffset = { 2.0f, 2.0f },
|
||||
.data.emmitRate = 2.2f,
|
||||
.data.emmitRate = 3.2f,
|
||||
.data.emmitVariance = 1.0f,
|
||||
.data.emmitVarianceMin = 0.0f,
|
||||
.data.emmitVarianceMax = 1.0f,
|
||||
|
||||
@@ -74,7 +74,7 @@ ecs_entity_t entityCreateSoldier(const Position position, Player player, Game *g
|
||||
ecs_set(ECS, e, Health, {
|
||||
.startHP = 40.0f,
|
||||
.hp = 40.0f,
|
||||
.lastChanged = -1.0f
|
||||
.lastChanged = -1000.0f
|
||||
});
|
||||
Unit *unit = ecs_get_mut(ECS, e, Unit);
|
||||
unit->minDamage = 5.0f;
|
||||
@@ -87,7 +87,7 @@ ecs_entity_t entityCreateWarrior(const Position position, Player player, Game *g
|
||||
ecs_set(ECS, e, Health, {
|
||||
.startHP = 80.0f,
|
||||
.hp = 80.0f,
|
||||
.lastChanged = -1.0f
|
||||
.lastChanged = -1000.0f
|
||||
});
|
||||
Unit *unit = ecs_get_mut(ECS, e, Unit);
|
||||
unit->minDamage = 8.0f;
|
||||
@@ -109,7 +109,7 @@ ecs_entity_t entityCreateWorker(const Position position, Player player, Game *ga
|
||||
ecs_set(ECS, e, Health, {
|
||||
.startHP = 20.0f,
|
||||
.hp = 20.0f,
|
||||
.lastChanged = -1.0f
|
||||
.lastChanged = -1000.0f
|
||||
});
|
||||
|
||||
return e;
|
||||
@@ -123,7 +123,7 @@ ecs_entity_t entityCreateSwarmGoblin(const Position position, Player player, Gam
|
||||
ecs_set(ECS, e, Health, {
|
||||
.startHP = 40.0f,
|
||||
.hp = 40.0f,
|
||||
.lastChanged = -1.0f
|
||||
.lastChanged = -1000.0f
|
||||
});
|
||||
|
||||
Unit *unit = ecs_get_mut(ECS, e, Unit);
|
||||
@@ -142,7 +142,7 @@ ecs_entity_t entityCreateSwarmOrc(const Position position, Player player, Game *
|
||||
ecs_set(ECS, e, Health, {
|
||||
.startHP = 80.0f,
|
||||
.hp = 80.0f,
|
||||
.lastChanged = -1.0f
|
||||
.lastChanged = -1000.0f
|
||||
});
|
||||
|
||||
Unit *unit = ecs_get_mut(ECS, e, Unit);
|
||||
|
||||
@@ -27,6 +27,7 @@ typedef struct DrawData {
|
||||
|
||||
typedef struct Options {
|
||||
// Video
|
||||
bool debugMenu;
|
||||
bool fullscreen;
|
||||
bool limitFps;
|
||||
// Audio
|
||||
@@ -42,6 +43,7 @@ typedef struct GameData {
|
||||
static GameData getDefaultGameData() {
|
||||
return (GameData) {
|
||||
.options = {
|
||||
.debugMenu = false,
|
||||
.fullscreen = false,
|
||||
.limitFps = true,
|
||||
.master = 0.5f,
|
||||
|
||||
@@ -766,6 +766,11 @@ void imguiRender(float dt, void *userData) {
|
||||
Game *game = ecs_singleton_get_mut(ECS, Game);
|
||||
InputState *input = ecs_singleton_get_mut(ECS, InputState);
|
||||
|
||||
if (!game->gameData.options.debugMenu) {
|
||||
bzArrayClear(game->debug.inspecting);
|
||||
return;
|
||||
}
|
||||
|
||||
//igShowDemoWindow(NULL);
|
||||
|
||||
igSetNextWindowSize((ImVec2){300, 400}, ImGuiCond_FirstUseEver);
|
||||
|
||||
@@ -445,8 +445,9 @@ void drawSettingsUI(Game *game, f32 dt) {
|
||||
static GameData gameData = {};
|
||||
if (game->screenPrevFrame != SCREEN_SETTINGS)
|
||||
gameData = game->gameData;
|
||||
uiSettingsLabel("Video");
|
||||
uiSettingsCheckbox("Fullscreen", &gameData.options.fullscreen);
|
||||
uiSettingsLabel("Game");
|
||||
//uiSettingsCheckbox("Fullscreen", &gameData.options.fullscreen);
|
||||
uiSettingsCheckbox("Debug Mode", &gameData.options.debugMenu);
|
||||
uiSettingsCheckbox("Limit FPS", &gameData.options.limitFps);
|
||||
//uiSettingsCheckbox("V-Sync", &opts.vsync);
|
||||
|
||||
|
||||
@@ -204,12 +204,12 @@ void setupSystems() {
|
||||
ECS_SYSTEM(ECS, renderDebugPath, EcsOnUpdate, Path);
|
||||
|
||||
ECS_SYSTEM(ECS, renderColliders, EcsOnUpdate, Position, HitBox);
|
||||
ECS_SYSTEM(ECS, renderOrientationDirection, EcsOnUpdate, Position, Orientation);
|
||||
//ECS_SYSTEM(ECS, renderOrientationDirection, EcsOnUpdate, Position, Orientation);
|
||||
|
||||
ECS_SYSTEM(ECS, delayDeleteUpdate, EcsOnUpdate, DelayDelete);
|
||||
|
||||
renderDebugPathSystem = renderDebugPath;
|
||||
renderOrientDirSystem = renderOrientationDirection;
|
||||
//renderOrientDirSystem = renderOrientationDirection;
|
||||
renderCollidersSystem = renderColliders;
|
||||
|
||||
//ecs_enable(ECS, renderOrientDirSystem, false);
|
||||
|
||||
Reference in New Issue
Block a user