diff --git a/CMakeLists.txt b/CMakeLists.txt index e9233eb..cab59ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,6 +37,7 @@ project(DREAM2026 # Target: DREAM2026 set(DREAM2026_SOURCES cmake.toml + "src/Engine/Engine.cpp" "src/Game/src/Game.cpp" "src/main.cpp" ) diff --git a/src/Engine/Engine.cpp b/src/Engine/Engine.cpp new file mode 100644 index 0000000..aa1781d --- /dev/null +++ b/src/Engine/Engine.cpp @@ -0,0 +1,31 @@ +#include "Engine.hpp" +#include "raylib.h" + +void Engine::init() { + InitWindow(screenWidth, screenHeight, "DREAM Engine 0.0.1"); + + SetTargetFPS(165); +} + +void Engine::update(float deltaTime) { + deltaTime = GetFrameTime(); +} + +void Engine::draw() { + BeginDrawing(); + + ClearBackground(BLACK); + DrawText("fsdf", 10, 10, 16, WHITE); + + EndDrawing(); +} + +void Engine::run() { + init(); + while (!WindowShouldClose()) { + update(deltaTime); + draw(); + } + + CloseWindow(); +} diff --git a/src/Engine/Engine.hpp b/src/Engine/Engine.hpp new file mode 100644 index 0000000..656a301 --- /dev/null +++ b/src/Engine/Engine.hpp @@ -0,0 +1,23 @@ +#pragma once + +#include "../Game/src/Game.hpp" + +class Engine { +private: + Game m_game; + + const int screenWidth = 1280; + const int screenHeight = 720; + + float deltaTime; + + void init(); + void update(float deltaTime); + void draw(); + +public: + Engine() = default; + ~Engine() = default; + + void run(); +}; diff --git a/src/Game/src/Game.hpp b/src/Game/src/Game.hpp index e69de29..85c5e1a 100644 --- a/src/Game/src/Game.hpp +++ b/src/Game/src/Game.hpp @@ -0,0 +1,12 @@ +#pragma once + +class Game { +private: + +public: + Game() = default; + ~Game() = default; + + void update(); + void draw(); +}; diff --git a/src/main.cpp b/src/main.cpp index 871d1ab..3f426ef 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,29 +1,6 @@ -#include "raylib.h" +#include "Engine/Engine.hpp" -int main(void) { - const int screenWidth = 800; - const int screenHeight = 450; - - struct Player { - Rectangle playerRec; - float velocity; - }; - - InitWindow(screenWidth, screenHeight, "DREAM"); - - SetTargetFPS(60); - - while (!WindowShouldClose()) - { - BeginDrawing(); - - ClearBackground(BLACK); - - DrawText("whoever can read this is gay", 190, 200, 20, LIGHTGRAY); - - EndDrawing(); - } - - CloseWindow(); - return 0; +int main() { + Engine engine; + engine.run(); }