fix 🪱 fixed window logic breaking after moving it to WindowManager class

This commit is contained in:
2025-07-13 13:19:43 +02:00
parent 1b1d8a5d82
commit d04c0a6e15
26 changed files with 82 additions and 41 deletions

Binary file not shown.

View File

@ -2,6 +2,18 @@
"Version": 1,
"WorkspaceRootPath": "C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{5653811A-38D1-4D9D-9446-A417E8557584}|ShadowCrestGameEngine.vcxproj|C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\core\\WindowManager.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{5653811A-38D1-4D9D-9446-A417E8557584}|ShadowCrestGameEngine.vcxproj|solutionrelative:src\\core\\WindowManager.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{5653811A-38D1-4D9D-9446-A417E8557584}|ShadowCrestGameEngine.vcxproj|C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\core\\WindowManager.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{5653811A-38D1-4D9D-9446-A417E8557584}|ShadowCrestGameEngine.vcxproj|solutionrelative:src\\core\\WindowManager.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{5653811A-38D1-4D9D-9446-A417E8557584}|ShadowCrestGameEngine.vcxproj|C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\core\\Engine.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{5653811A-38D1-4D9D-9446-A417E8557584}|ShadowCrestGameEngine.vcxproj|solutionrelative:src\\core\\Engine.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{5653811A-38D1-4D9D-9446-A417E8557584}|ShadowCrestGameEngine.vcxproj|C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\core\\Engine.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{5653811A-38D1-4D9D-9446-A417E8557584}|ShadowCrestGameEngine.vcxproj|solutionrelative:src\\core\\Engine.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
@ -14,10 +26,6 @@
"AbsoluteMoniker": "D:0:0:{5653811A-38D1-4D9D-9446-A417E8557584}|ShadowCrestGameEngine.vcxproj|C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\core\\Logger.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{5653811A-38D1-4D9D-9446-A417E8557584}|ShadowCrestGameEngine.vcxproj|solutionrelative:src\\core\\Logger.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{5653811A-38D1-4D9D-9446-A417E8557584}|ShadowCrestGameEngine.vcxproj|C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\core\\WindowManager.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{5653811A-38D1-4D9D-9446-A417E8557584}|ShadowCrestGameEngine.vcxproj|solutionrelative:src\\core\\WindowManager.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\SDL3.def||{8B382828-6202-11D1-8870-0000F87579D2}",
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:SDL3.def||{8B382828-6202-11D1-8870-0000F87579D2}"
@ -30,11 +38,37 @@
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 3,
"SelectedChildIndex": 4,
"Children": [
{
"$type": "Document",
"DocumentIndex": 4,
"DocumentIndex": 2,
"Title": "Engine.h",
"DocumentMoniker": "C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\core\\Engine.h",
"RelativeDocumentMoniker": "src\\core\\Engine.h",
"ToolTip": "C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\core\\Engine.h",
"RelativeToolTip": "src\\core\\Engine.h",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2025-07-13T00:30:33.574Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "WindowManager.h",
"DocumentMoniker": "C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\core\\WindowManager.h",
"RelativeDocumentMoniker": "src\\core\\WindowManager.h",
"ToolTip": "C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\core\\WindowManager.h",
"RelativeToolTip": "src\\core\\WindowManager.h",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAcAAAACAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2025-07-13T00:30:23.261Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 6,
"Title": "SDL3.def",
"DocumentMoniker": "C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\SDL3.def",
"RelativeDocumentMoniker": "SDL3.def",
@ -46,7 +80,7 @@
},
{
"$type": "Document",
"DocumentIndex": 2,
"DocumentIndex": 5,
"Title": "Logger.cpp",
"DocumentMoniker": "C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\core\\Logger.cpp",
"RelativeDocumentMoniker": "src\\core\\Logger.cpp",
@ -58,32 +92,33 @@
},
{
"$type": "Document",
"DocumentIndex": 3,
"DocumentIndex": 0,
"Title": "WindowManager.cpp",
"DocumentMoniker": "C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\core\\WindowManager.cpp",
"RelativeDocumentMoniker": "src\\core\\WindowManager.cpp",
"ToolTip": "C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\core\\WindowManager.cpp",
"RelativeToolTip": "src\\core\\WindowManager.cpp",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"ViewState": "AgIAAAAAAAAAAAAAAAAAABIAAAABAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2025-07-12T23:31:48.358Z"
"WhenOpened": "2025-07-12T23:31:48.358Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 0,
"DocumentIndex": 3,
"Title": "Engine.cpp",
"DocumentMoniker": "C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\core\\Engine.cpp",
"RelativeDocumentMoniker": "src\\core\\Engine.cpp",
"ToolTip": "C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\core\\Engine.cpp",
"RelativeToolTip": "src\\core\\Engine.cpp",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAkAAAAGAAAAAAAAAA==",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAYAAAAbAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2025-07-12T23:30:21.367Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 1,
"DocumentIndex": 4,
"Title": "main.cpp",
"DocumentMoniker": "C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\main.cpp",
"RelativeDocumentMoniker": "src\\main.cpp",

View File

@ -2,18 +2,10 @@
"Version": 1,
"WorkspaceRootPath": "C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{5653811A-38D1-4D9D-9446-A417E8557584}|ShadowCrestGameEngine.vcxproj|C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\core\\Engine.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{5653811A-38D1-4D9D-9446-A417E8557584}|ShadowCrestGameEngine.vcxproj|solutionrelative:src\\core\\Engine.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{5653811A-38D1-4D9D-9446-A417E8557584}|ShadowCrestGameEngine.vcxproj|C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\core\\WindowManager.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{5653811A-38D1-4D9D-9446-A417E8557584}|ShadowCrestGameEngine.vcxproj|solutionrelative:src\\core\\WindowManager.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{5653811A-38D1-4D9D-9446-A417E8557584}|ShadowCrestGameEngine.vcxproj|C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\main.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{5653811A-38D1-4D9D-9446-A417E8557584}|ShadowCrestGameEngine.vcxproj|solutionrelative:src\\main.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{5653811A-38D1-4D9D-9446-A417E8557584}|ShadowCrestGameEngine.vcxproj|C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\core\\WindowManager.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{5653811A-38D1-4D9D-9446-A417E8557584}|ShadowCrestGameEngine.vcxproj|solutionrelative:src\\core\\WindowManager.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
@ -22,6 +14,14 @@
"AbsoluteMoniker": "D:0:0:{5653811A-38D1-4D9D-9446-A417E8557584}|ShadowCrestGameEngine.vcxproj|C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\core\\Engine.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{5653811A-38D1-4D9D-9446-A417E8557584}|ShadowCrestGameEngine.vcxproj|solutionrelative:src\\core\\Engine.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{5653811A-38D1-4D9D-9446-A417E8557584}|ShadowCrestGameEngine.vcxproj|C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\core\\Engine.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{5653811A-38D1-4D9D-9446-A417E8557584}|ShadowCrestGameEngine.vcxproj|solutionrelative:src\\core\\Engine.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{5653811A-38D1-4D9D-9446-A417E8557584}|ShadowCrestGameEngine.vcxproj|C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\main.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{5653811A-38D1-4D9D-9446-A417E8557584}|ShadowCrestGameEngine.vcxproj|solutionrelative:src\\main.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{5653811A-38D1-4D9D-9446-A417E8557584}|ShadowCrestGameEngine.vcxproj|C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\core\\Logger.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{5653811A-38D1-4D9D-9446-A417E8557584}|ShadowCrestGameEngine.vcxproj|solutionrelative:src\\core\\Logger.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
@ -38,11 +38,11 @@
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 5,
"SelectedChildIndex": 4,
"Children": [
{
"$type": "Document",
"DocumentIndex": 4,
"DocumentIndex": 2,
"Title": "Engine.h",
"DocumentMoniker": "C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\core\\Engine.h",
"RelativeDocumentMoniker": "src\\core\\Engine.h",
@ -55,13 +55,13 @@
},
{
"$type": "Document",
"DocumentIndex": 3,
"DocumentIndex": 1,
"Title": "WindowManager.h",
"DocumentMoniker": "C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\core\\WindowManager.h",
"RelativeDocumentMoniker": "src\\core\\WindowManager.h",
"ToolTip": "C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\core\\WindowManager.h",
"RelativeToolTip": "src\\core\\WindowManager.h",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAkAAAACAAAAAAAAAA==",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAcAAAACAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2025-07-13T00:30:23.261Z",
"EditorCaption": ""
@ -88,38 +88,37 @@
"RelativeToolTip": "src\\core\\Logger.cpp",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2025-07-12T23:31:49.016Z",
"EditorCaption": ""
"WhenOpened": "2025-07-12T23:31:49.016Z"
},
{
"$type": "Document",
"DocumentIndex": 1,
"DocumentIndex": 0,
"Title": "WindowManager.cpp",
"DocumentMoniker": "C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\core\\WindowManager.cpp",
"RelativeDocumentMoniker": "src\\core\\WindowManager.cpp",
"ToolTip": "C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\core\\WindowManager.cpp",
"RelativeToolTip": "src\\core\\WindowManager.cpp",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAcAAABDAAAAAAAAAA==",
"ViewState": "AgIAAAAAAAAAAAAAAAAAABIAAAABAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2025-07-12T23:31:48.358Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 0,
"DocumentIndex": 3,
"Title": "Engine.cpp",
"DocumentMoniker": "C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\core\\Engine.cpp",
"RelativeDocumentMoniker": "src\\core\\Engine.cpp",
"ToolTip": "C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\core\\Engine.cpp",
"RelativeToolTip": "src\\core\\Engine.cpp",
"ViewState": "AgIAAAAAAAAAAAAAAAAAABAAAAAUAAAAAAAAAA==",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAYAAAAbAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2025-07-12T23:30:21.367Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 2,
"DocumentIndex": 4,
"Title": "main.cpp",
"DocumentMoniker": "C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\main.cpp",
"RelativeDocumentMoniker": "src\\main.cpp",

Binary file not shown.

View File

@ -4,7 +4,7 @@
#include "WindowManager.h"
bool running = true;
WindowManager wm;
WindowManager *wm = nullptr;
bool Engine::Init() {
if (!SDL_Init(SDL_INIT_VIDEO)) {
@ -14,7 +14,7 @@ bool Engine::Init() {
wm = new WindowManager();
if (!wm.InitWindow("ShadowCrest", 800, 600)) {
if (!wm->InitWindow("ShadowCrest", 800, 600)) {
std::cerr << "SDL_Init failed: " << SDL_GetError() << "\n";
return false;
}
@ -36,6 +36,8 @@ void Engine::Run() {
}
void Engine::Shutdown() {
SDL_DestroyWindow(window);
if (wm != nullptr) {
wm->Close();
}
SDL_Quit();
}

View File

@ -1,12 +1,19 @@
#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) {
bool WindowManager::InitWindow(const char *name, int width, int height) {
// creates window
window = SDL_CreateWindow(name, width, height, SDL_WINDOW_RESIZABLE);
return window != nullptr;
}
void WindowManager::Draw() {
std::cout << "draw to window";
}
void WindowManager::Close() {
SDL_DestroyWindow(window);
}

View File

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

Binary file not shown.

Binary file not shown.