Skip to content

asmwarrior/magnum-wx

Repository files navigation

A sample Magnum + wxWidgets C++ project

Those packages and tools are used to build this project.

How to build

First, you have MSYS2 installed in your Windows.

The wxWidgets library could be installed by such commands in the msys2 shell.

pacman -S mingw-w64-x86_64-wxmsw3.1

And the Magnum library should also be installed by the commands

pacman -S mingw-w64-x86_64-magnum

In the root folder, there is a file named wx-config-msys2.exe, which I built from the project: eranif/wx-config-msys2: wx-config tool for MSYS2 based installation of wxWidgets using the mingw64 repository. The wx-config-msys2.exe will be called when you click the "Build" button in Code::Blocks to generate the correct build options.

The source code is mainly modified from this magnum example code:

https://github.com/mosra/magnum-examples/blob/master/src/mouseinteraction/MouseInteractionExample.cpp

Also, the wxWidgets code is modified and redesigned from magnum's wxWidgets bootstrap code:

https://github.com/mosra/magnum-bootstrap/tree/base-wxwidgets

The result application

The main GUI

The current issue(as 2021-08-01, this issue is fixed now by using the arcball example code from magnum example)

The mouse scroll event works OK(see void GLPanel::OnMouseScroll(wxMouseEvent &event) function), so when you scroll up/down with the mouse's wheel, you can zoom in/out the scene.

The key press handling works OK(see void GLPanel::OnKeyDown(wxKeyEvent &event) function), when you press the "0" key, the scene/camera will get reset, when you press the "1", "3" or "7" key, the scene/camera will go to the preset positions.

But it looks like the mouse left button drag does not rotate the scene correctly(see void GLPanel::OnMouseMove(wxMouseEvent &event) function), compared with Magnum's official webgl demos here: Mouse In­ter­ac­tion Ex­am­ple, also the right mouse button drag is not working, it should translate the screne/camera.

About

a sample wxWidgets + Magnum project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published