summaryrefslogtreecommitdiffhomepage
path: root/test/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/main.cpp')
-rw-r--r--test/main.cpp47
1 files changed, 12 insertions, 35 deletions
diff --git a/test/main.cpp b/test/main.cpp
index f7014255..dffb19e1 100644
--- a/test/main.cpp
+++ b/test/main.cpp
@@ -1,35 +1,26 @@
-#include <Magnum/Magnum.h>
-#include <Magnum/Platform/Sdl2Application.h>
-#include "compat/assert.hpp"
-#include "tile-atlas.hpp"
-#include "serialize/tile-atlas.hpp"
-#include "serialize/json-helper.hpp"
+#include "app.hpp"
#include "loader.hpp"
-#include "serialize/magnum-vector.hpp"
+#include <filesystem>
+#include <Corrade/Containers/Pair.h>
+#include <Corrade/Containers/StringStlView.h>
+#include <Corrade/Utility/Path.h>
+#include <Magnum/Magnum.h>
namespace Magnum::Examples {
-struct app final : Platform::Application
-{
- using dpi_policy = Platform::Implementation::Sdl2DpiScalingPolicy;
-
- explicit app(const Arguments& arguments);
- ~app();
- void drawEvent() override;
- void test();
-};
-
app::app(const Arguments& arguments):
Platform::Application{
arguments,
Configuration{}
.setTitle("Test")
- .setSize({1024, 768}, dpi_policy::Physical),
+ .setSize({1024, 768}, Platform::Implementation::Sdl2DpiScalingPolicy::Physical),
GLConfiguration{}
.setSampleCount(4)
- //.setFlags(Platform::Sdl2Application::GLConfiguration::Flag::Debug)
+ .setFlags(Platform::Sdl2Application::GLConfiguration::Flag::Debug)
}
{
+ if (auto path_opt = Utility::Path::executableLocation(); path_opt)
+ std::filesystem::current_path(std::string{Utility::Path::split(*path_opt).first()});
}
app::~app()
@@ -43,11 +34,9 @@ void app::drawEvent()
Platform::Sdl2Application::exit(0);
}
-void app::test() // NOLINT(readability-convert-member-functions-to-static)
+void app::test()
{
- auto atlas = loader.tile_atlas("../share/game/images/metal1.tga", {2, 2});
- bool ret = json_helper<std::shared_ptr<tile_atlas>>::to_json(atlas, "f:/dev/game/build/test/atlas.json");
- ASSERT(ret);
+ test_json();
}
} // namespace Magnum::Examples
@@ -55,15 +44,3 @@ void app::test() // NOLINT(readability-convert-member-functions-to-static)
using namespace Magnum::Examples;
MAGNUM_APPLICATION_MAIN(Magnum::Examples::app)
-
-#ifdef _MSC_VER
-# include <cstdlib>
-# ifdef __clang__
-# pragma clang diagnostic ignored "-Wmissing-prototypes"
-# pragma clang diagnostic ignored "-Wmain"
-# endif
-
-extern "C" int __stdcall WinMain(void*, void*, void*, int /* nCmdShow */) {
- return main(__argc, __argv);
-}
-#endif