aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/facade
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2024-12-17 20:47:14 +0100
committerheavydemon21 <nielsstunnebrink1@gmail.com>2024-12-17 20:47:14 +0100
commit36f941aa1cdea5faeec20a0dc793e0538ccd6d15 (patch)
treef944b01ed0bb0d189e115f375cda8e3e7df5c17e /src/crepe/facade
parent970159235e5f1a1dcb6a7f725e782374ced54d3b (diff)
implemented feedback
Diffstat (limited to 'src/crepe/facade')
-rw-r--r--src/crepe/facade/Font.cpp2
-rw-r--r--src/crepe/facade/Font.h2
-rw-r--r--src/crepe/facade/SDLContext.cpp4
3 files changed, 3 insertions, 5 deletions
diff --git a/src/crepe/facade/Font.cpp b/src/crepe/facade/Font.cpp
index 0c670c1..771002f 100644
--- a/src/crepe/facade/Font.cpp
+++ b/src/crepe/facade/Font.cpp
@@ -2,7 +2,6 @@
#include "../api/Asset.h"
#include "../api/Config.h"
-#include <string>
#include "Font.h"
@@ -12,7 +11,6 @@ using namespace crepe;
Font::Font(const Asset & src, Mediator & mediator) : Resource(src, mediator) {
const Config & config = Config::get_instance();
const std::string FONT_PATH = src.get_path();
-
TTF_Font * loaded_font = TTF_OpenFont(FONT_PATH.c_str(), config.font.size);
if (loaded_font == NULL) {
throw runtime_error(format("Font: {} (path: {})", TTF_GetError(), FONT_PATH));
diff --git a/src/crepe/facade/Font.h b/src/crepe/facade/Font.h
index b08366d..b208d96 100644
--- a/src/crepe/facade/Font.h
+++ b/src/crepe/facade/Font.h
@@ -1,10 +1,10 @@
#pragma once
#include <SDL2/SDL_ttf.h>
-#include <functional>
#include <memory>
#include "../Resource.h"
+#include "../api/Config.h"
namespace crepe {
diff --git a/src/crepe/facade/SDLContext.cpp b/src/crepe/facade/SDLContext.cpp
index ea3b71c..9a122f5 100644
--- a/src/crepe/facade/SDLContext.cpp
+++ b/src/crepe/facade/SDLContext.cpp
@@ -208,14 +208,14 @@ void SDLContext::draw_text(const RenderText & data) {
};
SDL_Surface * tmp_font_surface
= TTF_RenderText_Solid(font.get_font(), text.text.c_str(), color);
- if (!tmp_font_surface) {
+ if (tmp_font_surface == NULL) {
throw runtime_error(format("draw_text: font surface error: {}", SDL_GetError()));
}
font_surface = {tmp_font_surface, [](SDL_Surface * surface) { SDL_FreeSurface(surface); }};
SDL_Texture * tmp_font_texture
= SDL_CreateTextureFromSurface(this->game_renderer.get(), font_surface.get());
- if (!tmp_font_texture) {
+ if (tmp_font_texture == NULL) {
throw runtime_error(format("draw_text: font texture error: {}", SDL_GetError()));
}
font_texture