From 9c76df4faa7b2597418557dba83a64ce9c273a6a Mon Sep 17 00:00:00 2001 From: tulpenkiste Date: Tue, 30 May 2023 15:20:34 +0100 Subject: [PATCH] Move pragmautil.hpp into core --- core/engine/engine.cpp | 2 +- core/node/node.hpp | 6 +++--- {include => core}/pragmautil.hpp | 0 core/resources/texture.hpp | 2 +- meson.build | 2 +- renderer/rsdl/rsdl.cpp | 11 +++-------- test/app.cpp | 2 +- 7 files changed, 10 insertions(+), 15 deletions(-) rename {include => core}/pragmautil.hpp (100%) diff --git a/core/engine/engine.cpp b/core/engine/engine.cpp index 0ffdc11..97e42d1 100644 --- a/core/engine/engine.cpp +++ b/core/engine/engine.cpp @@ -1,6 +1,6 @@ #include "enginever.hpp" #include "engine.hpp" -#include +#include "../pragmautil.hpp" #include namespace hibis { diff --git a/core/node/node.hpp b/core/node/node.hpp index 9a5c4fb..33f15a4 100644 --- a/core/node/node.hpp +++ b/core/node/node.hpp @@ -3,7 +3,7 @@ namespace hibis { class Node { public: - virtual void process(float delta) = 0; - virtual void physicsProcess(float delta) = 0; + virtual void process(float delta) {} + virtual void physicsProcess(float delta) {} }; -} \ No newline at end of file +} diff --git a/include/pragmautil.hpp b/core/pragmautil.hpp similarity index 100% rename from include/pragmautil.hpp rename to core/pragmautil.hpp diff --git a/core/resources/texture.hpp b/core/resources/texture.hpp index b312401..18b815f 100644 --- a/core/resources/texture.hpp +++ b/core/resources/texture.hpp @@ -1,7 +1,7 @@ #pragma once #include "resource.hpp" -#include +#include "../pragmautil.hpp" namespace hibis { TODO("Make this function") diff --git a/meson.build b/meson.build index cb6945d..552bae5 100644 --- a/meson.build +++ b/meson.build @@ -8,7 +8,7 @@ confdata.set('version', meson.project_version()) configure_file(input: 'core/enginever.in.hpp', output: 'enginever.hpp', configuration: confdata) # Include Directory -include_dirs = include_directories('./include') +include_dirs = [] # include_directories('./include') # Files libhibis_src_core = files('core/engine/engine.cpp') diff --git a/renderer/rsdl/rsdl.cpp b/renderer/rsdl/rsdl.cpp index dd5316e..96f601f 100644 --- a/renderer/rsdl/rsdl.cpp +++ b/renderer/rsdl/rsdl.cpp @@ -59,21 +59,16 @@ namespace hibis::rsdl { } void RSDL::drawText(Resource* resource, std::string text, IntVec2 pos, Color color) { - WARNING("tulip what the hell is this, this sucks.\nAvoid remaking textures every time text has to be drawn") + WARNING("(Tulip, this is abysmal) Avoid remaking textures every time text has to be drawn") if (Font* font = (Font*)resource) { SDL_Surface* textSurface = TTF_RenderText_Solid(font->mLoadedFont, text.c_str(), SDL_Color {color.r, color.g, color.b, color.a }); SDL_Texture* textTexture = SDL_CreateTextureFromSurface(mRendererContext, textSurface); - int width = 0; - int height = 0; - - TTF_SizeText(font->mLoadedFont, text.c_str(), &width, &height); - SDL_Rect textRect; textRect.x = pos.x; textRect.y = pos.y; - textRect.w = width; - textRect.h = height; + + TTF_SizeText(font->mLoadedFont, text.c_str(), &textRect.w, &textRect.h); SDL_RenderCopy(mRendererContext, textTexture, NULL, &textRect); diff --git a/test/app.cpp b/test/app.cpp index 23a3217..4004424 100644 --- a/test/app.cpp +++ b/test/app.cpp @@ -14,7 +14,7 @@ #include #if defined(_MSC_VER) || defined(_MSC_FULL_VER) -WARNING("Please avoid using MSVC in C++ projects utilising std::chrono due to frame timing issues") +WARNING("Please avoid using MSVC in C++ projects utilising std::chrono and std::this_thread due to unfixed frame timing issues in the MSVC C++ implementation") #endif using namespace hibis;