Browse Source

Platform: updates for the new documentation theme.

pull/225/head
Vladimír Vondruš 8 years ago
parent
commit
d49b8efe9e
  1. 6
      src/Magnum/Platform/AbstractXApplication.h
  2. 93
      src/Magnum/Platform/AndroidApplication.h
  3. 48
      src/Magnum/Platform/GlfwApplication.h
  4. 43
      src/Magnum/Platform/GlutApplication.h
  5. 23
      src/Magnum/Platform/GlxApplication.h
  6. 4
      src/Magnum/Platform/Screen.h
  7. 10
      src/Magnum/Platform/ScreenedApplication.h
  8. 200
      src/Magnum/Platform/Sdl2Application.h
  9. 53
      src/Magnum/Platform/WindowlessCglApplication.h
  10. 83
      src/Magnum/Platform/WindowlessEglApplication.h
  11. 37
      src/Magnum/Platform/WindowlessGlxApplication.h
  12. 39
      src/Magnum/Platform/WindowlessIosApplication.h
  13. 39
      src/Magnum/Platform/WindowlessWglApplication.h
  14. 39
      src/Magnum/Platform/WindowlessWindowsEglApplication.h
  15. 23
      src/Magnum/Platform/XEglApplication.h

6
src/Magnum/Platform/AbstractXApplication.h

