17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Samples/basic/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # The following sample does not require any default font engine.
2 | add_subdirectory("bitmap_font")
3 |
4 | # Only enable the remaining samples if a default font engine is selected.
5 | if(RMLUI_FONT_ENGINE_ENABLED)
6 | add_subdirectory("animation")
7 | add_subdirectory("benchmark")
8 | add_subdirectory("custom_log")
9 | add_subdirectory("data_binding")
10 | add_subdirectory("demo")
11 | add_subdirectory("drag")
12 | add_subdirectory("effects")
13 | add_subdirectory("load_document")
14 | add_subdirectory("transform")
15 | add_subdirectory("tree_view")
16 |
17 | if(RMLUI_HARFBUZZ_SAMPLE)
18 | add_subdirectory("harfbuzz")
19 | else()
20 | message(STATUS "HarfBuzz sample disabled due to RMLUI_HARFBUZZ_SAMPLE=OFF")
21 | endif()
22 | if(RMLUI_LOTTIE_PLUGIN)
23 | add_subdirectory("lottie")
24 | else()
25 | message(STATUS "Lottie sample disabled due to RMLUI_LOTTIE_PLUGIN=OFF")
26 | endif()
27 | if(RMLUI_SVG_PLUGIN)
28 | add_subdirectory("svg")
29 | else()
30 | message(STATUS "SVG sample disabled due to RMLUI_SVG_PLUGIN=OFF")
31 | endif()
32 |
33 | # Enable the IME sample only for Windows backends; no other platform backend is currently supported.
34 | if(RMLUI_BACKEND MATCHES "^Win32")
35 | add_subdirectory("ime")
36 | else()
37 | message(STATUS "IME sample disabled - only available with Win32 backends, see RMLUI_BACKEND")
38 | endif()
39 | endif()
40 |
--------------------------------------------------------------------------------
/Samples/basic/animation/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(SAMPLE_NAME "animation")
2 | set(TARGET_NAME "${RMLUI_SAMPLE_PREFIX}${SAMPLE_NAME}")
3 |
4 | add_executable(${TARGET_NAME} WIN32
5 | src/main.cpp
6 | )
7 |
8 | set_common_target_options(${TARGET_NAME})
9 |
10 | target_link_libraries(${TARGET_NAME} PRIVATE rmlui_shell)
11 |
12 | install_sample_target(${TARGET_NAME})
13 |
--------------------------------------------------------------------------------
/Samples/basic/benchmark/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(SAMPLE_NAME "benchmark")
2 | set(TARGET_NAME "${RMLUI_SAMPLE_PREFIX}${SAMPLE_NAME}")
3 |
4 | add_executable(${TARGET_NAME} WIN32
5 | src/main.cpp
6 | )
7 |
8 | set_common_target_options(${TARGET_NAME})
9 |
10 | target_link_libraries(${TARGET_NAME} PRIVATE rmlui_shell)
11 |
12 | install_sample_target(${TARGET_NAME})
13 |
--------------------------------------------------------------------------------
/Samples/basic/benchmark/data/benchmark.rml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Benchmark Sample
5 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/Samples/basic/bitmap_font/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(SAMPLE_NAME "bitmap_font")
2 | set(TARGET_NAME "${RMLUI_SAMPLE_PREFIX}${SAMPLE_NAME}")
3 |
4 | add_executable(${TARGET_NAME} WIN32
5 | src/FontEngineBitmap.cpp
6 | src/FontEngineBitmap.h
7 | src/FontEngineInterfaceBitmap.cpp
8 | src/FontEngineInterfaceBitmap.h
9 | src/main.cpp
10 | )
11 |
12 | set_common_target_options(${TARGET_NAME})
13 |
14 | target_link_libraries(${TARGET_NAME} PRIVATE rmlui_shell)
15 |
16 | install_sample_target(${TARGET_NAME})
17 |
--------------------------------------------------------------------------------
/Samples/basic/bitmap_font/data/Comfortaa_Regular_22.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikke89/RmlUi/0c96c0eed25c5d86ae300887eae4a0333b34b22b/Samples/basic/bitmap_font/data/Comfortaa_Regular_22.tga
--------------------------------------------------------------------------------
/Samples/basic/custom_log/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(SAMPLE_NAME "custom_log")
2 | set(TARGET_NAME "${RMLUI_SAMPLE_PREFIX}${SAMPLE_NAME}")
3 |
4 | add_executable(${TARGET_NAME} WIN32
5 | src/main.cpp
6 | src/SystemInterface.cpp
7 | src/SystemInterface.h
8 | )
9 |
10 | set_common_target_options(${TARGET_NAME})
11 |
12 | target_link_libraries(${TARGET_NAME} PRIVATE rmlui_shell)
13 |
14 | install_sample_target(${TARGET_NAME})
15 |
--------------------------------------------------------------------------------
/Samples/basic/data_binding/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(SAMPLE_NAME "data_binding")
2 | set(TARGET_NAME "${RMLUI_SAMPLE_PREFIX}${SAMPLE_NAME}")
3 |
4 | add_executable(${TARGET_NAME} WIN32
5 | src/main.cpp
6 | )
7 |
8 | set_common_target_options(${TARGET_NAME})
9 |
10 | target_link_libraries(${TARGET_NAME} PRIVATE rmlui_shell)
11 |
12 | install_sample_target(${TARGET_NAME})
13 |
--------------------------------------------------------------------------------
/Samples/basic/demo/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(SAMPLE_NAME "demo")
2 | set(TARGET_NAME "${RMLUI_SAMPLE_PREFIX}${SAMPLE_NAME}")
3 |
4 | add_executable(${TARGET_NAME} WIN32
5 | src/main.cpp
6 | src/DemoEventListener.cpp
7 | src/DemoEventListener.h
8 | src/DemoWindow.cpp
9 | src/DemoWindow.h
10 | )
11 |
12 | set_common_target_options(${TARGET_NAME})
13 |
14 | target_link_libraries(${TARGET_NAME} PRIVATE rmlui_shell)
15 |
16 | install_sample_target(${TARGET_NAME})
17 |
18 | if(MSVC)
19 | # Set UTF-8 on MSVC to properly encode emoji characters.
20 | target_compile_options(${TARGET_NAME} PRIVATE /utf-8)
21 | endif()
22 |
--------------------------------------------------------------------------------
/Samples/basic/drag/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(SAMPLE_NAME "drag")
2 | set(TARGET_NAME "${RMLUI_SAMPLE_PREFIX}${SAMPLE_NAME}")
3 |
4 | add_executable(${TARGET_NAME} WIN32
5 | src/DragListener.cpp
6 | src/DragListener.h
7 | src/Inventory.cpp
8 | src/Inventory.h
9 | src/main.cpp
10 | )
11 |
12 | set_common_target_options(${TARGET_NAME})
13 |
14 | target_link_libraries(${TARGET_NAME} PRIVATE rmlui_shell)
15 |
16 | install_sample_target(${TARGET_NAME})
17 |
--------------------------------------------------------------------------------
/Samples/basic/drag/data/icon.rcss:
--------------------------------------------------------------------------------
1 | icon
2 | {
3 | /* The icons are floated left so they appear left-to-right. */
4 | float: left;
5 |
6 | /* The padding is added to push the text down to the bottom of the element. */
7 | box-sizing: border-box;
8 | width: 100dp;
9 | height: 100dp;
10 | padding: 60dp 10dp 0 10dp;
11 | margin: 10dp;
12 |
13 | decorator: image( ../../../assets/present.tga );
14 |
15 | font-size: 12dp;
16 | text-align: center;
17 | font-effect: shadow(1dp 1dp black);
18 |
19 | cursor: move;
20 |
21 | drag: clone;
22 | }
23 |
--------------------------------------------------------------------------------
/Samples/basic/drag/data/inventory.rml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Inventory
6 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/Samples/basic/effects/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | if(NOT RMLUI_BACKEND MATCHES "GL3$")
2 | message(STATUS "Effects sample disabled - only available on GL3 backends")
3 | return()
4 | endif()
5 |
6 | set(SAMPLE_NAME "effects")
7 | set(TARGET_NAME "${RMLUI_SAMPLE_PREFIX}${SAMPLE_NAME}")
8 |
9 | add_executable(${TARGET_NAME} WIN32
10 | src/main.cpp
11 | )
12 |
13 | set_common_target_options(${TARGET_NAME})
14 |
15 | target_link_libraries(${TARGET_NAME} PRIVATE rmlui_shell)
16 |
17 | install_sample_target(${TARGET_NAME})
18 |
--------------------------------------------------------------------------------
/Samples/basic/harfbuzz/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(SAMPLE_NAME "harfbuzz")
2 | set(TARGET_NAME "${RMLUI_SAMPLE_PREFIX}${SAMPLE_NAME}")
3 |
4 | add_executable(${TARGET_NAME} WIN32
5 | src/FontEngineInterfaceHarfBuzz.cpp
6 | src/FontEngineInterfaceHarfBuzz.h
7 | src/FontFace.cpp
8 | src/FontFace.h
9 | src/FontFaceHandleHarfBuzz.cpp
10 | src/FontFaceHandleHarfBuzz.h
11 | src/FontFaceLayer.cpp
12 | src/FontFaceLayer.h
13 | src/FontFamily.cpp
14 | src/FontFamily.h
15 | src/FontGlyph.h
16 | src/FontProvider.cpp
17 | src/FontProvider.h
18 | src/FreeTypeInterface.cpp
19 | src/FreeTypeInterface.h
20 | src/LanguageData.h
21 | src/TextureLayout.cpp
22 | src/TextureLayout.h
23 | src/TextureLayoutRectangle.cpp
24 | src/TextureLayoutRectangle.h
25 | src/TextureLayoutRow.cpp
26 | src/TextureLayoutRow.h
27 | src/TextureLayoutTexture.cpp
28 | src/TextureLayoutTexture.h
29 | src/main.cpp
30 | )
31 |
32 | set_common_target_options(${TARGET_NAME})
33 |
34 | target_link_libraries(${TARGET_NAME} PRIVATE rmlui_shell Freetype::Freetype harfbuzz::harfbuzz)
35 |
36 | # Use private Core headers as a workaround for now, until we merge the HarfBuzz font engine into Core.
37 | target_include_directories(${TARGET_NAME} PRIVATE ${PROJECT_SOURCE_DIR}/Source/Core)
38 | # Remove this check once the HarfBuzz font engine has been merged into Core.
39 | if(WIN32 AND BUILD_SHARED_LIBS)
40 | message(FATAL_ERROR "The HarfBuzz sample cannot be built when using shared libraries on Windows. Please disable either BUILD_SHARED_LIBS or RMLUI_HARFBUZZ_SAMPLE.")
41 | endif()
42 |
43 | install_sample_target(${TARGET_NAME})
44 |
--------------------------------------------------------------------------------
/Samples/basic/harfbuzz/data/Cairo-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikke89/RmlUi/0c96c0eed25c5d86ae300887eae4a0333b34b22b/Samples/basic/harfbuzz/data/Cairo-Regular.ttf
--------------------------------------------------------------------------------
/Samples/basic/harfbuzz/data/Poppins-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikke89/RmlUi/0c96c0eed25c5d86ae300887eae4a0333b34b22b/Samples/basic/harfbuzz/data/Poppins-Regular.ttf
--------------------------------------------------------------------------------
/Samples/basic/ime/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(SAMPLE_NAME "ime")
2 | set(TARGET_NAME "${RMLUI_SAMPLE_PREFIX}${SAMPLE_NAME}")
3 |
4 | add_executable(${TARGET_NAME} WIN32
5 | src/SystemFontWin32.cpp
6 | src/SystemFontWin32.h
7 | src/main.cpp
8 | )
9 |
10 | set_common_target_options(${TARGET_NAME})
11 |
12 | target_link_libraries(${TARGET_NAME} PRIVATE rmlui_shell)
13 |
14 | install_sample_target(${TARGET_NAME})
15 |
--------------------------------------------------------------------------------
/Samples/basic/ime/src/SystemFontWin32.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This source file is part of RmlUi, the HTML/CSS Interface Middleware
3 | *
4 | * For the latest information, see http://github.com/mikke89/RmlUi
5 | *
6 | * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
7 | * Copyright (c) 2019-2024 The RmlUi Team, and contributors
8 | *
9 | * Permission is hereby granted, free of charge, to any person obtaining a copy
10 | * of this software and associated documentation files (the "Software"), to deal
11 | * in the Software without restriction, including without limitation the rights
12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | * copies of the Software, and to permit persons to whom the Software is
14 | * furnished to do so, subject to the following conditions:
15 | *
16 | * The above copyright notice and this permission notice shall be included in
17 | * all copies or substantial portions of the Software.
18 | *
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 | * THE SOFTWARE.
26 | *
27 | */
28 |
29 | #ifndef RMLUI_SAMPLES_IME_SYSTEMFONTWIN32_H
30 | #define RMLUI_SAMPLES_IME_SYSTEMFONTWIN32_H
31 |
32 | #include
33 |
34 | Rml::Vector GetSelectedSystemFonts();
35 |
36 | #endif
37 |
--------------------------------------------------------------------------------
/Samples/basic/load_document/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(SAMPLE_NAME "load_document")
2 | set(TARGET_NAME "${RMLUI_SAMPLE_PREFIX}${SAMPLE_NAME}")
3 |
4 | add_executable(${TARGET_NAME} WIN32
5 | src/main.cpp
6 | )
7 |
8 | set_common_target_options(${TARGET_NAME})
9 |
10 | target_link_libraries(${TARGET_NAME} PRIVATE rmlui_shell)
11 |
12 | install_sample_target(${TARGET_NAME})
13 |
--------------------------------------------------------------------------------
/Samples/basic/lottie/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(SAMPLE_NAME "lottie")
2 | set(TARGET_NAME "${RMLUI_SAMPLE_PREFIX}${SAMPLE_NAME}")
3 |
4 | add_executable(${TARGET_NAME} WIN32
5 | src/main.cpp
6 | )
7 |
8 | set_common_target_options(${TARGET_NAME})
9 |
10 | target_link_libraries(${TARGET_NAME} PRIVATE rmlui_shell)
11 |
12 | install_sample_target(${TARGET_NAME})
13 |
--------------------------------------------------------------------------------
/Samples/basic/lottie/data/LICENSE.txt:
--------------------------------------------------------------------------------
1 | The file 'a_mountain.json' included in this directory is from the rlottie project [1], licensed under MIT. The license is restated below.
2 | [1] https://github.com/Samsung/rlottie
3 |
4 | ----------------------------
5 |
6 | Copyright 2020 (see AUTHORS)
7 |
8 | 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:
9 |
10 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
11 |
12 | 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.
13 |
--------------------------------------------------------------------------------
/Samples/basic/lottie/data/lottie.rml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Demo
4 |
5 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/Samples/basic/svg/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(SAMPLE_NAME "svg")
2 | set(TARGET_NAME "${RMLUI_SAMPLE_PREFIX}${SAMPLE_NAME}")
3 |
4 | add_executable(${TARGET_NAME} WIN32
5 | src/main.cpp
6 | )
7 |
8 | set_common_target_options(${TARGET_NAME})
9 |
10 | target_link_libraries(${TARGET_NAME} PRIVATE rmlui_shell)
11 |
12 | install_sample_target(${TARGET_NAME})
13 |
--------------------------------------------------------------------------------
/Samples/basic/svg/data/svg_decorator.rml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Demo
4 |
5 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Samples/basic/svg/data/svg_element.rml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Demo
4 |
5 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Samples/basic/transform/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(SAMPLE_NAME "transform")
2 | set(TARGET_NAME "${RMLUI_SAMPLE_PREFIX}${SAMPLE_NAME}")
3 |
4 | add_executable(${TARGET_NAME} WIN32
5 | src/main.cpp
6 | )
7 |
8 | set_common_target_options(${TARGET_NAME})
9 |
10 | target_link_libraries(${TARGET_NAME} PRIVATE rmlui_shell)
11 |
12 | install_sample_target(${TARGET_NAME})
13 |
--------------------------------------------------------------------------------
/Samples/basic/tree_view/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(SAMPLE_NAME "tree_view")
2 | set(TARGET_NAME "${RMLUI_SAMPLE_PREFIX}${SAMPLE_NAME}")
3 |
4 | add_executable(${TARGET_NAME} WIN32
5 | src/FileBrowser.cpp
6 | src/FileBrowser.h
7 | src/main.cpp
8 | )
9 |
10 | set_common_target_options(${TARGET_NAME})
11 |
12 | target_link_libraries(${TARGET_NAME} PRIVATE rmlui_shell)
13 |
14 | install_sample_target(${TARGET_NAME})
15 |
--------------------------------------------------------------------------------
/Samples/basic/tree_view/data/tree_view.rml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Tree View
5 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 | {{ file.name }}
49 |
50 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/Samples/basic/tree_view/src/FileBrowser.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This source file is part of RmlUi, the HTML/CSS Interface Middleware
3 | *
4 | * For the latest information, see http://github.com/mikke89/RmlUi
5 | *
6 | * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
7 | * Copyright (c) 2019-2023 The RmlUi Team, and contributors
8 | *
9 | * Permission is hereby granted, free of charge, to any person obtaining a copy
10 | * of this software and associated documentation files (the "Software"), to deal
11 | * in the Software without restriction, including without limitation the rights
12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | * copies of the Software, and to permit persons to whom the Software is
14 | * furnished to do so, subject to the following conditions:
15 | *
16 | * The above copyright notice and this permission notice shall be included in
17 | * all copies or substantial portions of the Software.
18 | *
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 | * THE SOFTWARE.
26 | *
27 | */
28 |
29 | #ifndef FILEBROWSER_H
30 | #define FILEBROWSER_H
31 |
32 | #include
33 |
34 | namespace FileBrowser {
35 |
36 | bool Initialise(Rml::Context* context, const Rml::String& root_dir);
37 |
38 | }
39 |
40 | #endif
41 |
--------------------------------------------------------------------------------
/Samples/invaders/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(SAMPLE_NAME "invaders")
2 | set(TARGET_NAME "${RMLUI_SAMPLE_PREFIX}${SAMPLE_NAME}")
3 |
4 | add_executable(${TARGET_NAME} WIN32
5 | src/DecoratorDefender.cpp
6 | src/DecoratorDefender.h
7 | src/DecoratorStarfield.cpp
8 | src/DecoratorStarfield.h
9 | src/Defender.cpp
10 | src/Defender.h
11 | src/ElementGame.cpp
12 | src/ElementGame.h
13 | src/EventHandler.cpp
14 | src/EventHandler.h
15 | src/EventHandlerHighScore.cpp
16 | src/EventHandlerHighScore.h
17 | src/EventHandlerOptions.cpp
18 | src/EventHandlerOptions.h
19 | src/EventHandlerStartGame.cpp
20 | src/EventHandlerStartGame.h
21 | src/EventListener.cpp
22 | src/EventListener.h
23 | src/EventListenerInstancer.cpp
24 | src/EventListenerInstancer.h
25 | src/EventManager.cpp
26 | src/EventManager.h
27 | src/Game.cpp
28 | src/Game.h
29 | src/GameDetails.cpp
30 | src/GameDetails.h
31 | src/HighScores.cpp
32 | src/HighScores.h
33 | src/Invader.cpp
34 | src/Invader.h
35 | src/main.cpp
36 | src/Mothership.cpp
37 | src/Mothership.h
38 | src/Shield.cpp
39 | src/Shield.h
40 | src/Sprite.cpp
41 | src/Sprite.h
42 | )
43 |
44 | set_common_target_options(${TARGET_NAME})
45 |
46 | target_link_libraries(${TARGET_NAME} PRIVATE rmlui_shell)
47 |
48 | install_sample_target(${TARGET_NAME})
49 |
--------------------------------------------------------------------------------
/Samples/invaders/data/background.rml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/Samples/invaders/data/background.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikke89/RmlUi/0c96c0eed25c5d86ae300887eae4a0333b34b22b/Samples/invaders/data/background.tga
--------------------------------------------------------------------------------
/Samples/invaders/data/help_defender.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikke89/RmlUi/0c96c0eed25c5d86ae300887eae4a0333b34b22b/Samples/invaders/data/help_defender.tga
--------------------------------------------------------------------------------
/Samples/invaders/data/help_invader_mothership.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikke89/RmlUi/0c96c0eed25c5d86ae300887eae4a0333b34b22b/Samples/invaders/data/help_invader_mothership.tga
--------------------------------------------------------------------------------
/Samples/invaders/data/help_invader_rank1.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikke89/RmlUi/0c96c0eed25c5d86ae300887eae4a0333b34b22b/Samples/invaders/data/help_invader_rank1.tga
--------------------------------------------------------------------------------
/Samples/invaders/data/help_invader_rank2.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikke89/RmlUi/0c96c0eed25c5d86ae300887eae4a0333b34b22b/Samples/invaders/data/help_invader_rank2.tga
--------------------------------------------------------------------------------
/Samples/invaders/data/help_invader_rank3.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikke89/RmlUi/0c96c0eed25c5d86ae300887eae4a0333b34b22b/Samples/invaders/data/help_invader_rank3.tga
--------------------------------------------------------------------------------
/Samples/invaders/data/high_scores_defender.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikke89/RmlUi/0c96c0eed25c5d86ae300887eae4a0333b34b22b/Samples/invaders/data/high_scores_defender.tga
--------------------------------------------------------------------------------
/Samples/invaders/data/invaders.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikke89/RmlUi/0c96c0eed25c5d86ae300887eae4a0333b34b22b/Samples/invaders/data/invaders.tga
--------------------------------------------------------------------------------
/Samples/invaders/data/logo.rml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Samples/invaders/data/logo.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikke89/RmlUi/0c96c0eed25c5d86ae300887eae4a0333b34b22b/Samples/invaders/data/logo.tga
--------------------------------------------------------------------------------
/Samples/invaders/data/main_menu.rml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Main Menu
4 |
5 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/Samples/invaders/data/options.rml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Options
4 |
5 |
26 |
27 |
28 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/Samples/invaders/data/pause.rml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Quit?
4 |
5 |
19 |
20 |
21 |
22 |
Are you sure you want to end this game?
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Samples/invaders/src/EventHandler.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * This source file is part of RmlUi, the HTML/CSS Interface Middleware
3 | *
4 | * For the latest information, see http://github.com/mikke89/RmlUi
5 | *
6 | * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
7 | * Copyright (c) 2019-2023 The RmlUi Team, and contributors
8 | *
9 | * Permission is hereby granted, free of charge, to any person obtaining a copy
10 | * of this software and associated documentation files (the "Software"), to deal
11 | * in the Software without restriction, including without limitation the rights
12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | * copies of the Software, and to permit persons to whom the Software is
14 | * furnished to do so, subject to the following conditions:
15 | *
16 | * The above copyright notice and this permission notice shall be included in
17 | * all copies or substantial portions of the Software.
18 | *
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 | * THE SOFTWARE.
26 | *
27 | */
28 |
29 | #include "EventHandler.h"
30 |
31 | EventHandler::~EventHandler() {}
32 |
--------------------------------------------------------------------------------
/Samples/invaders/src/EventHandler.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This source file is part of RmlUi, the HTML/CSS Interface Middleware
3 | *
4 | * For the latest information, see http://github.com/mikke89/RmlUi
5 | *
6 | * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
7 | * Copyright (c) 2019-2023 The RmlUi Team, and contributors
8 | *
9 | * Permission is hereby granted, free of charge, to any person obtaining a copy
10 | * of this software and associated documentation files (the "Software"), to deal
11 | * in the Software without restriction, including without limitation the rights
12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | * copies of the Software, and to permit persons to whom the Software is
14 | * furnished to do so, subject to the following conditions:
15 | *
16 | * The above copyright notice and this permission notice shall be included in
17 | * all copies or substantial portions of the Software.
18 | *
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 | * THE SOFTWARE.
26 | *
27 | */
28 |
29 | #ifndef RMLUI_INVADERS_EVENTHANDLER_H
30 | #define RMLUI_INVADERS_EVENTHANDLER_H
31 |
32 | #include
33 |
34 | /**
35 | @author Peter Curry
36 | */
37 |
38 | class EventHandler {
39 | public:
40 | virtual ~EventHandler();
41 | virtual void ProcessEvent(Rml::Event& event, const Rml::String& value) = 0;
42 | };
43 |
44 | #endif
45 |
--------------------------------------------------------------------------------
/Samples/lua_invaders/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(SAMPLE_NAME "lua_invaders")
2 | set(TARGET_NAME "${RMLUI_SAMPLE_PREFIX}${SAMPLE_NAME}")
3 |
4 | add_executable(${TARGET_NAME} WIN32
5 | src/DecoratorDefender.cpp
6 | src/DecoratorDefender.h
7 | src/DecoratorStarfield.cpp
8 | src/DecoratorStarfield.h
9 | src/Defender.cpp
10 | src/Defender.h
11 | src/ElementGame.cpp
12 | src/ElementGame.h
13 | src/ElementGameInstancer.cpp
14 | src/ElementGameInstancer.h
15 | src/Game.cpp
16 | src/Game.h
17 | src/GameDetails.cpp
18 | src/GameDetails.h
19 | src/HighScores.cpp
20 | src/HighScores.h
21 | src/Invader.cpp
22 | src/Invader.h
23 | src/LuaInterface.cpp
24 | src/LuaInterface.h
25 | src/main.cpp
26 | src/Mothership.cpp
27 | src/Mothership.h
28 | src/Shield.cpp
29 | src/Shield.h
30 | src/Sprite.cpp
31 | src/Sprite.h
32 | )
33 |
34 | set_common_target_options(${TARGET_NAME})
35 |
36 | target_link_libraries(${TARGET_NAME} PRIVATE
37 | rmlui_shell
38 | rmlui_lua
39 | RmlUi::External::Lua
40 | )
41 |
42 | install_sample_target(${TARGET_NAME})
43 |
--------------------------------------------------------------------------------
/Samples/lua_invaders/data/background.rml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/Samples/lua_invaders/data/background.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikke89/RmlUi/0c96c0eed25c5d86ae300887eae4a0333b34b22b/Samples/lua_invaders/data/background.tga
--------------------------------------------------------------------------------
/Samples/lua_invaders/data/help_defender.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikke89/RmlUi/0c96c0eed25c5d86ae300887eae4a0333b34b22b/Samples/lua_invaders/data/help_defender.tga
--------------------------------------------------------------------------------
/Samples/lua_invaders/data/help_invader_mothership.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikke89/RmlUi/0c96c0eed25c5d86ae300887eae4a0333b34b22b/Samples/lua_invaders/data/help_invader_mothership.tga
--------------------------------------------------------------------------------
/Samples/lua_invaders/data/help_invader_rank1.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikke89/RmlUi/0c96c0eed25c5d86ae300887eae4a0333b34b22b/Samples/lua_invaders/data/help_invader_rank1.tga
--------------------------------------------------------------------------------
/Samples/lua_invaders/data/help_invader_rank2.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikke89/RmlUi/0c96c0eed25c5d86ae300887eae4a0333b34b22b/Samples/lua_invaders/data/help_invader_rank2.tga
--------------------------------------------------------------------------------
/Samples/lua_invaders/data/help_invader_rank3.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikke89/RmlUi/0c96c0eed25c5d86ae300887eae4a0333b34b22b/Samples/lua_invaders/data/help_invader_rank3.tga
--------------------------------------------------------------------------------
/Samples/lua_invaders/data/high_scores_defender.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikke89/RmlUi/0c96c0eed25c5d86ae300887eae4a0333b34b22b/Samples/lua_invaders/data/high_scores_defender.tga
--------------------------------------------------------------------------------
/Samples/lua_invaders/data/invaders.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikke89/RmlUi/0c96c0eed25c5d86ae300887eae4a0333b34b22b/Samples/lua_invaders/data/invaders.tga
--------------------------------------------------------------------------------
/Samples/lua_invaders/data/logo.rml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Samples/lua_invaders/data/logo.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikke89/RmlUi/0c96c0eed25c5d86ae300887eae4a0333b34b22b/Samples/lua_invaders/data/logo.tga
--------------------------------------------------------------------------------
/Samples/lua_invaders/data/main_menu.rml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Main Menu
4 |
5 |
19 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/Samples/lua_invaders/data/pause.rml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Quit?
4 |
5 |
19 |
20 |
21 |
22 |
Are you sure you want to end this game?
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Samples/lua_invaders/data/window.rml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/Samples/lua_invaders/lua/start.lua:
--------------------------------------------------------------------------------
1 | function Startup()
2 | maincontext = rmlui.contexts["main"]
3 | maincontext:LoadDocument("lua_invaders/data/background.rml"):Show()
4 | maincontext:LoadDocument("lua_invaders/data/main_menu.rml"):Show()
5 | end
6 |
7 | Startup()
8 |
--------------------------------------------------------------------------------
/Samples/lua_invaders/src/ElementGameInstancer.cpp:
--------------------------------------------------------------------------------
1 | #include "ElementGameInstancer.h"
2 | #include "ElementGame.h"
3 |
4 | ElementGameInstancer::~ElementGameInstancer() {}
5 |
6 | Rml::ElementPtr ElementGameInstancer::InstanceElement(Rml::Element* /*parent*/, const Rml::String& tag, const Rml::XMLAttributes& /*attributes*/)
7 | {
8 | return Rml::ElementPtr(new ElementGame(tag));
9 | }
10 |
11 | void ElementGameInstancer::ReleaseElement(Rml::Element* element)
12 | {
13 | delete element;
14 | }
15 |
--------------------------------------------------------------------------------
/Samples/lua_invaders/src/ElementGameInstancer.h:
--------------------------------------------------------------------------------
1 | #ifndef RMLUI_LUAINVADERS_ELEMENTGAMEINSTANCER_H
2 | #define RMLUI_LUAINVADERS_ELEMENTGAMEINSTANCER_H
3 |
4 | #include
5 |
6 | class ElementGameInstancer : public Rml::ElementInstancer {
7 | public:
8 | virtual ~ElementGameInstancer();
9 |
10 | /// Instances an element given the tag name and attributes
11 | /// @param tag Name of the element to instance
12 | /// @param attributes vector of name value pairs
13 | Rml::ElementPtr InstanceElement(Rml::Element* parent, const Rml::String& tag, const Rml::XMLAttributes& attributes) override;
14 |
15 | /// Releases the given element
16 | /// @param element to release
17 | void ReleaseElement(Rml::Element* element) override;
18 | };
19 |
20 | #endif
21 |
--------------------------------------------------------------------------------
/Samples/lua_invaders/src/LuaInterface.h:
--------------------------------------------------------------------------------
1 | #ifndef RMLUI_LUAINVADERS_LUAINTERFACE_H
2 | #define RMLUI_LUAINVADERS_LUAINTERFACE_H
3 | /*
4 | This will define the "Game" global table in Lua and some functions with it.
5 |
6 | In Lua, the skeleton definition of Game with the fake function definitions (because it calls c++ code) would look something like
7 |
8 | Game = Game or {} --so if something else made a "Game" table, we would save the previous table, and just add on to it
9 | Game.Shutdown = function() Shell::RequestExit() end
10 | Game.SetPaused = function(paused) GameDetails::SetPaused(paused) end --where paused is a bool
11 | Game.SetDifficulty = function(difficulty) GameDetails::SetDifficulty(difficulty) end --difficulty is a value from Game.difficulty
12 | Game.SetDefenderColour = function(colour) GameDetails::SetDefenderColour(colour) end --colour is of type Colourb
13 | Game.SubmitHighScore = function() HighScores::SubmitScore(stuff from GameDetails) end
14 | Game.SetHighScoreName = function(name) HighScore::SubmitName(name) end -- name is a string
15 | Game.difficulty = { "HARD" = GameDetails::HARD, "EASY" = GameDetails::EASY }
16 | */
17 |
18 | struct lua_State;
19 | class Game;
20 | class LuaInterface {
21 | public:
22 | static void Initialise(lua_State* L);
23 | static void InitGame(lua_State* L);
24 | };
25 |
26 | #endif
27 |
--------------------------------------------------------------------------------
/Samples/shell/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #[[
2 | Note: rmlui_shell is NOT a sample. It's a utility static library with code common to the RmlUi samples.
3 | ]]
4 |
5 | add_library(rmlui_shell STATIC
6 | src/PlatformExtensions.cpp
7 | src/RendererExtensions.cpp
8 | src/Shell.cpp
9 | src/ShellFileInterface.cpp
10 |
11 | include/PlatformExtensions.h
12 | include/RendererExtensions.h
13 | include/Shell.h
14 | include/ShellFileInterface.h
15 | )
16 |
17 | set_common_target_options(rmlui_shell)
18 |
19 | target_link_libraries(rmlui_shell PRIVATE rmlui_backend_${RMLUI_BACKEND})
20 |
21 | target_include_directories(rmlui_shell PUBLIC "include" "${PROJECT_SOURCE_DIR}/Backends")
22 |
23 | if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
24 | target_link_libraries(rmlui_shell PRIVATE Windows::Shell::LightweightUtility)
25 | elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
26 | target_link_libraries(rmlui_shell PRIVATE macOS::Cocoa)
27 | endif()
28 |
29 | target_link_libraries(rmlui_shell PUBLIC rmlui_core rmlui_debugger)
30 |
31 | if(RMLUI_BACKEND MATCHES "GL2$")
32 | target_compile_definitions(rmlui_shell PRIVATE "RMLUI_RENDERER_GL2")
33 | endif()
34 | if(RMLUI_BACKEND MATCHES "GL3$")
35 | target_compile_definitions(rmlui_shell PRIVATE "RMLUI_RENDERER_GL3")
36 | endif()
37 |
--------------------------------------------------------------------------------
/Samples/tutorial/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(RMLUI_TUTORIAL_PREFIX "rmlui_tutorial_")
2 |
3 | add_subdirectory("drag")
4 | add_subdirectory("template")
5 |
--------------------------------------------------------------------------------
/Samples/tutorial/drag/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(TUTORIAL_NAME "drag")
2 | set(TARGET_NAME "${RMLUI_TUTORIAL_PREFIX}${TUTORIAL_NAME}")
3 |
4 | add_executable(${TARGET_NAME} WIN32
5 | src/Inventory.cpp
6 | src/Inventory.h
7 | src/main.cpp
8 | )
9 |
10 | set_common_target_options(${TARGET_NAME})
11 |
12 | target_link_libraries(${TARGET_NAME} PRIVATE rmlui_shell)
13 |
14 | install_sample_target(${TARGET_NAME})
15 |
--------------------------------------------------------------------------------
/Samples/tutorial/drag/data/inventory.rml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Inventory
6 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Samples/tutorial/drag/data/tutorial.rcss:
--------------------------------------------------------------------------------
1 | /* Hide the window icon. */
2 | div#title_bar div#icon
3 | {
4 | display: none;
5 | }
6 |
7 | icon
8 | {
9 | /* The icons are floated left so they appear left-to-right. */
10 | float: left;
11 |
12 | /* The padding is added to push the text down to the bottom of the element. */
13 | box-sizing: border-box;
14 | width: 100dp;
15 | height: 100dp;
16 | padding: 60dp 10dp 0dp 10dp;
17 | margin: 10dp;
18 |
19 | decorator: image( /assets/present.tga );
20 |
21 | font-size: 12dp;
22 | text-align: center;
23 | font-effect: shadow(1dp 1dp black);
24 | }
25 |
--------------------------------------------------------------------------------
/Samples/tutorial/drag/src/Inventory.cpp:
--------------------------------------------------------------------------------
1 | #include "Inventory.h"
2 | #include
3 |
4 | Inventory::Inventory(const Rml::String& title, const Rml::Vector2f& position, Rml::Context* context)
5 | {
6 | document = context->LoadDocument("tutorial/drag/data/inventory.rml");
7 | if (document)
8 | {
9 | document->GetElementById("title")->SetInnerRML(title);
10 | document->SetProperty(Rml::PropertyId::Left, Rml::Property(position.x, Rml::Unit::DP));
11 | document->SetProperty(Rml::PropertyId::Top, Rml::Property(position.y, Rml::Unit::DP));
12 | document->Show();
13 | }
14 | }
15 |
16 | Inventory::~Inventory()
17 | {
18 | if (document)
19 | document->Close();
20 | }
21 |
22 | void Inventory::AddItem(const Rml::String& name)
23 | {
24 | if (!document)
25 | return;
26 |
27 | Rml::Element* content = document->GetElementById("content");
28 | if (!content)
29 | return;
30 |
31 | // Create the new 'icon' element.
32 | Rml::ElementPtr icon = Rml::Factory::InstanceElement(content, "icon", "icon", Rml::XMLAttributes());
33 | icon->SetInnerRML(name);
34 | content->AppendChild(std::move(icon));
35 | }
36 |
--------------------------------------------------------------------------------
/Samples/tutorial/drag/src/Inventory.h:
--------------------------------------------------------------------------------
1 | #ifndef INVENTORY_H
2 | #define INVENTORY_H
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | /**
9 | @author Peter Curry
10 | */
11 |
12 | class Inventory {
13 | public:
14 | /// Constructs a new inventory and opens its window.
15 | /// @param[in] title The title of the new inventory.
16 | /// @param[in] position The position of the inventory window.
17 | /// @param[in] context The context to open the inventory window in.
18 | Inventory(const Rml::String& title, const Rml::Vector2f& position, Rml::Context* context);
19 | /// Destroys the inventory and closes its window.
20 | ~Inventory();
21 |
22 | /// Adds a brand-new item into this inventory.
23 | /// @param[in] name The name of this item.
24 | void AddItem(const Rml::String& name);
25 |
26 | private:
27 | Rml::ElementDocument* document;
28 | };
29 |
30 | #endif
31 |
--------------------------------------------------------------------------------
/Samples/tutorial/template/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(TUTORIAL_NAME "template")
2 | set(TARGET_NAME "${RMLUI_TUTORIAL_PREFIX}${TUTORIAL_NAME}")
3 |
4 | add_executable(${TARGET_NAME} WIN32
5 | src/main.cpp
6 | )
7 |
8 | set_common_target_options(${TARGET_NAME})
9 |
10 | target_link_libraries(${TARGET_NAME} PRIVATE rmlui_shell)
11 |
12 | install_sample_target(${TARGET_NAME})
13 |
--------------------------------------------------------------------------------
/Samples/tutorial/template/data/tutorial.rcss:
--------------------------------------------------------------------------------
1 | @spritesheet theme
2 | {
3 | src: /assets/invader.tga;
4 |
5 | window-tl: 0px 0px 133px 140px;
6 | window-t: 134px 0px 1px 140px;
7 | window-tr: 136px 0px 10px 140px;
8 | window-l: 0px 139px 10px 1px;
9 | window-c: 11px 139px 1px 1px;
10 | window-r: 10px 139px -10px 1px; /* mirrored left */
11 | window-bl: 0px 140px 11px 11px;
12 | window-b: 11px 140px 1px 11px;
13 | window-br: 136px 140px 10px 11px;
14 | }
15 |
16 | body
17 | {
18 | font-family: LatoLatin;
19 | font-weight: normal;
20 | font-style: normal;
21 | font-size: 15dp;
22 | color: white;
23 | }
24 |
25 | body.window
26 | {
27 | decorator: tiled-box(
28 | window-tl, window-t, window-tr,
29 | window-l, window-c, window-r,
30 | window-bl, window-b, window-br
31 | );
32 | }
33 |
34 | div
35 | {
36 | display: block;
37 | }
38 |
--------------------------------------------------------------------------------
/Samples/tutorial/template/data/tutorial.rml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Window
5 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Source/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_subdirectory("Core")
2 |
3 | if(RMLUI_LOTTIE_PLUGIN)
4 | add_subdirectory("Lottie")
5 | endif()
6 | if(RMLUI_SVG_PLUGIN)
7 | add_subdirectory("SVG")
8 | endif()
9 |
10 | add_subdirectory("Debugger")
11 |
12 | if(RMLUI_LUA_BINDINGS)
13 | add_subdirectory("Lua")
14 | endif()
15 |
--------------------------------------------------------------------------------
/Source/Core/ContextInstancer.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * This source file is part of RmlUi, the HTML/CSS Interface Middleware
3 | *
4 | * For the latest information, see http://github.com/mikke89/RmlUi
5 | *
6 | * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
7 | * Copyright (c) 2019-2023 The RmlUi Team, and contributors
8 | *
9 | * Permission is hereby granted, free of charge, to any person obtaining a copy
10 | * of this software and associated documentation files (the "Software"), to deal
11 | * in the Software without restriction, including without limitation the rights
12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | * copies of the Software, and to permit persons to whom the Software is
14 | * furnished to do so, subject to the following conditions:
15 | *
16 | * The above copyright notice and this permission notice shall be included in
17 | * all copies or substantial portions of the Software.
18 | *
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 | * THE SOFTWARE.
26 | *
27 | */
28 |
29 | #include "../../Include/RmlUi/Core/ContextInstancer.h"
30 |
31 | namespace Rml {
32 |
33 | ContextInstancer::~ContextInstancer() {}
34 |
35 | } // namespace Rml
36 |
--------------------------------------------------------------------------------
/Source/Core/EventInstancer.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * This source file is part of RmlUi, the HTML/CSS Interface Middleware
3 | *
4 | * For the latest information, see http://github.com/mikke89/RmlUi
5 | *
6 | * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
7 | * Copyright (c) 2019-2023 The RmlUi Team, and contributors
8 | *
9 | * Permission is hereby granted, free of charge, to any person obtaining a copy
10 | * of this software and associated documentation files (the "Software"), to deal
11 | * in the Software without restriction, including without limitation the rights
12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | * copies of the Software, and to permit persons to whom the Software is
14 | * furnished to do so, subject to the following conditions:
15 | *
16 | * The above copyright notice and this permission notice shall be included in
17 | * all copies or substantial portions of the Software.
18 | *
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 | * THE SOFTWARE.
26 | *
27 | */
28 |
29 | #include "../../Include/RmlUi/Core/EventInstancer.h"
30 |
31 | namespace Rml {
32 |
33 | EventInstancer::~EventInstancer() {}
34 |
35 | } // namespace Rml
36 |
--------------------------------------------------------------------------------
/Source/Core/EventListenerInstancer.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * This source file is part of RmlUi, the HTML/CSS Interface Middleware
3 | *
4 | * For the latest information, see http://github.com/mikke89/RmlUi
5 | *
6 | * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
7 | * Copyright (c) 2019-2023 The RmlUi Team, and contributors
8 | *
9 | * Permission is hereby granted, free of charge, to any person obtaining a copy
10 | * of this software and associated documentation files (the "Software"), to deal
11 | * in the Software without restriction, including without limitation the rights
12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | * copies of the Software, and to permit persons to whom the Software is
14 | * furnished to do so, subject to the following conditions:
15 | *
16 | * The above copyright notice and this permission notice shall be included in
17 | * all copies or substantial portions of the Software.
18 | *
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 | * THE SOFTWARE.
26 | *
27 | */
28 |
29 | #include "../../Include/RmlUi/Core/EventListenerInstancer.h"
30 |
31 | namespace Rml {
32 |
33 | EventListenerInstancer::~EventListenerInstancer() {}
34 |
35 | } // namespace Rml
36 |
--------------------------------------------------------------------------------
/Source/Core/FontEngineDefault/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # RMLUI_CMAKE_MINIMUM_VERSION_RAISE_NOTICE:
2 | # Using absolute paths to prevent improper interpretation of relative paths Relative paths can be used once the minimum
3 | # CMake version is greater or equal than CMake 3.13
4 | target_sources(rmlui_core PRIVATE
5 | "${CMAKE_CURRENT_SOURCE_DIR}/FontEngineInterfaceDefault.cpp"
6 | "${CMAKE_CURRENT_SOURCE_DIR}/FontEngineInterfaceDefault.h"
7 | "${CMAKE_CURRENT_SOURCE_DIR}/FontFace.cpp"
8 | "${CMAKE_CURRENT_SOURCE_DIR}/FontFace.h"
9 | "${CMAKE_CURRENT_SOURCE_DIR}/FontFaceHandleDefault.cpp"
10 | "${CMAKE_CURRENT_SOURCE_DIR}/FontFaceHandleDefault.h"
11 | "${CMAKE_CURRENT_SOURCE_DIR}/FontFaceLayer.cpp"
12 | "${CMAKE_CURRENT_SOURCE_DIR}/FontFaceLayer.h"
13 | "${CMAKE_CURRENT_SOURCE_DIR}/FontFamily.cpp"
14 | "${CMAKE_CURRENT_SOURCE_DIR}/FontFamily.h"
15 | "${CMAKE_CURRENT_SOURCE_DIR}/FontProvider.cpp"
16 | "${CMAKE_CURRENT_SOURCE_DIR}/FontProvider.h"
17 | "${CMAKE_CURRENT_SOURCE_DIR}/FontTypes.h"
18 | "${CMAKE_CURRENT_SOURCE_DIR}/FreeTypeInterface.cpp"
19 | "${CMAKE_CURRENT_SOURCE_DIR}/FreeTypeInterface.h"
20 | )
21 |
22 | target_compile_definitions(rmlui_core PRIVATE "RMLUI_FONT_ENGINE_FREETYPE")
23 |
--------------------------------------------------------------------------------
/Source/Core/Traits.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * This source file is part of RmlUi, the HTML/CSS Interface Middleware
3 | *
4 | * For the latest information, see http://github.com/mikke89/RmlUi
5 | *
6 | * Copyright (c) 2019-2024 The RmlUi Team, and contributors
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy
9 | * of this software and associated documentation files (the "Software"), to deal
10 | * in the Software without restriction, including without limitation the rights
11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | * copies of the Software, and to permit persons to whom the Software is
13 | * furnished to do so, subject to the following conditions:
14 | *
15 | * The above copyright notice and this permission notice shall be included in
16 | * all copies or substantial portions of the Software.
17 | *
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | * THE SOFTWARE.
25 | *
26 | */
27 |
28 | #include "../../Include/RmlUi/Core/Traits.h"
29 |
30 | namespace Rml {
31 |
32 | int FamilyBase::GetNewId()
33 | {
34 | static int id = 0;
35 | return id++;
36 | }
37 |
38 | } // namespace Rml
39 |
--------------------------------------------------------------------------------
/Source/Core/XMLNodeHandler.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * This source file is part of RmlUi, the HTML/CSS Interface Middleware
3 | *
4 | * For the latest information, see http://github.com/mikke89/RmlUi
5 | *
6 | * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
7 | * Copyright (c) 2019-2023 The RmlUi Team, and contributors
8 | *
9 | * Permission is hereby granted, free of charge, to any person obtaining a copy
10 | * of this software and associated documentation files (the "Software"), to deal
11 | * in the Software without restriction, including without limitation the rights
12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | * copies of the Software, and to permit persons to whom the Software is
14 | * furnished to do so, subject to the following conditions:
15 | *
16 | * The above copyright notice and this permission notice shall be included in
17 | * all copies or substantial portions of the Software.
18 | *
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 | * THE SOFTWARE.
26 | *
27 | */
28 |
29 | #include "../../Include/RmlUi/Core/XMLNodeHandler.h"
30 |
31 | namespace Rml {
32 |
33 | XMLNodeHandler::~XMLNodeHandler() {}
34 |
35 | } // namespace Rml
36 |
--------------------------------------------------------------------------------
/Source/Core/precompiled.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This source file is part of RmlUi, the HTML/CSS Interface Middleware
3 | *
4 | * For the latest information, see http://github.com/mikke89/RmlUi
5 | *
6 | * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
7 | * Copyright (c) 2019-2023 The RmlUi Team, and contributors
8 | *
9 | * Permission is hereby granted, free of charge, to any person obtaining a copy
10 | * of this software and associated documentation files (the "Software"), to deal
11 | * in the Software without restriction, including without limitation the rights
12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | * copies of the Software, and to permit persons to whom the Software is
14 | * furnished to do so, subject to the following conditions:
15 | *
16 | * The above copyright notice and this permission notice shall be included in
17 | * all copies or substantial portions of the Software.
18 | *
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 | * THE SOFTWARE.
26 | *
27 | */
28 |
29 | #ifndef RMLUI_CORE_PRECOMPILED_H
30 | #define RMLUI_CORE_PRECOMPILED_H
31 |
32 | #include "../../Include/RmlUi/Core.h"
33 |
34 | #endif
35 |
--------------------------------------------------------------------------------
/Source/Debugger/.clang-format:
--------------------------------------------------------------------------------
1 | BasedOnStyle: InheritParentConfig
2 | NamespaceIndentation: None
3 |
--------------------------------------------------------------------------------
/Source/Debugger/ElementDebugDocument.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * This source file is part of RmlUi, the HTML/CSS Interface Middleware
3 | *
4 | * For the latest information, see http://github.com/mikke89/RmlUi
5 | *
6 | * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
7 | * Copyright (c) 2019-2024 The RmlUi Team, and contributors
8 | *
9 | * Permission is hereby granted, free of charge, to any person obtaining a copy
10 | * of this software and associated documentation files (the "Software"), to deal
11 | * in the Software without restriction, including without limitation the rights
12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | * copies of the Software, and to permit persons to whom the Software is
14 | * furnished to do so, subject to the following conditions:
15 | *
16 | * The above copyright notice and this permission notice shall be included in
17 | * all copies or substantial portions of the Software.
18 | *
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 | * THE SOFTWARE.
26 | *
27 | */
28 |
29 | #include "ElementDebugDocument.h"
30 |
31 | namespace Rml {
32 | namespace Debugger {
33 |
34 | ElementDebugDocument::ElementDebugDocument(const String& tag) : ElementDocument(tag)
35 | {
36 | SetFocusableFromModal(true);
37 | }
38 |
39 | } // namespace Debugger
40 | } // namespace Rml
41 |
--------------------------------------------------------------------------------
/Source/Lottie/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # This plugin targets rmlui_core directly and is incorporated into the core library when enabled.
2 |
3 | target_sources(rmlui_core PRIVATE
4 | "${CMAKE_CURRENT_SOURCE_DIR}/ElementLottie.cpp"
5 | "${CMAKE_CURRENT_SOURCE_DIR}/LottiePlugin.cpp"
6 | "${CMAKE_CURRENT_SOURCE_DIR}/LottiePlugin.h"
7 | "${PROJECT_SOURCE_DIR}/Include/RmlUi/Lottie/ElementLottie.h"
8 | )
9 |
10 | target_compile_definitions(rmlui_core PRIVATE "RMLUI_LOTTIE_PLUGIN")
11 |
--------------------------------------------------------------------------------
/Source/Lottie/LottiePlugin.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This source file is part of RmlUi, the HTML/CSS Interface Middleware
3 | *
4 | * For the latest information, see http://github.com/mikke89/RmlUi
5 | *
6 | * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
7 | * Copyright (c) 2019-2023 The RmlUi Team, and contributors
8 | *
9 | * Permission is hereby granted, free of charge, to any person obtaining a copy
10 | * of this software and associated documentation files (the "Software"), to deal
11 | * in the Software without restriction, including without limitation the rights
12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | * copies of the Software, and to permit persons to whom the Software is
14 | * furnished to do so, subject to the following conditions:
15 | *
16 | * The above copyright notice and this permission notice shall be included in
17 | * all copies or substantial portions of the Software.
18 | *
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 | * THE SOFTWARE.
26 | *
27 | */
28 |
29 | #ifndef RMLUI_LOTTIE_LOTTIE_PLUGIN_H
30 | #define RMLUI_LOTTIE_LOTTIE_PLUGIN_H
31 |
32 | namespace Rml {
33 | namespace Lottie {
34 |
35 | void Initialise();
36 |
37 | }
38 | } // namespace Rml
39 |
40 | #endif
41 |
--------------------------------------------------------------------------------
/Source/Lua/.clang-format:
--------------------------------------------------------------------------------
1 | BasedOnStyle: InheritParentConfig
2 | NamespaceIndentation: None
3 |
--------------------------------------------------------------------------------
/Source/Lua/Elements/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # RMLUI_CMAKE_MINIMUM_VERSION_RAISE_NOTICE:
2 | # Using absolute paths to prevent improper interpretation of relative paths. Relative paths can be used once the minimum
3 | # CMake version is greater or equal than CMake 3.13
4 | target_sources(rmlui_lua PRIVATE
5 | "${CMAKE_CURRENT_SOURCE_DIR}/As.h"
6 | "${CMAKE_CURRENT_SOURCE_DIR}/ElementForm.cpp"
7 | "${CMAKE_CURRENT_SOURCE_DIR}/ElementForm.h"
8 | "${CMAKE_CURRENT_SOURCE_DIR}/ElementFormControl.cpp"
9 | "${CMAKE_CURRENT_SOURCE_DIR}/ElementFormControl.h"
10 | "${CMAKE_CURRENT_SOURCE_DIR}/ElementFormControlInput.cpp"
11 | "${CMAKE_CURRENT_SOURCE_DIR}/ElementFormControlInput.h"
12 | "${CMAKE_CURRENT_SOURCE_DIR}/ElementFormControlSelect.cpp"
13 | "${CMAKE_CURRENT_SOURCE_DIR}/ElementFormControlSelect.h"
14 | "${CMAKE_CURRENT_SOURCE_DIR}/ElementFormControlTextArea.cpp"
15 | "${CMAKE_CURRENT_SOURCE_DIR}/ElementFormControlTextArea.h"
16 | "${CMAKE_CURRENT_SOURCE_DIR}/ElementTabSet.cpp"
17 | "${CMAKE_CURRENT_SOURCE_DIR}/ElementTabSet.h"
18 | "${CMAKE_CURRENT_SOURCE_DIR}/SelectOptionsProxy.cpp"
19 | "${CMAKE_CURRENT_SOURCE_DIR}/SelectOptionsProxy.h"
20 | )
21 |
--------------------------------------------------------------------------------
/Source/Lua/Lua.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * This source file is part of RmlUi, the HTML/CSS Interface Middleware
3 | *
4 | * For the latest information, see http://github.com/mikke89/RmlUi
5 | *
6 | * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
7 | * Copyright (c) 2019-2023 The RmlUi Team, and contributors
8 | *
9 | * Permission is hereby granted, free of charge, to any person obtaining a copy
10 | * of this software and associated documentation files (the "Software"), to deal
11 | * in the Software without restriction, including without limitation the rights
12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | * copies of the Software, and to permit persons to whom the Software is
14 | * furnished to do so, subject to the following conditions:
15 | *
16 | * The above copyright notice and this permission notice shall be included in
17 | * all copies or substantial portions of the Software.
18 | *
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 | * THE SOFTWARE.
26 | *
27 | */
28 |
29 | #include "LuaPlugin.h"
30 | #include
31 | #include
32 |
33 | namespace Rml {
34 | namespace Lua {
35 |
36 | void Initialise()
37 | {
38 | ::Rml::Lua::Initialise(nullptr);
39 | }
40 |
41 | void Initialise(lua_State* lua_state)
42 | {
43 | ::Rml::RegisterPlugin(new LuaPlugin(lua_state));
44 | }
45 |
46 | } // namespace Lua
47 | } // namespace Rml
48 |
--------------------------------------------------------------------------------
/Source/SVG/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # This plugin targets rmlui_core directly and is incorporated into the core library when enabled.
2 |
3 | target_sources(rmlui_core PRIVATE
4 | "${CMAKE_CURRENT_SOURCE_DIR}/DecoratorSVG.cpp"
5 | "${CMAKE_CURRENT_SOURCE_DIR}/DecoratorSVG.h"
6 | "${CMAKE_CURRENT_SOURCE_DIR}/ElementSVG.cpp"
7 | "${CMAKE_CURRENT_SOURCE_DIR}/SVGCache.cpp"
8 | "${CMAKE_CURRENT_SOURCE_DIR}/SVGCache.h"
9 | "${CMAKE_CURRENT_SOURCE_DIR}/SVGPlugin.cpp"
10 | "${CMAKE_CURRENT_SOURCE_DIR}/SVGPlugin.h"
11 | "${PROJECT_SOURCE_DIR}/Include/RmlUi/SVG/ElementSVG.h"
12 | )
13 |
14 | target_compile_definitions(rmlui_core PRIVATE "RMLUI_SVG_PLUGIN")
15 |
--------------------------------------------------------------------------------
/Source/SVG/SVGPlugin.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This source file is part of RmlUi, the HTML/CSS Interface Middleware
3 | *
4 | * For the latest information, see http://github.com/mikke89/RmlUi
5 | *
6 | * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
7 | * Copyright (c) 2019- The RmlUi Team, and contributors
8 | *
9 | * Permission is hereby granted, free of charge, to any person obtaining a copy
10 | * of this software and associated documentation files (the "Software"), to deal
11 | * in the Software without restriction, including without limitation the rights
12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | * copies of the Software, and to permit persons to whom the Software is
14 | * furnished to do so, subject to the following conditions:
15 | *
16 | * The above copyright notice and this permission notice shall be included in
17 | * all copies or substantial portions of the Software.
18 | *
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 | * THE SOFTWARE.
26 | *
27 | */
28 |
29 | #ifndef RMLUI_SVG_SVG_PLUGIN_H
30 | #define RMLUI_SVG_SVG_PLUGIN_H
31 |
32 | namespace Rml {
33 | namespace SVG {
34 |
35 | void Initialise();
36 |
37 | }
38 | } // namespace Rml
39 |
40 | #endif
41 |
--------------------------------------------------------------------------------
/Tests/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Enable some extra testing code in the core library.
2 | target_compile_definitions(rmlui_core PUBLIC RMLUI_TESTS_ENABLED)
3 |
4 | include("${PROJECT_SOURCE_DIR}/CMake/DependenciesForTests.cmake")
5 |
6 | if(EMSCRIPTEN)
7 | # Add data for tests to emscripten targets
8 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -sLLD_REPORT_UNDEFINED")
9 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --preload-file \"${CMAKE_CURRENT_SOURCE_DIR}/Data/@/Tests/Data/\"")
10 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --preload-file \"${PROJECT_SOURCE_DIR}/Samples/basic/demo/data/@/basic/demo/data/\"")
11 | endif()
12 |
13 | add_subdirectory("Source")
14 |
--------------------------------------------------------------------------------
/Tests/Data/UnitTests/Specificity_Basic.rcss:
--------------------------------------------------------------------------------
1 | body {
2 | display: block;
3 | width: 10px;
4 | height: 100px;
5 | background: #ccc;
6 | }
7 |
8 | .a {
9 | width: 80px;
10 | }
11 | .b {
12 | width: 90px;
13 | }
14 | .c {
15 | width: 100px;
16 | }
17 |
--------------------------------------------------------------------------------
/Tests/Data/UnitTests/Specificity_MediaQuery.rcss:
--------------------------------------------------------------------------------
1 | body {
2 | display:block;
3 | width: 100px;
4 | height: 100px;
5 | background: #ccc;
6 | }
7 |
--------------------------------------------------------------------------------
/Tests/Data/UnitTests/data-title.rml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
The following boxes should produce curved borders. There should be no overlapping triangles, and their backgrounds should not be visible outside their borders.
50 |
51 |
52 |
53 |
The following text should wrap down to the next line and produce borders on each line.
The float to the left should extend past the background of the containing '.box' element.
35 |
36 |
37 |
38 |
float: left
39 |
Using 'overflow: auto' on the containing '.box' element. This should establish a new block formatting context (thereby resolving all floats) so that the background wraps around the entire float.
40 |
41 |
42 |
43 |
float: left
44 |
Using 'display: flow-root' on the containing '.box' element. This also establishes a new block formatting context, and should be equivalent to the previous box.
22 | Beginning of p contents.
23 | Start of outer contents.
24 | Inner contents.
25 | Sibling contents.
26 | End of outer contents.
27 | End of p contents.
28 |
22 | Beginning of p contents.
23 | Start of outer contents.
24 | Inner contents.
25 | Sibling contents.
26 | End of outer contents.
27 | End of p contents.
28 |