MAIN LOOP DONE
This commit is contained in:
@@ -37,6 +37,7 @@ project(DREAM2026
|
|||||||
# Target: DREAM2026
|
# Target: DREAM2026
|
||||||
set(DREAM2026_SOURCES
|
set(DREAM2026_SOURCES
|
||||||
cmake.toml
|
cmake.toml
|
||||||
|
"src/Engine/Engine.cpp"
|
||||||
"src/Game/src/Game.cpp"
|
"src/Game/src/Game.cpp"
|
||||||
"src/main.cpp"
|
"src/main.cpp"
|
||||||
)
|
)
|
||||||
|
|||||||
31
src/Engine/Engine.cpp
Normal file
31
src/Engine/Engine.cpp
Normal file
@@ -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();
|
||||||
|
}
|
||||||
23
src/Engine/Engine.hpp
Normal file
23
src/Engine/Engine.hpp
Normal file
@@ -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();
|
||||||
|
};
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
class Game {
|
||||||
|
private:
|
||||||
|
|
||||||
|
public:
|
||||||
|
Game() = default;
|
||||||
|
~Game() = default;
|
||||||
|
|
||||||
|
void update();
|
||||||
|
void draw();
|
||||||
|
};
|
||||||
|
|||||||
31
src/main.cpp
31
src/main.cpp
@@ -1,29 +1,6 @@
|
|||||||
#include "raylib.h"
|
#include "Engine/Engine.hpp"
|
||||||
|
|
||||||
int main(void) {
|
int main() {
|
||||||
const int screenWidth = 800;
|
Engine engine;
|
||||||
const int screenHeight = 450;
|
engine.run();
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user