diff --git a/doc/generated/CMakeLists.txt b/doc/generated/CMakeLists.txt index 0c591a08d..324f2f0a4 100644 --- a/doc/generated/CMakeLists.txt +++ b/doc/generated/CMakeLists.txt @@ -31,7 +31,8 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/../../modules/") find_package(Magnum REQUIRED MeshTools Primitives - Shaders) + Shaders + Sdl2Application) if(CORRADE_TARGET_APPLE) find_package(Magnum REQUIRED WindowlessCglApplication) @@ -49,8 +50,14 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CORRADE_CXX_FLAGS}") include_directories(${MAGNUM_INCLUDE_DIRS} + ${MAGNUM_APPLICATION_INCLUDE_DIRS} ${MAGNUM_WINDOWLESSAPPLICATION_INCLUDE_DIRS}) +add_executable(hello hello.cpp) +target_link_libraries(hello + ${MAGNUM_LIBRARIES} + ${MAGNUM_APPLICATION_LIBRARIES}) + add_executable(shaders shaders.cpp) target_link_libraries(shaders ${MAGNUM_LIBRARIES} diff --git a/doc/generated/README.md b/doc/generated/README.md index 23b8f5c64..e3f8bdbdc 100644 --- a/doc/generated/README.md +++ b/doc/generated/README.md @@ -1,9 +1,9 @@ Source files for images in Magnum documentation ----------------------------------------------- -Compile and install Magnum with windowless application for your platform and -`magnum-distancefieldconverter` utility and any `PngImporter` and -`PngImageConverter` plugins from Magnum Plugins. +Compile and install Magnum with `Sdl2Application`, windowless application for +your platform and `magnum-distancefieldconverter` utility and any `PngImporter` +and `PngImageConverter` plugins from Magnum Plugins. Create build dir, point CMake to this directory and compile the executables: @@ -12,6 +12,21 @@ Create build dir, point CMake to this directory and compile the executables: cmake ../doc/generated cmake --build . +### "Getting started" image + +Displayed by the `hello` executable. Run the app and take screenshot using +KSnapshot (including decorations, 880x707). Similarly for the gray version. The +resulting files should be resized to half the size and without alpha channel +using imagemagick: + +```bash +mogrify -flatten -background '#ffffff' -resize 440 getting-started.png +mogrify -flatten -background '#ffffff' -resize 440 getting-started-blue.png +``` + +The output printed by the application can be used to update the example output +in `doc/getting-started.dox`. + ### Shader images Generated by the `shaders` executable. Must be run in this directory, the diff --git a/doc/generated/hello.cpp b/doc/generated/hello.cpp new file mode 100644 index 000000000..c5f495249 --- /dev/null +++ b/doc/generated/hello.cpp @@ -0,0 +1,54 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013, 2014 + Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include +#include +#include +#include +#include +#include + +using namespace Magnum; + +class Hello: public Platform::Application { +public: + explicit Hello(const Arguments& arguments); + +private: + void drawEvent() override; +}; + +Hello::Hello(const Arguments& arguments): Platform::Application(arguments) { + Renderer::setClearColor(Color3::fromHSV(216.0_degf, 0.85f, 1.0f)); + Debug() << "Hello! This application is running on" << Context::current()->version() + << "using" << Context::current()->rendererString(); +} + +void Hello::drawEvent() { + defaultFramebuffer.clear(FramebufferClear::Color); + swapBuffers(); +} + +MAGNUM_APPLICATION_MAIN(Hello) diff --git a/doc/getting-started-blue.png b/doc/getting-started-blue.png index 10e381ddb..df4aac6ab 100644 Binary files a/doc/getting-started-blue.png and b/doc/getting-started-blue.png differ diff --git a/doc/getting-started.dox b/doc/getting-started.dox index 084cc03c3..7a25aaf14 100644 --- a/doc/getting-started.dox +++ b/doc/getting-started.dox @@ -196,7 +196,7 @@ First include the needed headers: And in the constructor (which is currently empty) change the clear color and print something to debug output: @code -Renderer::setClearColor({0.07f, 0.44f, 0.73f}); +Renderer::setClearColor(Color3::fromHSV(216.0_degf, 0.85f, 1.0f)); Debug() << "Hello! This application is running on" << Context::current()->version() << "using" << Context::current()->rendererString(); @@ -205,7 +205,7 @@ Debug() << "Hello! This application is running on" << Context::current()->versio After rebuilding and starting the application, the clear color changes to blueish one and something like this would be printed to the console: -> Hello! This application is running on OpenGL 3.3 using Geforce GT 330M +> Hello! This application is running on OpenGL 4.5 using GeForce GT 740M @image html getting-started-blue.png @image latex getting-started-blue.png diff --git a/doc/getting-started.png b/doc/getting-started.png index 2df2b37b3..85089868a 100644 Binary files a/doc/getting-started.png and b/doc/getting-started.png differ