diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 90828e0..47a495e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,21 +11,22 @@ jobs: fail-fast: false matrix: platform: - - { name: Windows VS2019, os: windows-latest } - - { name: Linux GCC, os: ubuntu-latest } - - { name: Linux Clang, os: ubuntu-latest, flags: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ } - - { name: MacOS XCode, os: macos-latest } + - { name: Windows VS2022, os: windows-2022 } + - { name: Linux GCC, os: ubuntu-22.04 } + - { name: Linux Clang, os: ubuntu-22.04, flags: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ } + - { name: macOS x64, os: macos-14, flags: -DCMAKE_OSX_ARCHITECTURES=x86_64 } + - { name: macOS M1, os: macos-14, flags: -DCMAKE_OSX_ARCHITECTURES=arm64 } steps: - name: PubBus - Checkout Code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: SFML - Install Linux Dependencies if: runner.os == 'Linux' run: sudo apt-get update && sudo apt-get install libxrandr-dev libxcursor-dev libudev-dev libgl1-mesa-dev libegl1-mesa-dev - name: SFML - Checkout Code - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: repository: SFML/SFML path: SFML diff --git a/examples/SFML/CMakeLists.txt b/examples/SFML/CMakeLists.txt index 9882c2c..8baea82 100644 --- a/examples/SFML/CMakeLists.txt +++ b/examples/SFML/CMakeLists.txt @@ -1,9 +1,9 @@ -find_package(SFML 2.5 COMPONENTS graphics REQUIRED) +find_package(SFML 3.0 COMPONENTS Graphics REQUIRED) add_executable(SFML "SFML.cpp" "Messages.hpp") target_include_directories(SFML PRIVATE "${CMAKE_SOURCE_DIR}/include") -target_link_libraries(SFML sfml-graphics) +target_link_libraries(SFML SFML::Graphics) if(PUBBUS_INSTALL_EXAMPLE) install(TARGETS SFML RUNTIME DESTINATION examples) diff --git a/examples/SFML/Messages.hpp b/examples/SFML/Messages.hpp index 9d24ef0..abe3660 100644 --- a/examples/SFML/Messages.hpp +++ b/examples/SFML/Messages.hpp @@ -32,6 +32,7 @@ struct KeyMessage : pub::Message Type type; sf::Keyboard::Key code; + sf::Keyboard::Scancode scancode; bool alt; bool control; bool shift; @@ -40,7 +41,7 @@ struct KeyMessage : pub::Message struct TextMessage : pub::Message { - sf::Uint32 unicode; + std::uint32_t unicode; }; struct MouseMoveMessage : pub::Message diff --git a/examples/SFML/SFML.cpp b/examples/SFML/SFML.cpp index 05ca3da..ce67c89 100644 --- a/examples/SFML/SFML.cpp +++ b/examples/SFML/SFML.cpp @@ -10,7 +10,7 @@ class PositionText final : public sf::Drawable { public: explicit PositionText(const sf::Font& font) - : m_text{ "0, 0", font } + : m_text{ font, "0, 0" } { } @@ -27,7 +27,7 @@ class PositionText final : public sf::Drawable void onMouseScroll(const MouseWheelScrollMessage& message) { - m_text.setString(std::to_string(message.wheel) + ": " + std::to_string(message.delta)); + m_text.setString(std::to_string(static_cast(message.wheel)) + ": " + std::to_string(message.delta)); } private: @@ -43,7 +43,7 @@ class ButtonText final : public sf::Drawable { public: explicit ButtonText(const sf::Font& font) - : m_text{ "Pressed / Released", font } + : m_text{ font, "Pressed / Released" } { } @@ -56,17 +56,17 @@ class ButtonText final : public sf::Drawable void onKeyEvent(const KeyMessage& message) { const auto type = message.type == KeyMessage::Type::Pressed ? "Pressed"s : "Released"s; - m_text.setString(type + ": " + std::to_string(message.code)); + m_text.setString(type + ": " + std::to_string(static_cast(message.code)) + " / " + std::to_string(static_cast(message.scancode))); } void onMouseEvent(const MouseButtonMessage& message) { const auto type = message.type == MouseButtonMessage::Type::Pressed ? "Pressed"s : "Released"s; - m_text.setString(type + ": " + std::to_string(message.button)); + m_text.setString(type + ": " + std::to_string(static_cast(message.button))); } private: - void draw(sf::RenderTarget& target, const sf::RenderStates states) const override final + void draw(sf::RenderTarget& target, const sf::RenderStates& states) const override final { target.draw(m_text, states); } @@ -76,7 +76,7 @@ class ButtonText final : public sf::Drawable int main() { - sf::RenderWindow window({ 800, 600 }, "PubBus SFML Test"); + sf::RenderWindow window(sf::VideoMode{{ 800, 600 }}, "PubBus SFML Test"); window.setFramerateLimit(60); sf::Font font; @@ -134,6 +134,7 @@ int main() bus.publish(KeyMessage{ .type = event.type == sf::Event::KeyPressed ? KeyMessage::Type::Pressed : KeyMessage::Type::Released, .code = event.key.code, + .scancode = event.key.scancode, .alt = event.key.alt, .control = event.key.control, .shift = event.key.shift,