@ -90,7 +90,7 @@ class AbstractXApplication {
/** /**
* @brief Execute main loop * @brief Execute main loop
* @return Value for returning from `main()` * @return Value for returning from @cpp main() @ce
* *
* See @ref MAGNUM_GLXAPPLICATION_MAIN() or * See @ref MAGNUM_GLXAPPLICATION_MAIN() or
* @ref MAGNUM_XEGLAPPLICATION_MAIN() for usage information. * @ref MAGNUM_XEGLAPPLICATION_MAIN() for usage information.
@ -218,7 +218,7 @@ class AbstractXApplication::Configuration {
* @brief Set window title * @brief Set window title
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Default is `"Magnum X Application"`. * Default is @cpp "Magnum X Application" @ce.
*/ */
Configuration& setTitle(std::string title) { Configuration& setTitle(std::string title) {
_title = std::move(title); _title = std::move(title);
@ -232,7 +232,7 @@ class AbstractXApplication::Configuration {
* @brief Set window size * @brief Set window size
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Default is `{800, 600}`. * Default is @cpp {800, 600} @ce.
*/ */
Configuration& setSize(const Vector2i& size) { Configuration& setSize(const Vector2i& size) {
_size = size; _size = size;

93
src/Magnum/Platform/AndroidApplication.h

@ -58,7 +58,7 @@ in @ref building-corrade-cross-android "Corrade's" and @ref building-cross-andro
building documentation. It is built if `WITH_ANDROIDAPPLICATION` is enabled in building documentation. It is built if `WITH_ANDROIDAPPLICATION` is enabled in
CMake. CMake.
## Bootstrap application @section Platform-AndroidApplication-bootstrap Bootstrap application
Fully contained base application using @ref Sdl2Application for desktop build Fully contained base application using @ref Sdl2Application for desktop build
and @ref AndroidApplication for Android build along with full Android packaging and @ref AndroidApplication for Android build along with full Android packaging
@ -80,23 +80,27 @@ will create `build.xml` file for Ant and a bunch of other files. You need to
specify the target for which you will build in the `-t` parameter. List of all specify the target for which you will build in the `-t` parameter. List of all
targets can be obtained by calling `android list target`. targets can be obtained by calling `android list target`.
android update project -p . -t "android-19" @code{.sh}
android update project -p . -t "android-19"
@endcode
Then create build directories for ARM and x86 and run `cmake` and build command Then create build directories for ARM and x86 and run `cmake` and build command
in them. Set `CMAKE_PREFIX_PATH` to the directory where you have all the in them. Set `CMAKE_PREFIX_PATH` to the directory where you have all the
dependencies. dependencies.
mkdir build-android-arm && cd build-android-arm @code{.sh}
cmake .. \ mkdir build-android-arm && cd build-android-arm
-DCMAKE_TOOLCHAIN_FILE="../toolchains/generic/Android-ARM.cmake" \ cmake .. \
-DCMAKE_PREFIX_PATH=/opt/android-ndk/platforms/android-19/arch-arm/usr -DCMAKE_TOOLCHAIN_FILE="../toolchains/generic/Android-ARM.cmake" \
cmake --build . -DCMAKE_PREFIX_PATH=/opt/android-ndk/platforms/android-19/arch-arm/usr
cmake --build .
mkdir build-android-x86 && cd build-android-x86
cmake .. \ mkdir build-android-x86 && cd build-android-x86
-DCMAKE_TOOLCHAIN_FILE="../toolchains/generic/Android-x86.cmake" \ cmake .. \
-DCMAKE_PREFIX_PATH=/opt/android-ndk/platforms/android-19/arch-x86/usr -DCMAKE_TOOLCHAIN_FILE="../toolchains/generic/Android-x86.cmake" \
cmake --build . -DCMAKE_PREFIX_PATH=/opt/android-ndk/platforms/android-19/arch-x86/usr
cmake --build .
@endcode
See @ref cmake for more information. See @ref cmake for more information.
@ -104,10 +108,12 @@ The compiled binaries will be put into `lib/armeabi-v7a` and `lib/x86`. You can
then build the APK package simply by running `ant`. The resulting APK package then build the APK package simply by running `ant`. The resulting APK package
can be then installed directly on the device or emulator using `adb install`. can be then installed directly on the device or emulator using `adb install`.
ant debug @code{.sh}
adb install bin/NativeActivity-debug.apk ant debug
adb install bin/NativeActivity-debug.apk
@endcode
## General usage @section Platform-AndroidApplication-usage General usage
For CMake you need to copy `FindEGL.cmake` and `FindOpenGLES2.cmake` (or For CMake you need to copy `FindEGL.cmake` and `FindOpenGLES2.cmake` (or
`FindOpenGLES3.cmake`) from `modules/` directory in Magnum source to `modules/` `FindOpenGLES3.cmake`) from `modules/` directory in Magnum source to `modules/`
@ -120,14 +126,17 @@ other platforms you need to create *shared library* instead of executable. The
resulting binary then needs to be copied to `lib/armeabi-v7a` and `lib/x86`, resulting binary then needs to be copied to `lib/armeabi-v7a` and `lib/x86`,
you can do that automatically in CMake using the following commands: you can do that automatically in CMake using the following commands:
file(MAKE_DIRECTORY "${CMAKE_SOURCE_DIR}/libs/${ANDROID_ABI}") @code{.cmake}
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/libs/${ANDROID_ABI}") file(MAKE_DIRECTORY "${CMAKE_SOURCE_DIR}/libs/${ANDROID_ABI}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/libs/${ANDROID_ABI}")
@endcode
In C++ code you need to implement at least @ref drawEvent() to be able to draw In C++ code you need to implement at least @ref drawEvent() to be able to draw
on the screen. The subclass must be then made accessible from JNI using on the screen. The subclass must be then made accessible from JNI using
@ref MAGNUM_ANDROIDAPPLICATION_MAIN() macro. See @ref platform for more @ref MAGNUM_ANDROIDAPPLICATION_MAIN() macro. See @ref platform for more
information. information.
@code
@code{.cpp}
class MyApplication: public Platform::AndroidApplication { class MyApplication: public Platform::AndroidApplication {
// implement required methods... // implement required methods...
}; };
@ -135,28 +144,30 @@ MAGNUM_ANDROIDAPPLICATION_MAIN(MyApplication)
@endcode @endcode
If no other application header is included, this class is also aliased to If no other application header is included, this class is also aliased to
`Platform::Application` and the macro is aliased to `MAGNUM_APPLICATION_MAIN()` @cpp Platform::Application @ce and the macro is aliased to @cpp MAGNUM_APPLICATION_MAIN() @ce
to simplify porting. to simplify porting.
### Android packaging stuff @subsection Platform-AndroidApplication-packaging Android packaging stuff
The application needs at least the `AndroidManifest.xml` with the following The application needs at least the `AndroidManifest.xml` with the following
contents: contents:
<?xml version="1.0" encoding="utf-8"?> @code{.xml}
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="cz.mosra.magnum.application" android:versionCode="1" android:versionName="1.0"> <?xml version="1.0" encoding="utf-8"?>
<uses-sdk android:minSdkVersion="9" /> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="cz.mosra.magnum.application" android:versionCode="1" android:versionName="1.0">
<uses-feature android:glEsVersion="0x00020000" /> <uses-sdk android:minSdkVersion="9" />
<application android:label="Magnum Android Application" android:hasCode="false"> <uses-feature android:glEsVersion="0x00020000" />
<activity android:name="android.app.NativeActivity" android:label="Magnum Android Application"> <application android:label="Magnum Android Application" android:hasCode="false">
<meta-data android:name="android.app.lib_name" android:value="{{application}}" /> <activity android:name="android.app.NativeActivity" android:label="Magnum Android Application">
<intent-filter> <meta-data android:name="android.app.lib_name" android:value="{{application}}" />
<action android:name="android.intent.action.MAIN" /> <intent-filter>
<category android:name="android.intent.category.LAUNCHER" /> <action android:name="android.intent.action.MAIN" />
</intent-filter> <category android:name="android.intent.category.LAUNCHER" />
</activity> </intent-filter>
</application> </activity>
</manifest> </application>
</manifest>
@endcode
Modify `android:label` to your liking, set unique `package` name and replace Modify `android:label` to your liking, set unique `package` name and replace
`{{application}}` with name of the binary file (without extension). If you plan `{{application}}` with name of the binary file (without extension). If you plan
@ -165,7 +176,7 @@ file will be named `NativeActivity.apk` by default, you can change that either
by passing `-n` parameter to `android update project` or later by editing first by passing `-n` parameter to `android update project` or later by editing first
line of the generated `build.xml` file. line of the generated `build.xml` file.
## Redirecting output to Android log buffer @section Platform-AndroidApplication-output-redirection Redirecting output to Android log buffer
The application by default redirects @ref Corrade::Utility::Debug "Debug", The application by default redirects @ref Corrade::Utility::Debug "Debug",
@ref Corrade::Utility::Warning "Warning" and @ref Corrade::Utility::Error "Error" @ref Corrade::Utility::Warning "Warning" and @ref Corrade::Utility::Error "Error"
@ -353,9 +364,9 @@ class AndroidApplication::Configuration {
* @brief Set window size * @brief Set window size
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Default is `{0, 0}`, which means that the size of the physical * Default is @cpp {0, 0} @ce, which means that the size of the
* window will be used. If set to different value than the physical * physical window will be used. If set to different value than the
* size, the surface will be scaled. * physical size, the surface will be scaled.
*/ */
Configuration& setSize(const Vector2i& size) { Configuration& setSize(const Vector2i& size) {
_size = size; _size = size;
@ -578,9 +589,9 @@ CORRADE_ENUMSET_OPERATORS(AndroidApplication::MouseMoveEvent::Buttons)
See @ref Magnum::Platform::AndroidApplication "Platform::AndroidApplication" See @ref Magnum::Platform::AndroidApplication "Platform::AndroidApplication"
for usage information. This macro abstracts out platform-specific entry point for usage information. This macro abstracts out platform-specific entry point
code (the classic `main()` function cannot be used in Android). See code (the classic @cpp main() @ce function cannot be used in Android). See
@ref portability-applications for more information. When no other application @ref portability-applications for more information. When no other application
header is included this macro is also aliased to `MAGNUM_APPLICATION_MAIN()`. header is included this macro is also aliased to @cpp MAGNUM_APPLICATION_MAIN() @ce.
*/ */
#define MAGNUM_ANDROIDAPPLICATION_MAIN(className) \ #define MAGNUM_ANDROIDAPPLICATION_MAIN(className) \
void android_main(android_app* state) { \ void android_main(android_app* state) { \

48
src/Magnum/Platform/GlfwApplication.h

@ -56,7 +56,7 @@ This application library is available on all platforms where GLFW is ported. It
depends on **GLFW** library and is built if `WITH_GLFWAPPLICATION` is enabled depends on **GLFW** library and is built if `WITH_GLFWAPPLICATION` is enabled
in CMake. in CMake.
## Bootstrap application @section Platform-GlfwApplication-bootstrap Bootstrap application
Fully contained base application using @ref GlfwApplication along with CMake Fully contained base application using @ref GlfwApplication along with CMake
setup is available in `base-glfw` branch of setup is available in `base-glfw` branch of
@ -66,14 +66,16 @@ or [zip](https://github.com/mosra/magnum-bootstrap/archive/base-glfw.zip) file.
After extracting the downloaded archive you can build and run the application After extracting the downloaded archive you can build and run the application
with these four commands: with these four commands:
mkdir build && cd build @code{.sh}
cmake .. mkdir build && cd build
cmake --build . cmake ..
./src/MyApplication # or ./src/Debug/MyApplication cmake --build .
./src/MyApplication # or ./src/Debug/MyApplication
@endcode
See @ref cmake for more information. See @ref cmake for more information.
## General usage @section Platform-GlfwApplication-usage General usage
In CMake you need to request `GlfwApplication` component of `Magnum` package In CMake you need to request `GlfwApplication` component of `Magnum` package
and link to `Magnum::GlfwApplication` target. If no other application is and link to `Magnum::GlfwApplication` target. If no other application is
@ -81,10 +83,11 @@ requested, you can also use generic `Magnum::Application` alias to simplify
porting. Again, see @ref building and @ref cmake for more information. porting. Again, see @ref building and @ref cmake for more information.
In C++ code you need to implement at least @ref drawEvent() to be able to draw In C++ code you need to implement at least @ref drawEvent() to be able to draw
on the screen. The subclass can be then used directly in `main()` -- see on the screen. The subclass can be then used directly in @cpp main() @ce
convenience macro @ref MAGNUM_GLFWAPPLICATION_MAIN(). See @ref platform for --- see convenience macro @ref MAGNUM_GLFWAPPLICATION_MAIN(). See @ref platform
more information. for more information.
@code
@code{.cpp}
class MyApplication: public Platform::GlfwApplication { class MyApplication: public Platform::GlfwApplication {
// implement required methods... // implement required methods...
}; };
@ -92,8 +95,8 @@ MAGNUM_GLFWAPPLICATION_MAIN(MyApplication)
@endcode @endcode
If no other application header is included, this class is also aliased to If no other application header is included, this class is also aliased to
`Platform::Application` and the macro is aliased to `MAGNUM_APPLICATION_MAIN()` @cpp Platform::Application @ce and the macro is aliased to
to simplify porting. @cpp MAGNUM_APPLICATION_MAIN() @ce to simplify porting.
*/ */
class GlfwApplication { class GlfwApplication {
public: public:
@ -148,7 +151,7 @@ class GlfwApplication {
/** /**
* @brief Execute main loop * @brief Execute main loop
* @return Value for returning from `main()` * @return Value for returning from @cpp main() @ce
* *
* See @ref MAGNUM_GLFWAPPLICATION_MAIN() for usage information. * See @ref MAGNUM_GLFWAPPLICATION_MAIN() for usage information.
*/ */
@ -206,8 +209,9 @@ class GlfwApplication {
/** /**
* @brief Set swap interval * @brief Set swap interval
* *
* Set `0` for no VSync, `1` for enabled VSync. Some platforms support * Set @cpp 0 @ce for no VSync, @cpp 1 @ce for enabled VSync. Some
* `-1` for late swap tearing. Default is driver-dependent. * platforms support @cpp -1 @ce for late swap tearing. Default is
* driver-dependent.
*/ */
void setSwapInterval(Int interval); void setSwapInterval(Int interval);
@ -450,7 +454,7 @@ class GlfwApplication::Configuration {
* @brief Set window title * @brief Set window title
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Default is `"Magnum GLFW Application"`. * Default is @cpp "Magnum GLFW Application" @ce.
*/ */
Configuration& setTitle(std::string title) { Configuration& setTitle(std::string title) {
_title = std::move(title); _title = std::move(title);
@ -464,7 +468,7 @@ class GlfwApplication::Configuration {
* @brief Set window size * @brief Set window size
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Default is `{800, 600}`. * Default is @cpp {800, 600} @ce.
*/ */
Configuration& setSize(const Vector2i& size) { Configuration& setSize(const Vector2i& size) {
_size = size; _size = size;
@ -540,8 +544,8 @@ class GlfwApplication::Configuration {
* @brief Set sample count * @brief Set sample count
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Default is `0`, thus no multisampling. The actual sample count is * Default is @cpp 0 @ce, thus no multisampling. The actual sample
* ignored, GLFW either enables it or disables. See also * count is ignored, GLFW either enables it or disables. See also
* @ref Renderer::Feature::Multisampling. * @ref Renderer::Feature::Multisampling.
*/ */
Configuration& setSampleCount(Int count) { Configuration& setSampleCount(Int count) {
@ -1038,14 +1042,16 @@ See @ref Magnum::Platform::GlfwApplication "Platform::GlfwApplication" for
usage information. This macro abstracts out platform-specific entry point code usage information. This macro abstracts out platform-specific entry point code
and is equivalent to the following, see @ref portability-applications for more and is equivalent to the following, see @ref portability-applications for more
information. information.
@code
@code{.cpp}
int main(int argc, char** argv) { int main(int argc, char** argv) {
className app({argc, argv}); className app({argc, argv});
return app.exec(); return app.exec();
} }
@endcode @endcode
When no other application header is included this macro is also aliased to When no other application header is included this macro is also aliased to
`MAGNUM_APPLICATION_MAIN()`. @cpp MAGNUM_APPLICATION_MAIN() @ce.
*/ */
#define MAGNUM_GLFWAPPLICATION_MAIN(className) \ #define MAGNUM_GLFWAPPLICATION_MAIN(className) \
int main(int argc, char** argv) { \ int main(int argc, char** argv) { \

43
src/Magnum/Platform/GlutApplication.h

@ -53,7 +53,7 @@ This application library is available only on desktop OpenGL (Linux, Windows,
macOS). It depends on **GLUT** library and is built if `WITH_GLUTAPPLICATION` macOS). It depends on **GLUT** library and is built if `WITH_GLUTAPPLICATION`
is enabled in CMake. is enabled in CMake.
## Bootstrap application @section Platform-GlutApplication-bootstrap Bootstrap application
Fully contained base application using @ref GlutApplication along with Fully contained base application using @ref GlutApplication along with
CMake setup is available in `base-glut` branch of CMake setup is available in `base-glut` branch of
@ -63,14 +63,16 @@ or [zip](https://github.com/mosra/magnum-bootstrap/archive/base-glut.zip) file.
After extracting the downloaded archive you can build and run the application After extracting the downloaded archive you can build and run the application
with these four commands: with these four commands:
mkdir build && cd build @code{.sh}
cmake .. mkdir build && cd build
cmake --build . cmake ..
./src/MyApplication # or ./src/Debug/MyApplication cmake --build .
./src/MyApplication # or ./src/Debug/MyApplication
@endcode
See @ref cmake for more information. See @ref cmake for more information.
## General usage @section Platform-GlutApplication-usage General usage
In CMake you need to request `GlutApplication` component of `Magnum` package In CMake you need to request `GlutApplication` component of `Magnum` package
and link to `Magnum::GlutApplication` target. If no other application is and link to `Magnum::GlutApplication` target. If no other application is
@ -78,10 +80,11 @@ requested, you can also use generic `Magnum::Application` alias to simplify
porting. Again, see @ref building and @ref cmake for more information. porting. Again, see @ref building and @ref cmake for more information.
In C++ code you need to implement at least @ref drawEvent() to be able to draw In C++ code you need to implement at least @ref drawEvent() to be able to draw
on the screen. The subclass can be then used directly in `main()` -- see on the screen. The subclass can be then used directly in @cpp main() @ce
convenience macro @ref MAGNUM_GLUTAPPLICATION_MAIN(). See @ref platform for --- see convenience macro @ref MAGNUM_GLUTAPPLICATION_MAIN(). See @ref platform
more information. for more information.
@code
@code{.cpp}
class MyApplication: public Platform::GlutApplication { class MyApplication: public Platform::GlutApplication {
// implement required methods... // implement required methods...
}; };
@ -89,8 +92,8 @@ MAGNUM_GLUTAPPLICATION_MAIN(MyApplication)
@endcode @endcode
If no other application header is included, this class is also aliased to If no other application header is included, this class is also aliased to
`Platform::Application` and the macro is aliased to `MAGNUM_APPLICATION_MAIN()` @cpp Platform::Application @ce and the macro is aliased to
to simplify porting. @cpp MAGNUM_APPLICATION_MAIN() @ce to simplify porting.
*/ */
class GlutApplication { class GlutApplication {
public: public:
@ -143,7 +146,7 @@ class GlutApplication {
/** /**
* @brief Execute main loop * @brief Execute main loop
* @return Value for returning from `main()` * @return Value for returning from @cpp main() @ce
* *
* See @ref MAGNUM_GLUTAPPLICATION_MAIN() for usage information. * See @ref MAGNUM_GLUTAPPLICATION_MAIN() for usage information.
*/ */
@ -321,7 +324,7 @@ class GlutApplication::Configuration {
* @brief Set window title * @brief Set window title
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Default is `"Magnum GLUT Application"`. * Default is @cpp "Magnum GLUT Application" @ce.
*/ */
Configuration& setTitle(std::string title) { Configuration& setTitle(std::string title) {
_title = std::move(title); _title = std::move(title);
@ -335,7 +338,7 @@ class GlutApplication::Configuration {
* @brief Set window size * @brief Set window size
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Default is `{800, 600}`. * Default is @cpp {800, 600} @ce.
*/ */
Configuration& setSize(const Vector2i& size) { Configuration& setSize(const Vector2i& size) {
_size = size; _size = size;
@ -379,8 +382,8 @@ class GlutApplication::Configuration {
* @brief Set sample count * @brief Set sample count
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Default is `0`, thus no multisampling. The actual sample count is * Default is @cpp 0 @ce, thus no multisampling. The actual sample
* ignored, GLUT either enables it or disables. See also * count is ignored, GLUT either enables it or disables. See also
* @ref Renderer::Feature::Multisampling. * @ref Renderer::Feature::Multisampling.
*/ */
Configuration& setSampleCount(Int count) { Configuration& setSampleCount(Int count) {
@ -617,14 +620,16 @@ See @ref Magnum::Platform::GlutApplication "Platform::GlutApplication" for
usage information. This macro abstracts out platform-specific entry point code usage information. This macro abstracts out platform-specific entry point code
and is equivalent to the following, see @ref portability-applications for more and is equivalent to the following, see @ref portability-applications for more
information. information.
@code
@code{.cpp}
int main(int argc, char** argv) { int main(int argc, char** argv) {
className app({argc, argv}); className app({argc, argv});
return app.exec(); return app.exec();
} }
@endcode @endcode
When no other application header is included this macro is also aliased to When no other application header is included this macro is also aliased to
`MAGNUM_APPLICATION_MAIN()`. @cpp MAGNUM_APPLICATION_MAIN() @ce.
*/ */
#define MAGNUM_GLUTAPPLICATION_MAIN(className) \ #define MAGNUM_GLUTAPPLICATION_MAIN(className) \
int main(int argc, char** argv) { \ int main(int argc, char** argv) { \

23
src/Magnum/Platform/GlxApplication.h

@ -44,13 +44,13 @@ This application library is available on desktop OpenGL and
depends on **X11** library and is built if `WITH_GLXAPPLICATION` is enabled in depends on **X11** library and is built if `WITH_GLXAPPLICATION` is enabled in
CMake. CMake.
## Bootstrap application @section Platform-GlxApplication-bootstrap Bootstrap application
The usage is very similar to @ref Sdl2Application, for which fully contained The usage is very similar to @ref Sdl2Application, for which fully contained
base application along with CMake setup is available, see its documentation for base application along with CMake setup is available, see its documentation for
more information. more information.
## General usage @section Platform-GlxApplication-usage General usage
In CMake you need to request `GlxApplication` component of `Magnum` package and In CMake you need to request `GlxApplication` component of `Magnum` package and
link to `Magnum::GlxApplication` target. If no other application is requested, link to `Magnum::GlxApplication` target. If no other application is requested,
@ -58,10 +58,11 @@ you can also use generic `Magnum::Application` alias to simplify porting. See
@ref building and @ref cmake for more information. @ref building and @ref cmake for more information.
In C++ code you need to implement at least @ref drawEvent() to be able to draw In C++ code you need to implement at least @ref drawEvent() to be able to draw
on the screen. The subclass can be then used directly in `main()` -- see on the screen. The subclass can be then used directly in @cpp main() @ce
convenience macro @ref MAGNUM_GLXAPPLICATION_MAIN(). See @ref platform for more --- see convenience macro @ref MAGNUM_GLXAPPLICATION_MAIN(). See @ref platform
information. for more information.
@code
@code{.cpp}
class MyApplication: public Platform::GlxApplication { class MyApplication: public Platform::GlxApplication {
// implement required methods... // implement required methods...
}; };
@ -69,8 +70,8 @@ MAGNUM_GLXAPPLICATION_MAIN(MyApplication)
@endcode @endcode
If no other application header is included, this class is also aliased to If no other application header is included, this class is also aliased to
`Platform::Application` and the macro is aliased to `MAGNUM_APPLICATION_MAIN()` @cpp Platform::Application @ce and the macro is aliased to
to simplify porting. @cpp MAGNUM_APPLICATION_MAIN() @ce to simplify porting.
*/ */
class GlxApplication: public AbstractXApplication { class GlxApplication: public AbstractXApplication {
public: public:
@ -113,14 +114,16 @@ See @ref Magnum::Platform::GlxApplication "Platform::GlxApplication" for usage
information. This macro abstracts out platform-specific entry point code and is information. This macro abstracts out platform-specific entry point code and is
equivalent to the following, see @ref portability-applications for more equivalent to the following, see @ref portability-applications for more
information. information.
@code
@code{.cpp}
int main(int argc, char** argv) { int main(int argc, char** argv) {
className app({argc, argv}); className app({argc, argv});
return app.exec(); return app.exec();
} }
@endcode @endcode
When no other application header is included this macro is also aliased to When no other application header is included this macro is also aliased to
`MAGNUM_APPLICATION_MAIN()`. @cpp MAGNUM_APPLICATION_MAIN() @ce.
*/ */
#define MAGNUM_GLXAPPLICATION_MAIN(className) \ #define MAGNUM_GLXAPPLICATION_MAIN(className) \
int main(int argc, char** argv) { \ int main(int argc, char** argv) { \

4
src/Magnum/Platform/Screen.h

@ -51,9 +51,9 @@ namespace Implementation {
See @ref BasicScreenedApplication for more information. See @ref BasicScreenedApplication for more information.
If exactly one application header is included, this class is also aliased to If exactly one application header is included, this class is also aliased to
`Platform::Screen`. @cpp Platform::Screen @ce.
## Explicit template specializations @section Platform-BasicScreen-template-specializations Explicit template specializations
The following specialization are explicitly compiled into each particular The following specialization are explicitly compiled into each particular
`*Application` library. For other specializations you have to use `*Application` library. For other specializations you have to use

10
src/Magnum/Platform/ScreenedApplication.h

@ -43,7 +43,7 @@ namespace Magnum { namespace Platform {
Manages list of screens and propagates events to them. Manages list of screens and propagates events to them.
If exactly one application header is included, this class is also aliased to If exactly one application header is included, this class is also aliased to
`Platform::ScreenedApplication`. @cpp Platform::ScreenedApplication @ce.
Each @ref BasicScreen "Screen" specifies which set of events should be Each @ref BasicScreen "Screen" specifies which set of events should be
propagated to it using @ref BasicScreen::setPropagatedEvents(). When propagated to it using @ref BasicScreen::setPropagatedEvents(). When
@ -66,7 +66,8 @@ application gets an event, they are propagated to the screens:
Uses @ref Corrade::Containers::LinkedList for efficient screen management. Uses @ref Corrade::Containers::LinkedList for efficient screen management.
Traversing front-to-back through the list of screens can be done using Traversing front-to-back through the list of screens can be done using
range-based for: range-based for:
@code
@code{.cpp}
MyApplication app; MyApplication app;
for(Screen& screen: app.screens()) { for(Screen& screen: app.screens()) {
// ... // ...
@ -76,13 +77,14 @@ for(Screen& screen: app.screens()) {
Or, if you need more flexibility, like in the following code. Traversing Or, if you need more flexibility, like in the following code. Traversing
back-to-front can be done using @ref Corrade::Containers::LinkedList::last() back-to-front can be done using @ref Corrade::Containers::LinkedList::last()
and @ref BasicScreen::nextNearerScreen(). and @ref BasicScreen::nextNearerScreen().
@code
@code{.cpp}
for(Screen* s = app.screens().first(); s; s = s->nextFartherScreen()) { for(Screen* s = app.screens().first(); s; s = s->nextFartherScreen()) {
// ... // ...
} }
@endcode @endcode
## Explicit template specializations @section Platform-ScreenedApplication-template-specializations Explicit template specializations
The following specialization are explicitly compiled into each particular The following specialization are explicitly compiled into each particular
`*Application` library. For other specializations you have to use `*Application` library. For other specializations you have to use

200
src/Magnum/Platform/Sdl2Application.h

@ -65,7 +65,7 @@ respective sections in @ref building-corrade-cross-emscripten "Corrade's" and
on **SDL2** library (Emscripten has it built in) and is built if on **SDL2** library (Emscripten has it built in) and is built if
`WITH_SDL2APPLICATION` is enabled in CMake. `WITH_SDL2APPLICATION` is enabled in CMake.
## Bootstrap application @section Platform-Sdl2Application-bootstrap Bootstrap application
Fully contained base application using @ref Sdl2Application along with Fully contained base application using @ref Sdl2Application along with
CMake setup is available in `base` branch of CMake setup is available in `base` branch of
@ -75,14 +75,16 @@ or [zip](https://github.com/mosra/magnum-bootstrap/archive/base.zip) file.
After extracting the downloaded archive you can build and run the application After extracting the downloaded archive you can build and run the application
with these four commands: with these four commands:
mkdir build && cd build @code{.sh}
cmake .. mkdir build && cd build
cmake --build . cmake ..
./src/MyApplication # or ./src/Debug/MyApplication cmake --build .
./src/MyApplication # or ./src/Debug/MyApplication
@endcode
See @ref cmake for more information. See @ref cmake for more information.
## Bootstrap application for Emscripten @section Platform-Sdl2Application-bootstrap-emscripten Bootstrap application for Emscripten
Fully contained base application using @ref Sdl2Application for both desktop Fully contained base application using @ref Sdl2Application for both desktop
and Emscripten build along with full HTML markup and CMake setup is available and Emscripten build along with full HTML markup and CMake setup is available
@ -104,18 +106,20 @@ Set `CMAKE_PREFIX_PATH` to where you have all the dependencies installed, set
`CMAKE_INSTALL_PREFIX` to have the files installed in proper location (a `CMAKE_INSTALL_PREFIX` to have the files installed in proper location (a
webserver, e.g. `/srv/http/emscripten`). webserver, e.g. `/srv/http/emscripten`).
mkdir build-emscripten && cd build-emscripten @code{.sh}
cmake .. \ mkdir build-emscripten && cd build-emscripten
-DCMAKE_TOOLCHAIN_FILE="../toolchains/generic/Emscripten.cmake" \ cmake .. \
-DCMAKE_PREFIX_PATH=/usr/lib/emscripten/system \ -DCMAKE_TOOLCHAIN_FILE="../toolchains/generic/Emscripten.cmake" \
-DCMAKE_INSTALL_PREFIX=/srv/http/emscripten -DCMAKE_PREFIX_PATH=/usr/lib/emscripten/system \
cmake --build . -DCMAKE_INSTALL_PREFIX=/srv/http/emscripten
cmake --build . --target install cmake --build .
cmake --build . --target install
@endcode
You can then open `MyApplication.html` in your browser (through webserver, e.g. You can then open `MyApplication.html` in your browser (through webserver, e.g.
`http://localhost/emscripten/MyApplication.html`). http://localhost/emscripten/MyApplication.html).
## Bootstrap application for iOS @section Platform-Sdl2Application-bootstrap-ios Bootstrap application for iOS
Fully contained base application using @ref Sdl2Application for both desktop Fully contained base application using @ref Sdl2Application for both desktop
and iOS build along with pre-filled `*.plist` is available in `base-ios` branch and iOS build along with pre-filled `*.plist` is available in `base-ios` branch
@ -132,18 +136,20 @@ Then create build directory and run `cmake` to generate the Xcode project. Set
in `CMAKE_OSX_ARCHITECTURES`. Set `CMAKE_PREFIX_PATH` to the directory where in `CMAKE_OSX_ARCHITECTURES`. Set `CMAKE_PREFIX_PATH` to the directory where
you have all the dependencies. you have all the dependencies.
mkdir build-ios && cd build-ios @code{.sh}
cmake .. \ mkdir build-ios && cd build-ios
-DCMAKE_TOOLCHAIN_FILE=../toolchains/generic/iOS.cmake \ cmake .. \
-DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk \ -DCMAKE_TOOLCHAIN_FILE=../toolchains/generic/iOS.cmake \
-DCMAKE_OSX_ARCHITECTURES="arm64;armv7;armv7s" \ -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk \
-DCMAKE_PREFIX_PATH=~/ios-libs \ -DCMAKE_OSX_ARCHITECTURES="arm64;armv7;armv7s" \
-G Xcode -DCMAKE_PREFIX_PATH=~/ios-libs \
-G Xcode
@endcode
You can then open the generated project file in Xcode and build/deploy it from You can then open the generated project file in Xcode and build/deploy it from
there. there.
## Bootstrap application for Windows RT @section Platform-Sdl2Application-bootstrap-winrt Bootstrap application for Windows RT
Fully contained base application using @ref Sdl2Application for both desktop Fully contained base application using @ref Sdl2Application for both desktop
and Windows Phone / Windows Store build along with all required plumbing is and Windows Phone / Windows Store build along with all required plumbing is
@ -159,14 +165,23 @@ built statically. Assuming the native Corrade installation is in `C:/Sys` and
all WinRT dependencies are in `C:/Sys-winrt`, the build can be done similarly all WinRT dependencies are in `C:/Sys-winrt`, the build can be done similarly
to the following: to the following:
mkdir build-winrt && cd build-winrt @code{.bat}
cmake -DCORRADE_RC_EXECUTABLE="C:/Sys/bin/corrade-rc.exe" -DCMAKE_PREFIX_PATH="C:/Sys-winrt" -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=8.1 -G "Visual Studio 14 2015" -DSIGNING_CERTIFICATE=<path-to-your-pfx-file> .. mkdir build-winrt && cd build-winrt
cmake --build . cmake .. ^
-DCORRADE_RC_EXECUTABLE="C:/Sys/bin/corrade-rc.exe" ^
-DCMAKE_PREFIX_PATH="C:/Sys-winrt" ^
-DCMAKE_SYSTEM_NAME=WindowsStore ^
-DCMAKE_SYSTEM_VERSION=8.1 ^
-G "Visual Studio 14 2015" ^
-DSIGNING_CERTIFICATE=<path-to-your-pfx-file>
cmake --build .
@endcode
Change `WindowsStore` to `WindowsPhone` if you want to build for Windows Phone instead. The `build-winrt/src/AppPackages` directory will then contain the Change `WindowsStore` to `WindowsPhone` if you want to build for Windows Phone
instead. The `build-winrt/src/AppPackages` directory will then contain the
final package along with a PowerShell script for easy local installation. final package along with a PowerShell script for easy local installation.
## General usage @section Platform-Sdl2Application-usage General usage
For CMake you need to copy `FindSDL2.cmake` from `modules/` directory in For CMake you need to copy `FindSDL2.cmake` from `modules/` directory in
Magnum source to `modules/` dir in your project (so it is able to find SDL2). Magnum source to `modules/` dir in your project (so it is able to find SDL2).
@ -176,11 +191,12 @@ In case of Emscripten you need also `FindOpenGLES2.cmake`. Request
also use generic `Magnum::Application` alias to simplify porting. Again, see also use generic `Magnum::Application` alias to simplify porting. Again, see
@ref building and @ref cmake for more information. @ref building and @ref cmake for more information.
In C++ code you need to implement at least @ref drawEvent() to be able to draw on the In C++ code you need to implement at least @ref drawEvent() to be able to draw
screen. The subclass can be then used directly in `main()` -- see convenience on the screen. The subclass can be then used directly in `main()` --- see
macro @ref MAGNUM_SDL2APPLICATION_MAIN(). See @ref platform for more convenience macro @ref MAGNUM_SDL2APPLICATION_MAIN(). See @ref platform for
information. more information.
@code
@code{.cpp}
class MyApplication: public Platform::Sdl2Application { class MyApplication: public Platform::Sdl2Application {
// implement required methods... // implement required methods...
}; };
@ -188,19 +204,20 @@ MAGNUM_SDL2APPLICATION_MAIN(MyApplication)
@endcode @endcode
If no other application header is included, this class is also aliased to If no other application header is included, this class is also aliased to
`Platform::Application` and the macro is aliased to `MAGNUM_APPLICATION_MAIN()` @cpp Platform::Application @ce and the macro is aliased to @cpp MAGNUM_APPLICATION_MAIN() @ce
to simplify porting. to simplify porting.
## Usage with Emscripten @section Platform-Sdl2Application-usage-emscripten Usage with Emscripten
If you are targetting Emscripten, you need to provide HTML markup for your If you are targetting Emscripten, you need to provide HTML markup for your
application. Template one is below or in the bootstrap application, you can application. Template one is below or in the bootstrap application, you can
modify it to your liking. The markup references two files, modify it to your liking. The markup references two files,
`EmscriptenApplication.js` and `WebApplication.css`, both are in `Platform/` `EmscriptenApplication.js` and `WebApplication.css`, both are in `Platform/`
directory in the source tree and are also installed into `share/magnum/` inside directory in the source tree and are also installed into `share/magnum/` inside
your Emscripten toolchain. Change `&lt;application&gt;` to name of your your Emscripten toolchain. Change `{{application}}` to name of your
executable. executable.
@code
@code{.html}
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
@ -215,25 +232,26 @@ executable.
<div id="status">Initialization...</div> <div id="status">Initialization...</div>
<div id="statusDescription"></div> <div id="statusDescription"></div>
<script src="EmscriptenApplication.js"></script> <script src="EmscriptenApplication.js"></script>
<script async="async" src="<application>.js"></script> <script async="async" src="{{application}}.js"></script>
</div> </div>
</body> </body>
</html> </html>
@endcode @endcode
You can modify all the files to your liking, but the HTML file must contain at You can modify all the files to your liking, but the HTML file must contain at
least the `&lt;canvas&gt;` enclosed in listener `&lt;div&gt;`. The JavaScript least the @cb{.html} <canvas> @ce enclosed in listener @cb{.html} <div> @ce.
file contains event listeners which print loading status on the page. The The JavaScript file contains event listeners which print loading status on the
status displayed in the remaining two `&lt;div&gt;`s, if they are available. page. The status displayed in the remaining two @cb{.html} <div> @ce s, if they
The CSS file contains rudimentary style to avoid eye bleeding. are available. The CSS file contains rudimentary style to avoid eye bleeding.
The application redirects all output (thus also @ref Corrade::Utility::Debug "Debug", The application redirects all output (thus also @ref Corrade::Utility::Debug "Debug",
@ref Corrade::Utility::Warning "Warning" and @ref Corrade::Utility::Error "Error") @ref Corrade::Utility::Warning "Warning" and @ref Corrade::Utility::Error "Error")
to JavaScript console. It's possible to pass command-line arguments to `main()` to JavaScript console. It's possible to pass command-line arguments to
using GET URL parameters. For example, `/app/?foo=bar&fizz&buzz=3` will go to @cpp main() @ce using GET URL parameters. For example,
the app as `['--foo', 'bar', '--fizz', '--buzz', '3']`. `/app/?foo=bar&fizz&buzz=3` will go to the app as
@cb{.py} ['--foo', 'bar', '--fizz', '--buzz', '3'] @ce.
## Usage with iOS @section Platform-Sdl2Application-usage-ios Usage with iOS
A lot of options for iOS build (such as HiDPI/Retina support, supported display A lot of options for iOS build (such as HiDPI/Retina support, supported display
orientation, icons, splash screen...) is specified through the `*.plist` file. orientation, icons, splash screen...) is specified through the `*.plist` file.
@ -243,30 +261,31 @@ rolling your own template and passing **abosolute** path to it to CMake using
the `MACOSX_BUNDLE_INFO_PLIST` property. Below are contents of the `*.plist` the `MACOSX_BUNDLE_INFO_PLIST` property. Below are contents of the `*.plist`
file used in the bootstrap application, requesting OpenGL ES 2.0 and file used in the bootstrap application, requesting OpenGL ES 2.0 and
advertising Retina support: advertising Retina support:
@code
@code{.xml}
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
<string>en-US</string> <string>en-US</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string> <string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
<string>cz.mosra.magnum.MyApplication</string> <string>cz.mosra.magnum.MyApplication</string>
<key>CFBundleInfoDictionaryVersion</key> <key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string> <string>6.0</string>
<key>CFBundleName</key> <key>CFBundleName</key>
<string>My Application</string> <string>My Application</string>
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>UIRequiredDeviceCapabilities</key> <key>UIRequiredDeviceCapabilities</key>
<array> <array>
<string>opengles-2</string> <string>opengles-2</string>
</array> </array>
<key>NSHighResolutionCapable</key> <key>NSHighResolutionCapable</key>
<true/> <true/>
</dict> </dict>
</plist> </plist>
@endcode @endcode
@ -280,13 +299,14 @@ application window, see documentation of particular value for details:
- @ref Configuration::WindowFlag::Resizable makes the application respond to - @ref Configuration::WindowFlag::Resizable makes the application respond to
device orientation changes device orientation changes
## Usage with Windows RT @section Platform-Sdl2Application-usage-winrt Usage with Windows RT
For Windows RT you need to provide logo images and splash screen, all For Windows RT you need to provide logo images and splash screen, all
referenced from the `*.appxmanifest` file. The file is slightly different for referenced from the `*.appxmanifest` file. The file is slightly different for
different targets, template for Windows Store and MSVC 2013 is below, others different targets, template for Windows Store and MSVC 2013 is below, others
are in the bootstrap application. are in the bootstrap application.
@code
@code{.xml}
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest"> <Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest">
<Identity Name="MyApplication" Publisher="CN=A Publisher" Version="1.1.0.0" /> <Identity Name="MyApplication" Publisher="CN=A Publisher" Version="1.1.0.0" />
@ -390,7 +410,7 @@ class Sdl2Application {
/** /**
* @brief Execute main loop * @brief Execute main loop
* @return Value for returning from `main()` * @return Value for returning from @cpp main() @ce
* *
* Calls @ref mainLoopIteration() in a loop until @ref exit() is * Calls @ref mainLoopIteration() in a loop until @ref exit() is
* called. See @ref MAGNUM_SDL2APPLICATION_MAIN() for usage * called. See @ref MAGNUM_SDL2APPLICATION_MAIN() for usage
@ -454,8 +474,8 @@ class Sdl2Application {
/** /**
* @brief Try to create context with given configuration * @brief Try to create context with given configuration
* *
* Unlike @ref createContext() returns `false` if the context cannot be * Unlike @ref createContext() returns @cpp false @ce if the context
* created, `true` otherwise. * cannot be created, @cpp true @ce otherwise.
*/ */
bool tryCreateContext(const Configuration& configuration); bool tryCreateContext(const Configuration& configuration);
@ -484,10 +504,11 @@ class Sdl2Application {
/** /**
* @brief Set swap interval * @brief Set swap interval
* *
* Set `0` for no VSync, `1` for enabled VSync. Some platforms support * Set @cpp 0 @ce for no VSync, @cpp 1 @ce for enabled VSync. Some
* `-1` for late swap tearing. Prints error message and returns `false` * platforms support @cpp -1 @ce for late swap tearing. Prints error
* if swap interval cannot be set, `true` otherwise. Default is * message and returns @cpp false @ce if swap interval cannot be set,
* driver-dependent, you can query the value with @ref swapInterval(). * @cpp true @ce otherwise. Default is driver-dependent, you can query
* the value with @ref swapInterval().
* @see @ref setMinimalLoopPeriod() * @see @ref setMinimalLoopPeriod()
*/ */
bool setSwapInterval(Int interval); bool setSwapInterval(Int interval);
@ -497,8 +518,8 @@ class Sdl2Application {
* @brief Set minimal loop period * @brief Set minimal loop period
* *
* This setting reduces the main loop frequency in case VSync is * This setting reduces the main loop frequency in case VSync is
* not/cannot be enabled or no drawing is done. Default is `0` (i.e. * not/cannot be enabled or no drawing is done. Default is @cpp 0 @ce
* looping at maximum frequency). * (i.e. looping at maximum frequency).
* @note Not available in @ref CORRADE_TARGET_EMSCRIPTEN "Emscripten", * @note Not available in @ref CORRADE_TARGET_EMSCRIPTEN "Emscripten",
* the browser is managing the frequency instead. * the browser is managing the frequency instead.
* @see @ref setSwapInterval() * @see @ref setSwapInterval()
@ -844,7 +865,7 @@ class Sdl2Application::Configuration {
* @brief Set window title * @brief Set window title
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Default is `"Magnum SDL2 Application"`. * Default is @cpp "Magnum SDL2 Application" @ce.
* @note In @ref CORRADE_TARGET_EMSCRIPTEN "Emscripten" and * @note In @ref CORRADE_TARGET_EMSCRIPTEN "Emscripten" and
* @ref CORRADE_TARGET_IOS "iOS" this function does nothing and is * @ref CORRADE_TARGET_IOS "iOS" this function does nothing and is
* included only for compatibility. You need to set the title * included only for compatibility. You need to set the title
@ -866,10 +887,11 @@ class Sdl2Application::Configuration {
* @brief Set window size * @brief Set window size
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Default is `{800, 600}`. On iOS it defaults to a "reasonable" size * Default is @cpp {800, 600} @ce and @cpp {640, 480} @ce on
* based on whether HiDPI support is enabled using * Emscripten. On iOS it defaults to a "reasonable" size based on
* @ref WindowFlag::AllowHighDpi, but not necessarily native display * whether HiDPI support is enabled using @ref WindowFlag::AllowHighDpi,
* resolution (you have to set it explicitly). * but not necessarily native display resolution (you have to set it
* explicitly).
*/ */
Configuration& setSize(const Vector2i& size) { Configuration& setSize(const Vector2i& size) {
_size = size; _size = size;
@ -945,7 +967,7 @@ class Sdl2Application::Configuration {
* @brief Set sample count * @brief Set sample count
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Default is `0`, thus no multisampling. See also * Default is @cpp 0 @ce, thus no multisampling. See also
* @ref Renderer::Feature::Multisampling. * @ref Renderer::Feature::Multisampling.
*/ */
Configuration& setSampleCount(Int count) { Configuration& setSampleCount(Int count) {
@ -965,7 +987,7 @@ class Sdl2Application::Configuration {
* @brief Set sRGB-capable default framebuffer * @brief Set sRGB-capable default framebuffer
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Default is `false`. See also @ref Renderer::Feature::FramebufferSRGB. * Default is @cpp false @ce. See also @ref Renderer::Feature::FramebufferSRGB.
* @note Not available in @ref CORRADE_TARGET_EMSCRIPTEN "Emscripten". * @note Not available in @ref CORRADE_TARGET_EMSCRIPTEN "Emscripten".
*/ */
Configuration& setSRGBCapable(bool enabled) { Configuration& setSRGBCapable(bool enabled) {
@ -1279,8 +1301,8 @@ class Sdl2Application::KeyEvent: public Sdl2Application::InputEvent {
/** /**
* @brief Whether the key press is repeated * @brief Whether the key press is repeated
* *
* Returns `true` if the key press event is repeated, `false` if not or * Returns @cpp true @ce if the key press event is repeated,
* if this was key release event. * @cpp false @ce if not or if this was key release event.
*/ */
constexpr bool isRepeated() const { return _repeated; } constexpr bool isRepeated() const { return _repeated; }
@ -1637,14 +1659,16 @@ usage information. This macro abstracts out platform-specific entry point code
and is equivalent to the following on all supported platforms except and is equivalent to the following on all supported platforms except
@ref CORRADE_TARGET_WINDOWS_RT "Windows RT", see @ref portability-applications @ref CORRADE_TARGET_WINDOWS_RT "Windows RT", see @ref portability-applications
for more information. for more information.
@code
@code{.cpp}
int main(int argc, char** argv) { int main(int argc, char** argv) {
className app({argc, argv}); className app({argc, argv});
return app.exec(); return app.exec();
} }
@endcode @endcode
When no other application header is included this macro is also aliased to When no other application header is included this macro is also aliased to
`MAGNUM_APPLICATION_MAIN()`. @cpp MAGNUM_APPLICATION_MAIN() @ce.
*/ */
#ifndef CORRADE_TARGET_WINDOWS_RT #ifndef CORRADE_TARGET_WINDOWS_RT
#define MAGNUM_SDL2APPLICATION_MAIN(className) \ #define MAGNUM_SDL2APPLICATION_MAIN(className) \

53
src/Magnum/Platform/WindowlessCglApplication.h

@ -54,7 +54,7 @@ CMake.
Meant to be used when there is a need to manage (multiple) GL contexts Meant to be used when there is a need to manage (multiple) GL contexts
manually. See @ref platform-windowless-contexts for more information. If no manually. See @ref platform-windowless-contexts for more information. If no
other application header is included, this class is also aliased to other application header is included, this class is also aliased to
`Platform::WindowlessGLContext`. @cpp Platform::WindowlessGLContext @ce.
*/ */
class WindowlessCglContext { class WindowlessCglContext {
public: public:
@ -109,8 +109,8 @@ class WindowlessCglContext {
/** /**
* @brief Make the context current * @brief Make the context current
* *
* Prints error message and returns `false` on failure, otherwise * Prints error message and returns @cpp false @ce on failure,
* returns `true`. * otherwise returns @cpp true @ce.
*/ */
bool makeCurrent(); bool makeCurrent();
@ -139,7 +139,7 @@ Application for offscreen rendering using @ref WindowlessCglContext. This
application library is available on desktop OpenGL on macOS. It is built if application library is available on desktop OpenGL on macOS. It is built if
`WITH_WINDOWLESSCGLAPPLICATION` is enabled in CMake. `WITH_WINDOWLESSCGLAPPLICATION` is enabled in CMake.
## Bootstrap application @section Platform-WindowlessCglApplication-bootstrap Bootstrap application
Fully contained windowless application using @ref WindowlessCglApplication Fully contained windowless application using @ref WindowlessCglApplication
along with CMake setup is available in `base-windowless` branch of along with CMake setup is available in `base-windowless` branch of
@ -149,27 +149,28 @@ or [zip](https://github.com/mosra/magnum-bootstrap/archive/base-windowless.zip)
file. After extracting the downloaded archive you can build and run the file. After extracting the downloaded archive you can build and run the
application with these four commands: application with these four commands:
mkdir build && cd build @code{.sh}
cmake .. mkdir build && cd build
cmake --build . cmake ..
./src/MyApplication # or ./src/Debug/MyApplication cmake --build .
./src/MyApplication # or ./src/Debug/MyApplication
@endcode
See @ref cmake for more information. See @ref cmake for more information.
## General usage @section Platform-WindowlessCglApplication-usage General usage
In CMake you need to request `WindowlessCglApplication` component, add In CMake you need to request `WindowlessCglApplication` component of `Magnum`
`${MAGNUM_WINDOWLESSCGLAPPLICATION_INCLUDE_DIRS}` to include path and link to package and link to `Magnum::WindowlessCglApplication` target. If no other
`${MAGNUM_WINDOWLESSCGLAPPLICATION_LIBRARIES}`. If no other windowless application is requested, you can also use generic `Magnum::Application` alias
application is requested, you can also use generic to simplify porting. Again, see @ref building and @ref cmake for more
`${MAGNUM_WINDOWLESSAPPLICATION_INCLUDE_DIRS}` and information.
`${MAGNUM_WINDOWLESSAPPLICATION_LIBRARIES}` aliases to simplify porting. Again,
see @ref building and @ref cmake for more information.
Place your code into @ref exec(). The subclass can be then used directly in Place your code into @ref exec(). The subclass can be then used directly in
`main()` -- see convenience macro @ref MAGNUM_WINDOWLESSCGLAPPLICATION_MAIN(). `main()` --- see convenience macro @ref MAGNUM_WINDOWLESSCGLAPPLICATION_MAIN().
See @ref platform for more information. See @ref platform for more information.
@code
@code{.sh}
class MyApplication: public Platform::WindowlessCglApplication { class MyApplication: public Platform::WindowlessCglApplication {
// implement required methods... // implement required methods...
}; };
@ -177,8 +178,8 @@ MAGNUM_WINDOWLESSCGLAPPLICATION_MAIN(MyApplication)
@endcode @endcode
If no other application header is included, this class is also aliased to If no other application header is included, this class is also aliased to
`Platform::WindowlessApplication` and the macro is aliased to @cpp Platform::WindowlessApplication @ce and the macro is aliased to
`MAGNUM_WINDOWLESSAPPLICATION_MAIN()` to simplify porting. @cpp MAGNUM_WINDOWLESSAPPLICATION_MAIN() @ce to simplify porting.
*/ */
class WindowlessCglApplication { class WindowlessCglApplication {
public: public:
@ -249,7 +250,7 @@ class WindowlessCglApplication {
/** /**
* @brief Execute application * @brief Execute application
* @return Value for returning from `main()` * @return Value for returning from @cpp main() @ce
* *
* See @ref MAGNUM_WINDOWLESSCGLAPPLICATION_MAIN() for usage * See @ref MAGNUM_WINDOWLESSCGLAPPLICATION_MAIN() for usage
* information. * information.
@ -281,8 +282,8 @@ class WindowlessCglApplication {
/** /**
* @brief Try to create context with given configuration * @brief Try to create context with given configuration
* *
* Unlike @ref createContext() returns `false` if the context cannot be * Unlike @ref createContext() returns @cpp false @ce if the context
* created, `true` otherwise. * cannot be created, @cpp true @ce otherwise.
*/ */
bool tryCreateContext(const Configuration& configuration); bool tryCreateContext(const Configuration& configuration);
@ -299,14 +300,16 @@ See @ref Magnum::Platform::WindowlessCglApplication "Platform::WindowlessCglAppl
for usage information. This macro abstracts out platform-specific entry point for usage information. This macro abstracts out platform-specific entry point
code and is equivalent to the following, see @ref portability-applications for code and is equivalent to the following, see @ref portability-applications for
more information. more information.
@code
@code{.cpp}
int main(int argc, char** argv) { int main(int argc, char** argv) {
className app({argc, argv}); className app({argc, argv});
return app.exec(); return app.exec();
} }
@endcode @endcode
When no other windowless application header is included this macro is also When no other windowless application header is included this macro is also
aliased to `MAGNUM_WINDOWLESSAPPLICATION_MAIN()`. aliased to @cpp MAGNUM_WINDOWLESSAPPLICATION_MAIN() @ce.
*/ */
#define MAGNUM_WINDOWLESSCGLAPPLICATION_MAIN(className) \ #define MAGNUM_WINDOWLESSCGLAPPLICATION_MAIN(className) \
int main(int argc, char** argv) { \ int main(int argc, char** argv) { \

83
src/Magnum/Platform/WindowlessEglApplication.h

@ -56,7 +56,7 @@ built if `WITH_WINDOWLESSEGLAPPLICATION` is enabled in CMake.
Meant to be used when there is a need to manage (multiple) GL contexts Meant to be used when there is a need to manage (multiple) GL contexts
manually. See @ref platform-windowless-contexts for more information. If no manually. See @ref platform-windowless-contexts for more information. If no
other application header is included, this class is also aliased to other application header is included, this class is also aliased to
`Platform::WindowlessGLContext`. @cpp Platform::WindowlessGLContext @ce.
*/ */
class WindowlessEglContext { class WindowlessEglContext {
public: public:
@ -106,8 +106,8 @@ class WindowlessEglContext {
/** /**
* @brief Make the context current * @brief Make the context current
* *
* Prints error message and returns `false` on failure, otherwise * Prints error message and returns @cpp false @ce on failure,
* returns `true`. * otherwise returns @cpp true @ce.
*/ */
bool makeCurrent(); bool makeCurrent();
@ -188,7 +188,7 @@ works (Linux desktop or ES, iOS and also @ref CORRADE_TARGET_EMSCRIPTEN "Emscrip
See other `Windowless*Application` classes for an alternative. It is built if See other `Windowless*Application` classes for an alternative. It is built if
`WITH_WINDOWLESSEGLAPPLICATION` is enabled in CMake. `WITH_WINDOWLESSEGLAPPLICATION` is enabled in CMake.
## Bootstrap application @section Platform-WindowlessEglApplication-bootstrap Bootstrap application
Fully contained windowless application using @ref WindowlessEglApplication Fully contained windowless application using @ref WindowlessEglApplication
along with CMake setup is available in `windowless` branch of along with CMake setup is available in `windowless` branch of
@ -198,14 +198,16 @@ or [zip](https://github.com/mosra/magnum-bootstrap/archive/windowless.zip)
file. After extracting the downloaded archive you can build and run the file. After extracting the downloaded archive you can build and run the
application with these four commands: application with these four commands:
mkdir build && cd build @code{.sh}
cmake .. mkdir build && cd build
cmake --build . cmake ..
./src/MyApplication # or ./src/Debug/MyApplication cmake --build .
./src/MyApplication # or ./src/Debug/MyApplication
@endcode
See @ref cmake for more information. See @ref cmake for more information.
## Bootstrap application for Emscripten @section Platform-WindowlessEglApplication-bootstrap-emscripten Bootstrap application for Emscripten
Fully contained windowless application together with Emscripten support along Fully contained windowless application together with Emscripten support along
with full HTML markup and CMake setup is available in `windowless-emscripten` with full HTML markup and CMake setup is available in `windowless-emscripten`
@ -227,18 +229,20 @@ Set `CMAKE_PREFIX_PATH` to where you have all the dependencies installed, set
`CMAKE_INSTALL_PREFIX` to have the files installed in proper location (a `CMAKE_INSTALL_PREFIX` to have the files installed in proper location (a
webserver, e.g. `/srv/http/emscripten`). webserver, e.g. `/srv/http/emscripten`).
mkdir build-emscripten && cd build-emscripten @code{.sh}
cmake .. \ mkdir build-emscripten && cd build-emscripten
-DCMAKE_TOOLCHAIN_FILE="../toolchains/generic/Emscripten.cmake" \ cmake .. \
-DCMAKE_PREFIX_PATH=/usr/lib/emscripten/system \ -DCMAKE_TOOLCHAIN_FILE="../toolchains/generic/Emscripten.cmake" \
-DCMAKE_INSTALL_PREFIX=/srv/http/emscripten -DCMAKE_PREFIX_PATH=/usr/lib/emscripten/system \
cmake --build . -DCMAKE_INSTALL_PREFIX=/srv/http/emscripten
cmake --build . --target install cmake --build .
cmake --build . --target install
@endcode
You can then open `MyApplication.html` in your browser (through webserver, e.g. You can then open `MyApplication.html` in your browser (through webserver, e.g.
`http://localhost/emscripten/MyApplication.html`). http://localhost/emscripten/MyApplication.html).
## General usage @section Platform-WindowlessEglApplication-usage General usage
In CMake you need to request `WindowlessEglApplication` component and link to In CMake you need to request `WindowlessEglApplication` component and link to
`Magnum::WindowlessEglApplication` target. If no other windowless application `Magnum::WindowlessEglApplication` target. If no other windowless application
@ -248,7 +252,8 @@ simplify porting. Again, see @ref building and @ref cmake for more information.
Place your code into @ref exec(). The subclass can be then used in main Place your code into @ref exec(). The subclass can be then used in main
function using @ref MAGNUM_WINDOWLESSEGLAPPLICATION_MAIN() macro. See function using @ref MAGNUM_WINDOWLESSEGLAPPLICATION_MAIN() macro. See
@ref platform for more information. @ref platform for more information.
@code
@code{.cpp}
class MyApplication: public Platform::WindowlessEglApplication { class MyApplication: public Platform::WindowlessEglApplication {
// implement required methods... // implement required methods...
}; };
@ -256,19 +261,20 @@ MAGNUM_WINDOWLESSEGLAPPLICATION_MAIN(MyApplication)
@endcode @endcode
If no other application header is included, this class is also aliased to If no other application header is included, this class is also aliased to
`Platform::WindowlessApplication` and the macro is aliased to @cpp Platform::WindowlessApplication @ce and the macro is aliased to
`MAGNUM_WINDOWLESSAPPLICATION_MAIN()` to simplify porting. @cpp MAGNUM_WINDOWLESSAPPLICATION_MAIN() @ce to simplify porting.
## Usage with Emscripten @section Platform-WindowlessEglApplication-usage-emscripten Usage with Emscripten
If you are targetting Emscripten, you need to provide HTML markup for your If you are targetting Emscripten, you need to provide HTML markup for your
application. Template one is below or in the bootstrap application, you can application. Template one is below or in the bootstrap application, you can
modify it to your liking. The markup references two files, modify it to your liking. The markup references two files,
`WindowlessEmscriptenApplication.js` and `WebApplication.css`, both are in `WindowlessEmscriptenApplication.js` and `WebApplication.css`, both are in
`Platform/` directory in the source tree and are also installed into `Platform/` directory in the source tree and are also installed into
`share/magnum/` inside your Emscripten toolchain. Change `&lt;application&gt;` `share/magnum/` inside your Emscripten toolchain. Change `{{application}}`
to name of your executable. to name of your executable.
@code
@code{.html}
<!DOCTYPE html> <!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
@ -284,23 +290,24 @@ to name of your executable.
<div id="status">Initialization...</div> <div id="status">Initialization...</div>
<div id="statusDescription"></div> <div id="statusDescription"></div>
<script src="WindowlessEmscriptenApplication.js"></script> <script src="WindowlessEmscriptenApplication.js"></script>
<script async="async" src="<application>.js"></script> <script async="async" src="{{application}}.js"></script>
</div> </div>
</body> </body>
</html> </html>
@endcode @endcode
You can modify all the files to your liking, but the HTML file must contain at You can modify all the files to your liking, but the HTML file must contain at
least the `&lt;canvas&gt;` enclosed in listener `&lt;div&gt;`. The JavaScript least the @cb{.html} <canvas> @ce enclosed in listener @cb{.html} <div> @ce.
file contains event listeners which print loading status on the page. The The JavaScript file contains event listeners which print loading status on the
status displayed in the remaining two `&lt;div&gt;`s, if they are available. page. The status displayed in the remaining two @cb{.html} <div> @ce s, if they
The CSS file contains rudimentary style to avoid eye bleeding. are available. The CSS file contains rudimentary style to avoid eye bleeding.
The application prints all output (thus also @ref Corrade::Utility::Debug "Debug", The application prints all output (thus also @ref Corrade::Utility::Debug "Debug",
@ref Corrade::Utility::Warning "Warning" and @ref Corrade::Utility::Error "Error") @ref Corrade::Utility::Warning "Warning" and @ref Corrade::Utility::Error "Error")
to the `&lt;pre&gt;` on the page. It's possible to pass command-line arguments to the @cb{.html} <pre> @ce on the page. It's possible to pass command-line
to `main()` using GET URL parameters. For example, `/app/?foo=bar&fizz&buzz=3` arguments to @cpp main() @ce using GET URL parameters. For example,
will go to the app as `['--foo', 'bar', '--fizz', '--buzz', '3']`. `/app/?foo=bar&fizz&buzz=3` will go to the app as
@cb{.py} ['--foo', 'bar', '--fizz', '--buzz', '3'] @ce.
*/ */
class WindowlessEglApplication { class WindowlessEglApplication {
public: public:
@ -371,7 +378,7 @@ class WindowlessEglApplication {
/** /**
* @brief Execute application * @brief Execute application
* @return Value for returning from `main()` * @return Value for returning from @cpp main() @ce
* *
* See @ref MAGNUM_WINDOWLESSEGLAPPLICATION_MAIN() for usage * See @ref MAGNUM_WINDOWLESSEGLAPPLICATION_MAIN() for usage
* information. * information.
@ -403,8 +410,8 @@ class WindowlessEglApplication {
/** /**
* @brief Try to create context with given configuration * @brief Try to create context with given configuration
* *
* Unlike @ref createContext() returns `false` if the context cannot be * Unlike @ref createContext() returns @cpp false @ce if the context
* created, `true` otherwise. * cannot be created, @cpp true @ce otherwise.
*/ */
bool tryCreateContext(const Configuration& configuration); bool tryCreateContext(const Configuration& configuration);
@ -421,14 +428,16 @@ See @ref Magnum::Platform::WindowlessEglApplication "Platform::WindowlessEglAppl
for usage information. This macro abstracts out platform-specific entry point for usage information. This macro abstracts out platform-specific entry point
code and is equivalent to the following, see @ref portability-applications for code and is equivalent to the following, see @ref portability-applications for
more information. more information.
@code
@code{.cpp}
int main(int argc, char** argv) { int main(int argc, char** argv) {
className app({argc, argv}); className app({argc, argv});
return app.exec(); return app.exec();
} }
@endcode @endcode
When no other windowless application header is included this macro is also When no other windowless application header is included this macro is also
aliased to `MAGNUM_WINDOWLESSAPPLICATION_MAIN()`. aliased to @cpp MAGNUM_WINDOWLESSAPPLICATION_MAIN() @ce.
*/ */
#define MAGNUM_WINDOWLESSEGLAPPLICATION_MAIN(className) \ #define MAGNUM_WINDOWLESSEGLAPPLICATION_MAIN(className) \
int main(int argc, char** argv) { \ int main(int argc, char** argv) { \

37
src/Magnum/Platform/WindowlessGlxApplication.h

@ -58,7 +58,7 @@ is enabled in CMake.
Meant to be used when there is a need to manage (multiple) GL contexts Meant to be used when there is a need to manage (multiple) GL contexts
manually. See @ref platform-windowless-contexts for more information. If no manually. See @ref platform-windowless-contexts for more information. If no
other application header is included, this class is also aliased to other application header is included, this class is also aliased to
`Platform::WindowlessGLContext`. @cpp Platform::WindowlessGLContext @ce.
*/ */
class WindowlessGlxContext { class WindowlessGlxContext {
public: public:
@ -118,8 +118,8 @@ class WindowlessGlxContext {
/** /**
* @brief Make the context current * @brief Make the context current
* *
* Prints error message and returns `false` on failure, otherwise * Prints error message and returns @cpp false @ce on failure,
* returns `true`. * otherwise returns @cpp true @ce.
*/ */
bool makeCurrent(); bool makeCurrent();
@ -188,7 +188,7 @@ application library is available on desktop OpenGL and
depends on **X11** library and is built if `WITH_WINDOWLESSGLXAPPLICATION` is depends on **X11** library and is built if `WITH_WINDOWLESSGLXAPPLICATION` is
enabled in CMake. enabled in CMake.
## Bootstrap application @section Platform-WindowlessGlxApplication-bootstrap Bootstrap application
Fully contained windowless application using @ref WindowlessGlxApplication Fully contained windowless application using @ref WindowlessGlxApplication
along with CMake setup is available in `base-windowless` branch of along with CMake setup is available in `base-windowless` branch of
@ -198,14 +198,16 @@ or [zip](https://github.com/mosra/magnum-bootstrap/archive/base-windowless.zip)
file. After extracting the downloaded archive you can build and run the file. After extracting the downloaded archive you can build and run the
application with these four commands: application with these four commands:
mkdir build && cd build @code{.sh}
cmake .. mkdir build && cd build
cmake --build . cmake ..
./src/MyApplication # or ./src/Debug/MyApplication cmake --build .
./src/MyApplication # or ./src/Debug/MyApplication
@endcode
See @ref cmake for more information. See @ref cmake for more information.
## General usage @section Platform-WindowlessGlxApplication-usage General usage
In CMake you need to request `WindowlessGlxApplication` component of `Magnum` In CMake you need to request `WindowlessGlxApplication` component of `Magnum`
package and link to `Magnum::WindowlessGlxApplication` target. If no other package and link to `Magnum::WindowlessGlxApplication` target. If no other
@ -214,9 +216,10 @@ windowless application is requested, you can also use generic
@ref building and @ref cmake for more information. @ref building and @ref cmake for more information.
Place your code into @ref exec(). The subclass can be then used directly in Place your code into @ref exec(). The subclass can be then used directly in
`main()` -- see convenience macro @ref MAGNUM_WINDOWLESSGLXAPPLICATION_MAIN(). @cpp main() @ce --- see convenience macro @ref MAGNUM_WINDOWLESSGLXAPPLICATION_MAIN().
See @ref platform for more information. See @ref platform for more information.
@code
@code{.cpp}
class MyApplication: public Platform::WindowlessGlxApplication { class MyApplication: public Platform::WindowlessGlxApplication {
// implement required methods... // implement required methods...
}; };
@ -224,8 +227,8 @@ MAGNUM_WINDOWLESSGLXAPPLICATION_MAIN(MyApplication)
@endcode @endcode
If no other application header is included, this class is also aliased to If no other application header is included, this class is also aliased to
`Platform::WindowlessApplication` and the macro is aliased to @cpp Platform::WindowlessApplication @ce and the macro is aliased to
`MAGNUM_WINDOWLESSAPPLICATION_MAIN()` to simplify porting. @cpp MAGNUM_WINDOWLESSAPPLICATION_MAIN() @ce to simplify porting.
*/ */
class WindowlessGlxApplication { class WindowlessGlxApplication {
public: public:
@ -296,7 +299,7 @@ class WindowlessGlxApplication {
/** /**
* @brief Execute application * @brief Execute application
* @return Value for returning from `main()` * @return Value for returning from @cpp main() @ce
* *
* See @ref MAGNUM_WINDOWLESSGLXAPPLICATION_MAIN() for usage * See @ref MAGNUM_WINDOWLESSGLXAPPLICATION_MAIN() for usage
* information. * information.
@ -346,14 +349,16 @@ See @ref Magnum::Platform::WindowlessGlxApplication "Platform::WindowlessGlxAppl
for usage information. This macro abstracts out platform-specific entry point for usage information. This macro abstracts out platform-specific entry point
code and is equivalent to the following, see @ref portability-applications for code and is equivalent to the following, see @ref portability-applications for
more information. more information.
@code
@code{.cpp}
int main(int argc, char** argv) { int main(int argc, char** argv) {
className app({argc, argv}); className app({argc, argv});
return app.exec(); return app.exec();
} }
@endcode @endcode
When no other windowless application header is included this macro is also When no other windowless application header is included this macro is also
aliased to `MAGNUM_WINDOWLESSAPPLICATION_MAIN()`. aliased to @cpp MAGNUM_WINDOWLESSAPPLICATION_MAIN() @ce.
*/ */
#define MAGNUM_WINDOWLESSGLXAPPLICATION_MAIN(className) \ #define MAGNUM_WINDOWLESSGLXAPPLICATION_MAIN(className) \
int main(int argc, char** argv) { \ int main(int argc, char** argv) { \

39
src/Magnum/Platform/WindowlessIosApplication.h

@ -55,7 +55,7 @@ enabled in CMake.
Meant to be used when there is a need to manage (multiple) GL contexts Meant to be used when there is a need to manage (multiple) GL contexts
manually. See @ref platform-windowless-contexts for more information. If no manually. See @ref platform-windowless-contexts for more information. If no
other application header is included, this class is also aliased to other application header is included, this class is also aliased to
`Platform::WindowlessGLContext`. @cpp Platform::WindowlessGLContext @ce.
*/ */
class WindowlessIosContext { class WindowlessIosContext {
public: public:
@ -105,8 +105,8 @@ class WindowlessIosContext {
/** /**
* @brief Make the context current * @brief Make the context current
* *
* Prints error message and returns `false` on failure, otherwise * Prints error message and returns @cpp false @ce on failure,
* returns `true`. * otherwise returns @cpp true @ce.
*/ */
bool makeCurrent(); bool makeCurrent();
@ -134,7 +134,7 @@ Application for offscreen rendering using @ref WindowlessIosContext. Does not
have any default framebuffer. It is built if `WITH_WINDOWLESSIOSAPPLICATION` is have any default framebuffer. It is built if `WITH_WINDOWLESSIOSAPPLICATION` is
enabled in CMake. enabled in CMake.
## Bootstrap application @section Platform-WindowlessIosApplication-bootstrap Bootstrap application
Fully contained windowless application using @ref WindowlessIosApplication Fully contained windowless application using @ref WindowlessIosApplication
along with CMake setup is available in `windowless` branch of along with CMake setup is available in `windowless` branch of
@ -144,14 +144,16 @@ or [zip](https://github.com/mosra/magnum-bootstrap/archive/windowless.zip)
file. After extracting the downloaded archive you can build and run the file. After extracting the downloaded archive you can build and run the
application with these four commands: application with these four commands:
mkdir build && cd build @code{.sh}
cmake .. mkdir build && cd build
cmake --build . cmake ..
./src/MyApplication # or ./src/Debug/MyApplication cmake --build .
./src/MyApplication # or ./src/Debug/MyApplication
@endcode
See @ref cmake for more information. See @ref cmake for more information.
## General usage @section Platform-WindowlessIosApplication-usage General usage
In CMake you need to request `WindowlessIosApplication` component and link to In CMake you need to request `WindowlessIosApplication` component and link to
`Magnum::WindowlessIosApplication` target. If no other windowless application `Magnum::WindowlessIosApplication` target. If no other windowless application
@ -161,7 +163,8 @@ simplify porting. Again, see @ref building and @ref cmake for more information.
Place your code into @ref exec(). The subclass can be then used in main Place your code into @ref exec(). The subclass can be then used in main
function using @ref MAGNUM_WINDOWLESSIOSAPPLICATION_MAIN() macro. See function using @ref MAGNUM_WINDOWLESSIOSAPPLICATION_MAIN() macro. See
@ref platform for more information. @ref platform for more information.
@code
@code{.cpp}
class MyApplication: public Platform::WindowlessIosApplication { class MyApplication: public Platform::WindowlessIosApplication {
// implement required methods... // implement required methods...
}; };
@ -169,8 +172,8 @@ MAGNUM_WINDOWLESSIOSAPPLICATION_MAIN(MyApplication)
@endcode @endcode
If no other application header is included, this class is also aliased to If no other application header is included, this class is also aliased to
`Platform::WindowlessApplication` and the macro is aliased to @cpp Platform::WindowlessApplication @ce and the macro is aliased to
`MAGNUM_WINDOWLESSAPPLICATION_MAIN()` to simplify porting. @cpp MAGNUM_WINDOWLESSAPPLICATION_MAIN() @ce to simplify porting.
*/ */
class WindowlessIosApplication { class WindowlessIosApplication {
public: public:
@ -241,7 +244,7 @@ class WindowlessIosApplication {
/** /**
* @brief Execute application * @brief Execute application
* @return Value for returning from `main()` * @return Value for returning from @cpp main() @ce
* *
* See @ref MAGNUM_WINDOWLESSIOSAPPLICATION_MAIN() for usage * See @ref MAGNUM_WINDOWLESSIOSAPPLICATION_MAIN() for usage
* information. * information.
@ -273,8 +276,8 @@ class WindowlessIosApplication {
/** /**
* @brief Try to create context with given configuration * @brief Try to create context with given configuration
* *
* Unlike @ref createContext() returns `false` if the context cannot be * Unlike @ref createContext() returns @cpp false @ce if the context
* created, `true` otherwise. * cannot be created, @cpp true @ce otherwise.
*/ */
bool tryCreateContext(const Configuration& configuration); bool tryCreateContext(const Configuration& configuration);
@ -291,14 +294,16 @@ See @ref Magnum::Platform::WindowlessIosApplication "Platform::WindowlessIosAppl
for usage information. This macro abstracts out platform-specific entry point for usage information. This macro abstracts out platform-specific entry point
code and is equivalent to the following, see @ref portability-applications for code and is equivalent to the following, see @ref portability-applications for
more information. more information.
@code
@code{.cpp}
int main(int argc, char** argv) { int main(int argc, char** argv) {
className app({argc, argv}); className app({argc, argv});
return app.exec(); return app.exec();
} }
@endcode @endcode
When no other windowless application header is included this macro is also When no other windowless application header is included this macro is also
aliased to `MAGNUM_WINDOWLESSAPPLICATION_MAIN()`. aliased to @cpp MAGNUM_WINDOWLESSAPPLICATION_MAIN() @ce.
*/ */
#define MAGNUM_WINDOWLESSIOSAPPLICATION_MAIN(className) \ #define MAGNUM_WINDOWLESSIOSAPPLICATION_MAIN(className) \
int main(int argc, char** argv) { \ int main(int argc, char** argv) { \

39
src/Magnum/Platform/WindowlessWglApplication.h

@ -59,7 +59,7 @@ built if `WITH_WINDOWLESSWGLAPPLICATION` is enabled in CMake.
Meant to be used when there is a need to manage (multiple) GL contexts Meant to be used when there is a need to manage (multiple) GL contexts
manually. See @ref platform-windowless-contexts for more information. If no manually. See @ref platform-windowless-contexts for more information. If no
other application header is included, this class is also aliased to other application header is included, this class is also aliased to
`Platform::WindowlessGLContext`. @cpp Platform::WindowlessGLContext @ce.
*/ */
class WindowlessWglContext { class WindowlessWglContext {
public: public:
@ -119,8 +119,8 @@ class WindowlessWglContext {
/** /**
* @brief Make the context current * @brief Make the context current
* *
* Prints error message and returns `false` on failure, otherwise * Prints error message and returns @cpp false @ce on failure,
* returns `true`. * otherwise returns @cpp true @ce.
*/ */
bool makeCurrent(); bool makeCurrent();
@ -187,7 +187,7 @@ Application for offscreen rendering using @ref WindowlessWglContext. This
application library is available on desktop OpenGL on Windows. It is built if application library is available on desktop OpenGL on Windows. It is built if
`WITH_WINDOWLESSWGLAPPLICATION` is enabled in CMake. `WITH_WINDOWLESSWGLAPPLICATION` is enabled in CMake.
## Bootstrap application @section Platform-WindowlessWglApplication-bootstrap Bootstrap application
Fully contained windowless application using @ref WindowlessWglApplication Fully contained windowless application using @ref WindowlessWglApplication
along with CMake setup is available in `windowless` branch of along with CMake setup is available in `windowless` branch of
@ -197,14 +197,16 @@ or [zip](https://github.com/mosra/magnum-bootstrap/archive/windowless.zip)
file. After extracting the downloaded archive you can build and run the file. After extracting the downloaded archive you can build and run the
application with these four commands: application with these four commands:
mkdir build && cd build @code{.bat}
cmake .. mkdir build && cd build
cmake --build . cmake ..
./src/MyApplication # or ./src/Debug/MyApplication cmake --build .
./src/MyApplication # or ./src/Debug/MyApplication
@endcode
See @ref cmake for more information. See @ref cmake for more information.
## General usage @section Platform-WindowlessWglApplication-usage General usage
In CMake you need to request `WindowlessWglApplication` component of `Magnum` In CMake you need to request `WindowlessWglApplication` component of `Magnum`
package and link to `Magnum::WindowlessWglApplication` target. If no other package and link to `Magnum::WindowlessWglApplication` target. If no other
@ -212,10 +214,11 @@ windowless application is requested, you can also use generic
`Magnum::WindowlessApplication` alias to simplify porting. Again, see `Magnum::WindowlessApplication` alias to simplify porting. Again, see
@ref building and @ref cmake for more information. @ref building and @ref cmake for more information.
Place your code into @ref exec(). The subclass can be then used in main Place your code into @ref exec(). The subclass can be then used in @cpp main() @ce
function using @ref MAGNUM_WINDOWLESSWGLAPPLICATION_MAIN() macro. See function using @ref MAGNUM_WINDOWLESSWGLAPPLICATION_MAIN() macro. See
@ref platform for more information. @ref platform for more information.
@code
@code{.cpp}
class MyApplication: public Platform::WindowlessWglApplication { class MyApplication: public Platform::WindowlessWglApplication {
// implement required methods... // implement required methods...
}; };
@ -223,8 +226,8 @@ MAGNUM_WINDOWLESSWGLAPPLICATION_MAIN(MyApplication)
@endcode @endcode
If no other application header is included, this class is also aliased to If no other application header is included, this class is also aliased to
`Platform::WindowlessApplication` and the macro is aliased to @cpp Platform::WindowlessApplication @ce and the macro is aliased to
`MAGNUM_WINDOWLESSAPPLICATION_MAIN()` to simplify porting. @cpp MAGNUM_WINDOWLESSAPPLICATION_MAIN() @ce to simplify porting.
*/ */
class WindowlessWglApplication { class WindowlessWglApplication {
public: public:
@ -327,8 +330,8 @@ class WindowlessWglApplication {
/** /**
* @brief Try to create context with given configuration * @brief Try to create context with given configuration
* *
* Unlike @ref createContext() returns `false` if the context cannot be * Unlike @ref createContext() returns @cpp false @ce if the context
* created, `true` otherwise. * cannot be created, @cpp true @ce otherwise.
*/ */
bool tryCreateContext(const Configuration& configuration); bool tryCreateContext(const Configuration& configuration);
@ -345,14 +348,16 @@ See @ref Magnum::Platform::WindowlessWglApplication "Platform::WindowlessWglAppl
for usage information. This macro abstracts out platform-specific entry point for usage information. This macro abstracts out platform-specific entry point
code and is equivalent to the following, see @ref portability-applications for code and is equivalent to the following, see @ref portability-applications for
more information. more information.
@code
@code{.cpp}
int main(int argc, char** argv) { int main(int argc, char** argv) {
className app({argc, argv}); className app({argc, argv});
return app.exec(); return app.exec();
} }
@endcode @endcode
When no other windowless application header is included this macro is also When no other windowless application header is included this macro is also
aliased to `MAGNUM_WINDOWLESSAPPLICATION_MAIN()`. aliased to @cpp MAGNUM_WINDOWLESSAPPLICATION_MAIN() @ce.
*/ */
#define MAGNUM_WINDOWLESSWGLAPPLICATION_MAIN(className) \ #define MAGNUM_WINDOWLESSWGLAPPLICATION_MAIN(className) \
int main(int argc, char** argv) { \ int main(int argc, char** argv) { \

39
src/Magnum/Platform/WindowlessWindowsEglApplication.h

@ -55,7 +55,7 @@ It is built if `WITH_WINDOWLESSWINDOWSEGLAPPLICATION` is enabled in CMake.
Meant to be used when there is a need to manage (multiple) GL contexts Meant to be used when there is a need to manage (multiple) GL contexts
manually. See @ref platform-windowless-contexts for more information. If no manually. See @ref platform-windowless-contexts for more information. If no
other application header is included, this class is also aliased to other application header is included, this class is also aliased to
`Platform::WindowlessGLContext`. @cpp Platform::WindowlessGLContext @ce.
*/ */
class WindowlessWindowsEglContext { class WindowlessWindowsEglContext {
public: public:
@ -105,8 +105,8 @@ class WindowlessWindowsEglContext {
/** /**
* @brief Make the context current * @brief Make the context current
* *
* Prints error message and returns `false` on failure, otherwise * Prints error message and returns @cpp false @ce on failure,
* returns `true`. * otherwise returns @cpp true @ce.
*/ */
bool makeCurrent(); bool makeCurrent();
@ -174,7 +174,7 @@ Application for offscreen rendering using @ref WindowlessWindowsEglContext.
This application library is available on OpenGL ES (also ANGLE) on Windows. It This application library is available on OpenGL ES (also ANGLE) on Windows. It
is built if `WITH_WINDOWLESSWINDOWSEGLAPPLICATION` is enabled in CMake. is built if `WITH_WINDOWLESSWINDOWSEGLAPPLICATION` is enabled in CMake.
## Bootstrap application @section Platform-WindowlessWindowsEglApplication-bootstrap Bootstrap application
Fully contained windowless application using @ref WindowlessWindowsEglApplication Fully contained windowless application using @ref WindowlessWindowsEglApplication
along with CMake setup is available in `windowless` branch of along with CMake setup is available in `windowless` branch of
@ -184,14 +184,16 @@ or [zip](https://github.com/mosra/magnum-bootstrap/archive/windowless.zip)
file. After extracting the downloaded archive you can build and run the file. After extracting the downloaded archive you can build and run the
application with these four commands: application with these four commands:
mkdir build && cd build @code{.sh}
cmake .. mkdir build && cd build
cmake --build . cmake ..
./src/MyApplication # or ./src/Debug/MyApplication cmake --build .
./src/MyApplication # or ./src/Debug/MyApplication
@endcode
See @ref cmake for more information. See @ref cmake for more information.
## General usage @section Platform-WindowlessWindowsEglApplication-usage General usage
In CMake you need to request `WindowlessWindowsEglApplication` component of In CMake you need to request `WindowlessWindowsEglApplication` component of
`Magnum` package and link to `Magnum::WindowlessWindowsEglApplication` target. `Magnum` package and link to `Magnum::WindowlessWindowsEglApplication` target.
@ -202,7 +204,8 @@ If no other windowless application is requested, you can also use generic
Place your code into @ref exec(). The subclass can be then used in main Place your code into @ref exec(). The subclass can be then used in main
function using @ref MAGNUM_WINDOWLESSWINDOWSEGLAPPLICATION_MAIN() macro. See function using @ref MAGNUM_WINDOWLESSWINDOWSEGLAPPLICATION_MAIN() macro. See
@ref platform for more information. @ref platform for more information.
@code
@code{.cpp}
class MyApplication: public Platform::WindowlessWindowsEglApplication { class MyApplication: public Platform::WindowlessWindowsEglApplication {
// implement required methods... // implement required methods...
}; };
@ -210,8 +213,8 @@ MAGNUM_WINDOWLESSWINDOWSEGLAPPLICATION_MAIN(MyApplication)
@endcode @endcode
If no other application header is included, this class is also aliased to If no other application header is included, this class is also aliased to
`Platform::WindowlessApplication` and the macro is aliased to @cpp Platform::WindowlessApplication @ce and the macro is aliased to
`MAGNUM_WINDOWLESSAPPLICATION_MAIN()` to simplify porting. @cpp MAGNUM_WINDOWLESSAPPLICATION_MAIN() @ce to simplify porting.
*/ */
class WindowlessWindowsEglApplication { class WindowlessWindowsEglApplication {
public: public:
@ -281,7 +284,7 @@ class WindowlessWindowsEglApplication {
/** /**
* @brief Execute application * @brief Execute application
* @return Value for returning from `main()` * @return Value for returning from @cpp main() @ce
* *
* See @ref MAGNUM_WINDOWLESSWINDOWSEGLAPPLICATION_MAIN() for usage * See @ref MAGNUM_WINDOWLESSWINDOWSEGLAPPLICATION_MAIN() for usage
* information. * information.
@ -312,8 +315,8 @@ class WindowlessWindowsEglApplication {
/** /**
* @brief Try to create context with given configuration * @brief Try to create context with given configuration
* *
* Unlike @ref createContext() returns `false` if the context cannot be * Unlike @ref createContext() returns @cpp false @ce if the context
* created, `true` otherwise. * cannot be created, @cpp true @ce otherwise.
*/ */
bool tryCreateContext(const Configuration& configuration); bool tryCreateContext(const Configuration& configuration);
@ -330,14 +333,16 @@ See @ref Magnum::Platform::WindowlessWindowsEglApplication "Platform::Windowless
for usage information.This macro abstracts out platform-specific entry point for usage information.This macro abstracts out platform-specific entry point
code and is equivalent to the following, see @ref portability-applications for code and is equivalent to the following, see @ref portability-applications for
more information. more information.
@code
@code{.cpp}
int main(int argc, char** argv) { int main(int argc, char** argv) {
className app({argc, argv}); className app({argc, argv});
return app.exec(); return app.exec();
} }
@endcode @endcode
When no other windowless application header is included this macro is also When no other windowless application header is included this macro is also
aliased to `MAGNUM_WINDOWLESSAPPLICATION_MAIN()`. aliased to @cpp MAGNUM_WINDOWLESSAPPLICATION_MAIN() @ce.
*/ */
#define MAGNUM_WINDOWLESSWINDOWSEGLAPPLICATION_MAIN(className) \ #define MAGNUM_WINDOWLESSWINDOWSEGLAPPLICATION_MAIN(className) \
int main(int argc, char** argv) { \ int main(int argc, char** argv) { \

23
src/Magnum/Platform/XEglApplication.h

@ -43,13 +43,13 @@ This application library is available on both desktop OpenGL and
@ref MAGNUM_TARGET_GLES "OpenGL ES" on Linux. It depends on **X11** and **EGL** @ref MAGNUM_TARGET_GLES "OpenGL ES" on Linux. It depends on **X11** and **EGL**
libraries and is built if `WITH_XEGLAPPLICATION` is enabled in CMake. libraries and is built if `WITH_XEGLAPPLICATION` is enabled in CMake.
## Bootstrap application @section Platform-XEglApplication-bootstrap Bootstrap application
The usage is very similar to @ref Sdl2Application, for which fully contained The usage is very similar to @ref Sdl2Application, for which fully contained
base application along with CMake setup is available, see its documentation for base application along with CMake setup is available, see its documentation for
more information. more information.
## General usage @section Platform-XEglApplication-usage General usage
For CMake you need to copy `FindEGL.cmake` from `modules/` directory in Magnum For CMake you need to copy `FindEGL.cmake` from `modules/` directory in Magnum
source to `modules/` dir in your project (so it is able to find EGL), request source to `modules/` dir in your project (so it is able to find EGL), request
@ -59,10 +59,11 @@ can also use generic `Magnum::Application` alias to simplify porting. See
@ref building and @ref cmake for more information. @ref building and @ref cmake for more information.
In C++ code you need to implement at least @ref drawEvent() to be able to draw In C++ code you need to implement at least @ref drawEvent() to be able to draw
on the screen. The subclass can be then used directly in `main()` -- see on the screen. The subclass can be then used directly in @cpp main() @ce
convenience macro @ref MAGNUM_XEGLAPPLICATION_MAIN(). See @ref platform for --- see convenience macro @ref MAGNUM_XEGLAPPLICATION_MAIN(). See @ref platform
more information. for more information.
@code
@code{.cpp}
class MyApplication: public Platform::XEglApplication { class MyApplication: public Platform::XEglApplication {
// implement required methods... // implement required methods...
}; };
@ -70,8 +71,8 @@ MAGNUM_XEGLAPPLICATION_MAIN(MyApplication)
@endcode @endcode
If no other application header is included, this class is also aliased to If no other application header is included, this class is also aliased to
`Platform::Application` and the macro is aliased to `MAGNUM_APPLICATION_MAIN()` @cpp Platform::Application @ce and the macro is aliased to
to simplify porting. @cpp MAGNUM_APPLICATION_MAIN() @ce to simplify porting.
*/ */
class XEglApplication: public AbstractXApplication { class XEglApplication: public AbstractXApplication {
public: public:
@ -114,14 +115,16 @@ See @ref Magnum::Platform::XEglApplication "Platform::XEglApplication" for
usage information. This macro abstracts out platform-specific entry point code usage information. This macro abstracts out platform-specific entry point code
and is equivalent to the following, see @ref portability-applications for more and is equivalent to the following, see @ref portability-applications for more
information. information.
@code
@code{.cpp}
int main(int argc, char** argv) { int main(int argc, char** argv) {
className app({argc, argv}); className app({argc, argv});
return app.exec(); return app.exec();
} }
@endcode @endcode
When no other application header is included this macro is also aliased to When no other application header is included this macro is also aliased to
`MAGNUM_APPLICATION_MAIN()`. @cpp MAGNUM_APPLICATION_MAIN() @ce.
*/ */
#define MAGNUM_XEGLAPPLICATION_MAIN(className) \ #define MAGNUM_XEGLAPPLICATION_MAIN(className) \
int main(int argc, char** argv) { \ int main(int argc, char** argv) { \

Loading…
Cancel
Save