added absolutely broken cpp code after painfull debugging session

This commit is contained in:
2025-07-13 02:42:51 +02:00
parent 5208d61954
commit 1b1d8a5d82
140 changed files with 79345 additions and 97 deletions

0
src/core/.gitkeep Normal file
View File

41
src/core/Engine.cpp Normal file
View File

@ -0,0 +1,41 @@
#include "Engine.h"
#include <iostream>
#include <SDL3/SDL.h>
#include "WindowManager.h"
bool running = true;
WindowManager wm;
bool Engine::Init() {
if (!SDL_Init(SDL_INIT_VIDEO)) {
std::cerr << "SDL_Init failed: " << SDL_GetError() << "\n";
return false;
}
wm = new WindowManager();
if (!wm.InitWindow("ShadowCrest", 800, 600)) {
std::cerr << "SDL_Init failed: " << SDL_GetError() << "\n";
return false;
}
return true;
}
void Engine::Run() {
SDL_Event event;
while (running) {
while (SDL_PollEvent(&event)) {
if (event.type == SDL_EVENT_QUIT) {
running = false;
}
}
SDL_Delay(16);
}
}
void Engine::Shutdown() {
SDL_DestroyWindow(window);
SDL_Quit();
}

8
src/core/Engine.h Normal file
View File

@ -0,0 +1,8 @@
#pragma once
class Engine {
public:
bool Init();
void Run();
void Shutdown();
};

0
src/core/Logger.cpp Normal file
View File

0
src/core/Logger.h Normal file
View File

View File

@ -0,0 +1,12 @@
#include "WindowManager.h"
#include <iostream>
#include <SDL3/SDL.h>
#include <Windows.h>
SDL_Window* window = nullptr;
bool WindowManager::InitWindow(char *name, int width, int height) {
// creates window
window = SDL_CreateWindow(name, width, height, SDL_WINDOW_RESIZABLE);
return window != nullptr;
}

10
src/core/WindowManager.h Normal file
View File

@ -0,0 +1,10 @@
#include <string>
using namespace std;
#pragma once
class WindowManager {
public:
bool InitWindow(char *name, int width, int height);
void Draw();
};