diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-06 19:12:39 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-06 19:12:39 +0200 |
commit | f60d07f5d5d8e08be409e1ba2c11d2a936c2af99 (patch) | |
tree | 15d1c7f4d4199c507b44688be94a11a66e2cd58d | |
parent | 48a9024aa96e066b179a865cb658f95f234570c1 (diff) |
a
-rw-r--r-- | main/CMakeLists.txt | 2 | ||||
-rw-r--r-- | test/CMakeLists.txt | 2 | ||||
-rw-r--r-- | test/app.hpp | 9 | ||||
-rw-r--r-- | test/json.cpp | 3 | ||||
-rw-r--r-- | test/main.cpp | 25 |
5 files changed, 21 insertions, 20 deletions
diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index 9614e17f..1d8da0a1 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -2,7 +2,7 @@ set(self "${PROJECT_NAME}-main") file(GLOB sources "*.cpp" CONFIGURE_ARGS) link_libraries(${PROJECT_NAME}) -link_libraries(Magnum::Application Magnum::Trade) +link_libraries(Magnum::Sdl2Application Magnum::Trade) corrade_add_resource(res ../resources.conf) add_executable(${self} WIN32 "${sources}" "${res}") diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index eef3719a..2e3415bd 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -4,7 +4,7 @@ file(GLOB sources "*.cpp" CONFIGURE_ARGS) file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/test") link_libraries(${PROJECT_NAME}) -link_libraries(Magnum::Application Magnum::Trade) +link_libraries(Magnum::WindowlessWglApplication Magnum::Trade) add_executable(${self} "${sources}" "../main/loader-impl.cpp") install(TARGETS ${self} RUNTIME DESTINATION bin) diff --git a/test/app.hpp b/test/app.hpp index 53ee24b5..c77c3369 100644 --- a/test/app.hpp +++ b/test/app.hpp @@ -1,13 +1,12 @@ #pragma once #include <Magnum/Magnum.h> -#include <Magnum/Platform/Sdl2Application.h> +#include <Magnum/Platform/WindowlessWglApplication.h> namespace Magnum::Examples { -struct app final : Platform::Application // NOLINT(cppcoreguidelines-virtual-class-destructor) +struct app final : Platform::WindowlessWglApplication // NOLINT(cppcoreguidelines-virtual-class-destructor) { explicit app(const Arguments& arguments); ~app(); - void drawEvent() override; - static void test_json(); - void test(); + int exec() override; + static bool test_json(); }; } // namespace Magnum::Examples diff --git a/test/json.cpp b/test/json.cpp index dfcbd23f..a47f08ac 100644 --- a/test/json.cpp +++ b/test/json.cpp @@ -7,7 +7,7 @@ #include "loader.hpp" namespace Magnum::Examples { -void app::test_json() // NOLINT(readability-convert-member-functions-to-static) +bool app::test_json() // NOLINT(readability-convert-member-functions-to-static) { bool ret = true; using nlohmann::to_json; @@ -24,6 +24,7 @@ void app::test_json() // NOLINT(readability-convert-member-functions-to-static) ret &= json_helper::to_json(v2i_2, output_dir/"vec2i_2.json"); } ASSERT(ret); + return 0; } } // namespace Magnum::Examples diff --git a/test/main.cpp b/test/main.cpp index d0bf23ed..2ec70290 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -9,14 +9,14 @@ namespace Magnum::Examples { app::app(const Arguments& arguments): - Platform::Application{ + Platform::WindowlessWglApplication{ arguments, Configuration{} - .setTitle("Test") - .setSize({1024, 768}, Platform::Implementation::Sdl2DpiScalingPolicy::Physical), +#if 0 GLConfiguration{} .setSampleCount(4) .setFlags(Platform::Sdl2Application::GLConfiguration::Flag::Debug) +#endif } { } @@ -26,19 +26,20 @@ app::~app() loader_::destroy(); } -void app::drawEvent() +int app::exec() { - test(); - Platform::Sdl2Application::exit(0); -} - -void app::test() -{ - test_json(); + bool ret = true; + ret &= test_json(); + return ret; } } // namespace Magnum::Examples +int main(int argc, char** argv) +{ + Magnum::Examples::app application{{argc, argv}}; + return application.exec(); +} using namespace Magnum::Examples; -MAGNUM_APPLICATION_MAIN(Magnum::Examples::app) +//MAGNUM_APPLICATION_MAIN(Magnum::Examples::app) |