diff options
author | salaaad2 <arthurdurant263@gmail.com> | 2022-06-13 22:15:48 +0200 |
---|---|---|
committer | salaaad2 <arthurdurant263@gmail.com> | 2022-06-13 22:15:48 +0200 |
commit | 95cde5c181b5fd1d9ee3f13db749799c4e8ac9d3 (patch) | |
tree | 352480349a46d19ab5b8078ac4ccb79d27166f04 /src | |
parent | mouse is captured again, pretty gud (diff) | |
download | yabs-95cde5c181b5fd1d9ee3f13db749799c4e8ac9d3.tar.gz yabs-95cde5c181b5fd1d9ee3f13db749799c4e8ac9d3.tar.bz2 yabs-95cde5c181b5fd1d9ee3f13db749799c4e8ac9d3.tar.xz yabs-95cde5c181b5fd1d9ee3f13db749799c4e8ac9d3.tar.zst yabs-95cde5c181b5fd1d9ee3f13db749799c4e8ac9d3.zip |
add raylib to the build chain with -O3 and -march=native
Diffstat (limited to '')
-rw-r--r-- | src/main.cpp | 11 | ||||
-rw-r--r-- | src/yabs_core.cpp | 6 | ||||
-rw-r--r-- | src/yabs_core.h | 3 |
3 files changed, 8 insertions, 12 deletions
diff --git a/src/main.cpp b/src/main.cpp index 0ec23c5..0472a95 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -9,7 +9,8 @@ #include "yabs_core.h" #include "yabs_utils.h" -static yabs::gameState game_state; +static yabs::gameState game_state = yabs::TITLE; + static yabs::Scene3D sc3d{ // camera {{5.0f, 5.0f, 5.0f}, {0.0f, 0.0f, 0.0f}, {0.0f, 1.0f, 0.0f}, 45.0f, 0}, @@ -80,9 +81,6 @@ int main(void) { break; } case (yabs::GAMEPLAY): { - while (game_state != yabs::NEXT) { - yabs::core::draw(game_state, model); - } break; } case (yabs::NEXT): { @@ -97,13 +95,14 @@ int main(void) { BeginDrawing(); ClearBackground(GRAY); BeginMode3D(sc3d.camera); + yabs::core::tick(sc3d); - yabs::core::draw(game_state, model); + yabs::core::draw(model); + EndMode3D(); DrawFPS(0, 0); DrawText("Controls: Mouse / WASD / SPACE/CTRL.", YABS_SCREENWIDTH - 400, 0, 20, DARKGRAY); - EndDrawing(); } UnloadTexture(texture); diff --git a/src/yabs_core.cpp b/src/yabs_core.cpp index 3648dfb..fabfb09 100644 --- a/src/yabs_core.cpp +++ b/src/yabs_core.cpp @@ -8,7 +8,6 @@ #include <stdlib.h> -#include "raymath.h" #include "yabs_core.h" namespace yabs { @@ -27,7 +26,7 @@ int reset_camera(Scene3D& scene_3d) { return (0); } -int draw(gameState const& game_state, Model& model) { +int draw(Model& model) { // draw checkerboard model for (int x = 0; x < 50; x++) { for (int z = 0; z < 50; z++) { @@ -38,8 +37,6 @@ int draw(gameState const& game_state, Model& model) { DrawModel(model, position, 1.0f, WHITE); } } - - // end draw return (0); } @@ -92,7 +89,6 @@ int tick(Scene3D& scene_3d) { scene_3d.camera.target.x = scene_3d.camera.position.x - transform.m12; scene_3d.camera.target.y = scene_3d.camera.position.y - transform.m13; scene_3d.camera.target.z = scene_3d.camera.position.z - transform.m14; - return (0); } diff --git a/src/yabs_core.h b/src/yabs_core.h index ce30e0c..9120d4c 100644 --- a/src/yabs_core.h +++ b/src/yabs_core.h @@ -10,6 +10,7 @@ /*********************************/ #include "raylib.h" +#include "raymath.h" #define YABS_SCREENWIDTH 1600 #define YABS_SCREENHEIGHT 900 @@ -45,7 +46,7 @@ namespace core { // for next level or death int reset_camera(Scene3D& scene_3d); -int draw(gameState const& game_state, Model& model); +int draw(Model& model); int tick(Scene3D& scene_3d); |