diff options
Diffstat (limited to 'src/crepe/facade')
| -rw-r--r-- | src/crepe/facade/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/crepe/facade/SDLContext.cpp | 17 | ||||
| -rw-r--r-- | src/crepe/facade/SignalCatch.cpp | 25 | ||||
| -rw-r--r-- | src/crepe/facade/SignalCatch.h | 24 |
4 files changed, 12 insertions, 56 deletions
diff --git a/src/crepe/facade/CMakeLists.txt b/src/crepe/facade/CMakeLists.txt index 4873e8d..243ae46 100644 --- a/src/crepe/facade/CMakeLists.txt +++ b/src/crepe/facade/CMakeLists.txt @@ -6,7 +6,6 @@ target_sources(crepe PUBLIC DB.cpp FontFacade.cpp Font.cpp - SignalCatch.cpp ) target_sources(crepe PUBLIC FILE_SET HEADERS FILES @@ -17,6 +16,5 @@ target_sources(crepe PUBLIC FILE_SET HEADERS FILES DB.h FontFacade.h Font.h - SignalCatch.h ) diff --git a/src/crepe/facade/SDLContext.cpp b/src/crepe/facade/SDLContext.cpp index 859f966..6c93fb2 100644 --- a/src/crepe/facade/SDLContext.cpp +++ b/src/crepe/facade/SDLContext.cpp @@ -69,8 +69,6 @@ SDLContext::SDLContext(Mediator & mediator) { throw runtime_error(format("SDL_ttf initialization failed: {}", TTF_GetError())); } - SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "1"); - mediator.sdl_context = *this; } @@ -174,6 +172,7 @@ SDL_FRect SDLContext::get_dst_rect(const DestinationRectangleData & ctx) const { } void SDLContext::draw(const RenderContext & ctx) { + SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "2"); const Sprite::Data & data = ctx.sprite.data; SDL_RendererFlip render_flip = (SDL_RendererFlip) ((SDL_FLIP_HORIZONTAL * data.flip.flip_x) @@ -206,6 +205,7 @@ void SDLContext::draw(const RenderContext & ctx) { } void SDLContext::draw_text(const RenderText & data) { + SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "0"); const Text & text = data.text; const Font & font = data.font; @@ -235,9 +235,16 @@ void SDLContext::draw_text(const RenderText & data) { = {tmp_font_texture, [](SDL_Texture * texture) { SDL_DestroyTexture(texture); }}; vec2 size = text.dimensions * cam_aux_data.render_scale * data.transform.scale; - vec2 screen_pos = (absoluut_pos - cam_aux_data.cam_pos + (cam_aux_data.zoomed_viewport) / 2 - ) * cam_aux_data.render_scale - - size / 2 + cam_aux_data.bar_size; + vec2 screen_pos = absoluut_pos; + if (text.data.world_space) { + screen_pos = (screen_pos - cam_aux_data.cam_pos + (cam_aux_data.zoomed_viewport) / 2) + * cam_aux_data.render_scale + - size / 2 + cam_aux_data.bar_size; + } else { + screen_pos + = (screen_pos + (cam_aux_data.zoomed_viewport) / 2) * cam_aux_data.render_scale + - size / 2 + cam_aux_data.bar_size; + } SDL_FRect dstrect { .x = screen_pos.x, diff --git a/src/crepe/facade/SignalCatch.cpp b/src/crepe/facade/SignalCatch.cpp deleted file mode 100644 index ad92d28..0000000 --- a/src/crepe/facade/SignalCatch.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include <stdexcept> - -#include "SignalCatch.h" - -using namespace crepe; -using namespace std; - -SignalCatch::SignalCatch() { - segvcatch::init_segv(&SignalCatch::segv); - segvcatch::init_fpe(&SignalCatch::fpe); -} - -SignalCatch::~SignalCatch() { - segvcatch::init_segv(); - segvcatch::init_fpe(); -} - -void SignalCatch::segv() { - throw runtime_error("segmentation fault"); -} - -void SignalCatch::fpe() { - throw domain_error("floating point exception"); -} - diff --git a/src/crepe/facade/SignalCatch.h b/src/crepe/facade/SignalCatch.h deleted file mode 100644 index 4562215..0000000 --- a/src/crepe/facade/SignalCatch.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include <segvcatch.h> - -namespace crepe { - -class SignalCatch { -public: - SignalCatch(); - ~SignalCatch(); - -private: - static void segv(); - static void fpe(); - -public: - SignalCatch(const SignalCatch &) = delete; - SignalCatch(SignalCatch &&) = delete; - SignalCatch & operator=(const SignalCatch &) = delete; - SignalCatch & operator=(SignalCatch &&) = delete; -}; - -} - |