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. 61
      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. 146
      src/Magnum/Platform/Sdl2Application.h
  9. 53
      src/Magnum/Platform/WindowlessCglApplication.h
  10. 77
      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
* @return Value for returning from `main()`
* @return Value for returning from @cpp main() @ce
*
* See @ref MAGNUM_GLXAPPLICATION_MAIN() or
* @ref MAGNUM_XEGLAPPLICATION_MAIN() for usage information.
@ -218,7 +218,7 @@ class AbstractXApplication::Configuration {
* @brief Set window title
* @return Reference to self (for method chaining)
*
* Default is `"Magnum X Application"`.
* Default is @cpp "Magnum X Application" @ce.
*/
Configuration& setTitle(std::string title) {
_title = std::move(title);
@ -232,7 +232,7 @@ class AbstractXApplication::Configuration {
* @brief Set window size
* @return Reference to self (for method chaining)
*
* Default is `{800, 600}`.
* Default is @cpp {800, 600} @ce.
*/
Configuration& setSize(const Vector2i& size) {
_size = size;

61
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
CMake.
## Bootstrap application
@section Platform-AndroidApplication-bootstrap Bootstrap application
Fully contained base application using @ref Sdl2Application for desktop build
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
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
in them. Set `CMAKE_PREFIX_PATH` to the directory where you have all the
dependencies.
mkdir build-android-arm && cd build-android-arm
cmake .. \
@code{.sh}
mkdir build-android-arm && cd build-android-arm
cmake .. \
-DCMAKE_TOOLCHAIN_FILE="../toolchains/generic/Android-ARM.cmake" \
-DCMAKE_PREFIX_PATH=/opt/android-ndk/platforms/android-19/arch-arm/usr
cmake --build .
cmake --build .
mkdir build-android-x86 && cd build-android-x86
cmake .. \
mkdir build-android-x86 && cd build-android-x86
cmake .. \
-DCMAKE_TOOLCHAIN_FILE="../toolchains/generic/Android-x86.cmake" \
-DCMAKE_PREFIX_PATH=/opt/android-ndk/platforms/android-19/arch-x86/usr
cmake --build .
cmake --build .
@endcode
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
can be then installed directly on the device or emulator using `adb install`.
ant debug
adb install bin/NativeActivity-debug.apk
@code{.sh}
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
`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`,
you can do that automatically in CMake using the following commands:
file(MAKE_DIRECTORY "${CMAKE_SOURCE_DIR}/libs/${ANDROID_ABI}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/libs/${ANDROID_ABI}")
@code{.cmake}
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
on the screen. The subclass must be then made accessible from JNI using
@ref MAGNUM_ANDROIDAPPLICATION_MAIN() macro. See @ref platform for more
information.
@code
@code{.cpp}
class MyApplication: public Platform::AndroidApplication {
// implement required methods...
};
@ -135,16 +144,17 @@ MAGNUM_ANDROIDAPPLICATION_MAIN(MyApplication)
@endcode
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.
### Android packaging stuff
@subsection Platform-AndroidApplication-packaging Android packaging stuff
The application needs at least the `AndroidManifest.xml` with the following
contents:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="cz.mosra.magnum.application" android:versionCode="1" android:versionName="1.0">
@code{.xml}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="cz.mosra.magnum.application" android:versionCode="1" android:versionName="1.0">
<uses-sdk android:minSdkVersion="9" />
<uses-feature android:glEsVersion="0x00020000" />
<application android:label="Magnum Android Application" android:hasCode="false">
@ -156,7 +166,8 @@ contents:
</intent-filter>
</activity>
</application>
</manifest>
</manifest>
@endcode
Modify `android:label` to your liking, set unique `package` name and replace
`{{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
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",
@ref Corrade::Utility::Warning "Warning" and @ref Corrade::Utility::Error "Error"
@ -353,9 +364,9 @@ class AndroidApplication::Configuration {
* @brief Set window size
* @return Reference to self (for method chaining)
*
* Default is `{0, 0}`, which means that the size of the physical
* window will be used. If set to different value than the physical
* size, the surface will be scaled.
* Default is @cpp {0, 0} @ce, which means that the size of the
* physical window will be used. If set to different value than the
* physical size, the surface will be scaled.
*/
Configuration& setSize(const Vector2i& size) {
_size = size;
@ -578,9 +589,9 @@ CORRADE_ENUMSET_OPERATORS(AndroidApplication::MouseMoveEvent::Buttons)
See @ref Magnum::Platform::AndroidApplication "Platform::AndroidApplication"
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
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) \
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
in CMake.
## Bootstrap application
@section Platform-GlfwApplication-bootstrap Bootstrap application
Fully contained base application using @ref GlfwApplication along with CMake
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
with these four commands:
mkdir build && cd build
cmake ..
cmake --build .
./src/MyApplication # or ./src/Debug/MyApplication
@code{.sh}
mkdir build && cd build
cmake ..
cmake --build .
./src/MyApplication # or ./src/Debug/MyApplication
@endcode
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
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.
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
convenience macro @ref MAGNUM_GLFWAPPLICATION_MAIN(). See @ref platform for
more information.
@code
on the screen. The subclass can be then used directly in @cpp main() @ce
--- see convenience macro @ref MAGNUM_GLFWAPPLICATION_MAIN(). See @ref platform
for more information.
@code{.cpp}
class MyApplication: public Platform::GlfwApplication {
// implement required methods...
};
@ -92,8 +95,8 @@ MAGNUM_GLFWAPPLICATION_MAIN(MyApplication)
@endcode
If no other application header is included, this class is also aliased to
`Platform::Application` and the macro is aliased to `MAGNUM_APPLICATION_MAIN()`
to simplify porting.
@cpp Platform::Application @ce and the macro is aliased to
@cpp MAGNUM_APPLICATION_MAIN() @ce to simplify porting.
*/
class GlfwApplication {
public:
@ -148,7 +151,7 @@ class GlfwApplication {
/**
* @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.
*/
@ -206,8 +209,9 @@ class GlfwApplication {
/**
* @brief Set swap interval
*
* Set `0` for no VSync, `1` for enabled VSync. Some platforms support
* `-1` for late swap tearing. Default is driver-dependent.
* Set @cpp 0 @ce for no VSync, @cpp 1 @ce for enabled VSync. Some
* platforms support @cpp -1 @ce for late swap tearing. Default is
* driver-dependent.
*/
void setSwapInterval(Int interval);
@ -450,7 +454,7 @@ class GlfwApplication::Configuration {
* @brief Set window title
* @return Reference to self (for method chaining)
*
* Default is `"Magnum GLFW Application"`.
* Default is @cpp "Magnum GLFW Application" @ce.
*/
Configuration& setTitle(std::string title) {
_title = std::move(title);
@ -464,7 +468,7 @@ class GlfwApplication::Configuration {
* @brief Set window size
* @return Reference to self (for method chaining)
*
* Default is `{800, 600}`.
* Default is @cpp {800, 600} @ce.
*/
Configuration& setSize(const Vector2i& size) {
_size = size;
@ -540,8 +544,8 @@ class GlfwApplication::Configuration {
* @brief Set sample count
* @return Reference to self (for method chaining)
*
* Default is `0`, thus no multisampling. The actual sample count is
* ignored, GLFW either enables it or disables. See also
* Default is @cpp 0 @ce, thus no multisampling. The actual sample
* count is ignored, GLFW either enables it or disables. See also
* @ref Renderer::Feature::Multisampling.
*/
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
and is equivalent to the following, see @ref portability-applications for more
information.
@code
@code{.cpp}
int main(int argc, char** argv) {
className app({argc, argv});
return app.exec();
}
@endcode
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) \
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`
is enabled in CMake.
## Bootstrap application
@section Platform-GlutApplication-bootstrap Bootstrap application
Fully contained base application using @ref GlutApplication along with
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
with these four commands:
mkdir build && cd build
cmake ..
cmake --build .
./src/MyApplication # or ./src/Debug/MyApplication
@code{.sh}
mkdir build && cd build
cmake ..
cmake --build .
./src/MyApplication # or ./src/Debug/MyApplication
@endcode
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
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.
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
convenience macro @ref MAGNUM_GLUTAPPLICATION_MAIN(). See @ref platform for
more information.
@code
on the screen. The subclass can be then used directly in @cpp main() @ce
--- see convenience macro @ref MAGNUM_GLUTAPPLICATION_MAIN(). See @ref platform
for more information.
@code{.cpp}
class MyApplication: public Platform::GlutApplication {
// implement required methods...
};
@ -89,8 +92,8 @@ MAGNUM_GLUTAPPLICATION_MAIN(MyApplication)
@endcode
If no other application header is included, this class is also aliased to
`Platform::Application` and the macro is aliased to `MAGNUM_APPLICATION_MAIN()`
to simplify porting.
@cpp Platform::Application @ce and the macro is aliased to
@cpp MAGNUM_APPLICATION_MAIN() @ce to simplify porting.
*/
class GlutApplication {
public:
@ -143,7 +146,7 @@ class GlutApplication {
/**
* @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.
*/
@ -321,7 +324,7 @@ class GlutApplication::Configuration {
* @brief Set window title
* @return Reference to self (for method chaining)
*
* Default is `"Magnum GLUT Application"`.
* Default is @cpp "Magnum GLUT Application" @ce.
*/
Configuration& setTitle(std::string title) {
_title = std::move(title);
@ -335,7 +338,7 @@ class GlutApplication::Configuration {
* @brief Set window size
* @return Reference to self (for method chaining)
*
* Default is `{800, 600}`.
* Default is @cpp {800, 600} @ce.
*/
Configuration& setSize(const Vector2i& size) {
_size = size;
@ -379,8 +382,8 @@ class GlutApplication::Configuration {
* @brief Set sample count
* @return Reference to self (for method chaining)
*
* Default is `0`, thus no multisampling. The actual sample count is
* ignored, GLUT either enables it or disables. See also
* Default is @cpp 0 @ce, thus no multisampling. The actual sample
* count is ignored, GLUT either enables it or disables. See also
* @ref Renderer::Feature::Multisampling.
*/
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
and is equivalent to the following, see @ref portability-applications for more
information.
@code
@code{.cpp}
int main(int argc, char** argv) {
className app({argc, argv});
return app.exec();
}
@endcode
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) \
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
CMake.
## Bootstrap application
@section Platform-GlxApplication-bootstrap Bootstrap application
The usage is very similar to @ref Sdl2Application, for which fully contained
base application along with CMake setup is available, see its documentation for
more information.
## General usage
@section Platform-GlxApplication-usage General usage
In CMake you need to request `GlxApplication` component of `Magnum` package and
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.
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
convenience macro @ref MAGNUM_GLXAPPLICATION_MAIN(). See @ref platform for more
information.
@code
on the screen. The subclass can be then used directly in @cpp main() @ce
--- see convenience macro @ref MAGNUM_GLXAPPLICATION_MAIN(). See @ref platform
for more information.
@code{.cpp}
class MyApplication: public Platform::GlxApplication {
// implement required methods...
};
@ -69,8 +70,8 @@ MAGNUM_GLXAPPLICATION_MAIN(MyApplication)
@endcode
If no other application header is included, this class is also aliased to
`Platform::Application` and the macro is aliased to `MAGNUM_APPLICATION_MAIN()`
to simplify porting.
@cpp Platform::Application @ce and the macro is aliased to
@cpp MAGNUM_APPLICATION_MAIN() @ce to simplify porting.
*/
class GlxApplication: public AbstractXApplication {
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
equivalent to the following, see @ref portability-applications for more
information.
@code
@code{.cpp}
int main(int argc, char** argv) {
className app({argc, argv});
return app.exec();
}
@endcode
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) \
int main(int argc, char** argv) { \

4
src/Magnum/Platform/Screen.h

@ -51,9 +51,9 @@ namespace Implementation {
See @ref BasicScreenedApplication for more information.
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
`*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.
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
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.
Traversing front-to-back through the list of screens can be done using
range-based for:
@code
@code{.cpp}
MyApplication app;
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
back-to-front can be done using @ref Corrade::Containers::LinkedList::last()
and @ref BasicScreen::nextNearerScreen().
@code
@code{.cpp}
for(Screen* s = app.screens().first(); s; s = s->nextFartherScreen()) {
// ...
}
@endcode
## Explicit template specializations
@section Platform-ScreenedApplication-template-specializations Explicit template specializations
The following specialization are explicitly compiled into each particular
`*Application` library. For other specializations you have to use

146
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
`WITH_SDL2APPLICATION` is enabled in CMake.
## Bootstrap application
@section Platform-Sdl2Application-bootstrap Bootstrap application
Fully contained base application using @ref Sdl2Application along with
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
with these four commands:
mkdir build && cd build
cmake ..
cmake --build .
./src/MyApplication # or ./src/Debug/MyApplication
@code{.sh}
mkdir build && cd build
cmake ..
cmake --build .
./src/MyApplication # or ./src/Debug/MyApplication
@endcode
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
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
webserver, e.g. `/srv/http/emscripten`).
mkdir build-emscripten && cd build-emscripten
cmake .. \
@code{.sh}
mkdir build-emscripten && cd build-emscripten
cmake .. \
-DCMAKE_TOOLCHAIN_FILE="../toolchains/generic/Emscripten.cmake" \
-DCMAKE_PREFIX_PATH=/usr/lib/emscripten/system \
-DCMAKE_INSTALL_PREFIX=/srv/http/emscripten
cmake --build .
cmake --build . --target install
cmake --build .
cmake --build . --target install
@endcode
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
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
you have all the dependencies.
mkdir build-ios && cd build-ios
cmake .. \
@code{.sh}
mkdir build-ios && cd build-ios
cmake .. \
-DCMAKE_TOOLCHAIN_FILE=../toolchains/generic/iOS.cmake \
-DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk \
-DCMAKE_OSX_ARCHITECTURES="arm64;armv7;armv7s" \
-DCMAKE_PREFIX_PATH=~/ios-libs \
-G Xcode
@endcode
You can then open the generated project file in Xcode and build/deploy it from
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
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
to the following:
mkdir build-winrt && cd build-winrt
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 .
@code{.bat}
mkdir build-winrt && cd build-winrt
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.
## General usage
@section Platform-Sdl2Application-usage General usage
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).
@ -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
@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
screen. The subclass can be then used directly in `main()` -- see convenience
macro @ref MAGNUM_SDL2APPLICATION_MAIN(). See @ref platform for more
information.
@code
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
convenience macro @ref MAGNUM_SDL2APPLICATION_MAIN(). See @ref platform for
more information.
@code{.cpp}
class MyApplication: public Platform::Sdl2Application {
// implement required methods...
};
@ -188,19 +204,20 @@ MAGNUM_SDL2APPLICATION_MAIN(MyApplication)
@endcode
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.
## Usage with Emscripten
@section Platform-Sdl2Application-usage-emscripten Usage with Emscripten
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
modify it to your liking. The markup references two files,
`EmscriptenApplication.js` and `WebApplication.css`, both are in `Platform/`
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.
@code
@code{.html}
<!DOCTYPE html>
<html>
<head>
@ -215,25 +232,26 @@ executable.
<div id="status">Initialization...</div>
<div id="statusDescription"></div>
<script src="EmscriptenApplication.js"></script>
<script async="async" src="<application>.js"></script>
<script async="async" src="{{application}}.js"></script>
</div>
</body>
</html>
@endcode
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
file contains event listeners which print loading status on the page. The
status displayed in the remaining two `&lt;div&gt;`s, if they are available.
The CSS file contains rudimentary style to avoid eye bleeding.
least the @cb{.html} <canvas> @ce enclosed in listener @cb{.html} <div> @ce.
The JavaScript file contains event listeners which print loading status on the
page. The status displayed in the remaining two @cb{.html} <div> @ce s, if they
are available. The CSS file contains rudimentary style to avoid eye bleeding.
The application redirects all output (thus also @ref Corrade::Utility::Debug "Debug",
@ref Corrade::Utility::Warning "Warning" and @ref Corrade::Utility::Error "Error")
to JavaScript console. It's possible to pass command-line arguments to `main()`
using GET URL parameters. For example, `/app/?foo=bar&fizz&buzz=3` will go to
the app as `['--foo', 'bar', '--fizz', '--buzz', '3']`.
to JavaScript console. It's possible to pass command-line arguments to
@cpp main() @ce using GET URL parameters. For example,
`/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
orientation, icons, splash screen...) is specified through the `*.plist` file.
@ -243,7 +261,8 @@ 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`
file used in the bootstrap application, requesting OpenGL ES 2.0 and
advertising Retina support:
@code
@code{.xml}
<?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">
<plist version="1.0">
@ -280,13 +299,14 @@ application window, see documentation of particular value for details:
- @ref Configuration::WindowFlag::Resizable makes the application respond to
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
referenced from the `*.appxmanifest` file. The file is slightly different for
different targets, template for Windows Store and MSVC 2013 is below, others
are in the bootstrap application.
@code
@code{.xml}
<?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">
<Identity Name="MyApplication" Publisher="CN=A Publisher" Version="1.1.0.0" />
@ -390,7 +410,7 @@ class Sdl2Application {
/**
* @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
* called. See @ref MAGNUM_SDL2APPLICATION_MAIN() for usage
@ -454,8 +474,8 @@ class Sdl2Application {
/**
* @brief Try to create context with given configuration
*
* Unlike @ref createContext() returns `false` if the context cannot be
* created, `true` otherwise.
* Unlike @ref createContext() returns @cpp false @ce if the context
* cannot be created, @cpp true @ce otherwise.
*/
bool tryCreateContext(const Configuration& configuration);
@ -484,10 +504,11 @@ class Sdl2Application {
/**
* @brief Set swap interval
*
* Set `0` for no VSync, `1` for enabled VSync. Some platforms support
* `-1` for late swap tearing. Prints error message and returns `false`
* if swap interval cannot be set, `true` otherwise. Default is
* driver-dependent, you can query the value with @ref swapInterval().
* Set @cpp 0 @ce for no VSync, @cpp 1 @ce for enabled VSync. Some
* platforms support @cpp -1 @ce for late swap tearing. Prints error
* message and returns @cpp false @ce if swap interval cannot be set,
* @cpp true @ce otherwise. Default is driver-dependent, you can query
* the value with @ref swapInterval().
* @see @ref setMinimalLoopPeriod()
*/
bool setSwapInterval(Int interval);
@ -497,8 +518,8 @@ class Sdl2Application {
* @brief Set minimal loop period
*
* 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.
* looping at maximum frequency).
* not/cannot be enabled or no drawing is done. Default is @cpp 0 @ce
* (i.e. looping at maximum frequency).
* @note Not available in @ref CORRADE_TARGET_EMSCRIPTEN "Emscripten",
* the browser is managing the frequency instead.
* @see @ref setSwapInterval()
@ -844,7 +865,7 @@ class Sdl2Application::Configuration {
* @brief Set window title
* @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
* @ref CORRADE_TARGET_IOS "iOS" this function does nothing and is
* included only for compatibility. You need to set the title
@ -866,10 +887,11 @@ class Sdl2Application::Configuration {
* @brief Set window size
* @return Reference to self (for method chaining)
*
* Default is `{800, 600}`. On iOS it defaults to a "reasonable" size
* based on whether HiDPI support is enabled using
* @ref WindowFlag::AllowHighDpi, but not necessarily native display
* resolution (you have to set it explicitly).
* Default is @cpp {800, 600} @ce and @cpp {640, 480} @ce on
* Emscripten. On iOS it defaults to a "reasonable" size based on
* whether HiDPI support is enabled using @ref WindowFlag::AllowHighDpi,
* but not necessarily native display resolution (you have to set it
* explicitly).
*/
Configuration& setSize(const Vector2i& size) {
_size = size;
@ -945,7 +967,7 @@ class Sdl2Application::Configuration {
* @brief Set sample count
* @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.
*/
Configuration& setSampleCount(Int count) {
@ -965,7 +987,7 @@ class Sdl2Application::Configuration {
* @brief Set sRGB-capable default framebuffer
* @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".
*/
Configuration& setSRGBCapable(bool enabled) {
@ -1279,8 +1301,8 @@ class Sdl2Application::KeyEvent: public Sdl2Application::InputEvent {
/**
* @brief Whether the key press is repeated
*
* Returns `true` if the key press event is repeated, `false` if not or
* if this was key release event.
* Returns @cpp true @ce if the key press event is repeated,
* @cpp false @ce if not or if this was key release event.
*/
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
@ref CORRADE_TARGET_WINDOWS_RT "Windows RT", see @ref portability-applications
for more information.
@code
@code{.cpp}
int main(int argc, char** argv) {
className app({argc, argv});
return app.exec();
}
@endcode
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
#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
manually. See @ref platform-windowless-contexts for more information. If no
other application header is included, this class is also aliased to
`Platform::WindowlessGLContext`.
@cpp Platform::WindowlessGLContext @ce.
*/
class WindowlessCglContext {
public:
@ -109,8 +109,8 @@ class WindowlessCglContext {
/**
* @brief Make the context current
*
* Prints error message and returns `false` on failure, otherwise
* returns `true`.
* Prints error message and returns @cpp false @ce on failure,
* otherwise returns @cpp true @ce.
*/
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
`WITH_WINDOWLESSCGLAPPLICATION` is enabled in CMake.
## Bootstrap application
@section Platform-WindowlessCglApplication-bootstrap Bootstrap application
Fully contained windowless application using @ref WindowlessCglApplication
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
application with these four commands:
mkdir build && cd build
cmake ..
cmake --build .
./src/MyApplication # or ./src/Debug/MyApplication
@code{.sh}
mkdir build && cd build
cmake ..
cmake --build .
./src/MyApplication # or ./src/Debug/MyApplication
@endcode
See @ref cmake for more information.
## General usage
@section Platform-WindowlessCglApplication-usage General usage
In CMake you need to request `WindowlessCglApplication` component, add
`${MAGNUM_WINDOWLESSCGLAPPLICATION_INCLUDE_DIRS}` to include path and link to
`${MAGNUM_WINDOWLESSCGLAPPLICATION_LIBRARIES}`. If no other windowless
application is requested, you can also use generic
`${MAGNUM_WINDOWLESSAPPLICATION_INCLUDE_DIRS}` and
`${MAGNUM_WINDOWLESSAPPLICATION_LIBRARIES}` aliases to simplify porting. Again,
see @ref building and @ref cmake for more information.
In CMake you need to request `WindowlessCglApplication` component of `Magnum`
package and link to `Magnum::WindowlessCglApplication` target. If no other
application is requested, you can also use generic `Magnum::Application` alias
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
`main()` -- see convenience macro @ref MAGNUM_WINDOWLESSCGLAPPLICATION_MAIN().
`main()` --- see convenience macro @ref MAGNUM_WINDOWLESSCGLAPPLICATION_MAIN().
See @ref platform for more information.
@code
@code{.sh}
class MyApplication: public Platform::WindowlessCglApplication {
// implement required methods...
};
@ -177,8 +178,8 @@ MAGNUM_WINDOWLESSCGLAPPLICATION_MAIN(MyApplication)
@endcode
If no other application header is included, this class is also aliased to
`Platform::WindowlessApplication` and the macro is aliased to
`MAGNUM_WINDOWLESSAPPLICATION_MAIN()` to simplify porting.
@cpp Platform::WindowlessApplication @ce and the macro is aliased to
@cpp MAGNUM_WINDOWLESSAPPLICATION_MAIN() @ce to simplify porting.
*/
class WindowlessCglApplication {
public:
@ -249,7 +250,7 @@ class WindowlessCglApplication {
/**
* @brief Execute application
* @return Value for returning from `main()`
* @return Value for returning from @cpp main() @ce
*
* See @ref MAGNUM_WINDOWLESSCGLAPPLICATION_MAIN() for usage
* information.
@ -281,8 +282,8 @@ class WindowlessCglApplication {
/**
* @brief Try to create context with given configuration
*
* Unlike @ref createContext() returns `false` if the context cannot be
* created, `true` otherwise.
* Unlike @ref createContext() returns @cpp false @ce if the context
* cannot be created, @cpp true @ce otherwise.
*/
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
code and is equivalent to the following, see @ref portability-applications for
more information.
@code
@code{.cpp}
int main(int argc, char** argv) {
className app({argc, argv});
return app.exec();
}
@endcode
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) \
int main(int argc, char** argv) { \

77
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
manually. See @ref platform-windowless-contexts for more information. If no
other application header is included, this class is also aliased to
`Platform::WindowlessGLContext`.
@cpp Platform::WindowlessGLContext @ce.
*/
class WindowlessEglContext {
public:
@ -106,8 +106,8 @@ class WindowlessEglContext {
/**
* @brief Make the context current
*
* Prints error message and returns `false` on failure, otherwise
* returns `true`.
* Prints error message and returns @cpp false @ce on failure,
* otherwise returns @cpp true @ce.
*/
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
`WITH_WINDOWLESSEGLAPPLICATION` is enabled in CMake.
## Bootstrap application
@section Platform-WindowlessEglApplication-bootstrap Bootstrap application
Fully contained windowless application using @ref WindowlessEglApplication
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
application with these four commands:
mkdir build && cd build
cmake ..
cmake --build .
./src/MyApplication # or ./src/Debug/MyApplication
@code{.sh}
mkdir build && cd build
cmake ..
cmake --build .
./src/MyApplication # or ./src/Debug/MyApplication
@endcode
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
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
webserver, e.g. `/srv/http/emscripten`).
mkdir build-emscripten && cd build-emscripten
cmake .. \
@code{.sh}
mkdir build-emscripten && cd build-emscripten
cmake .. \
-DCMAKE_TOOLCHAIN_FILE="../toolchains/generic/Emscripten.cmake" \
-DCMAKE_PREFIX_PATH=/usr/lib/emscripten/system \
-DCMAKE_INSTALL_PREFIX=/srv/http/emscripten
cmake --build .
cmake --build . --target install
cmake --build .
cmake --build . --target install
@endcode
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
`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
function using @ref MAGNUM_WINDOWLESSEGLAPPLICATION_MAIN() macro. See
@ref platform for more information.
@code
@code{.cpp}
class MyApplication: public Platform::WindowlessEglApplication {
// implement required methods...
};
@ -256,19 +261,20 @@ MAGNUM_WINDOWLESSEGLAPPLICATION_MAIN(MyApplication)
@endcode
If no other application header is included, this class is also aliased to
`Platform::WindowlessApplication` and the macro is aliased to
`MAGNUM_WINDOWLESSAPPLICATION_MAIN()` to simplify porting.
@cpp Platform::WindowlessApplication @ce and the macro is aliased to
@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
application. Template one is below or in the bootstrap application, you can
modify it to your liking. The markup references two files,
`WindowlessEmscriptenApplication.js` and `WebApplication.css`, both are in
`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.
@code
@code{.html}
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
@ -284,23 +290,24 @@ to name of your executable.
<div id="status">Initialization...</div>
<div id="statusDescription"></div>
<script src="WindowlessEmscriptenApplication.js"></script>
<script async="async" src="<application>.js"></script>
<script async="async" src="{{application}}.js"></script>
</div>
</body>
</html>
@endcode
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
file contains event listeners which print loading status on the page. The
status displayed in the remaining two `&lt;div&gt;`s, if they are available.
The CSS file contains rudimentary style to avoid eye bleeding.
least the @cb{.html} <canvas> @ce enclosed in listener @cb{.html} <div> @ce.
The JavaScript file contains event listeners which print loading status on the
page. The status displayed in the remaining two @cb{.html} <div> @ce s, if they
are available. The CSS file contains rudimentary style to avoid eye bleeding.
The application prints all output (thus also @ref Corrade::Utility::Debug "Debug",
@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 `main()` using GET URL parameters. For example, `/app/?foo=bar&fizz&buzz=3`
will go to the app as `['--foo', 'bar', '--fizz', '--buzz', '3']`.
to the @cb{.html} <pre> @ce on the page. It's possible to pass command-line
arguments to @cpp main() @ce using GET URL parameters. For example,
`/app/?foo=bar&fizz&buzz=3` will go to the app as
@cb{.py} ['--foo', 'bar', '--fizz', '--buzz', '3'] @ce.
*/
class WindowlessEglApplication {
public:
@ -371,7 +378,7 @@ class WindowlessEglApplication {
/**
* @brief Execute application
* @return Value for returning from `main()`
* @return Value for returning from @cpp main() @ce
*
* See @ref MAGNUM_WINDOWLESSEGLAPPLICATION_MAIN() for usage
* information.
@ -403,8 +410,8 @@ class WindowlessEglApplication {
/**
* @brief Try to create context with given configuration
*
* Unlike @ref createContext() returns `false` if the context cannot be
* created, `true` otherwise.
* Unlike @ref createContext() returns @cpp false @ce if the context
* cannot be created, @cpp true @ce otherwise.
*/
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
code and is equivalent to the following, see @ref portability-applications for
more information.
@code
@code{.cpp}
int main(int argc, char** argv) {
className app({argc, argv});
return app.exec();
}
@endcode
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) \
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
manually. See @ref platform-windowless-contexts for more information. If no
other application header is included, this class is also aliased to
`Platform::WindowlessGLContext`.
@cpp Platform::WindowlessGLContext @ce.
*/
class WindowlessGlxContext {
public:
@ -118,8 +118,8 @@ class WindowlessGlxContext {
/**
* @brief Make the context current
*
* Prints error message and returns `false` on failure, otherwise
* returns `true`.
* Prints error message and returns @cpp false @ce on failure,
* otherwise returns @cpp true @ce.
*/
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
enabled in CMake.
## Bootstrap application
@section Platform-WindowlessGlxApplication-bootstrap Bootstrap application
Fully contained windowless application using @ref WindowlessGlxApplication
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
application with these four commands:
mkdir build && cd build
cmake ..
cmake --build .
./src/MyApplication # or ./src/Debug/MyApplication
@code{.sh}
mkdir build && cd build
cmake ..
cmake --build .
./src/MyApplication # or ./src/Debug/MyApplication
@endcode
See @ref cmake for more information.
## General usage
@section Platform-WindowlessGlxApplication-usage General usage
In CMake you need to request `WindowlessGlxApplication` component of `Magnum`
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.
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.
@code
@code{.cpp}
class MyApplication: public Platform::WindowlessGlxApplication {
// implement required methods...
};
@ -224,8 +227,8 @@ MAGNUM_WINDOWLESSGLXAPPLICATION_MAIN(MyApplication)
@endcode
If no other application header is included, this class is also aliased to
`Platform::WindowlessApplication` and the macro is aliased to
`MAGNUM_WINDOWLESSAPPLICATION_MAIN()` to simplify porting.
@cpp Platform::WindowlessApplication @ce and the macro is aliased to
@cpp MAGNUM_WINDOWLESSAPPLICATION_MAIN() @ce to simplify porting.
*/
class WindowlessGlxApplication {
public:
@ -296,7 +299,7 @@ class WindowlessGlxApplication {
/**
* @brief Execute application
* @return Value for returning from `main()`
* @return Value for returning from @cpp main() @ce
*
* See @ref MAGNUM_WINDOWLESSGLXAPPLICATION_MAIN() for usage
* information.
@ -346,14 +349,16 @@ See @ref Magnum::Platform::WindowlessGlxApplication "Platform::WindowlessGlxAppl
for usage information. This macro abstracts out platform-specific entry point
code and is equivalent to the following, see @ref portability-applications for
more information.
@code
@code{.cpp}
int main(int argc, char** argv) {
className app({argc, argv});
return app.exec();
}
@endcode
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) \
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
manually. See @ref platform-windowless-contexts for more information. If no
other application header is included, this class is also aliased to
`Platform::WindowlessGLContext`.
@cpp Platform::WindowlessGLContext @ce.
*/
class WindowlessIosContext {
public:
@ -105,8 +105,8 @@ class WindowlessIosContext {
/**
* @brief Make the context current
*
* Prints error message and returns `false` on failure, otherwise
* returns `true`.
* Prints error message and returns @cpp false @ce on failure,
* otherwise returns @cpp true @ce.
*/
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
enabled in CMake.
## Bootstrap application
@section Platform-WindowlessIosApplication-bootstrap Bootstrap application
Fully contained windowless application using @ref WindowlessIosApplication
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
application with these four commands:
mkdir build && cd build
cmake ..
cmake --build .
./src/MyApplication # or ./src/Debug/MyApplication
@code{.sh}
mkdir build && cd build
cmake ..
cmake --build .
./src/MyApplication # or ./src/Debug/MyApplication
@endcode
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
`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
function using @ref MAGNUM_WINDOWLESSIOSAPPLICATION_MAIN() macro. See
@ref platform for more information.
@code
@code{.cpp}
class MyApplication: public Platform::WindowlessIosApplication {
// implement required methods...
};
@ -169,8 +172,8 @@ MAGNUM_WINDOWLESSIOSAPPLICATION_MAIN(MyApplication)
@endcode
If no other application header is included, this class is also aliased to
`Platform::WindowlessApplication` and the macro is aliased to
`MAGNUM_WINDOWLESSAPPLICATION_MAIN()` to simplify porting.
@cpp Platform::WindowlessApplication @ce and the macro is aliased to
@cpp MAGNUM_WINDOWLESSAPPLICATION_MAIN() @ce to simplify porting.
*/
class WindowlessIosApplication {
public:
@ -241,7 +244,7 @@ class WindowlessIosApplication {
/**
* @brief Execute application
* @return Value for returning from `main()`
* @return Value for returning from @cpp main() @ce
*
* See @ref MAGNUM_WINDOWLESSIOSAPPLICATION_MAIN() for usage
* information.
@ -273,8 +276,8 @@ class WindowlessIosApplication {
/**
* @brief Try to create context with given configuration
*
* Unlike @ref createContext() returns `false` if the context cannot be
* created, `true` otherwise.
* Unlike @ref createContext() returns @cpp false @ce if the context
* cannot be created, @cpp true @ce otherwise.
*/
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
code and is equivalent to the following, see @ref portability-applications for
more information.
@code
@code{.cpp}
int main(int argc, char** argv) {
className app({argc, argv});
return app.exec();
}
@endcode
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) \
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
manually. See @ref platform-windowless-contexts for more information. If no
other application header is included, this class is also aliased to
`Platform::WindowlessGLContext`.
@cpp Platform::WindowlessGLContext @ce.
*/
class WindowlessWglContext {
public:
@ -119,8 +119,8 @@ class WindowlessWglContext {
/**
* @brief Make the context current
*
* Prints error message and returns `false` on failure, otherwise
* returns `true`.
* Prints error message and returns @cpp false @ce on failure,
* otherwise returns @cpp true @ce.
*/
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
`WITH_WINDOWLESSWGLAPPLICATION` is enabled in CMake.
## Bootstrap application
@section Platform-WindowlessWglApplication-bootstrap Bootstrap application
Fully contained windowless application using @ref WindowlessWglApplication
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
application with these four commands:
mkdir build && cd build
cmake ..
cmake --build .
./src/MyApplication # or ./src/Debug/MyApplication
@code{.bat}
mkdir build && cd build
cmake ..
cmake --build .
./src/MyApplication # or ./src/Debug/MyApplication
@endcode
See @ref cmake for more information.
## General usage
@section Platform-WindowlessWglApplication-usage General usage
In CMake you need to request `WindowlessWglApplication` component of `Magnum`
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
@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
@ref platform for more information.
@code
@code{.cpp}
class MyApplication: public Platform::WindowlessWglApplication {
// implement required methods...
};
@ -223,8 +226,8 @@ MAGNUM_WINDOWLESSWGLAPPLICATION_MAIN(MyApplication)
@endcode
If no other application header is included, this class is also aliased to
`Platform::WindowlessApplication` and the macro is aliased to
`MAGNUM_WINDOWLESSAPPLICATION_MAIN()` to simplify porting.
@cpp Platform::WindowlessApplication @ce and the macro is aliased to
@cpp MAGNUM_WINDOWLESSAPPLICATION_MAIN() @ce to simplify porting.
*/
class WindowlessWglApplication {
public:
@ -327,8 +330,8 @@ class WindowlessWglApplication {
/**
* @brief Try to create context with given configuration
*
* Unlike @ref createContext() returns `false` if the context cannot be
* created, `true` otherwise.
* Unlike @ref createContext() returns @cpp false @ce if the context
* cannot be created, @cpp true @ce otherwise.
*/
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
code and is equivalent to the following, see @ref portability-applications for
more information.
@code
@code{.cpp}
int main(int argc, char** argv) {
className app({argc, argv});
return app.exec();
}
@endcode
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) \
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
manually. See @ref platform-windowless-contexts for more information. If no
other application header is included, this class is also aliased to
`Platform::WindowlessGLContext`.
@cpp Platform::WindowlessGLContext @ce.
*/
class WindowlessWindowsEglContext {
public:
@ -105,8 +105,8 @@ class WindowlessWindowsEglContext {
/**
* @brief Make the context current
*
* Prints error message and returns `false` on failure, otherwise
* returns `true`.
* Prints error message and returns @cpp false @ce on failure,
* otherwise returns @cpp true @ce.
*/
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
is built if `WITH_WINDOWLESSWINDOWSEGLAPPLICATION` is enabled in CMake.
## Bootstrap application
@section Platform-WindowlessWindowsEglApplication-bootstrap Bootstrap application
Fully contained windowless application using @ref WindowlessWindowsEglApplication
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
application with these four commands:
mkdir build && cd build
cmake ..
cmake --build .
./src/MyApplication # or ./src/Debug/MyApplication
@code{.sh}
mkdir build && cd build
cmake ..
cmake --build .
./src/MyApplication # or ./src/Debug/MyApplication
@endcode
See @ref cmake for more information.
## General usage
@section Platform-WindowlessWindowsEglApplication-usage General usage
In CMake you need to request `WindowlessWindowsEglApplication` component of
`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
function using @ref MAGNUM_WINDOWLESSWINDOWSEGLAPPLICATION_MAIN() macro. See
@ref platform for more information.
@code
@code{.cpp}
class MyApplication: public Platform::WindowlessWindowsEglApplication {
// implement required methods...
};
@ -210,8 +213,8 @@ MAGNUM_WINDOWLESSWINDOWSEGLAPPLICATION_MAIN(MyApplication)
@endcode
If no other application header is included, this class is also aliased to
`Platform::WindowlessApplication` and the macro is aliased to
`MAGNUM_WINDOWLESSAPPLICATION_MAIN()` to simplify porting.
@cpp Platform::WindowlessApplication @ce and the macro is aliased to
@cpp MAGNUM_WINDOWLESSAPPLICATION_MAIN() @ce to simplify porting.
*/
class WindowlessWindowsEglApplication {
public:
@ -281,7 +284,7 @@ class WindowlessWindowsEglApplication {
/**
* @brief Execute application
* @return Value for returning from `main()`
* @return Value for returning from @cpp main() @ce
*
* See @ref MAGNUM_WINDOWLESSWINDOWSEGLAPPLICATION_MAIN() for usage
* information.
@ -312,8 +315,8 @@ class WindowlessWindowsEglApplication {
/**
* @brief Try to create context with given configuration
*
* Unlike @ref createContext() returns `false` if the context cannot be
* created, `true` otherwise.
* Unlike @ref createContext() returns @cpp false @ce if the context
* cannot be created, @cpp true @ce otherwise.
*/
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
code and is equivalent to the following, see @ref portability-applications for
more information.
@code
@code{.cpp}
int main(int argc, char** argv) {
className app({argc, argv});
return app.exec();
}
@endcode
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) \
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**
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
base application along with CMake setup is available, see its documentation for
more information.
## General usage
@section Platform-XEglApplication-usage General usage
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
@ -59,10 +59,11 @@ can also use generic `Magnum::Application` alias to simplify porting. 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
on the screen. The subclass can be then used directly in `main()` -- see
convenience macro @ref MAGNUM_XEGLAPPLICATION_MAIN(). See @ref platform for
more information.
@code
on the screen. The subclass can be then used directly in @cpp main() @ce
--- see convenience macro @ref MAGNUM_XEGLAPPLICATION_MAIN(). See @ref platform
for more information.
@code{.cpp}
class MyApplication: public Platform::XEglApplication {
// implement required methods...
};
@ -70,8 +71,8 @@ MAGNUM_XEGLAPPLICATION_MAIN(MyApplication)
@endcode
If no other application header is included, this class is also aliased to
`Platform::Application` and the macro is aliased to `MAGNUM_APPLICATION_MAIN()`
to simplify porting.
@cpp Platform::Application @ce and the macro is aliased to
@cpp MAGNUM_APPLICATION_MAIN() @ce to simplify porting.
*/
class XEglApplication: public AbstractXApplication {
public:
@ -114,14 +115,16 @@ See @ref Magnum::Platform::XEglApplication "Platform::XEglApplication" for
usage information. This macro abstracts out platform-specific entry point code
and is equivalent to the following, see @ref portability-applications for more
information.
@code
@code{.cpp}
int main(int argc, char** argv) {
className app({argc, argv});
return app.exec();
}
@endcode
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) \
int main(int argc, char** argv) { \

Loading…
Cancel
Save