aboutsummaryrefslogtreecommitdiffstats
path: root/src/game.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/game.c')
-rw-r--r--src/game.c59
1 files changed, 7 insertions, 52 deletions
diff --git a/src/game.c b/src/game.c
index 4ada5de..6f87639 100644
--- a/src/game.c
+++ b/src/game.c
@@ -45,35 +45,13 @@ void resetScreenScale(Game* game)
}
}
-FocusCommand testFloatingWindowCallback(FloatingWindow* window, Game* game)
-{
- float x = window->rect.x + window->scroll.x;
- float y = window->rect.y + window->scroll.y;
-
- DrawText("test", x + 10, y + 10 + RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT, 15,
- BLUE);
-
- // Content size test.
- if (window->contentSize.x != 0.0)
- {
- DrawText("content size test", x + 150.0, y + 150.0, 20, RED);
- }
-
- // Button test.
- if (GuiButton((Rectangle){x + 10.0, y + 50.0, 40.0, 20.0}, "A"))
- {
- puts("hi");
- }
-
- return NO_FOCUS_ACTION;
-}
-
void initGame(Game* game)
{
game->sceneId = GAME_SCENE;
// Settings.
game->settings = defaultSettings();
+ game->isCrossHairEnabled = game->settings.isCrossHairEnabledDefault;
// Window.
InitWindow(game->settings.windowWidth, game->settings.windowHeight,
@@ -104,31 +82,6 @@ void initGame(Game* game)
game->player.camera.fovy = game->settings.fov;
game->player.position = Vector3Scale(game->world.size, 0.5);
- // Window manager.
- initWindowManager(&game->wm);
-
- FloatingWindow window = createFloatingWindow("test1",
- (Rectangle){0.0, 0.0,
- 100.0, 100.0});
- addWindowToWindowManager(&game->wm, window);
-
- window = createFloatingWindow("test2",\
- (Rectangle){200.0, 200.0, 100.0, 100.0});
- window.callback = testFloatingWindowCallback;
- addWindowToWindowManager(&game->wm, window);
-
- window = createFloatingWindow("test3",
- (Rectangle){300.0, 300.0, 100.0, 100.0});
- window.callback = testFloatingWindowCallback;
- window.contentSize = (Vector2){500.0, 500.0};
- addWindowToWindowManager(&game->wm, window);
-
- window = createFloatingWindow("test4",
- (Rectangle){400.0, 400.0, 100.0, 100.0});
- window.callback = testFloatingWindowCallback;
- window.contentSize = (Vector2){500.0, 500.0};
- addWindowToWindowManager(&game->wm, window);
-
disableGameCursor(game);
}
@@ -229,9 +182,13 @@ void updateGameScene(Game* game)
drawGameScreen(game);
- updateWindowManager(&game->wm, game);
+ // Cross hair.
+ if (IsKeyPressed(game->settings.toggleCrossHairKey))
+ {
+ game->isCrossHairEnabled = !game->isCrossHairEnabled;
+ }
- if (!game->isCursorEnabled)
+ if (game->isCrossHairEnabled)
{
drawCrosshair(game->settings.crossHairSize,
game->settings.crossHairThickness,
@@ -284,12 +241,10 @@ void enableGameCursor(Game* game)
{
game->isCursorEnabled = true;
EnableCursor();
- enableWindowManager(&game->wm);
}
void disableGameCursor(Game* game)
{
game->isCursorEnabled = false;
DisableCursor();
- disableWindowManager(&game->wm);
}