Skip to content

Update wraps #223

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
May 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
b15b832
chore: update httplib wrap to 0.20.1
Totto16 May 14, 2025
290ac67
chore: update fmt wrap to 11.2.0
Totto16 May 14, 2025
8c69a4f
chore: update icu wrap to 76.1
Totto16 May 14, 2025
4ae35d3
chore: update libpng wrap to 1.6.48
Totto16 May 14, 2025
abe8ce7
chore: update nlohmann_json wrap to 3.12.0
Totto16 May 14, 2025
645d5ea
chore: update spdlog wrap to 1.15.2
Totto16 May 14, 2025
a14fe0b
fix: fix the spdlog wrap error with newer fmt >= 11.2.0
Totto16 May 14, 2025
d284153
feat: update discord social sdk to 1.2.873
Totto16 May 14, 2025
67b3e22
fix: include string.h in file, where it was previously implictely inc…
Totto16 May 14, 2025
92efcba
fix: include <cstring> in file, where it was previously implictely in…
Totto16 May 14, 2025
ee45a78
fix: fix mingw detection in windows specifix , as gcc 15 changed a fe…
Totto16 May 14, 2025
f3e50e0
fix: fix linker errors in the newest MSVC releases
Totto16 May 14, 2025
81345e2
fix: fix 3ds compilation, by correctly disabling TLS in spdlog
Totto16 May 15, 2025
5646370
fix: fix include ordering in message_box in MSYS2
Totto16 May 15, 2025
5a2afa3
fix: correctly define exported attributes in MSYS2
Totto16 May 15, 2025
557b205
fix: correctyl dect MSYS2 in EXPORT declarations
Totto16 May 15, 2025
ceaf6dd
fix: fix spdlog errors under msvc
Totto16 May 15, 2025
d9c0947
fix: fix implementation of exported methods
Totto16 May 15, 2025
3ecef8b
fix: format all files
Totto16 May 15, 2025
6d5b104
feat: reafctor export symbols
Totto16 May 15, 2025
7d4ef0b
fix: format meson files
Totto16 May 15, 2025
5d7a072
fix: move spdlog_wrapper into graphics library, since spldog is not r…
Totto16 May 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/discord/core.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@

#include "helper/spdlog_wrapper.hpp"
#include <core/helper/utils.hpp>

#include "./core.hpp"

#include <fmt/format.h>
#include <spdlog/spdlog.h>


