diff --git a/src/Engine/Engine.cpp b/src/Engine/Engine.cpp index aa1781d..c40210a 100644 --- a/src/Engine/Engine.cpp +++ b/src/Engine/Engine.cpp @@ -1,31 +1,33 @@ #include "Engine.hpp" #include "raylib.h" -void Engine::init() { - InitWindow(screenWidth, screenHeight, "DREAM Engine 0.0.1"); +namespace DREAM { + 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(); + SetTargetFPS(165); } - CloseWindow(); + 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 index 656a301..5b70442 100644 --- a/src/Engine/Engine.hpp +++ b/src/Engine/Engine.hpp @@ -2,22 +2,24 @@ #include "../Game/src/Game.hpp" -class Engine { -private: - Game m_game; +namespace DREAM { + class Engine { + private: + GamePlaceholder::Game m_game; - const int screenWidth = 1280; - const int screenHeight = 720; + const int screenWidth = 1280; + const int screenHeight = 720; - float deltaTime; + float deltaTime; - void init(); - void update(float deltaTime); - void draw(); + void init(); + void update(float deltaTime); + void draw(); -public: - Engine() = default; - ~Engine() = default; + public: + Engine() = default; + ~Engine() = default; - void run(); -}; + void run(); + }; +} diff --git a/src/Engine/Window/Window.cpp b/src/Engine/Window/Window.cpp new file mode 100644 index 0000000..4eebb3a --- /dev/null +++ b/src/Engine/Window/Window.cpp @@ -0,0 +1,3 @@ +namespace DREAM { + // TODO: Implement Window functions +} diff --git a/src/Engine/Window/Window.hpp b/src/Engine/Window/Window.hpp new file mode 100644 index 0000000..6b3ef78 --- /dev/null +++ b/src/Engine/Window/Window.hpp @@ -0,0 +1,41 @@ +#pragma once + +#include + +namespace DREAM { + struct WindowConfig { + int m_width { 1280 }; + int m_height { 720 }; + + bool m_Fullscreen { false }; + bool m_vsync { false }; + bool m_resizable { false } ; + }; + + namespace Window { + void init(WindowConfig& config); + + void setWidth(int width); + void setHeight(int height); + + void setSize(int width, int height); + void setFullscreen(bool enabled); + void toggleFullscreen(); + + void setTitle(const std::string& title); + void setPosition(int x, int y); + + int getWidth(); + int getHeight(); + float getAspectRatio(); + + bool isFullscreen(); + bool isVSyncEnabled(); + bool isResizable(); + + int getMonitorIndex(); + int getMonitorRefreshRate(); + int getMonitorWidth(); + int getMonitorHeight(); + } +} diff --git a/src/Game/src/Game.hpp b/src/Game/src/Game.hpp index 85c5e1a..509c5bd 100644 --- a/src/Game/src/Game.hpp +++ b/src/Game/src/Game.hpp @@ -1,12 +1,14 @@ #pragma once -class Game { -private: +namespace GamePlaceholder { + class Game { + private: -public: - Game() = default; - ~Game() = default; + public: + Game() = default; + ~Game() = default; - void update(); - void draw(); -}; + void update(); + void draw(); + }; +} diff --git a/src/main.cpp b/src/main.cpp index 3f426ef..0d67b88 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,6 +1,6 @@ #include "Engine/Engine.hpp" int main() { - Engine engine; + DREAM::Engine engine; engine.run(); }