Skip to content

Commit d9c0947

Browse files
committed
fix: fix implementation of exported methods
msvc doesn't care, if I say dllimport ona definition, but MSYS2 requires the definition and declaration to be seperated, when I use dllimports / exports this mainyl is the case for = delete functions and some missed implementations, that were still in .hpp files
1 parent ceaf6dd commit d9c0947

File tree

20 files changed

+88
-63
lines changed

20 files changed

+88
-63
lines changed

src/discord/core.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ struct DiscordInstance {
137137

138138
OOPETRIS_GRAPHICS_EXPORTED DiscordInstance& operator=(DiscordInstance&& other) noexcept;
139139

140-
OOPETRIS_GRAPHICS_EXPORTED DiscordInstance(DiscordInstance& old) noexcept = delete;
140+
DiscordInstance(DiscordInstance& old) noexcept = delete;
141141

142-
OOPETRIS_GRAPHICS_EXPORTED DiscordInstance& operator=(const DiscordInstance& other) noexcept = delete;
142+
DiscordInstance& operator=(const DiscordInstance& other) noexcept = delete;
143143

144144
OOPETRIS_GRAPHICS_EXPORTED ~DiscordInstance();
145145

src/graphics/renderer.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ struct Renderer final {
2424

2525
public:
2626
OOPETRIS_GRAPHICS_EXPORTED explicit Renderer(const Window& window, VSync v_sync);
27-
OOPETRIS_GRAPHICS_EXPORTED Renderer(const Renderer&) = delete;
28-
OOPETRIS_GRAPHICS_EXPORTED Renderer& operator=(const Renderer&) = delete;
27+
Renderer(const Renderer&) = delete;
28+
Renderer& operator=(const Renderer&) = delete;
2929
OOPETRIS_GRAPHICS_EXPORTED ~Renderer();
3030

3131
OOPETRIS_GRAPHICS_EXPORTED void set_draw_color(const Color& color) const;

src/graphics/sdl_context.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
struct SdlContext final {
66
OOPETRIS_GRAPHICS_EXPORTED SdlContext();
7-
OOPETRIS_GRAPHICS_EXPORTED SdlContext(const SdlContext&) = delete;
8-
OOPETRIS_GRAPHICS_EXPORTED SdlContext(SdlContext&&) = delete;
9-
OOPETRIS_GRAPHICS_EXPORTED SdlContext& operator=(const SdlContext&) = delete;
10-
OOPETRIS_GRAPHICS_EXPORTED SdlContext& operator=(SdlContext&&) = delete;
7+
SdlContext(const SdlContext&) = delete;
8+
SdlContext(SdlContext&&) = delete;
9+
SdlContext& operator=(const SdlContext&) = delete;
10+
SdlContext& operator=(SdlContext&&) = delete;
1111
OOPETRIS_GRAPHICS_EXPORTED ~SdlContext();
1212
};

src/graphics/texture.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ struct Texture {
3939

4040
OOPETRIS_GRAPHICS_EXPORTED static Texture get_for_render_target(SDL_Renderer* renderer, const shapes::UPoint& size);
4141

42-
OOPETRIS_GRAPHICS_EXPORTED Texture(const Texture&) = delete;
43-
OOPETRIS_GRAPHICS_EXPORTED Texture& operator=(const Texture&) = delete;
42+
Texture(const Texture&) = delete;
43+
Texture& operator=(const Texture&) = delete;
4444

4545
OOPETRIS_GRAPHICS_EXPORTED Texture(Texture&& old) noexcept;
4646

src/graphics/window.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ struct Window final {
2525
OOPETRIS_GRAPHICS_EXPORTED Window(const std::string& title, u32 x_pos, u32 y_pos, u32 width, u32 height);
2626
OOPETRIS_GRAPHICS_EXPORTED Window(const std::string& title, WindowPosition position);
2727
OOPETRIS_GRAPHICS_EXPORTED Window(const std::string& title, u32 x_pos, u32 y_pos);
28-
OOPETRIS_GRAPHICS_EXPORTED Window(const Window&) = delete;
29-
OOPETRIS_GRAPHICS_EXPORTED Window(Window&&) = delete;
30-
OOPETRIS_GRAPHICS_EXPORTED Window& operator=(const Window&) = delete;
31-
OOPETRIS_GRAPHICS_EXPORTED Window& operator=(Window&&) = delete;
28+
Window(const Window&) = delete;
29+
Window(Window&&) = delete;
30+
Window& operator=(const Window&) = delete;
31+
Window& operator=(Window&&) = delete;
3232
OOPETRIS_GRAPHICS_EXPORTED ~Window();
3333

3434
OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] shapes::UPoint size() const;

src/helper/graphic_utils.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include <SDL.h>
1010
#include <filesystem>
11+
#include <vector>
1112

1213
namespace utils {
1314

src/input/game_input.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ void input::GameInput::handle_event(const InputEvent event, const SimulationStep
7373
}
7474
}
7575

76+
input::GameInput::GameInput(GameInput&&) = default;
77+
78+
input::GameInput& input::GameInput::operator=(GameInput&&) = default;
79+
80+
input::GameInput::~GameInput() = default;
81+
7682
void input::GameInput::update(const SimulationStep simulation_step_index) {
7783
const auto current_simulation_step_index = simulation_step_index;
7884

@@ -97,3 +103,8 @@ void input::GameInput::update(const SimulationStep simulation_step_index) {
97103
}
98104
}
99105
}
106+
107+
108+
void input::GameInput::late_update(SimulationStep /*simulation_step*/) {
109+
//do nothing, is expected here, this is virtual, so if there is soemthing to do, it gets overridden
110+
}

src/input/game_input.hpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,16 @@ namespace input {
6565
}
6666

6767
public:
68-
OOPETRIS_GRAPHICS_EXPORTED GameInput(const GameInput&) = delete;
69-
OOPETRIS_GRAPHICS_EXPORTED GameInput& operator=(const GameInput&) = delete;
68+
GameInput(const GameInput&) = delete;
69+
GameInput& operator=(const GameInput&) = delete;
7070

71-
OOPETRIS_GRAPHICS_EXPORTED GameInput(GameInput&&) = default;
72-
OOPETRIS_GRAPHICS_EXPORTED GameInput& operator=(GameInput&&) = default;
73-
74-
OOPETRIS_GRAPHICS_EXPORTED virtual ~GameInput() = default;
71+
OOPETRIS_GRAPHICS_EXPORTED GameInput(GameInput&&);
72+
OOPETRIS_GRAPHICS_EXPORTED GameInput& operator=(GameInput&&);
7573

74+
OOPETRIS_GRAPHICS_EXPORTED virtual ~GameInput();
7675

7776
OOPETRIS_GRAPHICS_EXPORTED virtual void update(SimulationStep simulation_step_index);
78-
OOPETRIS_GRAPHICS_EXPORTED virtual void late_update(SimulationStep /*simulation_step*/){};
77+
OOPETRIS_GRAPHICS_EXPORTED virtual void late_update(SimulationStep simulation_step);
7978

8079
OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] virtual std::optional<MenuEvent> get_menu_event(const SDL_Event& event
8180
) const = 0;

src/input/joystick_input.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,8 @@ namespace input {
251251

252252
OOPETRIS_GRAPHICS_EXPORTED ~JoystickLikeGameInput() override;
253253

254-
OOPETRIS_GRAPHICS_EXPORTED JoystickLikeGameInput(const JoystickLikeGameInput& input) = delete;
255-
OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] JoystickLikeGameInput& operator=(const JoystickLikeGameInput& input
254+
JoystickLikeGameInput(const JoystickLikeGameInput& input) = delete;
255+
[[nodiscard]] JoystickLikeGameInput& operator=(const JoystickLikeGameInput& input
256256
) = delete;
257257

258258
OOPETRIS_GRAPHICS_EXPORTED JoystickLikeGameInput(JoystickLikeGameInput&& input) noexcept;

src/input/touch_input.cpp

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
#include "touch_input.hpp"
77

88
#include <cmath>
9-
#include <memory>
109
#include <core/helper/spdlog_wrapper.hpp>
10+
#include <memory>
1111
#include <stdexcept>
1212

1313
void input::TouchGameInput::handle_event(const SDL_Event& event) {
@@ -213,7 +213,8 @@ input::TouchInput::get_by_device_index(const std::shared_ptr<Window>& window, in
213213
}
214214

215215

216-
[[nodiscard]] std::optional<input::NavigationEvent> input::TouchInput::get_navigation_event(const SDL_Event& event
216+
[[nodiscard]] std::optional<input::NavigationEvent> input::TouchInput::get_navigation_event(
217+
const SDL_Event& event
217218
) const {
218219
//technically no touch event, but it's a navigation event, and by APi design it can also handle those
219220
if (event.type == SDL_KEYDOWN and event.key.keysym.sym == SDLK_AC_BACK) {
@@ -239,7 +240,8 @@ input::TouchInput::get_by_device_index(const std::shared_ptr<Window>& window, in
239240
}
240241
}
241242

242-
[[nodiscard]] std::optional<input::PointerEventHelper> input::TouchInput::get_pointer_event(const SDL_Event& event
243+
[[nodiscard]] std::optional<input::PointerEventHelper> input::TouchInput::get_pointer_event(
244+
const SDL_Event& event
243245
) const {
244246

245247
auto pointer_event = input::PointerEvent::PointerUp;
@@ -276,8 +278,8 @@ input::TouchInput::get_by_device_index(const std::shared_ptr<Window>& window, in
276278
}
277279

278280

279-
[[nodiscard]] SDL_Event input::TouchInput::offset_pointer_event(const SDL_Event& event, const shapes::IPoint& point)
280-
const {
281+
[[nodiscard]] SDL_Event
282+
input::TouchInput::offset_pointer_event(const SDL_Event& event, const shapes::IPoint& point) const {
281283

282284

283285
auto new_event = event;
@@ -316,6 +318,13 @@ input::TouchInput::get_by_device_index(const std::shared_ptr<Window>& window, in
316318
return {};
317319
}
318320

321+
input::TouchSettings input::TouchSettings::default_settings() {
322+
return TouchSettings{ .move_x_threshold = 150.0 / 2160.0,
323+
.move_y_threshold = 400.0 / 1080.0,
324+
.rotation_duration_threshold = 500,
325+
.drop_duration_threshold = 200 };
326+
}
327+
319328

320329
void input::TouchInputManager::discover_devices(
321330
std::vector<std::unique_ptr<Input>>& inputs,

0 commit comments

Comments
 (0)