diff options
-rw-r--r-- | src/crepe/facade/SDLContext.cpp | 10 | ||||
-rw-r--r-- | src/example/rendering_particle.cpp | 12 |
2 files changed, 11 insertions, 11 deletions
diff --git a/src/crepe/facade/SDLContext.cpp b/src/crepe/facade/SDLContext.cpp index 8597f06..7676cfd 100644 --- a/src/crepe/facade/SDLContext.cpp +++ b/src/crepe/facade/SDLContext.cpp @@ -1,8 +1,8 @@ #include <SDL2/SDL.h> -#include <SDL2/SDL_pixels.h> #include <SDL2/SDL_blendmode.h> #include <SDL2/SDL_image.h> #include <SDL2/SDL_keycode.h> +#include <SDL2/SDL_pixels.h> #include <SDL2/SDL_rect.h> #include <SDL2/SDL_render.h> #include <SDL2/SDL_surface.h> @@ -245,10 +245,10 @@ SDL_FRect SDLContext::get_dst_rect(const DestinationRectangleData & ctx) const { size *= cam_aux_data.render_scale * ctx.img_scale * data.scale_offset; - vec2 screen_pos - = (ctx.pos + data.position_offset - 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 = (ctx.pos + data.position_offset - cam_aux_data.cam_pos + + (cam_aux_data.zoomed_viewport) / 2) + * cam_aux_data.render_scale + - size / 2 + cam_aux_data.bar_size; return SDL_FRect{ .x = screen_pos.x, diff --git a/src/example/rendering_particle.cpp b/src/example/rendering_particle.cpp index b57ba04..48e02ba 100644 --- a/src/example/rendering_particle.cpp +++ b/src/example/rendering_particle.cpp @@ -71,21 +71,21 @@ public: anim.set_anim(2); anim.pause(); - auto & cam = game_object.add_component<Camera>(ivec2{1280, 720}, vec2{400, 400}, + auto & cam = game_object.add_component<Camera>(ivec2{720, 1280}, vec2{400, 400}, Camera::Data{ .bg_color = Color::WHITE, }); - function<void()> on_click = [&](){ cout << "button clicked" << std::endl; }; - function<void()> on_enter = [&](){ cout << "enter" << std::endl; }; - function<void()> on_exit = [&](){ cout << "exit" << std::endl; }; + function<void()> on_click = [&]() { cout << "button clicked" << std::endl; }; + function<void()> on_enter = [&]() { cout << "enter" << std::endl; }; + function<void()> on_exit = [&]() { cout << "exit" << std::endl; }; - auto & button = game_object.add_component<Button>(vec2{200,200}, vec2{0,0}, on_click, false); + auto & button + = game_object.add_component<Button>(vec2{200, 200}, vec2{0, 0}, on_click, false); button.on_mouse_enter = on_enter; button.on_mouse_exit = on_exit; button.is_toggle = true; button.active = true; - } string get_name() const { return "TestScene"; }; |