Browse Source

Merge 17c74b23d7 into 4c65e22acc

pull/168/merge
Vladimír Vondruš 2 years ago committed by GitHub
parent
commit
7a266cd422
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 31
      doc/changelog-old.dox
  2. 57
      doc/changelog.dox
  3. 6
      doc/platform.dox
  4. 4
      src/Magnum/Platform/AndroidApplication.h
  5. 18
      src/Magnum/Platform/Screen.h
  6. 917
      src/Magnum/Platform/Sdl2Application.cpp
  7. 2071
      src/Magnum/Platform/Sdl2Application.h
  8. 112
      src/Magnum/Platform/Test/Sdl2ApplicationTest.cpp
  9. 2
      src/Magnum/SceneGraph/Camera.h

31
doc/changelog-old.dox

@ -108,7 +108,7 @@ Released 2018-05-01, tagged as
- Ability to create @ref Platform::Sdl2Application and
@ref Platform::GlfwApplication classes without implicitly created OpenGL
context by passing @ref Platform::Sdl2Application::Configuration::WindowFlag::Contextless "Configuration::WindowFlag::Contextless"
context by passing @cpp Configuration::WindowFlag::Contextless @ce
to them. These two can be now also built completely without the GL library.
- Added @ref Platform::AndroidApplication::windowSize()
- Added @ref Platform::AndroidApplication::nativeActivity() to access
@ -157,10 +157,9 @@ Released 2018-05-01, tagged as
@subsubsection changelog-2018-04-changes-platform Platform libraries
- Separated @ref Platform::Sdl2Application::Configuration "Platform::*Application::Configuration"
into @ref Platform::Sdl2Application::Configuration "Configuration" and
@ref Platform::Sdl2Application::GLConfiguration "GLConfiguration" to allow
creation of non-GL application instances in the future
- Separated @cpp Platform::*Application::Configuration @ce
into @cpp Configuration @ce and @cpp GLConfiguration @ce to allow creation
of non-GL application instances in the future
@subsubsection changelog-2018-04-changes-plugins Plugins
@ -753,10 +752,10 @@ a high-level overview.
possible
- Ported @ref magnum-gl-info "magnum-info" to Emscripten
- First-class support for scroll events in
@ref Platform::Sdl2Application::MouseScrollEvent (see
[mosra/magnum#157](https://github.com/mosra/magnum/pull/157))
- Added @ref Platform::Sdl2Application::MouseEvent::clickCount()
- Added @ref Platform::Sdl2Application::multiGestureEvent()
@cpp Platform::Sdl2Application::MouseScrollEvent @ce
(see [mosra/magnum#157](https://github.com/mosra/magnum/pull/157))
- Added @cpp Platform::Sdl2Application::MouseEvent::clickCount() @ce
- Added @cpp Platform::Sdl2Application::multiGestureEvent() @ce
- Exposing key repeat in
@ref Platform::Sdl2Application::KeyEvent::isRepeated() "Platform::*Application::KeyEvent::isRepeated()"
(see [mosra/magnum#161](https://github.com/mosra/magnum/issues/161),
@ -773,8 +772,8 @@ a high-level overview.
version is not what the application wants (as opposed to just aborting the
application) (see [mosra/magnum#105](https://github.com/mosra/magnum/issues/105))
- Added @cpp Platform::Sdl2Application::Configuration::setSRGBCapable() @ce
- Added @ref Platform::Sdl2Application::Configuration::WindowFlag::Borderless
and `Platform::Sdl2Application::Configuration::WindowFlag::AllowHighDpi`
- Added @cpp Platform::Sdl2Application::Configuration::WindowFlag::Borderless @ce
and @cpp Platform::Sdl2Application::Configuration::WindowFlag::AllowHighDpi @ce
for iOS and macOS
- Added @ref Platform::WindowlessGlxApplication::Configuration::setFlags() "Platform::Windowless*Application::Configuration::setFlags()" with
@ref Platform::WindowlessGlxApplication::Configuration::Flag::Debug "Flag::Debug"
@ -786,7 +785,7 @@ a high-level overview.
with @ref Platform::GlfwApplication
- Added modifier keys to
@ref Platform::Sdl2Application::KeyEvent::Key "Platform::*Application::KeyEvent::Key"
- Added @ref Platform::Sdl2Application::InputEvent::Modifier::Super to be
- Added @cpp Platform::Sdl2Application::InputEvent::Modifier::Super @ce to be
consistent with @ref Platform::GlfwApplication (see
[mosra/magnum#159](https://github.com/mosra/magnum/pull/159))
- Added @ref Platform::Sdl2Application::KeyEvent::keyName() "Platform::*Application::KeyEvent::keyName()"
@ -1102,10 +1101,10 @@ a high-level overview.
`Platform::GlfwApplication::MouseEvent::Button::WheelDown` mouse events are
deprecated, use @ref Platform::Sdl2Application::mouseScrollEvent() /
@ref Platform::GlfwApplication::mouseScrollEvent() and
@ref Platform::Sdl2Application::MouseScrollEvent /
@cpp Platform::Sdl2Application::MouseScrollEvent @ce /
@ref Platform::GlfwApplication::MouseScrollEvent instead
- @ref Platform::Sdl2Application::Sdl2Application() "Platform::*Application::*Application()"
and @ref Platform::WindowlessGlxApplication::WindowlessGlxApplication() "Platform::Windowless*Application::Windowless*Application()"
- @cpp Platform::*Application::*Application() @ce and
@ref Platform::WindowlessGlxApplication::WindowlessGlxApplication() "Platform::Windowless*Application::Windowless*Application()"
constructors taking @cpp nullptr @ce are deprecated, use constructors
taking @ref NoCreateT instead to create an application without creating
OpenGL context
@ -1844,7 +1843,7 @@ for a high-level overview.
purely integral coordinates, useful e.g. for UI or 2D platformers.
- Detailed collision queries and new `InvertedSphere` shape in Shapes library
- Texture support in @cpp Shaders::Flat @ce
- Mouse button queries in @ref Platform::Sdl2Application::MouseMoveEvent "Platform::*Application::MouseMoveEvent"
- Mouse button queries in @cpp Platform::*Application::MouseMoveEvent @ce
@subsection changelog-2013-10-changes Changes

57
doc/changelog.dox

@ -762,13 +762,13 @@ See also:
- Added @ref Platform::EmscriptenApplication::Configuration::addWindowFlags()
and @ref Platform::EmscriptenApplication::Configuration::clearWindowFlags()
for consistency with other application implementations
- Added @ref Platform::Sdl2Application::KeyEvent::Key::CapsLock,
@relativeref{Platform::Sdl2Application::KeyEvent::Key,ScrollLock},
@relativeref{Platform::Sdl2Application::KeyEvent::Key,NumLock},
@relativeref{Platform::Sdl2Application::KeyEvent::Key,PrintScreen},
@relativeref{Platform::Sdl2Application::KeyEvent::Key,Pause} and
@relativeref{Platform::Sdl2Application::KeyEvent::Key,Menu} for consistency
with @ref Platform::EmscriptenApplication and
- Added @ref Platform::Sdl2ApplicationWindow::KeyEvent::Key::CapsLock,
@relativeref{Platform::Sdl2ApplicationWindow::KeyEvent::Key,ScrollLock},
@relativeref{Platform::Sdl2ApplicationWindow::KeyEvent::Key,NumLock},
@relativeref{Platform::Sdl2ApplicationWindow::KeyEvent::Key,PrintScreen},
@relativeref{Platform::Sdl2ApplicationWindow::KeyEvent::Key,Pause} and
@relativeref{Platform::Sdl2ApplicationWindow::KeyEvent::Key,Menu} for
consistency with @ref Platform::EmscriptenApplication and
@ref Platform::GlfwApplication (see [mosra/magnum#547](https://github.com/mosra/magnum/pull/547))
- @ref Platform::Sdl2Application now overrides SDL's default behavior that
prevents computer from entering a power-saving mode while the application
@ -1160,9 +1160,9 @@ See also:
destroyed could fail with an error saying "cannot make the previous context
current" on certain system. This was due to EGL not destroying the context
if it's still made current.
- Fixed handling of @ref Platform::Sdl2Application::InputEvent::Modifier::Super,
which was misreported as @relativeref{Platform::Sdl2Application::InputEvent::Modifier,Alt} (see
[mosra/magnum#547](https://github.com/mosra/magnum/pull/547))
- Fixed handling of @ref Platform::Sdl2ApplicationWindow::InputEvent::Modifier::Super,
which was misreported as @relativeref{Platform::Sdl2ApplicationWindow::InputEvent::Modifier,Alt}
(see [mosra/magnum#547](https://github.com/mosra/magnum/pull/547))
- For meshes with multiple sets of vertex attributes (such as texture
coordinates), @ref MeshTools::compile() should be using only the first set
but it wasn't.
@ -1345,6 +1345,10 @@ See also:
performance and a default, use @relativeref{Platform::EmscriptenApplication::GLConfiguration,Flag::PowerPreferenceLowPower}
or @relativeref{Platform::EmscriptenApplication::GLConfiguration,Flag::PowerPreferenceHighPerformance}
instead
- GPU-context-related flags were moved from
@ref Platform::Sdl2Application::Configuration::WindowFlag to a new
@ref Platform::Sdl2Application::Configuration::Flag enum, as they're set
globally for all application windows and can't differ per-window
- @cpp Shaders::DistanceFieldVector @ce, @cpp Shaders::Flat @ce,
@cpp Shaders::Generic @ce, @cpp Shaders::MeshVisualizer2D @ce,
@cpp Shaders::MeshVisualizer3D @ce, @cpp Shaders::Phong @ce,
@ -2048,12 +2052,12 @@ Released 2020-06-27, tagged as
@ref Platform::AbstractXApplication::mainLoopIteration() for consistency
with @ref Platform::Sdl2Application (see
[mosra/magnum#387](https://github.com/mosra/magnum/pull/387))
- Added @ref Platform::Sdl2Application::KeyEvent::Key::Quote "Key::Quote",
@ref Platform::Sdl2Application::KeyEvent::Key::LeftBracket "Key::LeftBracket",
@ref Platform::Sdl2Application::KeyEvent::Key::RightBracket "Key::RightBracket",
@ref Platform::Sdl2Application::KeyEvent::Key::Backslash "Key::Backslash" and
@ref Platform::Sdl2Application::KeyEvent::Key::Backquote "Key::Backquote"
keys to @ref Platform::Sdl2Application::KeyEvent and
- Added @relativeref{Platform::Sdl2ApplicationWindow::KeyEvent,Key::Quote},
@relativeref{Platform::Sdl2ApplicationWindow::KeyEvent,Key::LeftBracket},
@relativeref{Platform::Sdl2ApplicationWindow::KeyEvent,Key::RightBracket},
@relativeref{Platform::Sdl2ApplicationWindow::KeyEvent,Key::Backslash} and
@relativeref{Platform::Sdl2ApplicationWindow::KeyEvent,Key::Backquote}
keys to @cpp Platform::Sdl2Application::KeyEvent @ce and
@ref Platform::GlfwApplication::KeyEvent
- Added @ref Platform::GlfwApplication::KeyEvent::Key::World1 and
@ref Platform::GlfwApplication::KeyEvent::Key::World2
@ -2071,12 +2075,9 @@ Released 2020-06-27, tagged as
- CUDA device selection in @ref Platform::WindowlessEglApplication (see
[mosra/magnum#449](https://github.com/mosra/magnum/pull/449))
- Added @ref Platform::GlfwApplication::Configuration::WindowFlag::Borderless
- Added @ref Platform::Sdl2Application::Configuration::WindowFlag::FullscreenDesktop,
@ref Platform::Sdl2Application::Configuration::WindowFlag::AlwaysOnTop "AlwaysOnTop",
@ref Platform::Sdl2Application::Configuration::WindowFlag::SkipTaskbar "SkipTaskbar",
@ref Platform::Sdl2Application::Configuration::WindowFlag::Utility "Utility",
@ref Platform::Sdl2Application::Configuration::WindowFlag::Tooltip "Tooltip"
and @ref Platform::Sdl2Application::Configuration::WindowFlag::PopupMenu "PopupMenu"
- Added @cpp Platform::Sdl2Application::Configuration::WindowFlag::FullscreenDesktop @ce,
@cpp AlwaysOnTop @ce, @cpp SkipTaskbar @ce, @cpp Utility @ce,
@cpp Tooltip @ce and @cpp PopupMenu @ce
- Added @ref Platform::Sdl2Application::Configuration::addWindowFlags() and
@ref Platform::Sdl2Application::Configuration::clearWindowFlags() "clearWindowFlags()"
for consistency with similar functions in
@ -2378,7 +2379,7 @@ Released 2020-06-27, tagged as
- The @ref Primitives::cylinderSolid() and @ref Primitives::coneSolid()
primitives were missing a face when both caps and texture coordinates were
enabled (see [mosra/magnum#386](https://github.com/mosra/magnum/issues/386))
- @ref Platform::Sdl2Application::Configuration::WindowFlag::Vulkan was
- @cpp Platform::Sdl2Application::Configuration::WindowFlag::Vulkan @ce was
enabled conditionally only for SDL >= 2.0.6, but the version defines were
never included so it was always disabled
- Fixed missing handling of
@ -2409,7 +2410,7 @@ Released 2020-06-27, tagged as
caused @ref Platform::Sdl2Application::setMinimalLoopPeriod() "setMinimalLoopPeriod()"
to be ignored even though Vsync was in fact not enabled.
- It was not possible to override DPI scaling using
@ref Platform::Sdl2Application::Configuration as command-line arguments
@cpp Platform::Sdl2Application::Configuration @ce as command-line arguments
always got a priority (see [mosra/magnum#416](https://github.com/mosra/magnum/issues/416))
- Fixed an otherwise harmless OOB access in @ref MeshTools::tipsifyInPlace()
that could trigger ASan or debug iterator errors
@ -2911,10 +2912,10 @@ Released 2019-10-24, tagged as
in @ref Platform::GlfwApplication and @ref Platform::EmscriptenApplication)
for changing window title at runtime as opposed to setting them on
application startup
- Added @ref Platform::Sdl2Application::Configuration::WindowFlag::OpenGL and
@ref Platform::Sdl2Application::Configuration::WindowFlag::Vulkan "WindowFlag::Vulkan",
meant to be used together with @ref Platform::Sdl2Application::Configuration::WindowFlag::Contextless for
manual creation of OpenGL contexts and Vulkan instances
- Added @cpp Platform::Sdl2Application::Configuration::WindowFlag::OpenGL @ce
and @cpp WindowFlag::Vulkan @ce, meant to be used together with
@cpp Platform::Sdl2Application::Configuration::WindowFlag::Contextless @ce
for manual creation of OpenGL contexts and Vulkan instances
- @ref Platform::WindowlessEglApplication now uses the
@m_class{m-doc-external} [EGL_EXT_device_enumeration](https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_device_enumeration.txt),
@m_class{m-doc-external} [EGL_EXT_platform_base](https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_platform_base.txt) and

6
doc/platform.dox

@ -136,8 +136,8 @@ target_link_libraries(myapplication
@section platform-configuration Specifying configuration
By default the application is created with some reasonable defaults (e.g.
window size 800x600 pixels). If you want something else, you can pass
@ref Platform::Sdl2Application::Configuration "Configuration" instance to
window size 800x600 pixels). If you want something else, you can pass a
@relativeref{Platform::Sdl2ApplicationWindow,Configuration} instance to the
application constructor. Using method chaining it can be done conveniently like
this:
@ -148,7 +148,7 @@ this:
Sometimes you may want to set up the application based on a configuration file
or system introspection, which can't really be done inside the base class
initializer. You can specify @ref NoCreate in the constructor instead and pass
the @relativeref{Platform::Sdl2Application,Configuration} later to a
the @relativeref{Platform::Sdl2ApplicationWindow,Configuration} later to a
@relativeref{Platform::Sdl2Application,create()} function:
@snippet Platform.cpp createcontext

4
src/Magnum/Platform/AndroidApplication.h

@ -149,8 +149,8 @@ to simplify porting.
@section Platform-AndroidApplication-resizing Responding to viewport events
Unlike in desktop application implementations, where this is controlled via
@ref Sdl2Application::Configuration::WindowFlag::Resizable, for example, on
Android you have to describe this in the `AndroidManifest.xml` file, as by
@ref Sdl2ApplicationWindow::Configuration::WindowFlag::Resizable, for example,
on Android you have to describe this in the `AndroidManifest.xml` file, as by
default the application gets killed and relaunched on screen orientation
change. See the @ref platforms-android-apps-manifest-screen-resize "manifest file docs"
for more information.

18
src/Magnum/Platform/Screen.h

@ -175,7 +175,7 @@ template<class Application> class BasicScreen:
* @brief Key event
*
* Defined only if the application has a
* @ref Sdl2Application::KeyEvent "KeyEvent".
* @relativeref{Sdl2ApplicationWindow,KeyEvent}.
*/
typedef typename BasicScreenedApplication<Application>::KeyEvent KeyEvent;
#endif
@ -192,7 +192,7 @@ template<class Application> class BasicScreen:
* @m_since{2019,10}
*
* Defined only if the application has a
* @ref Sdl2Application::MouseScrollEvent "MouseScrollEvent".
* @relativeref{Sdl2ApplicationWindow,MouseScrollEvent}.
*/
typedef typename BasicScreenedApplication<Application>::MouseScrollEvent MouseScrollEvent;
@ -201,7 +201,7 @@ template<class Application> class BasicScreen:
* @m_since{2019,10}
*
* Defined only if the application has a
* @ref Sdl2Application::TextInputEvent "TextInputEvent".
* @relativeref{Sdl2ApplicationWindow,TextInputEvent}.
*/
typedef typename BasicScreenedApplication<Application>::TextInputEvent TextInputEvent;
@ -210,7 +210,7 @@ template<class Application> class BasicScreen:
* @m_since{2019,10}
*
* Defined only if the application has a
* @ref Sdl2Application::TextEditingEvent "TextEditingEvent".
* @relativeref{Sdl2ApplicationWindow,TextEditingEvent}.
*/
typedef typename BasicScreenedApplication<Application>::TextEditingEvent TextEditingEvent;
#endif
@ -379,7 +379,7 @@ template<class Application> class BasicScreen:
* Called when @ref PropagatedEvent::Input is enabled and an key is
* pressed. See @ref Sdl2Application::keyPressEvent() "*Application::keyPressEvent()"
* for more information. Defined only if the application has a
* @ref Sdl2Application::KeyEvent "KeyEvent".
* @relativeref{Sdl2ApplicationWindow,KeyEvent}.
*/
virtual void keyPressEvent(KeyEvent& event);
@ -389,7 +389,7 @@ template<class Application> class BasicScreen:
* Called when @ref PropagatedEvent::Input is enabled and an key is
* released. See @ref Sdl2Application::keyReleaseEvent() "*Application::keyReleaseEvent()"
* for more information. Defined only if the application has a
* @ref Sdl2Application::KeyEvent "KeyEvent".
* @relativeref{Sdl2ApplicationWindow,KeyEvent}.
*/
virtual void keyReleaseEvent(KeyEvent& event);
#endif
@ -437,7 +437,7 @@ template<class Application> class BasicScreen:
* Called when @ref PropagatedEvent::Input is enabled and mouse wheel
* is rotated. See @ref Sdl2Application::mouseScrollEvent() "*Application::mouseScrollEvent()"
* for more information. Defined only if the application has a
* @ref Sdl2Application::MouseScrollEvent "MouseScrollEvent".
* @relativeref{Sdl2ApplicationWindow,MouseScrollEvent}.
*/
virtual void mouseScrollEvent(MouseScrollEvent& event);
#endif
@ -457,7 +457,7 @@ template<class Application> class BasicScreen:
*
* Called when @ref PropagatedEvent::Input is enabled and text is being
* input. Defined only if the application has a
* @ref Sdl2Application::TextInputEvent "TextInputEvent".
* @relativeref{Sdl2ApplicationWindow,TextInputEvent}.
*/
virtual void textInputEvent(TextInputEvent& event);
@ -467,7 +467,7 @@ template<class Application> class BasicScreen:
*
* Called when @ref PropagatedEvent::Input and the text is being
* edited. Defined only if the application has a
* @ref Sdl2Application::TextEditingEvent "TextEditingEvent".
* @relativeref{Sdl2ApplicationWindow,TextEditingEvent}.
*/
virtual void textEditingEvent(TextEditingEvent& event);
#endif

917
src/Magnum/Platform/Sdl2Application.cpp

File diff suppressed because it is too large Load Diff

2071
src/Magnum/Platform/Sdl2Application.h

File diff suppressed because it is too large Load Diff

112
src/Magnum/Platform/Test/Sdl2ApplicationTest.cpp

@ -23,9 +23,11 @@
DEALINGS IN THE SOFTWARE.
*/
#include <Corrade/Containers/GrowableArray.h>
#include <Corrade/Containers/Optional.h>
#include <Corrade/PluginManager/Manager.h>
#include <Corrade/Utility/Arguments.h>
#include <Corrade/Utility/Format.h>
#include <Corrade/Utility/Resource.h>
#include "Magnum/ImageView.h"
@ -174,6 +176,106 @@ Debug& operator<<(Debug& debug, const Application::KeyEvent::Key value) {
using namespace Containers::Literals;
#ifndef CORRADE_TARGET_EMSCRIPTEN
struct Sdl2ApplicationTestWindow: Platform::ApplicationWindow {
explicit Sdl2ApplicationTestWindow(Platform::Application& application, std::size_t id): Platform::ApplicationWindow{application, Configuration{}
.setTitle(Utility::format("Window {}", id))
.setSize({400, 300})
.addWindowFlags(Configuration::WindowFlag::Resizable)
}, _id{id} {}
void viewportEvent(ViewportEvent& event) override {
Debug{} << "window" << _id << "viewport event" << event.windowSize()
#ifdef MAGNUM_TARGET_GL
<< event.framebufferSize()
#endif
<< event.dpiScaling();
#warning query the GL fb size here and compare
// GL::defaultFramebuffer.setViewport({{}, event.framebufferSize()});
}
void drawEvent() override {
Debug{} << "window" << _id << "draw event";
#ifdef MAGNUM_TARGET_GL
GL::defaultFramebuffer.clear(GL::FramebufferClear::Color);
#endif
swapBuffers();
}
/* For testing event coordinates */
void mousePressEvent(MouseEvent& event) override {
Debug{} << "window" << _id << "mouse press event:" << event.position() << Int(event.button());
}
void mouseReleaseEvent(MouseEvent& event) override {
Debug{} << "window" << _id << "mouse release event:" << event.position() << Int(event.button());
}
void mouseMoveEvent(MouseMoveEvent& event) override {
Debug{} << "window" << _id << "mouse move event:" << event.position() << event.relativePosition() << Uint32(event.buttons());
}
void mouseScrollEvent(MouseScrollEvent& event) override {
Debug{} << "window" << _id << "mouse scroll event:" << event.offset() << event.position();
}
void keyPressEvent(KeyEvent& event) override {
Debug{} << "window" << _id << "key press event:" << SDL_Keycode(event.key()) << event.keyName();
if(event.key() == KeyEvent::Key::F1) {
Debug{} << "starting text input";
application().startTextInput();
} else if(event.key() == KeyEvent::Key::Esc) {
Debug{} << "stopping text input";
application().stopTextInput();
} else if(event.key() == KeyEvent::Key::T) {
Debug{} << "setting window title";
setWindowTitle("This is a UTF-8 Window Title™ and it should have no exclamation mark!!"_s.exceptSuffix(2));
}
#ifndef CORRADE_TARGET_EMSCRIPTEN
else if(event.key() == KeyEvent::Key::S) {
Debug{} << "setting window size, which should trigger a viewport event";
setWindowSize(Vector2i{300, 200});
} else if(event.key() == KeyEvent::Key::W) {
Debug{} << "setting max window size, which should trigger a viewport event";
setMaxWindowSize(Vector2i{700, 500});
}
#endif
else if(event.key() == KeyEvent::Key::H) {
Debug{} << "toggling hand cursor";
setCursor(cursor() == Cursor::Arrow ? Cursor::Hand : Cursor::Arrow);
}
#ifndef CORRADE_TARGET_EMSCRIPTEN
else if(event.key() == KeyEvent::Key::L) {
Debug{} << "toggling locked mouse";
setCursor(cursor() == Cursor::Arrow ? Cursor::HiddenLocked : Cursor::Arrow);
}
#else
else if(event.key() == KeyEvent::Key::F) {
Debug{} << "toggling fullscreen";
setContainerCssClass((_fullscreen ^= true) ? "mn-fullsize" : "");
}
#endif
else if(event.key() == KeyEvent::Key::X) {
Debug{} << "requesting an exit with code 5";
exit(5);
}
}
void keyReleaseEvent(KeyEvent& event) override {
Debug{} << "window" << _id << "key release event:" << SDL_Keycode(event.key()) << event.keyName();
}
void textInputEvent(TextInputEvent& event) override {
Debug{} << "window" << _id << "text input event:" << event.text();
}
private:
std::size_t _id;
};
#endif
struct Sdl2ApplicationTest: Platform::Application {
explicit Sdl2ApplicationTest(const Arguments& arguments);
@ -242,6 +344,10 @@ struct Sdl2ApplicationTest: Platform::Application {
Debug{} << "setting max window size, which should trigger a viewport event";
setMaxWindowSize(Vector2i{700, 500});
}
else if(event.key() == KeyEvent::Key::O) {
Debug{} << "opening window" << _windows.size();
arrayAppend(_windows, Containers::pointer<Sdl2ApplicationTestWindow>(*this, _windows.size()));
}
#endif
else if(event.key() == KeyEvent::Key::H) {
Debug{} << "toggling hand cursor";
@ -303,10 +409,12 @@ struct Sdl2ApplicationTest: Platform::Application {
if(event.type == SDL_WINDOWEVENT) d << event.window.event;
}
#ifdef CORRADE_TARGET_EMSCRIPTEN
private:
#ifndef CORRADE_TARGET_EMSCRIPTEN
Containers::Array<Containers::Pointer<Sdl2ApplicationTestWindow>> _windows;
#else
bool _fullscreen = false;
#endif
#endif
};
Sdl2ApplicationTest::Sdl2ApplicationTest(const Arguments& arguments): Platform::Application{arguments, NoCreate} {

2
src/Magnum/SceneGraph/Camera.h

@ -156,7 +156,7 @@ template<UnsignedInt dimensions, class T> class Camera: public AbstractFeature<d
*
* Conversion from integer window-space coordinates with origin in top
* left corner and Y down (e.g. from
* @ref Platform::Sdl2Application::MouseEvent "Platform::*Application::MouseEvent")
* @ref Platform::Sdl2ApplicationWindow::MouseEvent "Platform::*Application::MouseEvent")
* to floating-point coordinates on near XY plane with origin at camera
* position and Y up can be done using the following snippet:
*

Loading…
Cancel
Save