[[nodiscard]] std::string constants::discord ::get_asset_key(constants::discord::ArtAsset asset) {

Expand Down
12 changes: 6 additions & 6 deletions src/discord/core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <core/helper/expected.hpp>
#include <core/helper/types.hpp>

#include "../helper/windows.hpp"
#include "../helper/export_symbols.hpp"

#include <chrono>
#ifdef _WIN32
Expand Down Expand Up @@ -58,7 +58,7 @@ namespace constants::discord {
// manually synchronized to https://discord.com/developers/applications/1220147916371394650/rich-presence/assets
enum class ArtAsset : u8 { Logo };

OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::string get_asset_key(ArtAsset asset);
[[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::string get_asset_key(ArtAsset asset);

} // namespace constants::discord

Expand Down Expand Up @@ -116,7 +116,7 @@ struct DiscordActivityWrapper {
}


OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] const discordpp::Activity& get_raw() const;
[[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED const discordpp::Activity& get_raw() const;
};

enum class DiscordStatus : u8 { Starting = 0, Ok, Error };
Expand All @@ -131,15 +131,15 @@ struct DiscordInstance {
public:
OOPETRIS_GRAPHICS_EXPORTED explicit DiscordInstance();

OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] DiscordStatus get_status();
[[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED DiscordStatus get_status();

OOPETRIS_GRAPHICS_EXPORTED DiscordInstance(DiscordInstance&& old) noexcept;

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

OOPETRIS_GRAPHICS_EXPORTED DiscordInstance(DiscordInstance& old) noexcept = delete;
DiscordInstance(DiscordInstance& old) noexcept = delete;

OOPETRIS_GRAPHICS_EXPORTED DiscordInstance& operator=(const DiscordInstance& other) noexcept = delete;
DiscordInstance& operator=(const DiscordInstance& other) noexcept = delete;

OOPETRIS_GRAPHICS_EXPORTED ~DiscordInstance();

Expand Down
1 change: 1 addition & 0 deletions src/executables/game/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "ui/layout.hpp"


#include "helper/spdlog_wrapper.hpp"
#include <fmt/chrono.h>
#include <memory>
#include <ranges>
Expand Down
11 changes: 11 additions & 0 deletions src/executables/game/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,21 @@
#include "helper/web_utils.hpp"
#endif


#if defined(_MSC_VER)
#pragma warning(disable : 4275)
#pragma warning(disable : 4251)
#endif

#include <spdlog/sinks/basic_file_sink.h>
#include <spdlog/sinks/rotating_file_sink.h>
#include <spdlog/sinks/stdout_sinks.h>
#include <spdlog/spdlog.h>

#if defined(_MSC_VER)
#pragma warning(default : 4275)
#pragma warning(default : 4251)
#endif

namespace {
void initialize_spdlog() {
Expand Down
2 changes: 1 addition & 1 deletion src/executables/game/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#include "helper/graphic_utils.hpp"


#include "helper/spdlog_wrapper.hpp"
#include <argparse/argparse.hpp>
#include <spdlog/spdlog.h>


helper::expected<CommandLineArguments, std::string> helper::parse_args(const std::vector<std::string>& arguments) {
Expand Down
2 changes: 1 addition & 1 deletion src/game/bag.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <core/game/tetromino_type.hpp>
#include <core/helper/random.hpp>

#include "../helper/windows.hpp"
#include "../helper/export_symbols.hpp"
#include <array>

struct Bag final {
Expand Down
2 changes: 1 addition & 1 deletion src/game/command_line_arguments.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <core/helper/types.hpp>
#include <core/helper/utils.hpp>

#include "../helper/windows.hpp"
#include "../helper/export_symbols.hpp"

#include <filesystem>
#include <optional>
Expand Down
1 change: 1 addition & 0 deletions src/game/game.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

#include "helper/spdlog_wrapper.hpp"
#include <core/helper/magic_enum_wrapper.hpp>
#include <core/helper/utils.hpp>

Expand Down
10 changes: 5 additions & 5 deletions src/game/game.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <recordings/utility/recording.hpp>

#include "helper/clock_source.hpp"
#include "helper/windows.hpp"
#include "helper/export_symbols.hpp"
#include "input/input_creator.hpp"
#include "tetrion.hpp"
#include "ui/widget.hpp"
Expand Down Expand Up @@ -32,14 +32,14 @@ struct Game : public ui::Widget {

OOPETRIS_GRAPHICS_EXPORTED void render(const ServiceProvider& service_provider) const override;

OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] Widget::EventHandleResult
[[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED Widget::EventHandleResult
handle_event(const std::shared_ptr<input::InputManager>& input_manager, const SDL_Event& event) override;

OOPETRIS_GRAPHICS_EXPORTED void set_paused(bool paused);

OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] bool is_paused() const;
[[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED bool is_paused() const;

OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] bool is_game_finished() const;
[[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED bool is_game_finished() const;

OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] const std::shared_ptr<input::GameInput>& game_input() const;
[[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED const std::shared_ptr<input::GameInput>& game_input() const;
};
2 changes: 1 addition & 1 deletion src/game/graphic_helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <core/core.hpp>

#include "helper/windows.hpp"
#include "helper/export_symbols.hpp"
#include "manager/service_provider.hpp"

enum class MinoTransparency : u8 {
Expand Down
2 changes: 1 addition & 1 deletion src/game/grid.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "grid.hpp"
#include "graphics/renderer.hpp"

#include <spdlog/spdlog.h>
#include "helper/spdlog_wrapper.hpp"

Grid::Grid(const ui::Layout& layout, bool is_top_level)
: ui::Widget{ layout, ui::WidgetType::Component, is_top_level } {
Expand Down
8 changes: 4 additions & 4 deletions src/game/grid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <core/helper/color.hpp>

#include "graphics/rect.hpp"
#include "helper/windows.hpp"
#include "helper/export_symbols.hpp"
#include "manager/service_provider.hpp"
#include "ui/layout.hpp"
#include "ui/widget.hpp"
Expand All @@ -26,13 +26,13 @@ struct Grid final : public ui::Widget {

[[nodiscard]] shapes::UPoint tile_size() const;

OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] double scale_to_original() const;
[[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED double scale_to_original() const;

OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] shapes::UPoint to_screen_coords(grid::GridPoint grid_coords) const;
[[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED shapes::UPoint to_screen_coords(grid::GridPoint grid_coords) const;

OOPETRIS_GRAPHICS_EXPORTED void render(const ServiceProvider& service_provider) const override;

OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] helper::BoolWrapper<std::pair<ui::EventHandleType, ui::Widget*>>
[[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED helper::BoolWrapper<std::pair<ui::EventHandleType, ui::Widget*>>
handle_event(const std::shared_ptr<input::InputManager>& input_manager, const SDL_Event& event) override;

private:
Expand Down
2 changes: 1 addition & 1 deletion src/game/rotation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <core/helper/types.hpp>

#include "../helper/windows.hpp"
#include "../helper/export_symbols.hpp"

enum class Rotation : u8 {
North = 0,
Expand Down
2 changes: 1 addition & 1 deletion src/game/simulated_tetrion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#include "manager/music_manager.hpp"
#include "simulated_tetrion.hpp"

#include "helper/spdlog_wrapper.hpp"
#include <cassert>
#include <spdlog/spdlog.h>


SimulatedTetrion::SimulatedTetrion(
Expand Down
16 changes: 8 additions & 8 deletions src/game/simulated_tetrion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include "bag.hpp"
#include "grid.hpp"
#include "helper/windows.hpp"
#include "helper/export_symbols.hpp"
#include "input/game_input.hpp"
#include "manager/service_provider.hpp"
#include "tetromino.hpp"
Expand Down Expand Up @@ -123,14 +123,14 @@ struct SimulatedTetrion {
OOPETRIS_GRAPHICS_EXPORTED bool drop_tetromino(SimulationStep simulation_step_index);
OOPETRIS_GRAPHICS_EXPORTED void hold_tetromino(SimulationStep simulation_step_index);

OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] u8 tetrion_index() const;
OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] u32 level() const;
OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] u64 score() const;
OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] u32 lines_cleared() const;
OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] const MinoStack& mino_stack() const;
OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::unique_ptr<TetrionCoreInformation> core_information() const;
[[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED u8 tetrion_index() const;
[[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED u32 level() const;
[[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED u64 score() const;
[[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED u32 lines_cleared() const;
[[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED const MinoStack& mino_stack() const;
[[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED std::unique_ptr<TetrionCoreInformation> core_information() const;

OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] bool is_game_over() const;
[[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED bool is_game_over() const;

private:
template<typename Callable>
Expand Down
2 changes: 1 addition & 1 deletion src/game/simulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "input/replay_input.hpp"
#include "simulation.hpp"

#include <spdlog/spdlog.h>
#include "helper/spdlog_wrapper.hpp"


Simulation::Simulation(
Expand Down
4 changes: 2 additions & 2 deletions src/game/simulation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <core/helper/expected.hpp>
#include <recordings/utility/recording.hpp>

#include "helper/windows.hpp"
#include "helper/export_symbols.hpp"
#include "input/input_creator.hpp"
#include "input/replay_input.hpp"
#include "simulated_tetrion.hpp"
Expand All @@ -28,5 +28,5 @@ struct Simulation {

OOPETRIS_GRAPHICS_EXPORTED void update();

OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] bool is_game_finished() const;
[[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED bool is_game_finished() const;
};
2 changes: 1 addition & 1 deletion src/game/tetrion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "tetrion.hpp"
#include "ui/components/label.hpp"

#include <spdlog/spdlog.h>
#include "helper/spdlog_wrapper.hpp"
#include <sstream>


Expand Down
12 changes: 6 additions & 6 deletions src/game/tetrion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <core/helper/types.hpp>
#include <recordings/utility/tetrion_core_information.hpp>

#include "helper/windows.hpp"
#include "helper/export_symbols.hpp"
#include "input/game_input.hpp"
#include "manager/service_provider.hpp"
#include "simulated_tetrion.hpp"
Expand Down Expand Up @@ -44,13 +44,13 @@ struct Tetrion final : public ui::Widget, SimulatedTetrion {
OOPETRIS_GRAPHICS_EXPORTED Tetrion& operator=(Tetrion&& other) noexcept = delete;

OOPETRIS_GRAPHICS_EXPORTED void render(const ServiceProvider& service_provider) const override;
OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] Widget::EventHandleResult
[[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED Widget::EventHandleResult
handle_event(const std::shared_ptr<input::InputManager>& input_manager, const SDL_Event& event) override;

OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] Grid* get_grid();
OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] const Grid* get_grid() const;
OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] ui::GridLayout* get_text_layout();
OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] const ui::GridLayout* get_text_layout() const;
[[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED Grid* get_grid();
[[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED const Grid* get_grid() const;
[[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED ui::GridLayout* get_text_layout();
[[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED const ui::GridLayout* get_text_layout() const;

private:
void refresh_texts() override;
Expand Down
8 changes: 4 additions & 4 deletions src/game/tetromino.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <core/core.hpp>

#include "graphic_helpers.hpp"
#include "helper/windows.hpp"
#include "helper/export_symbols.hpp"
#include "rotation.hpp"

#include <array>
Expand All @@ -27,8 +27,8 @@ struct Tetromino final {
m_type{ type },
m_minos{ create_minos(position, m_rotation, type) } { }

OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] helper::TetrominoType type() const;
OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] Rotation rotation() const;
[[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED helper::TetrominoType type() const;
[[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED Rotation rotation() const;

OOPETRIS_GRAPHICS_EXPORTED void render(
const ServiceProvider& service_provider,
Expand All @@ -47,7 +47,7 @@ struct Tetromino final {
OOPETRIS_GRAPHICS_EXPORTED void move_right();
OOPETRIS_GRAPHICS_EXPORTED void move(shapes::AbstractPoint<i8> offset);

OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] const std::array<Mino, 4>& minos() const;
[[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED const std::array<Mino, 4>& minos() const;


private:
Expand Down
12 changes: 6 additions & 6 deletions src/graphics/renderer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <core/helper/color.hpp>

#include "helper/windows.hpp"
#include "helper/export_symbols.hpp"
#include "manager/font.hpp"
#include "rect.hpp"
#include "texture.hpp"
Expand All @@ -24,8 +24,8 @@ struct Renderer final {

public:
OOPETRIS_GRAPHICS_EXPORTED explicit Renderer(const Window& window, VSync v_sync);
OOPETRIS_GRAPHICS_EXPORTED Renderer(const Renderer&) = delete;
OOPETRIS_GRAPHICS_EXPORTED Renderer& operator=(const Renderer&) = delete;
Renderer(const Renderer&) = delete;
Renderer& operator=(const Renderer&) = delete;
OOPETRIS_GRAPHICS_EXPORTED ~Renderer();

OOPETRIS_GRAPHICS_EXPORTED void set_draw_color(const Color& color) const;
Expand Down Expand Up @@ -78,15 +78,15 @@ struct Renderer final {
texture.render(m_renderer, from, dest);
}

OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] Texture load_image(const std::filesystem::path& image_path) const;
OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] Texture prerender_text(
[[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED Texture load_image(const std::filesystem::path& image_path) const;
[[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED Texture prerender_text(
const std::string& text,
const Font& font,
const Color& color,
RenderType render_type = RenderType::Blended,
const Color& background_color = Color::black()
) const;
OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] Texture get_texture_for_render_target(const shapes::UPoint& size) const;
[[nodiscard]] OOPETRIS_GRAPHICS_EXPORTED Texture get_texture_for_render_target(const shapes::UPoint& size) const;

OOPETRIS_GRAPHICS_EXPORTED void set_render_target(const Texture& texture) const;
OOPETRIS_GRAPHICS_EXPORTED void reset_render_target() const;
Expand Down
10 changes: 5 additions & 5 deletions src/graphics/sdl_context.hpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#pragma once

#include "helper/windows.hpp"
#include "helper/export_symbols.hpp"

struct SdlContext final {
OOPETRIS_GRAPHICS_EXPORTED SdlContext();
OOPETRIS_GRAPHICS_EXPORTED SdlContext(const SdlContext&) = delete;
OOPETRIS_GRAPHICS_EXPORTED SdlContext(SdlContext&&) = delete;
OOPETRIS_GRAPHICS_EXPORTED SdlContext& operator=(const SdlContext&) = delete;
OOPETRIS_GRAPHICS_EXPORTED SdlContext& operator=(SdlContext&&) = delete;
SdlContext(const SdlContext&) = delete;
SdlContext(SdlContext&&) = delete;
SdlContext& operator=(const SdlContext&) = delete;
SdlContext& operator=(SdlContext&&) = delete;
OOPETRIS_GRAPHICS_EXPORTED ~SdlContext();
};
Loading
Loading