diff --git a/.vs/ShadowCrestGameEngine/FileContentIndex/75153341-a644-412d-8ab8-62108770e152.vsidx b/.vs/ShadowCrestGameEngine/FileContentIndex/75153341-a644-412d-8ab8-62108770e152.vsidx new file mode 100644 index 0000000..c5631ef Binary files /dev/null and b/.vs/ShadowCrestGameEngine/FileContentIndex/75153341-a644-412d-8ab8-62108770e152.vsidx differ diff --git a/.vs/ShadowCrestGameEngine/FileContentIndex/ef54b979-1f34-4d90-b43e-f3ae77bdb5c5.vsidx b/.vs/ShadowCrestGameEngine/FileContentIndex/ef54b979-1f34-4d90-b43e-f3ae77bdb5c5.vsidx deleted file mode 100644 index 97a3b2f..0000000 Binary files a/.vs/ShadowCrestGameEngine/FileContentIndex/ef54b979-1f34-4d90-b43e-f3ae77bdb5c5.vsidx and /dev/null differ diff --git a/.vs/ShadowCrestGameEngine/v17/.suo b/.vs/ShadowCrestGameEngine/v17/.suo index 1b7d041..f4b6ad4 100644 Binary files a/.vs/ShadowCrestGameEngine/v17/.suo and b/.vs/ShadowCrestGameEngine/v17/.suo differ diff --git a/.vs/ShadowCrestGameEngine/v17/Browse.VC.db b/.vs/ShadowCrestGameEngine/v17/Browse.VC.db index f5ada0e..83c9c3c 100644 Binary files a/.vs/ShadowCrestGameEngine/v17/Browse.VC.db and b/.vs/ShadowCrestGameEngine/v17/Browse.VC.db differ diff --git a/.vs/ShadowCrestGameEngine/v17/Browse.VC.db-shm b/.vs/ShadowCrestGameEngine/v17/Browse.VC.db-shm deleted file mode 100644 index 29d8ccd..0000000 Binary files a/.vs/ShadowCrestGameEngine/v17/Browse.VC.db-shm and /dev/null differ diff --git a/.vs/ShadowCrestGameEngine/v17/Browse.VC.db-wal b/.vs/ShadowCrestGameEngine/v17/Browse.VC.db-wal deleted file mode 100644 index d2a5909..0000000 Binary files a/.vs/ShadowCrestGameEngine/v17/Browse.VC.db-wal and /dev/null differ diff --git a/.vs/ShadowCrestGameEngine/v17/DocumentLayout.backup.json b/.vs/ShadowCrestGameEngine/v17/DocumentLayout.backup.json index c7b056d..3037212 100644 --- a/.vs/ShadowCrestGameEngine/v17/DocumentLayout.backup.json +++ b/.vs/ShadowCrestGameEngine/v17/DocumentLayout.backup.json @@ -60,7 +60,7 @@ "RelativeDocumentMoniker": "src\\game\\components\\TextComponent.cpp", "ToolTip": "C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\game\\components\\TextComponent.cpp", "RelativeToolTip": "src\\game\\components\\TextComponent.cpp", - "ViewState": "AgIAAAAAAAAAAAAAAAAAABAAAAAPAAAAAAAAAA==", + "ViewState": "AgIAAAAAAAAAAAAAAAAAABkAAAAAAAAAAAAAAA==", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", "WhenOpened": "2025-07-13T20:09:50.139Z", "EditorCaption": "" diff --git a/.vs/ShadowCrestGameEngine/v17/DocumentLayout.json b/.vs/ShadowCrestGameEngine/v17/DocumentLayout.json index 3037212..b7d1bbb 100644 --- a/.vs/ShadowCrestGameEngine/v17/DocumentLayout.json +++ b/.vs/ShadowCrestGameEngine/v17/DocumentLayout.json @@ -6,6 +6,10 @@ "AbsoluteMoniker": "D:0:0:{5653811A-38D1-4D9D-9446-A417E8557584}|ShadowCrestGameEngine.vcxproj|C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\game\\components\\TextComponent.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", "RelativeMoniker": "D:0:0:{5653811A-38D1-4D9D-9446-A417E8557584}|ShadowCrestGameEngine.vcxproj|solutionrelative:src\\game\\components\\TextComponent.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" }, + { + "AbsoluteMoniker": "D:0:0:{5653811A-38D1-4D9D-9446-A417E8557584}|ShadowCrestGameEngine.vcxproj|C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\core\\Engine.hpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{5653811A-38D1-4D9D-9446-A417E8557584}|ShadowCrestGameEngine.vcxproj|solutionrelative:src\\core\\Engine.hpp||{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}" @@ -18,10 +22,6 @@ "AbsoluteMoniker": "D:0:0:{5653811A-38D1-4D9D-9446-A417E8557584}|ShadowCrestGameEngine.vcxproj|C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\game\\components\\Component.hpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", "RelativeMoniker": "D:0:0:{5653811A-38D1-4D9D-9446-A417E8557584}|ShadowCrestGameEngine.vcxproj|solutionrelative:src\\game\\components\\Component.hpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" }, - { - "AbsoluteMoniker": "D:0:0:{5653811A-38D1-4D9D-9446-A417E8557584}|ShadowCrestGameEngine.vcxproj|C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\core\\Engine.hpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{5653811A-38D1-4D9D-9446-A417E8557584}|ShadowCrestGameEngine.vcxproj|solutionrelative:src\\core\\Engine.hpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" - }, { "AbsoluteMoniker": "D:0:0:{5653811A-38D1-4D9D-9446-A417E8557584}|ShadowCrestGameEngine.vcxproj|C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\game\\components\\TransformComponent.hpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", "RelativeMoniker": "D:0:0:{5653811A-38D1-4D9D-9446-A417E8557584}|ShadowCrestGameEngine.vcxproj|solutionrelative:src\\game\\components\\TransformComponent.hpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" @@ -60,7 +60,7 @@ "RelativeDocumentMoniker": "src\\game\\components\\TextComponent.cpp", "ToolTip": "C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\game\\components\\TextComponent.cpp", "RelativeToolTip": "src\\game\\components\\TextComponent.cpp", - "ViewState": "AgIAAAAAAAAAAAAAAAAAABkAAAAAAAAAAAAAAA==", + "ViewState": "AgIAAAAAAAAAAAAAAAAAABIAAAA5AAAAAAAAAA==", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", "WhenOpened": "2025-07-13T20:09:50.139Z", "EditorCaption": "" @@ -79,7 +79,7 @@ }, { "$type": "Document", - "DocumentIndex": 3, + "DocumentIndex": 4, "Title": "Component.hpp", "DocumentMoniker": "C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\game\\components\\Component.hpp", "RelativeDocumentMoniker": "src\\game\\components\\Component.hpp", @@ -87,12 +87,11 @@ "RelativeToolTip": "src\\game\\components\\Component.hpp", "ViewState": "AgIAAAAAAAAAAAAAAAAAAAgAAAAZAAAAAAAAAA==", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", - "WhenOpened": "2025-07-13T19:24:03.306Z", - "EditorCaption": "" + "WhenOpened": "2025-07-13T19:24:03.306Z" }, { "$type": "Document", - "DocumentIndex": 2, + "DocumentIndex": 3, "Title": "TextComponent.hpp", "DocumentMoniker": "C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\game\\components\\TextComponent.hpp", "RelativeDocumentMoniker": "src\\game\\components\\TextComponent.hpp", @@ -100,12 +99,11 @@ "RelativeToolTip": "src\\game\\components\\TextComponent.hpp", "ViewState": "AgIAAAAAAAAAAAAAAAAAAAwAAAAZAAAAAAAAAA==", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", - "WhenOpened": "2025-07-13T19:18:06.662Z", - "EditorCaption": "" + "WhenOpened": "2025-07-13T19:18:06.662Z" }, { "$type": "Document", - "DocumentIndex": 1, + "DocumentIndex": 2, "Title": "Engine.cpp", "DocumentMoniker": "C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\core\\Engine.cpp", "RelativeDocumentMoniker": "src\\core\\Engine.cpp", @@ -113,8 +111,7 @@ "RelativeToolTip": "src\\core\\Engine.cpp", "ViewState": "AgIAAEsAAAAAAAAAAAAAAFkAAAAAAAAAAAAAAA==", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|", - "WhenOpened": "2025-07-13T18:23:56.384Z", - "EditorCaption": "" + "WhenOpened": "2025-07-13T18:23:56.384Z" } ] } @@ -139,7 +136,7 @@ "Children": [ { "$type": "Document", - "DocumentIndex": 4, + "DocumentIndex": 1, "Title": "Engine.hpp", "DocumentMoniker": "C:\\Users\\steev\\Desktop\\ShadowCrestGameEngine\\src\\core\\Engine.hpp", "RelativeDocumentMoniker": "src\\core\\Engine.hpp", diff --git a/.vs/ShadowCrestGameEngine/v17/ipch/AutoPCH/97d2761a8ae672fc/TEXTCOMPONENT.ipch b/.vs/ShadowCrestGameEngine/v17/ipch/AutoPCH/97d2761a8ae672fc/TEXTCOMPONENT.ipch index 34aded2..d4d575b 100644 Binary files a/.vs/ShadowCrestGameEngine/v17/ipch/AutoPCH/97d2761a8ae672fc/TEXTCOMPONENT.ipch and b/.vs/ShadowCrestGameEngine/v17/ipch/AutoPCH/97d2761a8ae672fc/TEXTCOMPONENT.ipch differ diff --git a/.vs/ShadowCrestGameEngine/v17/ipch/AutoPCH/c806b5d5c43bcb0b/MAIN.ipch b/.vs/ShadowCrestGameEngine/v17/ipch/AutoPCH/c806b5d5c43bcb0b/MAIN.ipch index cc0826e..6e931c4 100644 Binary files a/.vs/ShadowCrestGameEngine/v17/ipch/AutoPCH/c806b5d5c43bcb0b/MAIN.ipch and b/.vs/ShadowCrestGameEngine/v17/ipch/AutoPCH/c806b5d5c43bcb0b/MAIN.ipch differ diff --git a/src/game/components/TextComponent.cpp b/src/game/components/TextComponent.cpp index 26eb36d..cba7ef0 100644 --- a/src/game/components/TextComponent.cpp +++ b/src/game/components/TextComponent.cpp @@ -1,48 +1,20 @@ #include "TextComponent.hpp" #include -TextComponent::TextComponent(const std::string& text, const std::string& fontPath, int fontSize, SDL_Color color) - : text(text), fontPath(fontPath), fontSize(fontSize), color(color) { +TextComponent::TextComponent(const std::string& text, const std::string& fontPath, int fontSize, SDL_Color color) : text(text), fontPath(fontPath), fontSize(fontSize), color(color) { } TextComponent::~TextComponent() { - if (texture) SDL_DestroyTexture(texture); - if (font) TTF_CloseFont(font); } void TextComponent::Init(SDL_Renderer* renderer) { - font = TTF_OpenFont(fontPath.c_str(), fontSize); - if (!font) { - SDL_Log("Failed to load font: %s", SDL_GetError()); - return; - } - - // TODO: implement a way to resize - SDL_Surface* surface = TTF_RenderText_Blended(font, text.c_str(), 10, color); - if (!surface) { - SDL_Log("Failed to render text surface: %s", SDL_GetError()); - return; - } - - texture = SDL_CreateTextureFromSurface(renderer, surface); - destRect = { 0, 0, (float)surface->w, (float)surface->h }; - - SDL_DestroySurface(surface); } void TextComponent::Update(float dt) { - // nothing dynamic for now } void TextComponent::Render(SDL_Renderer* renderer) { - if (texture) { - SDL_RenderTexture(renderer, texture, nullptr, &destRect); - } } void TextComponent::SetText(const std::string& newText) { - if (newText != text) { - text = newText; - // Re-render in Init() or a helper function you could create - } }