├── demo ├── extern │ ├── glm │ │ ├── gtx │ │ │ ├── type_trait.inl │ │ │ ├── raw_data.inl │ │ │ ├── type_aligned.inl │ │ │ ├── std_based_type.inl │ │ │ ├── number_precision.inl │ │ │ ├── projection.inl │ │ │ ├── perpendicular.inl │ │ │ ├── mixed_product.inl │ │ │ ├── normal.inl │ │ │ ├── float_notmalize.inl │ │ │ ├── optimum_pow.inl │ │ │ ├── log_base.inl │ │ │ ├── normalize_dot.inl │ │ │ ├── transform.inl │ │ │ ├── handed_coordinate_space.inl │ │ │ ├── orthonormalize.inl │ │ │ ├── scalar_relational.hpp │ │ │ ├── matrix_cross_product.inl │ │ │ ├── projection.hpp │ │ │ ├── polar_coordinates.inl │ │ │ ├── mixed_product.hpp │ │ │ ├── extend.hpp │ │ │ ├── normal.hpp │ │ │ ├── perpendicular.hpp │ │ │ ├── gradient_paint.inl │ │ │ ├── extend.inl │ │ │ ├── log_base.hpp │ │ │ ├── raw_data.hpp │ │ │ ├── matrix_cross_product.hpp │ │ │ ├── orthonormalize.hpp │ │ │ ├── closest_point.hpp │ │ │ ├── polar_coordinates.hpp │ │ │ ├── optimum_pow.hpp │ │ │ ├── closest_point.inl │ │ │ ├── matrix_decompose.hpp │ │ │ ├── string_cast.hpp │ │ │ ├── gradient_paint.hpp │ │ │ ├── wrap.hpp │ │ │ ├── scalar_relational.inl │ │ │ ├── handed_coordinate_space.hpp │ │ │ ├── normalize_dot.hpp │ │ │ ├── spline.hpp │ │ │ ├── transform.hpp │ │ │ ├── matrix_transform_2d.inl │ │ │ ├── vector_angle.inl │ │ │ └── compatibility.inl │ │ ├── detail │ │ │ ├── func_trigonometric_simd.inl │ │ │ ├── type_vec.inl │ │ │ ├── type_mat.inl │ │ │ ├── type_mat4x4_simd.inl │ │ │ ├── func_packing_simd.inl │ │ │ ├── func_vector_relational_simd.inl │ │ │ ├── type_half.hpp │ │ │ ├── _fixes.hpp │ │ │ ├── func_exponential_simd.inl │ │ │ └── precision.hpp │ │ ├── gtc │ │ │ ├── vec1.inl │ │ │ ├── type_precision.inl │ │ │ ├── functions.inl │ │ │ ├── functions.hpp │ │ │ ├── matrix_access.inl │ │ │ ├── matrix_access.hpp │ │ │ └── matrix_inverse.hpp │ │ ├── vec2.hpp │ │ ├── vec3.hpp │ │ ├── vec4.hpp │ │ ├── common.hpp │ │ ├── matrix.hpp │ │ ├── integer.hpp │ │ ├── packing.hpp │ │ ├── geometric.hpp │ │ ├── exponential.hpp │ │ ├── trigonometric.hpp │ │ ├── vector_relational.hpp │ │ ├── simd │ │ │ ├── packing.h │ │ │ ├── vector_relational.h │ │ │ ├── trigonometric.h │ │ │ └── exponential.h │ │ ├── LICENSE.txt │ │ ├── mat3x2.hpp │ │ ├── mat2x4.hpp │ │ ├── mat3x4.hpp │ │ ├── mat4x2.hpp │ │ ├── mat4x3.hpp │ │ └── mat2x3.hpp │ ├── katana-parser │ │ ├── visualc │ │ │ ├── include │ │ │ │ ├── util.h │ │ │ │ ├── unistd.h │ │ │ │ └── strings.h │ │ │ └── katana.vcxproj.user │ │ ├── THANKS │ │ ├── LICENSE │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── tokenizer.h │ ├── .clang-format │ ├── glfw │ │ ├── src │ │ │ ├── glfw3Config.cmake.in │ │ │ ├── glfw3.pc.in │ │ │ ├── xkb_unicode.h │ │ │ ├── null_joystick.h │ │ │ ├── posix_time.h │ │ │ └── null_joystick.c │ │ ├── CMake │ │ │ ├── modules │ │ │ │ ├── FindOSMesa.cmake │ │ │ │ ├── FindEpollShim.cmake │ │ │ │ ├── FindWaylandProtocols.cmake │ │ │ │ └── FindXKBCommon.cmake │ │ │ ├── i686-w64-mingw32.cmake │ │ │ ├── i686-w64-mingw32-clang.cmake │ │ │ ├── x86_64-w64-mingw32.cmake │ │ │ ├── x86_64-w64-mingw32-clang.cmake │ │ │ ├── GenerateMappings.cmake │ │ │ └── MacOSXBundleInfo.plist.in │ │ ├── LICENSE.md │ │ └── cmake_uninstall.cmake.in │ ├── glew │ │ └── CMakeLists.txt │ ├── gawain │ │ └── gawain │ │ │ ├── gwn_primitive_private.h │ │ │ ├── gwn_vertex_format_private.h │ │ │ ├── gwn_attr_binding.h │ │ │ ├── gwn_attr_binding_private.h │ │ │ ├── gwn_buffer_id.h │ │ │ └── gwn_context.h │ └── CMakeLists.txt ├── gpu │ ├── GPU_glfw.h │ ├── shaders │ │ ├── uniform_color_frag.glsl │ │ ├── smooth_color_frag.glsl │ │ ├── uniform_color_vert.glsl │ │ ├── texture_frag.glsl │ │ ├── smooth_color_vert.glsl │ │ ├── texture_vert.glsl │ │ └── pixel_alpha_mask_texture_uniform_color_frag.glsl │ ├── gpu_intern.h │ ├── GPU.h │ └── gpu.cc ├── resources │ ├── bfont.ttf │ ├── blender_icons16.png │ └── blender_icon_defines.h ├── bwidgets_demo.cc ├── utils │ └── CMakeLists.txt ├── stylesheet │ ├── CMakeLists.txt │ └── StyleSheet.h ├── window_manager │ └── CMakeLists.txt ├── Application.h ├── File.h ├── Application.cc ├── screen │ ├── CMakeLists.txt │ └── DefaultStage.h └── Pixmap.h ├── tests ├── gtest │ ├── .clang-format │ ├── CMakeLists.txt │ └── LICENSE ├── TestUtilMacros.h ├── CMakeLists.txt ├── demo │ └── CMakeLists.txt ├── bWidgets │ └── CMakeLists.txt └── testing_main.cc ├── docs ├── resources │ └── images │ │ ├── bwidgets_mvc.png │ │ └── screen_graph_responsibilities.png ├── bWidgets │ ├── about.md │ └── coding_style.md ├── local_index.html ├── custom.css ├── README.md └── build_instructions.md ├── .gitmodules ├── bwidgets ├── generics │ ├── bwDistance.h │ ├── CMakeLists.txt │ ├── bwPoint.h │ ├── bwFunctorInterface.h │ ├── bwPolygon.h │ ├── bwPoint.cc │ ├── bwGradient.h │ ├── bwRange.h │ ├── bwPolygon.cc │ ├── bwGradient.cc │ └── bwColor.h ├── styling │ ├── styles │ │ ├── bwStyleFlatDark.cc │ │ ├── bwStyleFlatLight.cc │ │ ├── bwStyleFlatDark.h │ │ ├── bwStyleFlatLight.h │ │ ├── bwStyleFlatGrey.h │ │ └── bwStyleClassic.h │ ├── bwStyle.cc │ ├── bwStyle.h │ ├── bwStyleCSS.h │ ├── bwStyleManager.h │ ├── bwStyleCSS.cc │ └── bwWidgetBaseStyle.h ├── utils │ ├── bwUtil.h │ └── CMakeLists.txt ├── COPYING ├── bwLayoutInterface.h ├── widgets │ ├── builtin_widgets.h │ ├── bwScrollBar.h │ ├── bwPushButton.h │ ├── CMakeLists.txt │ ├── bwPushButton.cc │ ├── bwCheckbox.h │ ├── bwContainerWidget.h │ ├── bwLabel.h │ ├── bwContainerWidget.cc │ ├── bwPanel.h │ ├── bwScrollView.h │ ├── bwRadioButton.h │ ├── bwWidget.cc │ ├── bwLabel.cc │ ├── bwNumberSlider.h │ ├── bwTextBox.h │ └── bwRadioButton.cc ├── screen_graph │ ├── Drawer.h │ ├── ScreenGraph.h │ ├── EventHandler.cc │ ├── Builder.cc │ └── EventHandler.h ├── bwContext.h ├── bwIconInterface.h ├── mit_license.txt ├── bwEvent.cc ├── bwEventDispatcher.h ├── bwEvent.h └── CMakeLists.txt ├── .gitignore └── LICENSE.txt /demo/extern/glm/gtx/type_trait.inl: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /demo/gpu/GPU_glfw.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | -------------------------------------------------------------------------------- /demo/extern/katana-parser/visualc/include/util.h: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /demo/extern/glm/detail/func_trigonometric_simd.inl: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /demo/extern/.clang-format: -------------------------------------------------------------------------------- 1 | DisableFormat: true 2 | SortIncludes: false -------------------------------------------------------------------------------- /demo/extern/katana-parser/visualc/include/unistd.h: -------------------------------------------------------------------------------- 1 | #include -------------------------------------------------------------------------------- /tests/gtest/.clang-format: -------------------------------------------------------------------------------- 1 | DisableFormat: true 2 | SortIncludes: false -------------------------------------------------------------------------------- /demo/extern/glm/gtc/vec1.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_vec1 2 | /// @file glm/gtc/vec1.inl 3 | -------------------------------------------------------------------------------- /demo/extern/glm/detail/type_vec.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/type_vec.inl 3 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/raw_data.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_raw_data 2 | /// @file glm/gtx/raw_data.inl 3 | -------------------------------------------------------------------------------- /demo/extern/glm/detail/type_mat.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/type_mat.inl 3 | 4 | -------------------------------------------------------------------------------- /demo/extern/glfw/src/glfw3Config.cmake.in: -------------------------------------------------------------------------------- 1 | include("${CMAKE_CURRENT_LIST_DIR}/glfw3Targets.cmake") 2 | -------------------------------------------------------------------------------- /demo/resources/bfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/julianeisel/bWidgets/HEAD/demo/resources/bfont.ttf -------------------------------------------------------------------------------- /demo/resources/blender_icons16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/julianeisel/bWidgets/HEAD/demo/resources/blender_icons16.png -------------------------------------------------------------------------------- /demo/extern/glm/vec2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/vec2.hpp 3 | 4 | #pragma once 5 | 6 | #include "detail/type_vec2.hpp" 7 | -------------------------------------------------------------------------------- /demo/extern/glm/vec3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/vec3.hpp 3 | 4 | #pragma once 5 | 6 | #include "detail/type_vec3.hpp" 7 | -------------------------------------------------------------------------------- /demo/extern/glm/vec4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/vec4.hpp 3 | 4 | #pragma once 5 | 6 | #include "detail/type_vec4.hpp" 7 | -------------------------------------------------------------------------------- /docs/resources/images/bwidgets_mvc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/julianeisel/bWidgets/HEAD/docs/resources/images/bwidgets_mvc.png -------------------------------------------------------------------------------- /demo/extern/glm/common.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/common.hpp 3 | 4 | #pragma once 5 | 6 | #include "detail/func_common.hpp" 7 | -------------------------------------------------------------------------------- /demo/extern/glm/gtc/type_precision.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_swizzle 2 | /// @file glm/gtc/swizzle.inl 3 | 4 | namespace glm 5 | { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /demo/extern/glm/matrix.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/matrix.hpp 3 | 4 | #pragma once 5 | 6 | #include "detail/func_matrix.hpp" 7 | -------------------------------------------------------------------------------- /demo/extern/glm/integer.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/integer.hpp 3 | 4 | #pragma once 5 | 6 | #include "detail/func_integer.hpp" 7 | -------------------------------------------------------------------------------- /demo/extern/glm/packing.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/packing.hpp 3 | 4 | #pragma once 5 | 6 | #include "detail/func_packing.hpp" 7 | -------------------------------------------------------------------------------- /demo/extern/glm/geometric.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/geometric.hpp 3 | 4 | #pragma once 5 | 6 | #include "detail/func_geometric.hpp" 7 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/type_aligned.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_type_aligned 2 | /// @file glm/gtc/type_aligned.inl 3 | 4 | namespace glm 5 | { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /demo/extern/glm/exponential.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/exponential.hpp 3 | 4 | #pragma once 5 | 6 | #include "detail/func_exponential.hpp" 7 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/std_based_type.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_std_based_type 2 | /// @file glm/gtx/std_based_type.inl 3 | 4 | namespace glm 5 | { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/number_precision.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_number_precision 2 | /// @file glm/gtx/number_precision.inl 3 | 4 | namespace glm 5 | { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /demo/extern/glm/detail/type_mat4x4_simd.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/type_mat4x4_sse2.inl 3 | 4 | namespace glm 5 | { 6 | 7 | }//namespace glm 8 | -------------------------------------------------------------------------------- /demo/extern/glm/trigonometric.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/trigonometric.hpp 3 | 4 | #pragma once 5 | 6 | #include "detail/func_trigonometric.hpp" 7 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "docs/resources/doxygen-awesome"] 2 | path = docs/resources/doxygen-awesome 3 | url = https://github.com/jothepro/doxygen-awesome-css.git 4 | -------------------------------------------------------------------------------- /docs/resources/images/screen_graph_responsibilities.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/julianeisel/bWidgets/HEAD/docs/resources/images/screen_graph_responsibilities.png -------------------------------------------------------------------------------- /demo/extern/glm/vector_relational.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/vector_relational.hpp 3 | 4 | #pragma once 5 | 6 | #include "detail/func_vector_relational.hpp" 7 | -------------------------------------------------------------------------------- /bwidgets/generics/bwDistance.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "bwPoint.h" 4 | 5 | namespace bWidgets { 6 | 7 | using bwDistance = bwPoint; 8 | 9 | } // namespace bWidgets 10 | -------------------------------------------------------------------------------- /demo/extern/glm/simd/packing.h: -------------------------------------------------------------------------------- 1 | /// @ref simd 2 | /// @file glm/simd/packing.h 3 | 4 | #pragma once 5 | 6 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 7 | 8 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore all dotfiles by default 2 | .* 3 | 4 | build 5 | CMakeLists.txt.user 6 | 7 | # Visual Studio 8 | CMakeSettings.json 9 | 10 | # Generated docs 11 | docs/doxygen_html_output/ 12 | -------------------------------------------------------------------------------- /demo/extern/glm/simd/vector_relational.h: -------------------------------------------------------------------------------- 1 | /// @ref simd 2 | /// @file glm/simd/vector_relational.h 3 | 4 | #pragma once 5 | 6 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 7 | 8 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 9 | -------------------------------------------------------------------------------- /demo/extern/glm/simd/trigonometric.h: -------------------------------------------------------------------------------- 1 | /// @ref simd 2 | /// @file glm/simd/trigonometric.h 3 | 4 | #pragma once 5 | 6 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 7 | 8 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 9 | 10 | -------------------------------------------------------------------------------- /demo/extern/katana-parser/visualc/include/strings.h: -------------------------------------------------------------------------------- 1 | /*Dummy file to satisfy source file dependencies on Windows platform*/ 2 | #define strcasecmp _stricmp 3 | #define strncasecmp _strnicmp 4 | #define inline __inline -------------------------------------------------------------------------------- /demo/extern/glm/detail/func_packing_simd.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/func_packing_simd.inl 3 | 4 | namespace glm{ 5 | namespace detail 6 | { 7 | 8 | }//namespace detail 9 | }//namespace glm 10 | -------------------------------------------------------------------------------- /demo/extern/katana-parser/visualc/katana.vcxproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /bwidgets/styling/styles/bwStyleFlatDark.cc: -------------------------------------------------------------------------------- 1 | #include "bwStyleFlatDark.h" 2 | 3 | namespace bWidgets { 4 | 5 | bwStyleFlatDark::bwStyleFlatDark() 6 | { 7 | type_id = TypeID::FLAT_DARK; 8 | } 9 | 10 | } // namespace bWidgets 11 | -------------------------------------------------------------------------------- /demo/extern/glm/detail/func_vector_relational_simd.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/func_vector_relational_simd.inl 3 | 4 | namespace glm{ 5 | namespace detail 6 | { 7 | 8 | }//namespace detail 9 | }//namespace glm 10 | -------------------------------------------------------------------------------- /bwidgets/styling/styles/bwStyleFlatLight.cc: -------------------------------------------------------------------------------- 1 | #include "bwStyleFlatLight.h" 2 | 3 | namespace bWidgets { 4 | 5 | bwStyleFlatLight::bwStyleFlatLight() 6 | { 7 | type_id = TypeID::FLAT_LIGHT; 8 | } 9 | 10 | } // namespace bWidgets 11 | -------------------------------------------------------------------------------- /bwidgets/utils/bwUtil.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /** 4 | * Portable version of __PRETTY_FUNCTION__. 5 | */ 6 | #ifdef _MSC_VER 7 | # define PRETTY_FUNCTION __FUNCSIG__ 8 | #else 9 | # define PRETTY_FUNCTION __PRETTY_FUNCTION__ 10 | #endif 11 | -------------------------------------------------------------------------------- /bwidgets/styling/styles/bwStyleFlatDark.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "bwStyleCSS.h" 4 | 5 | namespace bWidgets { 6 | 7 | class bwStyleFlatDark : public bwStyleCSS { 8 | public: 9 | bwStyleFlatDark(); 10 | }; 11 | 12 | } // namespace bWidgets 13 | -------------------------------------------------------------------------------- /bwidgets/utils/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # No source files here, causing error on clang. 2 | if(False) 3 | set(SRC 4 | bwUtil.h 5 | ) 6 | 7 | add_library(bw_utils ${SRC}) 8 | set_target_properties(bw_utils PROPERTIES LINKER_LANGUAGE CXX) 9 | endif() 10 | -------------------------------------------------------------------------------- /bwidgets/styling/styles/bwStyleFlatLight.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "bwStyleCSS.h" 4 | 5 | namespace bWidgets { 6 | 7 | class bwStyleFlatLight : public bwStyleCSS { 8 | public: 9 | bwStyleFlatLight(); 10 | }; 11 | 12 | } // namespace bWidgets 13 | -------------------------------------------------------------------------------- /bwidgets/COPYING: -------------------------------------------------------------------------------- 1 | Until further notice, files in this directory and sub-directories are licensed 2 | under the GNU General Public License (GPL) 2 or later (see gpl2_license.txt). 3 | Further modifications will be dual-licensed under the GPL 2 (or later) and the 4 | MIT license (see mit_license.txt) 5 | -------------------------------------------------------------------------------- /bwidgets/bwLayoutInterface.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "bwRectangle.h" 4 | 5 | namespace bWidgets { 6 | 7 | class bwLayoutInterface { 8 | public: 9 | virtual ~bwLayoutInterface() = default; 10 | 11 | virtual auto getRectangle() -> bwRectanglePixel = 0; 12 | }; 13 | 14 | } // namespace bWidgets 15 | -------------------------------------------------------------------------------- /bwidgets/styling/styles/bwStyleFlatGrey.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "bwStyle.h" 4 | 5 | namespace bWidgets { 6 | 7 | class bwStyleFlat : public bwStyle { 8 | public: 9 | bwStyleFlat(); 10 | 11 | void setWidgetStyle(class bwWidget& widget) override; 12 | }; 13 | 14 | } // namespace bWidgets 15 | -------------------------------------------------------------------------------- /bwidgets/styling/styles/bwStyleClassic.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "bwStyle.h" 4 | 5 | namespace bWidgets { 6 | 7 | class bwStyleClassic : public bwStyle { 8 | public: 9 | bwStyleClassic(); 10 | 11 | void setWidgetStyle(class bwWidget& widget) override; 12 | }; 13 | 14 | } // namespace bWidgets 15 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/projection.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_projection 2 | /// @file glm/gtx/projection.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER vecType proj(vecType const & x, vecType const & Normal) 8 | { 9 | return glm::dot(x, Normal) / glm::dot(Normal, Normal) * Normal; 10 | } 11 | }//namespace glm 12 | -------------------------------------------------------------------------------- /demo/extern/katana-parser/THANKS: -------------------------------------------------------------------------------- 1 | Katana CSS parser THANKS file 2 | 3 | Katana was originally written by QFish, but many people helped out through suggestions, question-answering, code reviews, bugfixes, and organizational support. Here is a list of these people. Help me keep it complete and exempt of errors. 4 | 5 | Gavin Kowe 6 | Geek Zoo Studio 7 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/perpendicular.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_perpendicular 2 | /// @file glm/gtx/perpendicular.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER vecType perp 8 | ( 9 | vecType const & x, 10 | vecType const & Normal 11 | ) 12 | { 13 | return x - proj(x, Normal); 14 | } 15 | }//namespace glm 16 | -------------------------------------------------------------------------------- /docs/bWidgets/about.md: -------------------------------------------------------------------------------- 1 | # bWidgets Design 2 | 3 | \brief High level documentation on the bWidgets source code. 4 | 5 | The following sub-pages provide basic insight on the bWidgets code and its 6 | design: 7 | * \subpage md_docs_bWidgets_design_overview 8 | * \subpage md_docs_bWidgets_design_principles 9 | * \subpage md_docs_bWidgets_coding_style 10 | -------------------------------------------------------------------------------- /bwidgets/generics/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SRC 2 | bwColor.cc 3 | bwGradient.cc 4 | bwPoint.cc 5 | bwPolygon.cc 6 | 7 | bwColor.h 8 | bwDistance.h 9 | bwGradient.h 10 | bwFunctorInterface.h 11 | bwPoint.h 12 | bwPolygon.h 13 | bwRange.h 14 | bwRectangle.h 15 | ) 16 | 17 | add_library(bw_generics) 18 | target_sources(bw_generics PRIVATE ${SRC}) 19 | -------------------------------------------------------------------------------- /tests/TestUtilMacros.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // If defined, use compile-time static_assert, else run-time EXPECT_TRUE. 4 | #define USE_STATIC_ASSERT_IF_POSSIBLE 5 | 6 | #ifdef USE_STATIC_ASSERT_IF_POSSIBLE 7 | # define MAYBE_STATIC_ASSERT(condition) static_assert((condition), "") 8 | #else 9 | # define MAYBE_STATIC_ASSERT EXPECT_TRUE 10 | #endif 11 | -------------------------------------------------------------------------------- /bwidgets/styling/bwStyle.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "bwStyle.h" 4 | 5 | namespace bWidgets { 6 | 7 | unsigned int bwStyle::s_default_widget_size_hint = 20; 8 | 9 | bwStyle::bwStyle(TypeID type_id) : type_id(type_id) 10 | { 11 | } 12 | 13 | void bwStyle::polish(class bwWidget&) 14 | { 15 | /* Nothing by default. */ 16 | } 17 | 18 | } // namespace bWidgets 19 | -------------------------------------------------------------------------------- /bwidgets/widgets/builtin_widgets.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /** 4 | * Utility header to include all built-in widgets. 5 | */ 6 | 7 | #include "bwCheckbox.h" 8 | #include "bwLabel.h" 9 | #include "bwNumberSlider.h" 10 | #include "bwPanel.h" 11 | #include "bwPushButton.h" 12 | #include "bwRadioButton.h" 13 | #include "bwScrollBar.h" 14 | #include "bwScrollView.h" 15 | #include "bwTextBox.h" -------------------------------------------------------------------------------- /demo/extern/glm/gtx/mixed_product.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_mixed_product 2 | /// @file glm/gtx/mixed_product.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER T mixedProduct 8 | ( 9 | tvec3 const & v1, 10 | tvec3 const & v2, 11 | tvec3 const & v3 12 | ) 13 | { 14 | return dot(cross(v1, v2), v3); 15 | } 16 | }//namespace glm 17 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/normal.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_normal 2 | /// @file glm/gtx/normal.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER tvec3 triangleNormal 8 | ( 9 | tvec3 const & p1, 10 | tvec3 const & p2, 11 | tvec3 const & p3 12 | ) 13 | { 14 | return normalize(cross(p1 - p2, p1 - p3)); 15 | } 16 | }//namespace glm 17 | -------------------------------------------------------------------------------- /demo/extern/glm/detail/type_half.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/type_half.hpp 3 | 4 | #pragma once 5 | 6 | #include "setup.hpp" 7 | 8 | namespace glm{ 9 | namespace detail 10 | { 11 | typedef short hdata; 12 | 13 | GLM_FUNC_DECL float toFloat32(hdata value); 14 | GLM_FUNC_DECL hdata toFloat16(float const & value); 15 | 16 | }//namespace detail 17 | }//namespace glm 18 | 19 | #include "type_half.inl" 20 | -------------------------------------------------------------------------------- /tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if(CMAKE_COMPILER_IS_GNUCC) 2 | remove_cc_flag( 3 | "-Wundef" 4 | ) 5 | endif() 6 | 7 | set(INC 8 | gtest/include 9 | ) 10 | 11 | set(SRC 12 | testing_main.cc 13 | 14 | TestUtilClasses.h 15 | TestUtilMacros.h 16 | ) 17 | 18 | add_library(testing ${SRC}) 19 | target_sources(testing PRIVATE ${SRC}) 20 | include_directories(${INC}) 21 | 22 | add_subdirectory(bWidgets) 23 | add_subdirectory(demo) 24 | add_subdirectory(gtest) 25 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/float_notmalize.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_float_normalize 2 | /// @file glm/gtx/float_normalize.inl 3 | 4 | #include 5 | 6 | namespace glm 7 | { 8 | template class vecType> 9 | GLM_FUNC_QUALIFIER vecType floatNormalize(vecType const & v) 10 | { 11 | return vecType(v) / static_cast(std::numeric_limits::max()); 12 | } 13 | 14 | }//namespace glm 15 | -------------------------------------------------------------------------------- /demo/extern/glfw/src/glfw3.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@CMAKE_INSTALL_PREFIX@ 2 | exec_prefix=${prefix} 3 | includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ 4 | libdir=@CMAKE_INSTALL_FULL_LIBDIR@ 5 | 6 | Name: GLFW 7 | Description: A multi-platform library for OpenGL, window and input 8 | Version: @GLFW_VERSION_FULL@ 9 | URL: https://www.glfw.org/ 10 | Requires.private: @GLFW_PKG_DEPS@ 11 | Libs: -L${libdir} -l@GLFW_LIB_NAME@ 12 | Libs.private: @GLFW_PKG_LIBS@ 13 | Cflags: -I${includedir} 14 | -------------------------------------------------------------------------------- /docs/local_index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

How did you get here? It should not be possible to visit this page! Instead, please go to this page

13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /docs/custom.css: -------------------------------------------------------------------------------- 1 | /* custom.css */ 2 | html { 3 | --side-nav-arrow-opacity: 0.5; 4 | --side-nav-arrow-hover-opacity: 0.9; 5 | } 6 | 7 | @media (prefers-color-scheme: dark) { 8 | html:not(.light-mode) { 9 | /* define dark-mode variable overrides here if you DON'T use doxygen-awesome-darkmode-toggle.js */ 10 | } 11 | } 12 | 13 | html.dark-mode { 14 | /* define dark-mode variable overrides here if you DO use doxygen-awesome-darkmode-toggle.js */ 15 | } 16 | -------------------------------------------------------------------------------- /demo/extern/glm/simd/exponential.h: -------------------------------------------------------------------------------- 1 | /// @ref simd 2 | /// @file glm/simd/experimental.h 3 | 4 | #pragma once 5 | 6 | #include "platform.h" 7 | 8 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 9 | 10 | GLM_FUNC_QUALIFIER glm_vec4 glm_vec1_sqrt_lowp(glm_vec4 x) 11 | { 12 | return _mm_mul_ss(_mm_rsqrt_ss(x), x); 13 | } 14 | 15 | GLM_FUNC_QUALIFIER glm_vec4 glm_vec4_sqrt_lowp(glm_vec4 x) 16 | { 17 | return _mm_mul_ps(_mm_rsqrt_ps(x), x); 18 | } 19 | 20 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 21 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/optimum_pow.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_optimum_pow 2 | /// @file glm/gtx/optimum_pow.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER genType pow2(genType const & x) 8 | { 9 | return x * x; 10 | } 11 | 12 | template 13 | GLM_FUNC_QUALIFIER genType pow3(genType const & x) 14 | { 15 | return x * x * x; 16 | } 17 | 18 | template 19 | GLM_FUNC_QUALIFIER genType pow4(genType const & x) 20 | { 21 | return (x * x) * (x * x); 22 | } 23 | }//namespace glm 24 | -------------------------------------------------------------------------------- /demo/extern/glfw/CMake/modules/FindOSMesa.cmake: -------------------------------------------------------------------------------- 1 | # Try to find OSMesa on a Unix system 2 | # 3 | # This will define: 4 | # 5 | # OSMESA_LIBRARIES - Link these to use OSMesa 6 | # OSMESA_INCLUDE_DIR - Include directory for OSMesa 7 | # 8 | # Copyright (c) 2014 Brandon Schaefer 9 | 10 | if (NOT WIN32) 11 | 12 | find_package (PkgConfig) 13 | pkg_check_modules (PKG_OSMESA QUIET osmesa) 14 | 15 | set (OSMESA_INCLUDE_DIR ${PKG_OSMESA_INCLUDE_DIRS}) 16 | set (OSMESA_LIBRARIES ${PKG_OSMESA_LIBRARIES}) 17 | 18 | endif () 19 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/log_base.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_log_base 2 | /// @file glm/gtx/log_base.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER genType log(genType const & x, genType const & base) 8 | { 9 | assert(x != genType(0)); 10 | return glm::log(x) / glm::log(base); 11 | } 12 | 13 | template class vecType> 14 | GLM_FUNC_QUALIFIER vecType log(vecType const & x, vecType const & base) 15 | { 16 | return glm::log(x) / glm::log(base); 17 | } 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /demo/extern/glm/detail/_fixes.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/_fixes.hpp 3 | 4 | #include 5 | 6 | //! Workaround for compatibility with other libraries 7 | #ifdef max 8 | #undef max 9 | #endif 10 | 11 | //! Workaround for compatibility with other libraries 12 | #ifdef min 13 | #undef min 14 | #endif 15 | 16 | //! Workaround for Android 17 | #ifdef isnan 18 | #undef isnan 19 | #endif 20 | 21 | //! Workaround for Android 22 | #ifdef isinf 23 | #undef isinf 24 | #endif 25 | 26 | //! Workaround for Chrone Native Client 27 | #ifdef log2 28 | #undef log2 29 | #endif 30 | 31 | -------------------------------------------------------------------------------- /bwidgets/generics/bwPoint.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace bWidgets { 6 | 7 | class bwPoint { 8 | public: 9 | bwPoint(float x = 0, float y = 0); 10 | 11 | auto operator==(const bwPoint& rhs) const -> bool; 12 | 13 | float x, y; 14 | }; 15 | 16 | auto operator*(const bwPoint&, float) -> bwPoint; 17 | auto operator*(float, const bwPoint&) -> bwPoint; 18 | auto operator+(const bwPoint&, const bwPoint&) -> bwPoint; 19 | auto operator-(const bwPoint&, const bwPoint&) -> bwPoint; 20 | 21 | auto distance(bwPoint a, bwPoint b) -> float; 22 | 23 | } // namespace bWidgets 24 | -------------------------------------------------------------------------------- /demo/extern/glfw/CMake/i686-w64-mingw32.cmake: -------------------------------------------------------------------------------- 1 | # Define the environment for cross-compiling with 32-bit MinGW-w64 GCC 2 | SET(CMAKE_SYSTEM_NAME Windows) # Target system name 3 | SET(CMAKE_SYSTEM_VERSION 1) 4 | SET(CMAKE_C_COMPILER "i686-w64-mingw32-gcc") 5 | SET(CMAKE_CXX_COMPILER "i686-w64-mingw32-g++") 6 | SET(CMAKE_RC_COMPILER "i686-w64-mingw32-windres") 7 | SET(CMAKE_RANLIB "i686-w64-mingw32-ranlib") 8 | 9 | # Configure the behaviour of the find commands 10 | SET(CMAKE_FIND_ROOT_PATH "/usr/i686-w64-mingw32") 11 | SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 12 | SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 13 | SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 14 | -------------------------------------------------------------------------------- /bwidgets/widgets/bwScrollBar.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "bwAbstractButton.h" 4 | 5 | namespace bWidgets { 6 | 7 | class bwScrollBar : public bwAbstractButton { 8 | public: 9 | bwScrollBar(unsigned int width_hint = 0, unsigned int height_hint = 0); 10 | 11 | auto getTypeIdentifier() const -> std::string_view override; 12 | 13 | void draw(bwStyle& style) override; 14 | 15 | auto createHandler() -> std::unique_ptr override; 16 | 17 | float ratio = 0.0f; // Ration between content and area height (max 1.0f). 18 | int scroll_offset = 0; 19 | 20 | private: 21 | void setScrollOffset(int value); 22 | }; 23 | 24 | } // namespace bWidgets 25 | -------------------------------------------------------------------------------- /demo/extern/glfw/CMake/i686-w64-mingw32-clang.cmake: -------------------------------------------------------------------------------- 1 | # Define the environment for cross-compiling with 32-bit MinGW-w64 Clang 2 | SET(CMAKE_SYSTEM_NAME Windows) # Target system name 3 | SET(CMAKE_SYSTEM_VERSION 1) 4 | SET(CMAKE_C_COMPILER "i686-w64-mingw32-clang") 5 | SET(CMAKE_CXX_COMPILER "i686-w64-mingw32-clang++") 6 | SET(CMAKE_RC_COMPILER "i686-w64-mingw32-windres") 7 | SET(CMAKE_RANLIB "i686-w64-mingw32-ranlib") 8 | 9 | # Configure the behaviour of the find commands 10 | SET(CMAKE_FIND_ROOT_PATH "/usr/i686-w64-mingw32") 11 | SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 12 | SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 13 | SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 14 | -------------------------------------------------------------------------------- /demo/extern/glfw/CMake/x86_64-w64-mingw32.cmake: -------------------------------------------------------------------------------- 1 | # Define the environment for cross-compiling with 64-bit MinGW-w64 GCC 2 | SET(CMAKE_SYSTEM_NAME Windows) # Target system name 3 | SET(CMAKE_SYSTEM_VERSION 1) 4 | SET(CMAKE_C_COMPILER "x86_64-w64-mingw32-gcc") 5 | SET(CMAKE_CXX_COMPILER "x86_64-w64-mingw32-g++") 6 | SET(CMAKE_RC_COMPILER "x86_64-w64-mingw32-windres") 7 | SET(CMAKE_RANLIB "x86_64-w64-mingw32-ranlib") 8 | 9 | # Configure the behaviour of the find commands 10 | SET(CMAKE_FIND_ROOT_PATH "/usr/x86_64-w64-mingw32") 11 | SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 12 | SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 13 | SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 14 | -------------------------------------------------------------------------------- /demo/extern/glfw/CMake/x86_64-w64-mingw32-clang.cmake: -------------------------------------------------------------------------------- 1 | # Define the environment for cross-compiling with 64-bit MinGW-w64 Clang 2 | SET(CMAKE_SYSTEM_NAME Windows) # Target system name 3 | SET(CMAKE_SYSTEM_VERSION 1) 4 | SET(CMAKE_C_COMPILER "x86_64-w64-mingw32-clang") 5 | SET(CMAKE_CXX_COMPILER "x86_64-w64-mingw32-clang++") 6 | SET(CMAKE_RC_COMPILER "x86_64-w64-mingw32-windres") 7 | SET(CMAKE_RANLIB "x86_64-w64-mingw32-ranlib") 8 | 9 | # Configure the behaviour of the find commands 10 | SET(CMAKE_FIND_ROOT_PATH "/usr/x86_64-w64-mingw32") 11 | SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 12 | SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 13 | SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 14 | -------------------------------------------------------------------------------- /tests/demo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if(NOT WITH_GTESTS) 2 | message(WARNING "Compiling tests even though WITH_GTESTS disabled") 3 | endif() 4 | 5 | if(CMAKE_COMPILER_IS_GNUCC) 6 | remove_cc_flag( 7 | "-Wundef" 8 | ) 9 | endif() 10 | 11 | set(INC 12 | ../../bwidgets 13 | ../../bwidgets/generics 14 | ../../bwidgets/utils 15 | ../../bwidgets/widgets 16 | ../../demo/screen 17 | ../gtest/include 18 | ) 19 | 20 | set(SRC 21 | ) 22 | 23 | set(LIB 24 | bwd_screen 25 | testing 26 | testing_gtest 27 | ) 28 | 29 | set(SYS_LIB 30 | -lpthread 31 | ) 32 | 33 | #add_executable(testing_bwidgets_demo ${SRC}) 34 | #target_link_libraries(testing_bwidgets_demo ${LIB} ${SYS_LIB}) 35 | #include_directories(${INC}) 36 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/normalize_dot.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_normalize_dot 2 | /// @file glm/gtx/normalize_dot.inl 3 | 4 | namespace glm 5 | { 6 | template class vecType> 7 | GLM_FUNC_QUALIFIER T normalizeDot(vecType const & x, vecType const & y) 8 | { 9 | return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y)); 10 | } 11 | 12 | template class vecType> 13 | GLM_FUNC_QUALIFIER T fastNormalizeDot(vecType const & x, vecType const & y) 14 | { 15 | return glm::dot(x, y) * glm::fastInverseSqrt(glm::dot(x, x) * glm::dot(y, y)); 16 | } 17 | }//namespace glm 18 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/transform.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_transform 2 | /// @file glm/gtx/transform.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER tmat4x4 translate(tvec3 const & v) 8 | { 9 | return translate(tmat4x4(static_cast(1)), v); 10 | } 11 | 12 | template 13 | GLM_FUNC_QUALIFIER tmat4x4 rotate(T angle, tvec3 const & v) 14 | { 15 | return rotate(tmat4x4(static_cast(1)), angle, v); 16 | } 17 | 18 | template 19 | GLM_FUNC_QUALIFIER tmat4x4 scale(tvec3 const & v) 20 | { 21 | return scale(tmat4x4(static_cast(1)), v); 22 | } 23 | 24 | }//namespace glm 25 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/handed_coordinate_space.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_handed_coordinate_space 2 | /// @file glm/gtx/handed_coordinate_space.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER bool rightHanded 8 | ( 9 | tvec3 const & tangent, 10 | tvec3 const & binormal, 11 | tvec3 const & normal 12 | ) 13 | { 14 | return dot(cross(normal, tangent), binormal) > T(0); 15 | } 16 | 17 | template 18 | GLM_FUNC_QUALIFIER bool leftHanded 19 | ( 20 | tvec3 const & tangent, 21 | tvec3 const & binormal, 22 | tvec3 const & normal 23 | ) 24 | { 25 | return dot(cross(normal, tangent), binormal) < T(0); 26 | } 27 | }//namespace glm 28 | -------------------------------------------------------------------------------- /bwidgets/screen_graph/Drawer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "bwRectangle.h" 6 | 7 | namespace bWidgets { 8 | 9 | class bwStyle; 10 | 11 | namespace bwScreenGraph { 12 | class ScreenGraph; 13 | class Node; 14 | 15 | class Drawer { 16 | public: 17 | static void draw(ScreenGraph& screen_graph, bwStyle& style); 18 | static void drawSubtree(Node& subtree_root, bwStyle& style); 19 | 20 | private: 21 | Drawer(bwStyle& style); 22 | 23 | void drawSubtreeRecursive(Node& subtree_root); 24 | void drawNode(Node& node); 25 | void pushMask(const Node& node); 26 | void popMask(); 27 | 28 | bwStyle& style; 29 | std::stack maskrect_stack; 30 | }; 31 | 32 | } // namespace bwScreenGraph 33 | } // namespace bWidgets 34 | -------------------------------------------------------------------------------- /bwidgets/widgets/bwPushButton.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "bwAbstractButton.h" 6 | 7 | namespace bWidgets { 8 | 9 | class bwPushButton : public bwAbstractButton { 10 | public: 11 | bwPushButton(const std::string& text, 12 | std::optional width_hint = std::nullopt, 13 | std::optional height_hint = std::nullopt); 14 | 15 | auto getTypeIdentifier() const -> std::string_view override; 16 | 17 | auto getIcon() const -> const bwIconInterface* override; 18 | auto setIcon(const class bwIconInterface&) -> bwPushButton&; 19 | 20 | auto canAlign() const -> bool override; 21 | 22 | private: 23 | const class bwIconInterface* icon{nullptr}; 24 | }; 25 | 26 | } // namespace bWidgets 27 | -------------------------------------------------------------------------------- /bwidgets/widgets/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(INC 2 | ) 3 | 4 | set(SRC 5 | bwAbstractButton.cc 6 | bwCheckbox.cc 7 | bwContainerWidget.cc 8 | bwLabel.cc 9 | bwNumberSlider.cc 10 | bwPanel.cc 11 | bwPushButton.cc 12 | bwRadioButton.cc 13 | bwScrollBar.cc 14 | bwScrollView.cc 15 | bwTextBox.cc 16 | bwWidget.cc 17 | 18 | builtin_widgets.h 19 | bwAbstractButton.h 20 | bwCheckbox.h 21 | bwContainerWidget.h 22 | bwLabel.h 23 | bwNumberSlider.h 24 | bwPanel.h 25 | bwPushButton.h 26 | bwRadioButton.h 27 | bwScrollBar.h 28 | bwScrollView.h 29 | bwTextBox.h 30 | bwWidget.h 31 | ) 32 | 33 | set(LIB 34 | bWidgets 35 | ) 36 | 37 | add_library(bw_widgets) 38 | target_sources(bw_widgets PRIVATE ${SRC}) 39 | include_directories(${INC}) 40 | target_link_libraries(bw_widgets ${LIB}) 41 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/orthonormalize.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_orthonormalize 2 | /// @file glm/gtx/orthonormalize.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER tmat3x3 orthonormalize(tmat3x3 const & m) 8 | { 9 | tmat3x3 r = m; 10 | 11 | r[0] = normalize(r[0]); 12 | 13 | T d0 = dot(r[0], r[1]); 14 | r[1] -= r[0] * d0; 15 | r[1] = normalize(r[1]); 16 | 17 | T d1 = dot(r[1], r[2]); 18 | d0 = dot(r[0], r[2]); 19 | r[2] -= r[0] * d0 + r[1] * d1; 20 | r[2] = normalize(r[2]); 21 | 22 | return r; 23 | } 24 | 25 | template 26 | GLM_FUNC_QUALIFIER tvec3 orthonormalize(tvec3 const & x, tvec3 const & y) 27 | { 28 | return normalize(x - y * dot(y, x)); 29 | } 30 | }//namespace glm 31 | -------------------------------------------------------------------------------- /bwidgets/screen_graph/ScreenGraph.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "bwContext.h" 4 | #include "bwEventDispatcher.h" 5 | 6 | namespace bWidgets { 7 | namespace bwScreenGraph { 8 | 9 | class Node; 10 | class LayoutNode; 11 | 12 | class ScreenGraph { 13 | public: 14 | template 15 | ScreenGraph(std::unique_ptr<_NodeType> _root_node) 16 | : event_dispatcher(*this), root_node(std::move(_root_node)) 17 | { 18 | } 19 | 20 | auto Root() const -> LayoutNode& 21 | { 22 | return *root_node; 23 | } 24 | 25 | /** The context describing the state of this screen-graph */ 26 | bwContext context; 27 | bwEventDispatcher event_dispatcher; 28 | 29 | private: 30 | std::unique_ptr root_node; 31 | }; 32 | 33 | } // namespace bwScreenGraph 34 | } // namespace bWidgets 35 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | # Managing the Documentation 2 | 3 | \brief Instructions for the bWidgets doxygen documentation. 4 | 5 | The doxygen code documentation is managed in the `docs/` directory. It is 6 | regularly uploaded to https://julianeisel.github.io/bWidgets/. 7 | 8 | To generate HTML documentation from the current source, execute the following 9 | command from the bWidgets __source directory__: 10 | 11 | ```bash 12 | $ doxygen docs/Doxyfile 13 | ``` 14 | The HTML output will then be generated into the `docs/doxygen_html_output/` 15 | directory. Open `docs/local_index.html` in a browser to see the result. 16 | 17 | Pushing the contents of the `docs/doxygen_html_output/` directory to the 18 | bWidgets remote repository will automatically update the 19 | [online documentation](https://julianeisel.github.io/bWidgets/). 20 | -------------------------------------------------------------------------------- /bwidgets/styling/bwStyle.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace bWidgets { 7 | 8 | class bwWidget; 9 | 10 | class bwStyle { 11 | public: 12 | enum class TypeID { 13 | CLASSIC, 14 | CLASSIC_CSS, 15 | FLAT_GREY, 16 | FLAT_DARK, 17 | FLAT_LIGHT, 18 | 19 | BUILTIN_TOT, 20 | 21 | // STYLE_CUSTOM, // For the future 22 | }; 23 | 24 | struct StyleType { 25 | TypeID type_id; 26 | std::string name; 27 | }; 28 | 29 | virtual ~bwStyle() = default; 30 | 31 | virtual void setWidgetStyle(bwWidget& widget) = 0; 32 | virtual void polish(bwWidget&); 33 | 34 | static unsigned int s_default_widget_size_hint; 35 | 36 | TypeID type_id; 37 | float dpi_fac{1.0f}; 38 | 39 | protected: 40 | bwStyle(TypeID type_id); 41 | }; 42 | 43 | } // namespace bWidgets 44 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/scalar_relational.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_scalar_relational 2 | /// @file glm/gtx/scalar_relational.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_scalar_relational GLM_GTX_scalar_relational 7 | /// @ingroup gtx 8 | /// 9 | /// @brief Extend a position from a source to a position at a defined length. 10 | /// 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_GTX_extend extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup gtx_scalar_relational 25 | /// @{ 26 | 27 | 28 | 29 | /// @} 30 | }//namespace glm 31 | 32 | #include "scalar_relational.inl" 33 | -------------------------------------------------------------------------------- /demo/extern/glfw/CMake/modules/FindEpollShim.cmake: -------------------------------------------------------------------------------- 1 | # Find EpollShim 2 | # Once done, this will define 3 | # 4 | # EPOLLSHIM_FOUND - System has EpollShim 5 | # EPOLLSHIM_INCLUDE_DIRS - The EpollShim include directories 6 | # EPOLLSHIM_LIBRARIES - The libraries needed to use EpollShim 7 | 8 | find_path(EPOLLSHIM_INCLUDE_DIRS NAMES sys/epoll.h sys/timerfd.h HINTS /usr/local/include/libepoll-shim) 9 | find_library(EPOLLSHIM_LIBRARIES NAMES epoll-shim libepoll-shim HINTS /usr/local/lib) 10 | 11 | if (EPOLLSHIM_INCLUDE_DIRS AND EPOLLSHIM_LIBRARIES) 12 | set(EPOLLSHIM_FOUND TRUE) 13 | endif (EPOLLSHIM_INCLUDE_DIRS AND EPOLLSHIM_LIBRARIES) 14 | 15 | include(FindPackageHandleStandardArgs) 16 | find_package_handle_standard_args(EPOLLSHIM DEFAULT_MSG EPOLLSHIM_LIBRARIES EPOLLSHIM_INCLUDE_DIRS) 17 | mark_as_advanced(EPOLLSHIM_INCLUDE_DIRS EPOLLSHIM_LIBRARIES) 18 | -------------------------------------------------------------------------------- /bwidgets/widgets/bwPushButton.cc: -------------------------------------------------------------------------------- 1 | #include "bwPushButton.h" 2 | 3 | namespace bWidgets { 4 | 5 | bwPushButton::bwPushButton(const std::string& text, 6 | std::optional width_hint, 7 | std::optional height_hint) 8 | : bwAbstractButton(text, width_hint, height_hint) 9 | { 10 | } 11 | 12 | auto bwPushButton::getTypeIdentifier() const -> std::string_view 13 | { 14 | return "bwPushButton"; 15 | } 16 | 17 | auto bwPushButton::getIcon() const -> const bwIconInterface* 18 | { 19 | return icon; 20 | } 21 | 22 | auto bwPushButton::setIcon(const bwIconInterface& icon_interface) -> bwPushButton& 23 | { 24 | icon = &icon_interface; 25 | return *this; 26 | } 27 | 28 | auto bwPushButton::canAlign() const -> bool 29 | { 30 | return true; 31 | } 32 | 33 | } // namespace bWidgets 34 | -------------------------------------------------------------------------------- /bwidgets/bwContext.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace bWidgets { 4 | 5 | class bwWidget; 6 | namespace bwScreenGraph { 7 | class Node; 8 | } 9 | 10 | /** 11 | * \brief Important state information for the screen-graph. 12 | * 13 | * Blender used to manage special states of widgets (e.g. hovered, active, 14 | * etc.) mostly using per widget flags. To query these special widgets (i.e. 15 | * the currently hovered widget), a lookup had to be performed. 16 | * Rather than requiring lookups, bWidgets uses this context data-struture for 17 | * access to special state widgets. 18 | */ 19 | struct bwContext { 20 | /** The currently hovered node (if any). */ 21 | bwScreenGraph::Node* hovered = nullptr; 22 | 23 | /** The currently active widget which gets any input (if any). */ 24 | bwScreenGraph::Node* active = nullptr; 25 | }; 26 | 27 | } // namespace bWidgets 28 | -------------------------------------------------------------------------------- /tests/bWidgets/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if(NOT WITH_GTESTS) 2 | message(WARNING "Compiling tests even though WITH_GTESTS disabled") 3 | endif() 4 | 5 | if(CMAKE_COMPILER_IS_GNUCC) 6 | remove_cc_flag( 7 | "-Wundef" 8 | ) 9 | endif() 10 | 11 | set(INC 12 | .. 13 | ../../bwidgets 14 | ../../bwidgets/generics 15 | ../../bwidgets/styling 16 | ../../bwidgets/utils 17 | ../../bwidgets/widgets 18 | ../gtest/include 19 | ) 20 | 21 | set(SRC 22 | bwPolygon_test.cc 23 | bwStyleProperties_test.cc 24 | screen_graph/Iterator_test.cc 25 | ) 26 | 27 | set(LIB 28 | bWidgets 29 | testing 30 | testing_gtest 31 | ) 32 | 33 | set(SYS_LIB 34 | -lpthread 35 | ) 36 | 37 | add_executable(testing_bwidgets ${SRC}) 38 | target_link_libraries(testing_bwidgets ${LIB} ${SYS_LIB}) 39 | include_directories(${INC}) 40 | 41 | add_test(NAME bwidgets_bwpolygon_test COMMAND testing_bwidgets) 42 | -------------------------------------------------------------------------------- /bwidgets/widgets/bwCheckbox.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "bwAbstractButton.h" 4 | 5 | namespace bWidgets { 6 | 7 | class bwCheckbox : public bwAbstractButton { 8 | public: 9 | bwCheckbox(const std::string& text = "", 10 | std::optional width_hint = std::nullopt, 11 | std::optional height_hint = std::nullopt); 12 | 13 | auto getTypeIdentifier() const -> std::string_view override; 14 | 15 | void draw(class bwStyle& style) override; 16 | 17 | auto createHandler() -> std::unique_ptr override; 18 | 19 | auto isChecked() const -> bool; 20 | 21 | private: 22 | auto isInsideCheckbox(const bwPoint& point) const -> bool; 23 | 24 | auto getCheckboxRectangle() const -> bwRectanglePixel; 25 | auto getTextRectangle(const bwRectanglePixel& checkbox_rectangle) const -> bwRectanglePixel; 26 | }; 27 | 28 | } // namespace bWidgets 29 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/matrix_cross_product.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_matrix_cross_product 2 | /// @file glm/gtx/matrix_cross_product.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER tmat3x3 matrixCross3 8 | ( 9 | tvec3 const & x 10 | ) 11 | { 12 | tmat3x3 Result(T(0)); 13 | Result[0][1] = x.z; 14 | Result[1][0] = -x.z; 15 | Result[0][2] = -x.y; 16 | Result[2][0] = x.y; 17 | Result[1][2] = x.x; 18 | Result[2][1] = -x.x; 19 | return Result; 20 | } 21 | 22 | template 23 | GLM_FUNC_QUALIFIER tmat4x4 matrixCross4 24 | ( 25 | tvec3 const & x 26 | ) 27 | { 28 | tmat4x4 Result(T(0)); 29 | Result[0][1] = x.z; 30 | Result[1][0] = -x.z; 31 | Result[0][2] = -x.y; 32 | Result[2][0] = x.y; 33 | Result[1][2] = x.x; 34 | Result[2][1] = -x.x; 35 | return Result; 36 | } 37 | 38 | }//namespace glm 39 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/projection.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_projection 2 | /// @file glm/gtx/projection.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_projection GLM_GTX_projection 7 | /// @ingroup gtx 8 | /// 9 | /// @brief Projection of a vector to other one 10 | /// 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../geometric.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_GTX_projection extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup gtx_projection 25 | /// @{ 26 | 27 | /// Projects x on Normal. 28 | /// 29 | /// @see gtx_projection 30 | template 31 | GLM_FUNC_DECL vecType proj(vecType const & x, vecType const & Normal); 32 | 33 | /// @} 34 | }//namespace glm 35 | 36 | #include "projection.inl" 37 | -------------------------------------------------------------------------------- /bwidgets/generics/bwFunctorInterface.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace bWidgets { 4 | 5 | /** 6 | * \brief Abstract function object class. 7 | * 8 | * We use this to avoid having to use function pointers with ugly void 9 | * pointers to pass type-generic data. Instead, just derive from this 10 | * interface and add needed data to the derived class. 11 | * 12 | * Example implementation: 13 | * \code{.cc} 14 | * class WidgetApplyFunctor : public bwFunctorInterface 15 | * { 16 | * bwWidget& some_widget; 17 | * 18 | * public: 19 | * WidgetApplyFunctor(bwWidget& widget) : 20 | * some_widget(widget) 21 | * { 22 | * } 23 | * 24 | * inline void operator()() override 25 | * { 26 | * some_widget.do_stuff(); 27 | * } 28 | * }; 29 | * \endcode 30 | */ 31 | class bwFunctorInterface { 32 | public: 33 | virtual void operator()() = 0; 34 | virtual ~bwFunctorInterface() = default; 35 | }; 36 | 37 | } // namespace bWidgets 38 | -------------------------------------------------------------------------------- /bwidgets/styling/bwStyleCSS.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "bwStyle.h" 4 | 5 | namespace bWidgets { 6 | 7 | class bwWidget; 8 | 9 | /** 10 | * \brief Style-class for CSS driven Styles. 11 | * 12 | * How CSS is applied to styles may have to be reworked a bit. For now it just 13 | * mattered to get something working (that is, making CSS control a style). 14 | * Maybe every style should have the ability to be manipulated via CSS? We 15 | * could for example store a CSS-Tree structure in each style that has priority 16 | * over hardcoded style. 17 | * It's also important to keep custom styles in mind. In the end, users should 18 | * be able to 'install' a new style via a CSS file. 19 | */ 20 | class bwStyleCSS : public bwStyle { 21 | public: 22 | bwStyleCSS(); 23 | 24 | void setWidgetStyle(bwWidget& widget); 25 | void polish(bwWidget& widget); 26 | 27 | static void (*polish_cb)(bwWidget& widget); 28 | }; 29 | 30 | } // namespace bWidgets 31 | -------------------------------------------------------------------------------- /bwidgets/styling/bwStyleManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include "bwStyle.h" 7 | 8 | namespace bWidgets { 9 | 10 | /** 11 | * \brief Singleton class for managing styles through type ID's. 12 | */ 13 | class bwStyleManager { 14 | public: 15 | using StyleTypeArray = std::array; 16 | 17 | static auto getStyleManager() -> bwStyleManager&; 18 | static auto createStyleFromTypeID(bwStyle::TypeID type_id) -> std::unique_ptr; 19 | 20 | void registerDefaultStyleTypes(); 21 | 22 | auto getBuiltinStyleTypes() const -> const StyleTypeArray&; 23 | 24 | private: 25 | bwStyleManager() = default; 26 | bwStyleManager(bwStyleManager const&) = delete; 27 | 28 | void operator=(bwStyleManager const&) = delete; 29 | 30 | StyleTypeArray builtin_style_types; 31 | // std::vector custom_types; 32 | }; 33 | 34 | } // namespace bWidgets 35 | -------------------------------------------------------------------------------- /tests/testing_main.cc: -------------------------------------------------------------------------------- 1 | #include "gtest/gtest.h" 2 | 3 | #include "TestUtilClasses.h" 4 | 5 | // ---- Init static util vars ---- 6 | 7 | int TestUtilClasses::NonTrivialConstructors::tot_default_ctor_calls = 0; 8 | int TestUtilClasses::NonTrivialConstructors::tot_int_ctor_calls = 0; 9 | int TestUtilClasses::NonTrivialConstructors::tot_copy_ctor_calls = 0; 10 | int TestUtilClasses::NonTrivialConstructors::tot_move_ctor_calls = 0; 11 | int TestUtilClasses::NonTrivialConstructors::tot_dtor_calls = 0; 12 | int TestUtilClasses::NonTrivialConstructors::tot_instances = 0; 13 | 14 | int TestUtilClasses::CustomSwap::tot_int_ctor_calls = 0; 15 | int TestUtilClasses::CustomSwap::tot_move_ctor_calls = 0; 16 | int TestUtilClasses::CustomSwap::tot_dtor_calls = 0; 17 | int TestUtilClasses::CustomSwap::tot_swap_calls = 0; 18 | 19 | // -------- 20 | 21 | int main(int argc, char** argv) 22 | { 23 | ::testing::InitGoogleTest(&argc, argv); 24 | return RUN_ALL_TESTS(); 25 | } 26 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/polar_coordinates.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_polar_coordinates 2 | /// @file glm/gtx/polar_coordinates.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER tvec3 polar 8 | ( 9 | tvec3 const & euclidean 10 | ) 11 | { 12 | T const Length(length(euclidean)); 13 | tvec3 const tmp(euclidean / Length); 14 | T const xz_dist(sqrt(tmp.x * tmp.x + tmp.z * tmp.z)); 15 | 16 | return tvec3( 17 | asin(tmp.y), // latitude 18 | atan(tmp.x, tmp.z), // longitude 19 | xz_dist); // xz distance 20 | } 21 | 22 | template 23 | GLM_FUNC_QUALIFIER tvec3 euclidean 24 | ( 25 | tvec2 const & polar 26 | ) 27 | { 28 | T const latitude(polar.x); 29 | T const longitude(polar.y); 30 | 31 | return tvec3( 32 | cos(latitude) * sin(longitude), 33 | sin(latitude), 34 | cos(latitude) * cos(longitude)); 35 | } 36 | 37 | }//namespace glm 38 | -------------------------------------------------------------------------------- /demo/extern/glm/gtc/functions.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_functions 2 | /// @file glm/gtc/functions.inl 3 | 4 | #include "../detail/func_exponential.hpp" 5 | 6 | namespace glm 7 | { 8 | template 9 | GLM_FUNC_QUALIFIER T gauss 10 | ( 11 | T x, 12 | T ExpectedValue, 13 | T StandardDeviation 14 | ) 15 | { 16 | return exp(-((x - ExpectedValue) * (x - ExpectedValue)) / (static_cast(2) * StandardDeviation * StandardDeviation)) / (StandardDeviation * sqrt(static_cast(6.28318530717958647692528676655900576))); 17 | } 18 | 19 | template 20 | GLM_FUNC_QUALIFIER T gauss 21 | ( 22 | tvec2 const& Coord, 23 | tvec2 const& ExpectedValue, 24 | tvec2 const& StandardDeviation 25 | ) 26 | { 27 | tvec2 const Squared = ((Coord - ExpectedValue) * (Coord - ExpectedValue)) / (static_cast(2) * StandardDeviation * StandardDeviation); 28 | return exp(-(Squared.x + Squared.y)); 29 | } 30 | }//namespace glm 31 | 32 | -------------------------------------------------------------------------------- /demo/extern/glm/detail/func_exponential_simd.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/func_exponential_simd.inl 3 | 4 | #include "../simd/exponential.h" 5 | 6 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 7 | 8 | namespace glm{ 9 | namespace detail 10 | { 11 | template 12 | struct compute_sqrt 13 | { 14 | GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & v) 15 | { 16 | tvec4 result(uninitialize); 17 | result.data = _mm_sqrt_ps(v.data); 18 | return result; 19 | } 20 | }; 21 | 22 | template <> 23 | struct compute_sqrt 24 | { 25 | GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & v) 26 | { 27 | tvec4 result(uninitialize); 28 | result.data = glm_vec4_sqrt_lowp(v.data); 29 | return result; 30 | } 31 | }; 32 | }//namespace detail 33 | }//namespace glm 34 | 35 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 36 | -------------------------------------------------------------------------------- /bwidgets/generics/bwPolygon.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace bWidgets { 6 | 7 | /* TODO for (2D-)polygons, we should actually use ints, not floats. Prevents precision and rounding 8 | * errors. */ 9 | using bwPointVec = std::vector; 10 | 11 | class bwPolygon { 12 | public: 13 | bwPolygon() = default; 14 | bwPolygon(const bwPolygon& poly) = default; 15 | bwPolygon(const bwPointVec& vertices); 16 | explicit bwPolygon(const unsigned int reserve_vertex_count); 17 | 18 | void addVertex(class bwPoint vertex); 19 | void addVertex(const float x, const float y); 20 | void addVertex(const int x, const int y); 21 | void reserve(const unsigned int count); 22 | auto getVertices() const -> const bwPointVec&; 23 | 24 | auto operator[](const unsigned int index) -> bwPoint&; 25 | 26 | auto isDrawable() const -> bool; 27 | 28 | protected: 29 | bwPointVec vertices{}; 30 | size_t vert_count{0}; 31 | }; 32 | 33 | } // namespace bWidgets 34 | -------------------------------------------------------------------------------- /bwidgets/generics/bwPoint.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "bwPoint.h" 4 | 5 | namespace bWidgets { 6 | 7 | bwPoint::bwPoint(float x, float y) : x(x), y(y) 8 | { 9 | } 10 | 11 | auto bwPoint::operator==(const bwPoint& rhs) const -> bool 12 | { 13 | return (x == rhs.x) && (y == rhs.y); 14 | } 15 | 16 | auto operator*(const bwPoint& lhs, float factor) -> bwPoint 17 | { 18 | return {lhs.x * factor, lhs.y * factor}; 19 | } 20 | auto operator*(float factor, const bwPoint& rhs) -> bwPoint 21 | { 22 | return {rhs.x * factor, rhs.y * factor}; 23 | } 24 | auto operator+(const bwPoint& lhs, const bwPoint& rhs) -> bwPoint 25 | { 26 | return {lhs.x + rhs.x, lhs.y + rhs.y}; 27 | } 28 | auto operator-(const bwPoint& lhs, const bwPoint& rhs) -> bwPoint 29 | { 30 | return {lhs.x - rhs.x, lhs.y - rhs.y}; 31 | } 32 | 33 | auto distance(bwPoint a, bwPoint b) -> float 34 | { 35 | return std::sqrt(std::pow(a.x - b.x, 2.0f) + std::pow(a.y - b.y, 2.0f)); 36 | } 37 | 38 | } // namespace bWidgets 39 | -------------------------------------------------------------------------------- /bwidgets/widgets/bwContainerWidget.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "bwWidget.h" 4 | #include "bwWidgetBaseStyle.h" 5 | 6 | namespace bWidgets { 7 | 8 | namespace bwScreenGraph { 9 | class ContainerNode; 10 | } 11 | 12 | class bwContainerWidget : public bwWidget { 13 | public: 14 | virtual auto getMaskRectangle() -> bwRectanglePixel; 15 | virtual auto childrenVisible() const -> bool; 16 | 17 | void registerProperties() override; 18 | 19 | protected: 20 | bwContainerWidget(const bwScreenGraph::ContainerNode& node, 21 | std::optional width_hint = std::nullopt, 22 | std::optional height_hint = std::nullopt); 23 | 24 | /** Reference to node owning this widget, for additional info queries. */ 25 | const bwScreenGraph::ContainerNode& node; 26 | 27 | public: 28 | bwWidgetBaseStyle 29 | base_style; // XXX public for setWidgetStyle. Should only be temporarily needed. 30 | }; 31 | 32 | } // namespace bWidgets 33 | -------------------------------------------------------------------------------- /bwidgets/widgets/bwLabel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "bwColor.h" 6 | #include "bwWidget.h" 7 | 8 | namespace bWidgets { 9 | 10 | class bwIconInterface; 11 | 12 | class bwLabel : public bwWidget { 13 | public: 14 | bwLabel(std::string text = "", 15 | std::optional width_hint = std::nullopt, 16 | std::optional height_hint = std::nullopt); 17 | 18 | auto getTypeIdentifier() const -> std::string_view override; 19 | 20 | void draw(bwStyle& style) override; 21 | void registerProperties() override; 22 | auto createHandler() -> std::unique_ptr override; 23 | 24 | auto getLabel() const -> const std::string* override; 25 | auto setLabel(const std::string&) -> bwLabel&; 26 | auto setIcon(const bwIconInterface& icon_interface) -> bwLabel&; 27 | 28 | private: 29 | std::string text; 30 | const class bwIconInterface* icon{nullptr}; 31 | 32 | bwColor text_color; 33 | }; 34 | 35 | } // namespace bWidgets 36 | -------------------------------------------------------------------------------- /bwidgets/bwIconInterface.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace bWidgets { 4 | 5 | /** 6 | * \brief Interface to reference icons from within bWidgets. 7 | * 8 | * Using this interface, bWidgets can reference icon objects of which it 9 | * doesn't know any implementation details. 10 | * 11 | * To get icon drawing to work you have to: 12 | * * implement this interface as some class for storing icon data (e.g. a 13 | * bitmap wrapper), 14 | * * implement the \link bWidgets::bwPaintEngine::drawIcon 15 | * bwPaintEngine::drawIcon() function for drawing the icon data, 16 | * * call the `setIcon` function of a widget (if available) to set the icon 17 | * reference. 18 | * 19 | * \note Managing icons, including their memory, has to be done outside of 20 | * bWidgets. At no point does bWidgets take ownership over icon data. 21 | */ 22 | class bwIconInterface { 23 | public: 24 | constexpr static float ICON_DEFAULT_SIZE = 16; 25 | virtual auto isValid() const -> bool = 0; 26 | }; 27 | 28 | } // namespace bWidgets 29 | -------------------------------------------------------------------------------- /demo/extern/glfw/LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2002-2006 Marcus Geelnard 2 | Copyright (c) 2006-2016 Camilla Löwy 3 | 4 | This software is provided 'as-is', without any express or implied 5 | warranty. In no event will the authors be held liable for any damages 6 | arising from the use of this software. 7 | 8 | Permission is granted to anyone to use this software for any purpose, 9 | including commercial applications, and to alter it and redistribute it 10 | freely, subject to the following restrictions: 11 | 12 | 1. The origin of this software must not be misrepresented; you must not 13 | claim that you wrote the original software. If you use this software 14 | in a product, an acknowledgment in the product documentation would 15 | be appreciated but is not required. 16 | 17 | 2. Altered source versions must be plainly marked as such, and must not 18 | be misrepresented as being the original software. 19 | 20 | 3. This notice may not be removed or altered from any source 21 | distribution. 22 | 23 | -------------------------------------------------------------------------------- /bwidgets/generics/bwGradient.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "bwColor.h" 4 | #include "bwRectangle.h" 5 | 6 | namespace bWidgets { 7 | 8 | /** 9 | * \brief Simple class for calculating colors for gradient fills. 10 | * 11 | * The implementation is currently pretty simple and limited, it's however all we need for 12 | * now. More features like unlimited stops at custom positions could be added if needed. 13 | */ 14 | class bwGradient { 15 | public: 16 | enum class Direction { 17 | TOP_BOTTOM, 18 | LEFT_RIGHT, 19 | }; 20 | 21 | bwGradient() = default; 22 | explicit bwGradient(const bwColor& base_color, 23 | float shade_begin, 24 | float shade_end, 25 | Direction direction = Direction::TOP_BOTTOM); 26 | 27 | auto calcPointColor(const class bwPoint& point, const bwRectanglePixel& bounding_box) const 28 | -> bwColor; 29 | 30 | bwColor begin, end; 31 | Direction direction{Direction::TOP_BOTTOM}; 32 | }; 33 | 34 | } // namespace bWidgets 35 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/mixed_product.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_mixed_product 2 | /// @file glm/gtx/mixed_product.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_mixed_product GLM_GTX_mixed_producte 7 | /// @ingroup gtx 8 | /// 9 | /// @brief Mixed product of 3 vectors. 10 | /// 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_GTX_mixed_product extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup gtx_mixed_product 25 | /// @{ 26 | 27 | /// @brief Mixed product of 3 vectors (from GLM_GTX_mixed_product extension) 28 | template 29 | GLM_FUNC_DECL T mixedProduct( 30 | tvec3 const & v1, 31 | tvec3 const & v2, 32 | tvec3 const & v3); 33 | 34 | /// @} 35 | }// namespace glm 36 | 37 | #include "mixed_product.inl" 38 | -------------------------------------------------------------------------------- /demo/gpu/shaders/uniform_color_frag.glsl: -------------------------------------------------------------------------------- 1 | /* 2 | * ***** BEGIN GPL LICENSE BLOCK ***** 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, see . 16 | * 17 | * Original work Copyright (c) 2016 Mike Erwin 18 | * 19 | * ***** END GPL LICENSE BLOCK ***** 20 | */ 21 | 22 | #version 330 core 23 | 24 | uniform vec4 color; 25 | 26 | out vec4 fragColor; 27 | 28 | void main() 29 | { 30 | fragColor = color; 31 | } 32 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/extend.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_extend 2 | /// @file glm/gtx/extend.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_extend GLM_GTX_extend 7 | /// @ingroup gtx 8 | /// 9 | /// @brief Extend a position from a source to a position at a defined length. 10 | /// 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_GTX_extend extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup gtx_extend 25 | /// @{ 26 | 27 | /// Extends of Length the Origin position using the (Source - Origin) direction. 28 | /// @see gtx_extend 29 | template 30 | GLM_FUNC_DECL genType extend( 31 | genType const & Origin, 32 | genType const & Source, 33 | typename genType::value_type const Length); 34 | 35 | /// @} 36 | }//namespace glm 37 | 38 | #include "extend.inl" 39 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/normal.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_normal 2 | /// @file glm/gtx/normal.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_extented_min_max (dependence) 6 | /// 7 | /// @defgroup gtx_normal GLM_GTX_normal 8 | /// @ingroup gtx 9 | /// 10 | /// @brief Compute the normal of a triangle. 11 | /// 12 | /// need to be included to use these functionalities. 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../glm.hpp" 18 | 19 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 20 | # pragma message("GLM: GLM_GTX_normal extension included") 21 | #endif 22 | 23 | namespace glm 24 | { 25 | /// @addtogroup gtx_normal 26 | /// @{ 27 | 28 | //! Computes triangle normal from triangle points. 29 | //! From GLM_GTX_normal extension. 30 | template 31 | GLM_FUNC_DECL tvec3 triangleNormal( 32 | tvec3 const & p1, 33 | tvec3 const & p2, 34 | tvec3 const & p3); 35 | 36 | /// @} 37 | }//namespace glm 38 | 39 | #include "normal.inl" 40 | -------------------------------------------------------------------------------- /bwidgets/screen_graph/EventHandler.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "EventHandler.h" 5 | #include "Node.h" 6 | 7 | namespace bWidgets { 8 | namespace bwScreenGraph { 9 | 10 | void EventHandler::addEventListener(EventHandler::EventType event_type, EventListener listener) 11 | { 12 | assert(event_type < TOT_EVENT_TYPES); 13 | listeners[event_type].push_back(listener); 14 | } 15 | 16 | void EventHandler::onMouseMove(bwEvent&) 17 | { 18 | } 19 | 20 | void EventHandler::onMouseEnter(bwEvent&) 21 | { 22 | } 23 | 24 | void EventHandler::onMouseLeave(bwEvent&) 25 | { 26 | } 27 | 28 | void EventHandler::onMousePress(bwMouseButtonEvent&) 29 | { 30 | } 31 | 32 | void EventHandler::onMouseRelease(bwMouseButtonEvent&) 33 | { 34 | } 35 | 36 | void EventHandler::onMouseClick(bwMouseButtonEvent&) 37 | { 38 | } 39 | 40 | void EventHandler::onMouseDrag(bwMouseButtonDragEvent&) 41 | { 42 | } 43 | 44 | void EventHandler::onMouseWheel(bwMouseWheelEvent&) 45 | { 46 | } 47 | 48 | } // namespace bwScreenGraph 49 | } // namespace bWidgets 50 | -------------------------------------------------------------------------------- /demo/gpu/shaders/smooth_color_frag.glsl: -------------------------------------------------------------------------------- 1 | /* 2 | * ***** BEGIN GPL LICENSE BLOCK ***** 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, see . 16 | * 17 | * Original work Copyright (c) 2016 Mike Erwin 18 | * 19 | * ***** END GPL LICENSE BLOCK ***** 20 | */ 21 | 22 | #version 330 core 23 | 24 | noperspective in vec4 finalColor; 25 | out vec4 fragColor; 26 | 27 | void main() 28 | { 29 | fragColor = finalColor; 30 | } 31 | -------------------------------------------------------------------------------- /demo/extern/glfw/CMake/modules/FindWaylandProtocols.cmake: -------------------------------------------------------------------------------- 1 | find_package(PkgConfig) 2 | 3 | pkg_check_modules(WaylandProtocols QUIET wayland-protocols>=${WaylandProtocols_FIND_VERSION}) 4 | 5 | execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=pkgdatadir wayland-protocols 6 | OUTPUT_VARIABLE WaylandProtocols_PKGDATADIR 7 | RESULT_VARIABLE _pkgconfig_failed) 8 | if (_pkgconfig_failed) 9 | message(FATAL_ERROR "Missing wayland-protocols pkgdatadir") 10 | endif() 11 | 12 | string(REGEX REPLACE "[\r\n]" "" WaylandProtocols_PKGDATADIR "${WaylandProtocols_PKGDATADIR}") 13 | 14 | find_package_handle_standard_args(WaylandProtocols 15 | FOUND_VAR 16 | WaylandProtocols_FOUND 17 | REQUIRED_VARS 18 | WaylandProtocols_PKGDATADIR 19 | VERSION_VAR 20 | WaylandProtocols_VERSION 21 | HANDLE_COMPONENTS 22 | ) 23 | 24 | set(WAYLAND_PROTOCOLS_FOUND ${WaylandProtocols_FOUND}) 25 | set(WAYLAND_PROTOCOLS_PKGDATADIR ${WaylandProtocols_PKGDATADIR}) 26 | set(WAYLAND_PROTOCOLS_VERSION ${WaylandProtocols_VERSION}) 27 | -------------------------------------------------------------------------------- /bwidgets/generics/bwRange.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace bWidgets { 4 | 5 | template class bwRange { 6 | public: 7 | bwRange(T _min, T _max) : min(_min), max(_max) 8 | { 9 | } 10 | 11 | void clampValue(T& value) 12 | { 13 | value = (value < min) ? min : ((value > max) ? max : value); 14 | } 15 | static void clampValue(T& value, const T& min, const T& max) 16 | { 17 | bwRange(min, max).clampValue(value); 18 | } 19 | 20 | bool isInside(const T& value, const bool including_min_max = false) const 21 | { 22 | if (including_min_max) { 23 | return (value >= min) && (value <= max); 24 | } 25 | else { 26 | return (value > min) && (value < max); 27 | } 28 | } 29 | static bool isInside(const T& value, 30 | const T& min, 31 | const T& max, 32 | const bool including_min_max = false) 33 | { 34 | return bwRange(min, max).isInside(value, including_min_max); 35 | } 36 | 37 | T min, max; 38 | }; 39 | 40 | } // namespace bWidgets 41 | -------------------------------------------------------------------------------- /demo/gpu/gpu_intern.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ***** BEGIN GPL LICENSE BLOCK ***** 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, see . 16 | * 17 | * Original work Copyright (c) 2018 Julian Eisel, Mike Erwin 18 | * 19 | * ***** END GPL LICENSE BLOCK ***** 20 | */ 21 | 22 | #pragma once 23 | 24 | extern "C" { // Gawain links to this 25 | void GPU_matrix_bind(const struct Gwn_ShaderInterface* shaderface); 26 | bool GPU_matrix_dirty_get(void); 27 | } 28 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/perpendicular.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_perpendicular 2 | /// @file glm/gtx/perpendicular.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_projection (dependence) 6 | /// 7 | /// @defgroup gtx_perpendicular GLM_GTX_perpendicular 8 | /// @ingroup gtx 9 | /// 10 | /// @brief Perpendicular of a vector from other one 11 | /// 12 | /// need to be included to use these functionalities. 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../glm.hpp" 18 | #include "../gtx/projection.hpp" 19 | 20 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 21 | # pragma message("GLM: GLM_GTX_perpendicular extension included") 22 | #endif 23 | 24 | namespace glm 25 | { 26 | /// @addtogroup gtx_perpendicular 27 | /// @{ 28 | 29 | //! Projects x a perpendicular axis of Normal. 30 | //! From GLM_GTX_perpendicular extension. 31 | template 32 | GLM_FUNC_DECL vecType perp( 33 | vecType const & x, 34 | vecType const & Normal); 35 | 36 | /// @} 37 | }//namespace glm 38 | 39 | #include "perpendicular.inl" 40 | -------------------------------------------------------------------------------- /demo/gpu/shaders/uniform_color_vert.glsl: -------------------------------------------------------------------------------- 1 | /* 2 | * ***** BEGIN GPL LICENSE BLOCK ***** 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, see . 16 | * 17 | * Original work Copyright (c) 2016 Mike Erwin 18 | * 19 | * ***** END GPL LICENSE BLOCK ***** 20 | */ 21 | 22 | #version 330 core 23 | 24 | uniform mat4 ModelViewProjectionMatrix; 25 | 26 | in vec2 pos; 27 | 28 | void main() 29 | { 30 | gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0); 31 | } 32 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/gradient_paint.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_gradient_paint 2 | /// @file glm/gtx/gradient_paint.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER T radialGradient 8 | ( 9 | tvec2 const & Center, 10 | T const & Radius, 11 | tvec2 const & Focal, 12 | tvec2 const & Position 13 | ) 14 | { 15 | tvec2 F = Focal - Center; 16 | tvec2 D = Position - Focal; 17 | T Radius2 = pow2(Radius); 18 | T Fx2 = pow2(F.x); 19 | T Fy2 = pow2(F.y); 20 | 21 | T Numerator = (D.x * F.x + D.y * F.y) + sqrt(Radius2 * (pow2(D.x) + pow2(D.y)) - pow2(D.x * F.y - D.y * F.x)); 22 | T Denominator = Radius2 - (Fx2 + Fy2); 23 | return Numerator / Denominator; 24 | } 25 | 26 | template 27 | GLM_FUNC_QUALIFIER T linearGradient 28 | ( 29 | tvec2 const & Point0, 30 | tvec2 const & Point1, 31 | tvec2 const & Position 32 | ) 33 | { 34 | tvec2 Dist = Point1 - Point0; 35 | return (Dist.x * (Position.x - Point0.x) + Dist.y * (Position.y - Point0.y)) / glm::dot(Dist, Dist); 36 | } 37 | }//namespace glm 38 | -------------------------------------------------------------------------------- /demo/gpu/shaders/texture_frag.glsl: -------------------------------------------------------------------------------- 1 | /* 2 | * ***** BEGIN GPL LICENSE BLOCK ***** 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, see . 16 | * 17 | * Original work Copyright (c) 2016 Martijn Berger 18 | * 19 | * ***** END GPL LICENSE BLOCK ***** 20 | */ 21 | 22 | #version 330 core 23 | 24 | in vec2 texCoord_interp; 25 | out vec4 fragColor; 26 | 27 | uniform vec4 color; 28 | uniform sampler2D image; 29 | 30 | void main() 31 | { 32 | fragColor = texture(image, texCoord_interp) * color; 33 | } 34 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Julian Eisel 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /bwidgets/mit_license.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Julian Eisel 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /demo/bwidgets_demo.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * ***** BEGIN GPL LICENSE BLOCK ***** 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, see . 16 | * 17 | * Original work Copyright (c) 2018 Julian Eisel 18 | * 19 | * ***** END GPL LICENSE BLOCK ***** 20 | */ 21 | 22 | #include "Application.h" 23 | 24 | using namespace bWidgetsDemo; 25 | 26 | int main(int /*argc*/, char** /*argv*/) 27 | { 28 | Application& app = Application::ensureApplication(); 29 | 30 | app.setup(); 31 | app.mainLoop(); 32 | app.exit(); 33 | 34 | return 0; 35 | } 36 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/extend.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_extend 2 | /// @file glm/gtx/extend.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER genType extend 8 | ( 9 | genType const & Origin, 10 | genType const & Source, 11 | genType const & Distance 12 | ) 13 | { 14 | return Origin + (Source - Origin) * Distance; 15 | } 16 | 17 | template 18 | GLM_FUNC_QUALIFIER tvec2 extend 19 | ( 20 | tvec2 const & Origin, 21 | tvec2 const & Source, 22 | T const & Distance 23 | ) 24 | { 25 | return Origin + (Source - Origin) * Distance; 26 | } 27 | 28 | template 29 | GLM_FUNC_QUALIFIER tvec3 extend 30 | ( 31 | tvec3 const & Origin, 32 | tvec3 const & Source, 33 | T const & Distance 34 | ) 35 | { 36 | return Origin + (Source - Origin) * Distance; 37 | } 38 | 39 | template 40 | GLM_FUNC_QUALIFIER tvec4 extend 41 | ( 42 | tvec4 const & Origin, 43 | tvec4 const & Source, 44 | T const & Distance 45 | ) 46 | { 47 | return Origin + (Source - Origin) * Distance; 48 | } 49 | }//namespace glm 50 | -------------------------------------------------------------------------------- /demo/utils/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ***** BEGIN GPL LICENSE BLOCK ***** 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License along 14 | # with this program; if not, see . 15 | # 16 | # Original work Copyright (c) 2018 Julian Eisel 17 | # 18 | # ***** END GPL LICENSE BLOCK ***** 19 | 20 | # No source files here, causing error on clang. 21 | if(False) 22 | set(INC 23 | ) 24 | 25 | set(SRC 26 | FixedNum.h 27 | ) 28 | 29 | add_library(bwd_utils) 30 | target_sources(bwd_utils PRIVATE ${SRC}) 31 | include_directories(${INC}) 32 | set_target_properties(bwd_utils PROPERTIES LINKER_LANGUAGE CXX) 33 | endif() 34 | -------------------------------------------------------------------------------- /bwidgets/styling/bwStyleCSS.cc: -------------------------------------------------------------------------------- 1 | #include "bwAbstractButton.h" 2 | #include "bwPainter.h" 3 | 4 | #include "bwStyleCSS.h" 5 | 6 | #include "builtin_widgets.h" 7 | 8 | namespace bWidgets { 9 | 10 | void (*bwStyleCSS::polish_cb)(class bwWidget&) = nullptr; 11 | 12 | bwStyleCSS::bwStyleCSS() : bwStyle(bwStyle::TypeID::CLASSIC_CSS) 13 | { 14 | } 15 | 16 | void bwStyleCSS::setWidgetStyle(bwWidget& widget) 17 | { 18 | polish(widget); 19 | 20 | if (auto* button = widget_cast(widget)) { 21 | button->base_style.roundbox_corners = button->rounded_corners; 22 | } 23 | else if (auto* container = widget_cast(widget)) { 24 | container->base_style.roundbox_corners = RoundboxCorner::ALL; 25 | } 26 | else if (auto* text_box = widget_cast(widget)) { 27 | text_box->base_style.roundbox_corners = 28 | RoundboxCorner::ALL; // XXX Incorrect, should set this in layout. 29 | } 30 | else { 31 | // base_style->roundbox_corners = RoundboxCorner::ALL; 32 | } 33 | } 34 | 35 | void bwStyleCSS::polish(bwWidget& widget) 36 | { 37 | if (polish_cb) { 38 | polish_cb(widget); 39 | } 40 | } 41 | 42 | } // namespace bWidgets 43 | -------------------------------------------------------------------------------- /demo/gpu/shaders/smooth_color_vert.glsl: -------------------------------------------------------------------------------- 1 | /* 2 | * ***** BEGIN GPL LICENSE BLOCK ***** 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, see . 16 | * 17 | * Original work Copyright (c) 2016 Mike Erwin 18 | * 19 | * ***** END GPL LICENSE BLOCK ***** 20 | */ 21 | 22 | #version 330 core 23 | 24 | uniform mat4 ModelViewProjectionMatrix; 25 | 26 | in vec2 pos; 27 | in vec4 color; 28 | 29 | noperspective out vec4 finalColor; 30 | 31 | void main() 32 | { 33 | gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0); 34 | finalColor = color; 35 | } 36 | -------------------------------------------------------------------------------- /demo/extern/katana-parser/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Hackers and Painters 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /bwidgets/widgets/bwContainerWidget.cc: -------------------------------------------------------------------------------- 1 | #include "bwContainerWidget.h" 2 | 3 | namespace bWidgets { 4 | 5 | bwContainerWidget::bwContainerWidget(const bwScreenGraph::ContainerNode& node, 6 | std::optional width_hint, 7 | std::optional height_hint) 8 | : bwWidget(width_hint, height_hint), node(node) 9 | { 10 | initialize(); 11 | } 12 | 13 | auto bwContainerWidget::getMaskRectangle() -> bwRectanglePixel 14 | { 15 | bwRectanglePixel maskrect = rectangle; 16 | 17 | if (base_style.isBorderVisible()) { 18 | /* With a visible border, we have to exclude the border size from the mask, so that content 19 | * appears clipped by the border. */ 20 | maskrect.resize(-1); 21 | } 22 | 23 | return maskrect; 24 | } 25 | 26 | auto bwContainerWidget::childrenVisible() const -> bool 27 | { 28 | /* By default, all children are visible, can be overriden if the container widget supports hiding 29 | * children. */ 30 | return true; 31 | } 32 | 33 | void bwContainerWidget::registerProperties() 34 | { 35 | base_style.registerProperties(style_properties); 36 | } 37 | 38 | } // namespace bWidgets 39 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/log_base.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_log_base 2 | /// @file glm/gtx/log_base.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_log_base GLM_GTX_log_base 7 | /// @ingroup gtx 8 | /// 9 | /// @brief Logarithm for any base. base can be a vector or a scalar. 10 | /// 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_GTX_log_base extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup gtx_log_base 25 | /// @{ 26 | 27 | /// Logarithm for any base. 28 | /// From GLM_GTX_log_base. 29 | template 30 | GLM_FUNC_DECL genType log( 31 | genType const & x, 32 | genType const & base); 33 | 34 | /// Logarithm for any base. 35 | /// From GLM_GTX_log_base. 36 | template class vecType> 37 | GLM_FUNC_DECL vecType sign( 38 | vecType const & x, 39 | vecType const & base); 40 | 41 | /// @} 42 | }//namespace glm 43 | 44 | #include "log_base.inl" 45 | -------------------------------------------------------------------------------- /demo/extern/glfw/CMake/GenerateMappings.cmake: -------------------------------------------------------------------------------- 1 | # Usage: 2 | # cmake -P GenerateMappings.cmake 3 | 4 | set(source_url "https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt") 5 | set(source_path "${CMAKE_CURRENT_BINARY_DIR}/gamecontrollerdb.txt") 6 | set(template_path "${CMAKE_ARGV3}") 7 | set(target_path "${CMAKE_ARGV4}") 8 | 9 | if (NOT EXISTS "${template_path}") 10 | message(FATAL_ERROR "Failed to find template file ${template_path}") 11 | endif() 12 | 13 | file(DOWNLOAD "${source_url}" "${source_path}" 14 | STATUS download_status 15 | TLS_VERIFY on) 16 | 17 | list(GET download_status 0 status_code) 18 | list(GET download_status 1 status_message) 19 | 20 | if (status_code) 21 | message(FATAL_ERROR "Failed to download ${source_url}: ${status_message}") 22 | endif() 23 | 24 | file(STRINGS "${source_path}" lines) 25 | foreach(line ${lines}) 26 | if ("${line}" MATCHES "^[0-9a-fA-F].*$") 27 | set(GLFW_GAMEPAD_MAPPINGS "${GLFW_GAMEPAD_MAPPINGS}\"${line}\",\n") 28 | endif() 29 | endforeach() 30 | 31 | configure_file("${template_path}" "${target_path}" @ONLY NEWLINE_STYLE UNIX) 32 | file(REMOVE "${source_path}") 33 | 34 | -------------------------------------------------------------------------------- /demo/extern/glfw/CMake/modules/FindXKBCommon.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find XKBCommon 2 | # Once done, this will define 3 | # 4 | # XKBCOMMON_FOUND - System has XKBCommon 5 | # XKBCOMMON_INCLUDE_DIRS - The XKBCommon include directories 6 | # XKBCOMMON_LIBRARIES - The libraries needed to use XKBCommon 7 | # XKBCOMMON_DEFINITIONS - Compiler switches required for using XKBCommon 8 | 9 | find_package(PkgConfig) 10 | pkg_check_modules(PC_XKBCOMMON QUIET xkbcommon) 11 | set(XKBCOMMON_DEFINITIONS ${PC_XKBCOMMON_CFLAGS_OTHER}) 12 | 13 | find_path(XKBCOMMON_INCLUDE_DIR 14 | NAMES xkbcommon/xkbcommon.h 15 | HINTS ${PC_XKBCOMMON_INCLUDE_DIR} ${PC_XKBCOMMON_INCLUDE_DIRS} 16 | ) 17 | 18 | find_library(XKBCOMMON_LIBRARY 19 | NAMES xkbcommon 20 | HINTS ${PC_XKBCOMMON_LIBRARY} ${PC_XKBCOMMON_LIBRARY_DIRS} 21 | ) 22 | 23 | set(XKBCOMMON_LIBRARIES ${XKBCOMMON_LIBRARY}) 24 | set(XKBCOMMON_LIBRARY_DIRS ${XKBCOMMON_LIBRARY_DIRS}) 25 | set(XKBCOMMON_INCLUDE_DIRS ${XKBCOMMON_INCLUDE_DIR}) 26 | 27 | include(FindPackageHandleStandardArgs) 28 | find_package_handle_standard_args(XKBCommon DEFAULT_MSG 29 | XKBCOMMON_LIBRARY 30 | XKBCOMMON_INCLUDE_DIR 31 | ) 32 | 33 | mark_as_advanced(XKBCOMMON_LIBRARY XKBCOMMON_INCLUDE_DIR) 34 | 35 | -------------------------------------------------------------------------------- /bwidgets/generics/bwPolygon.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "bwPoint.h" 5 | 6 | #include "bwPolygon.h" 7 | 8 | namespace bWidgets { 9 | 10 | bwPolygon::bwPolygon(const bwPointVec& vertices) : vertices(vertices), vert_count(vertices.size()) 11 | { 12 | } 13 | 14 | bwPolygon::bwPolygon(const unsigned int reserve_vertex_count) 15 | { 16 | vertices.reserve(reserve_vertex_count); 17 | } 18 | 19 | void bwPolygon::addVertex(bwPoint vertex) 20 | { 21 | vertices.push_back(vertex); 22 | vert_count++; 23 | } 24 | 25 | void bwPolygon::addVertex(const float x, const float y) 26 | { 27 | addVertex(bwPoint(x, y)); 28 | } 29 | 30 | void bwPolygon::addVertex(const int x, const int y) 31 | { 32 | addVertex({std::roundf(x), std::roundf(y)}); 33 | } 34 | 35 | void bwPolygon::reserve(const unsigned int count) 36 | { 37 | vertices.reserve(count); 38 | } 39 | 40 | auto bwPolygon::getVertices() const -> const bwPointVec& 41 | { 42 | return vertices; 43 | } 44 | 45 | auto bwPolygon::operator[](const unsigned int index) -> bwPoint& 46 | { 47 | return vertices[index]; 48 | } 49 | 50 | auto bwPolygon::isDrawable() const -> bool 51 | { 52 | return (vert_count > 0); 53 | } 54 | 55 | } // namespace bWidgets 56 | -------------------------------------------------------------------------------- /demo/gpu/shaders/texture_vert.glsl: -------------------------------------------------------------------------------- 1 | /* 2 | * ***** BEGIN GPL LICENSE BLOCK ***** 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, see . 16 | * 17 | * Original work Copyright (c) 2016, 2018 Julian Eisel, Martijn Berger 18 | * 19 | * ***** END GPL LICENSE BLOCK ***** 20 | */ 21 | 22 | #version 330 core 23 | 24 | uniform mat4 ModelViewProjectionMatrix; 25 | 26 | uniform vec4 color; 27 | 28 | in vec2 pos; 29 | in vec2 texCoord; 30 | out vec2 texCoord_interp; 31 | 32 | void main() 33 | { 34 | gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0f, 1.0f); 35 | 36 | texCoord_interp = texCoord; 37 | } 38 | -------------------------------------------------------------------------------- /demo/gpu/GPU.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ***** BEGIN GPL LICENSE BLOCK ***** 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, see . 16 | * 17 | * Original work Copyright (c) 2018 Jason Wilkins, Julian Eisel, Mike Erwin 18 | * 19 | * ***** END GPL LICENSE BLOCK ***** 20 | */ 21 | 22 | #pragma once 23 | 24 | #include "GL/glew.h" 25 | #include "GLFW/glfw3.h" 26 | 27 | void GPU_init(); 28 | void GPU_exit(); 29 | 30 | void gpuIdentityMatrix(void); 31 | 32 | void gpuTranslate2f(const float x, const float y); 33 | void gpuTranslate2f(const float vec[2]); 34 | 35 | void gpuOrtho(float left, float right, float bottom, float top); 36 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/raw_data.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_raw_data 2 | /// @file glm/gtx/raw_data.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_raw_data GLM_GTX_raw_data 7 | /// @ingroup gtx 8 | /// 9 | /// @brief Projection of a vector to other one 10 | /// 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependencies 16 | #include "../detail/setup.hpp" 17 | #include "../detail/type_int.hpp" 18 | 19 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 20 | # pragma message("GLM: GLM_GTX_raw_data extension included") 21 | #endif 22 | 23 | namespace glm 24 | { 25 | /// @addtogroup gtx_raw_data 26 | /// @{ 27 | 28 | //! Type for byte numbers. 29 | //! From GLM_GTX_raw_data extension. 30 | typedef detail::uint8 byte; 31 | 32 | //! Type for word numbers. 33 | //! From GLM_GTX_raw_data extension. 34 | typedef detail::uint16 word; 35 | 36 | //! Type for dword numbers. 37 | //! From GLM_GTX_raw_data extension. 38 | typedef detail::uint32 dword; 39 | 40 | //! Type for qword numbers. 41 | //! From GLM_GTX_raw_data extension. 42 | typedef detail::uint64 qword; 43 | 44 | /// @} 45 | }// namespace glm 46 | 47 | #include "raw_data.inl" 48 | -------------------------------------------------------------------------------- /demo/extern/glm/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License 2 | -------------------------------------------------------------------------------- 3 | Copyright (c) 2005 - 2016 G-Truc Creation 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /demo/gpu/shaders/pixel_alpha_mask_texture_uniform_color_frag.glsl: -------------------------------------------------------------------------------- 1 | /* 2 | * ***** BEGIN GPL LICENSE BLOCK ***** 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, see . 16 | * 17 | * Original work Copyright (c) 2017, 2018 Julian Eisel, Mike Erwin 18 | * 19 | * ***** END GPL LICENSE BLOCK ***** 20 | */ 21 | 22 | #version 330 core 23 | 24 | uniform vec4 color; 25 | uniform sampler2D glyph; 26 | 27 | in vec2 texCoord_interp; 28 | out vec4 fragColor; 29 | 30 | void main() 31 | { 32 | vec4 alpha_mask = texture(glyph, texCoord_interp); 33 | 34 | fragColor.rgb = color.rgb; 35 | fragColor.a = color.a * alpha_mask.r; 36 | } 37 | -------------------------------------------------------------------------------- /bwidgets/screen_graph/Builder.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "Builder.h" 4 | 5 | namespace bWidgets { 6 | namespace bwScreenGraph { 7 | 8 | Builder::Builder(LayoutNode& active_layout_node) : _active_layout_node(active_layout_node) 9 | { 10 | } 11 | 12 | Builder::Builder(ScreenGraph& screen_graph) : Builder(screen_graph.Root()) 13 | { 14 | } 15 | 16 | void Builder::setLayout(LayoutNode& node, std::unique_ptr layout) 17 | { 18 | node.layout = std::move(layout); 19 | } 20 | 21 | void Builder::setWidget(WidgetNode& node, std::unique_ptr widget) 22 | { 23 | node.widget = std::move(widget); 24 | node.handler = node.widget->createHandler(); 25 | } 26 | 27 | auto Builder::addWidget(LayoutNode& node, std::unique_ptr widget) -> bwWidget& 28 | { 29 | WidgetNode& node_ref = addChildNode(node); 30 | setWidget(node_ref, std::move(widget)); 31 | return *node_ref.widget; 32 | } 33 | 34 | /** 35 | * \brief Activate a layout node. 36 | * 37 | * Adding further items will add them as children to this node, until a 38 | * different layout node is activated. 39 | */ 40 | void Builder::setActiveLayout(LayoutNode& node) 41 | { 42 | _active_layout_node = node; 43 | } 44 | 45 | } // namespace bwScreenGraph 46 | } // namespace bWidgets 47 | -------------------------------------------------------------------------------- /demo/extern/glfw/cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | 2 | if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 3 | message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") 4 | endif() 5 | 6 | file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) 7 | string(REGEX REPLACE "\n" ";" files "${files}") 8 | 9 | foreach (file ${files}) 10 | message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") 11 | if (EXISTS "$ENV{DESTDIR}${file}") 12 | exec_program("@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 13 | OUTPUT_VARIABLE rm_out 14 | RETURN_VALUE rm_retval) 15 | if (NOT "${rm_retval}" STREQUAL 0) 16 | MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") 17 | endif() 18 | elseif (IS_SYMLINK "$ENV{DESTDIR}${file}") 19 | EXEC_PROGRAM("@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 20 | OUTPUT_VARIABLE rm_out 21 | RETURN_VALUE rm_retval) 22 | if (NOT "${rm_retval}" STREQUAL 0) 23 | message(FATAL_ERROR "Problem when removing symlink \"$ENV{DESTDIR}${file}\"") 24 | endif() 25 | else() 26 | message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") 27 | endif() 28 | endforeach() 29 | 30 | -------------------------------------------------------------------------------- /docs/bWidgets/coding_style.md: -------------------------------------------------------------------------------- 1 | # Coding Style 2 | 3 | \brief Information on the preferred coding "style" to use for bWidgets source 4 | code. 5 | 6 | In short: Be considerate, be reasonable! 7 | 8 | Although bWidgets is written in C++, it's used rather conservatively. Crazy 9 | template usage a la type-traits is avoided. Same goes for operator overloading 10 | for complex data-types, lambdas, multiple inheritance, etc.
11 | Also note that we stick to using C++11 (because of Blender).
12 | In fact, if possible we try to stick to a pretty C-like C++ usage. It's more 13 | like we use C++ features to compensate C weaknesses. 14 | 15 | Some features from C++ that make sense for us and that we do use: namespaces, 16 | constructors/destructors, smart pointers (`unique_ptr()` mainly), references, 17 | callable objects (functors), simple inheritance, standard library, aliases, 18 | `constexpr`.
19 | We are a bit wary of using templates and operator overloading. They are used, 20 | but only for very simple cases where they make sense. `auto` can be used for 21 | variables with obvious type, otherwise it should be avoided too. 22 | 23 | One thing we are unsure about is exception handling. Should we use C++ 24 | exceptions? Are alternatives preferable (return codes, `std::optional`, etc)? 25 | -------------------------------------------------------------------------------- /bwidgets/widgets/bwPanel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "bwContainerWidget.h" 4 | 5 | namespace bWidgets { 6 | 7 | class bwPanel : public bwContainerWidget { 8 | friend class bwPanelHandler; 9 | 10 | public: 11 | enum class State { 12 | OPEN, 13 | CLOSED, 14 | }; 15 | 16 | bwPanel(const bwScreenGraph::ContainerNode& node, 17 | std::string label, 18 | std::optional header_height_hint = std::nullopt); 19 | 20 | auto getTypeIdentifier() const -> std::string_view override; 21 | 22 | void draw(class bwStyle& style) override; 23 | 24 | void registerProperties() override; 25 | 26 | auto getLabel() const -> const std::string* override; 27 | auto childrenVisible() const -> bool override; 28 | 29 | auto createHandler() -> std::unique_ptr override; 30 | 31 | unsigned int getHeaderHeightHint() const; 32 | 33 | unsigned int header_height; 34 | State panel_state{State::OPEN}; 35 | 36 | private: 37 | void drawHeader(class bwStyle& style) const; 38 | auto getHeaderRectangle() const -> bwRectanglePixel; 39 | auto isCoordinateInsideHeader(const bwPoint& point) const -> bool; 40 | 41 | std::string label; 42 | 43 | public: 44 | bool draw_separator = false; 45 | }; 46 | 47 | } // namespace bWidgets 48 | -------------------------------------------------------------------------------- /demo/extern/glm/detail/precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/precision.hpp 3 | 4 | #pragma once 5 | 6 | #include "setup.hpp" 7 | 8 | namespace glm 9 | { 10 | enum precision 11 | { 12 | packed_highp, 13 | packed_mediump, 14 | packed_lowp, 15 | 16 | # if GLM_HAS_ALIGNED_TYPE 17 | aligned_highp, 18 | aligned_mediump, 19 | aligned_lowp, 20 | aligned = aligned_highp, 21 | # endif 22 | 23 | highp = packed_highp, 24 | mediump = packed_mediump, 25 | lowp = packed_lowp, 26 | packed = packed_highp, 27 | 28 | # if GLM_HAS_ALIGNED_TYPE && defined(GLM_FORCE_ALIGNED) 29 | defaultp = aligned_highp 30 | # else 31 | defaultp = highp 32 | # endif 33 | }; 34 | 35 | namespace detail 36 | { 37 | template 38 | struct is_aligned 39 | { 40 | static const bool value = false; 41 | }; 42 | 43 | # if GLM_HAS_ALIGNED_TYPE 44 | template<> 45 | struct is_aligned 46 | { 47 | static const bool value = true; 48 | }; 49 | 50 | template<> 51 | struct is_aligned 52 | { 53 | static const bool value = true; 54 | }; 55 | 56 | template<> 57 | struct is_aligned 58 | { 59 | static const bool value = true; 60 | }; 61 | # endif 62 | }//namespace detail 63 | }//namespace glm 64 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/matrix_cross_product.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_matrix_cross_product 2 | /// @file glm/gtx/matrix_cross_product.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_extented_min_max (dependence) 6 | /// 7 | /// @defgroup gtx_matrix_cross_product GLM_GTX_matrix_cross_product 8 | /// @ingroup gtx 9 | /// 10 | /// @brief Build cross product matrices 11 | /// 12 | /// need to be included to use these functionalities. 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../glm.hpp" 18 | 19 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 20 | # pragma message("GLM: GLM_GTX_matrix_cross_product extension included") 21 | #endif 22 | 23 | namespace glm 24 | { 25 | /// @addtogroup gtx_matrix_cross_product 26 | /// @{ 27 | 28 | //! Build a cross product matrix. 29 | //! From GLM_GTX_matrix_cross_product extension. 30 | template 31 | GLM_FUNC_DECL tmat3x3 matrixCross3( 32 | tvec3 const & x); 33 | 34 | //! Build a cross product matrix. 35 | //! From GLM_GTX_matrix_cross_product extension. 36 | template 37 | GLM_FUNC_DECL tmat4x4 matrixCross4( 38 | tvec3 const & x); 39 | 40 | /// @} 41 | }//namespace glm 42 | 43 | #include "matrix_cross_product.inl" 44 | -------------------------------------------------------------------------------- /demo/extern/glew/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ***** BEGIN GPL LICENSE BLOCK ***** 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License along 14 | # with this program; if not, see . 15 | # 16 | # Original work Copyright (c) 2018 Julian Eisel 17 | # 18 | # ***** END GPL LICENSE BLOCK ***** 19 | 20 | set(INC 21 | include 22 | ) 23 | 24 | set(SRC 25 | src/glew.c 26 | # src/glewinfo.c 27 | # src/visualinfo.c 28 | 29 | include/GL/eglew.h 30 | include/GL/glew.h 31 | include/GL/glxew.h 32 | include/GL/wglew.h 33 | ) 34 | 35 | set(LIB 36 | ${OPENGL_LIBRARIES} 37 | ) 38 | 39 | add_library(bwd_extern_glew) 40 | target_sources(bwd_extern_glew PRIVATE ${SRC}) 41 | include_directories(bwd_extern_glew ${INC}) 42 | target_link_libraries(bwd_extern_glew ${LIB}) 43 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/orthonormalize.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_orthonormalize 2 | /// @file glm/gtx/orthonormalize.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_extented_min_max (dependence) 6 | /// 7 | /// @defgroup gtx_orthonormalize GLM_GTX_orthonormalize 8 | /// @ingroup gtx 9 | /// 10 | /// @brief Orthonormalize matrices. 11 | /// 12 | /// need to be included to use these functionalities. 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../vec3.hpp" 18 | #include "../mat3x3.hpp" 19 | #include "../geometric.hpp" 20 | 21 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 22 | # pragma message("GLM: GLM_GTX_orthonormalize extension included") 23 | #endif 24 | 25 | namespace glm 26 | { 27 | /// @addtogroup gtx_orthonormalize 28 | /// @{ 29 | 30 | /// Returns the orthonormalized matrix of m. 31 | /// 32 | /// @see gtx_orthonormalize 33 | template 34 | GLM_FUNC_DECL tmat3x3 orthonormalize(tmat3x3 const & m); 35 | 36 | /// Orthonormalizes x according y. 37 | /// 38 | /// @see gtx_orthonormalize 39 | template 40 | GLM_FUNC_DECL tvec3 orthonormalize(tvec3 const & x, tvec3 const & y); 41 | 42 | /// @} 43 | }//namespace glm 44 | 45 | #include "orthonormalize.inl" 46 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/closest_point.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_closest_point 2 | /// @file glm/gtx/closest_point.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_closest_point GLM_GTX_closest_point 7 | /// @ingroup gtx 8 | /// 9 | /// @brief Find the point on a straight line which is the closet of a point. 10 | /// 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_GTX_closest_point extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup gtx_closest_point 25 | /// @{ 26 | 27 | /// Find the point on a straight line which is the closet of a point. 28 | /// @see gtx_closest_point 29 | template 30 | GLM_FUNC_DECL tvec3 closestPointOnLine( 31 | tvec3 const & point, 32 | tvec3 const & a, 33 | tvec3 const & b); 34 | 35 | /// 2d lines work as well 36 | template 37 | GLM_FUNC_DECL tvec2 closestPointOnLine( 38 | tvec2 const & point, 39 | tvec2 const & a, 40 | tvec2 const & b); 41 | 42 | /// @} 43 | }// namespace glm 44 | 45 | #include "closest_point.inl" 46 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/polar_coordinates.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_polar_coordinates 2 | /// @file glm/gtx/polar_coordinates.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_polar_coordinates GLM_GTX_polar_coordinates 7 | /// @ingroup gtx 8 | /// 9 | /// @brief Conversion from Euclidean space to polar space and revert. 10 | /// 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_GTX_polar_coordinates extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup gtx_polar_coordinates 25 | /// @{ 26 | 27 | /// Convert Euclidean to Polar coordinates, x is the xz distance, y, the latitude and z the longitude. 28 | /// 29 | /// @see gtx_polar_coordinates 30 | template 31 | GLM_FUNC_DECL tvec3 polar( 32 | tvec3 const & euclidean); 33 | 34 | /// Convert Polar to Euclidean coordinates. 35 | /// 36 | /// @see gtx_polar_coordinates 37 | template 38 | GLM_FUNC_DECL tvec3 euclidean( 39 | tvec2 const & polar); 40 | 41 | /// @} 42 | }//namespace glm 43 | 44 | #include "polar_coordinates.inl" 45 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/optimum_pow.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_optimum_pow 2 | /// @file glm/gtx/optimum_pow.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_optimum_pow GLM_GTX_optimum_pow 7 | /// @ingroup gtx 8 | /// 9 | /// @brief Integer exponentiation of power functions. 10 | /// 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_GTX_optimum_pow extension included") 20 | #endif 21 | 22 | namespace glm{ 23 | namespace gtx 24 | { 25 | /// @addtogroup gtx_optimum_pow 26 | /// @{ 27 | 28 | /// Returns x raised to the power of 2. 29 | /// 30 | /// @see gtx_optimum_pow 31 | template 32 | GLM_FUNC_DECL genType pow2(genType const & x); 33 | 34 | /// Returns x raised to the power of 3. 35 | /// 36 | /// @see gtx_optimum_pow 37 | template 38 | GLM_FUNC_DECL genType pow3(genType const & x); 39 | 40 | /// Returns x raised to the power of 4. 41 | /// 42 | /// @see gtx_optimum_pow 43 | template 44 | GLM_FUNC_DECL genType pow4(genType const & x); 45 | 46 | /// @} 47 | }//namespace gtx 48 | }//namespace glm 49 | 50 | #include "optimum_pow.inl" 51 | -------------------------------------------------------------------------------- /demo/stylesheet/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ***** BEGIN GPL LICENSE BLOCK ***** 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License along 14 | # with this program; if not, see . 15 | # 16 | # Original work Copyright (c) 2018 Julian Eisel 17 | # 18 | # ***** END GPL LICENSE BLOCK ***** 19 | 20 | set(INC 21 | .. 22 | ../extern/katana-parser/src 23 | ../../bwidgets/generics 24 | ) 25 | 26 | set(SRC 27 | PropertyParser.cc 28 | StyleSheet.cc 29 | StyleSheetTree.cc 30 | 31 | PropertyParser.h 32 | StyleSheet.h 33 | StyleSheetTree.h 34 | ) 35 | 36 | set(LIB 37 | bWidgets 38 | extern_katana 39 | ) 40 | 41 | add_library(bwd_stylesheet) 42 | target_sources(bwd_stylesheet PRIVATE ${SRC}) 43 | include_directories(${INC}) 44 | target_link_libraries(bwd_stylesheet ${LIB}) 45 | -------------------------------------------------------------------------------- /bwidgets/bwEvent.cc: -------------------------------------------------------------------------------- 1 | #include "bwEvent.h" 2 | 3 | namespace bWidgets { 4 | 5 | bwEvent::bwEvent(bwPoint _location) : location(_location) 6 | { 7 | } 8 | 9 | void bwEvent::swallow() 10 | { 11 | is_swallowed = true; 12 | } 13 | 14 | void bwEvent::unswallow() 15 | { 16 | is_swallowed = false; 17 | } 18 | 19 | auto bwEvent::isSwallowed() const -> bool 20 | { 21 | return is_swallowed; 22 | } 23 | 24 | bwMouseButtonEvent::bwMouseButtonEvent(Button _button, bwPoint _location) 25 | : bwEvent(_location), button(_button) 26 | { 27 | } 28 | 29 | bwMouseButtonDragEvent::bwMouseButtonDragEvent(Button _button, bwPoint _location) 30 | : bwMouseButtonEvent(_button, _location), drag_state(DRAGGING_BELOW_THRESHOLD) 31 | { 32 | } 33 | 34 | void bwMouseButtonDragEvent::addMouseMovement(bwPoint new_location) 35 | { 36 | if (drag_state == DRAGGING_BELOW_THRESHOLD && 37 | distance(location, new_location) > DRAG_THRESHOLD) { 38 | drag_state = DRAGGING; 39 | } 40 | 41 | drag_distance = new_location - location; 42 | } 43 | 44 | bwMouseWheelEvent::bwMouseWheelEvent(Direction _direction, bwPoint _location) 45 | : bwMouseButtonEvent(Button::WHEEL, _location), direction(_direction) 46 | { 47 | } 48 | 49 | auto bwMouseWheelEvent::getDirection() const -> Direction 50 | { 51 | return direction; 52 | } 53 | 54 | } // namespace bWidgets 55 | -------------------------------------------------------------------------------- /bwidgets/generics/bwGradient.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "bwPoint.h" 5 | 6 | #include "bwGradient.h" 7 | 8 | namespace bWidgets { 9 | 10 | bwGradient::bwGradient(const bwColor& base_color, 11 | float shade_begin, 12 | float shade_end, 13 | Direction direction) 14 | : direction(direction) 15 | { 16 | begin = base_color; 17 | begin.shade(shade_begin); 18 | end = base_color; 19 | end.shade(shade_end); 20 | } 21 | 22 | auto bwGradient::calcPointColor(const bwPoint& point, const bwRectanglePixel& bounding_box) const 23 | -> bwColor 24 | { 25 | const float pos_fac = (direction == bwGradient::Direction::TOP_BOTTOM) ? 26 | ((point.y - bounding_box.ymin) / (float)bounding_box.height()) : 27 | ((bounding_box.xmax - point.x) / (float)bounding_box.width()); 28 | const float pos_fac_inv = 1.0f - pos_fac; 29 | 30 | assert((pos_fac > -1e-5f) && ((pos_fac - 1.0f) <= 1e-6f)); 31 | 32 | return bwColor((begin[0] * pos_fac) + (end[0] * pos_fac_inv), 33 | (begin[1] * pos_fac) + (end[1] * pos_fac_inv), 34 | (begin[2] * pos_fac) + (end[2] * pos_fac_inv), 35 | (begin[3] * pos_fac) + (end[3] * pos_fac_inv)); 36 | } 37 | 38 | } // namespace bWidgets 39 | -------------------------------------------------------------------------------- /demo/extern/glm/gtc/functions.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtc_functions 2 | /// @file glm/gtc/functions.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtc_half_float (dependence) 6 | /// @see gtc_quaternion (dependence) 7 | /// 8 | /// @defgroup gtc_functions GLM_GTC_functions 9 | /// @ingroup gtc 10 | /// 11 | /// @brief List of useful common functions. 12 | /// 13 | /// need to be included to use these functionalities. 14 | 15 | #pragma once 16 | 17 | // Dependencies 18 | #include "../detail/setup.hpp" 19 | #include "../detail/precision.hpp" 20 | #include "../detail/type_vec2.hpp" 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTC_functions extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtc_functions 29 | /// @{ 30 | 31 | /// 1D gauss function 32 | /// 33 | /// @see gtc_epsilon 34 | template 35 | GLM_FUNC_DECL T gauss( 36 | T x, 37 | T ExpectedValue, 38 | T StandardDeviation); 39 | 40 | /// 2D gauss function 41 | /// 42 | /// @see gtc_epsilon 43 | template 44 | GLM_FUNC_DECL T gauss( 45 | tvec2 const& Coord, 46 | tvec2 const& ExpectedValue, 47 | tvec2 const& StandardDeviation); 48 | 49 | /// @} 50 | }//namespace glm 51 | 52 | #include "functions.inl" 53 | 54 | -------------------------------------------------------------------------------- /demo/extern/katana-parser/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ***** BEGIN GPL LICENSE BLOCK ***** 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License along 14 | # with this program; if not, see . 15 | # 16 | # Original work Copyright (c) 2018 Julian Eisel 17 | # 18 | # ***** END GPL LICENSE BLOCK ***** 19 | 20 | set(INC 21 | ) 22 | 23 | set(SRC 24 | src/foundation.c 25 | src/katana.lex.c 26 | src/katana.tab.c 27 | src/parser.c 28 | src/selector.c 29 | src/tokenizer.c 30 | 31 | src/foundation.h 32 | src/katana.h 33 | src/katana.lex.h 34 | src/katana.tab.h 35 | src/parser.h 36 | src/selector.h 37 | src/tokenizer.h 38 | ) 39 | 40 | if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") 41 | list(APPEND INC visualc/include) 42 | endif() 43 | 44 | include_directories(${INC}) 45 | add_library(extern_katana ${SRC}) 46 | -------------------------------------------------------------------------------- /demo/extern/glfw/src/xkb_unicode.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.3 Linux - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2014 Jonas Ådahl 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | long _glfwKeySym2Unicode(unsigned int keysym); 28 | 29 | -------------------------------------------------------------------------------- /bwidgets/styling/bwWidgetBaseStyle.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "bwColor.h" 4 | 5 | namespace bWidgets { 6 | 7 | enum class TextAlignment; 8 | class bwStyleProperties; 9 | 10 | /** 11 | * \class bwWidgetBaseStyle 12 | * \brief Properties for typical widgets with roundbox corners. 13 | */ 14 | class bwWidgetBaseStyle { 15 | public: 16 | bwWidgetBaseStyle(); 17 | 18 | void registerProperties(bwStyleProperties& style_properties); 19 | 20 | auto backgroundColor() const -> const bwColor&; 21 | auto textColor() const -> const bwColor&; 22 | auto borderColor() const -> const bwColor&; 23 | auto decorationColor() const -> const bwColor&; 24 | auto shadeTop() const -> float; 25 | auto shadeBottom() const -> float; 26 | 27 | auto isBorderVisible() const -> bool; 28 | 29 | bwColor background_color; 30 | bwColor text_color; 31 | bwColor border_color; 32 | bwColor decoration_color; 33 | 34 | int shade_top{0}; 35 | int shade_bottom{ 36 | 0}; // TODO could make this a char - or support gradient for background_color even. 37 | enum TextAlignment text_alignment; // Default value set in constructor. 38 | unsigned int roundbox_corners; // Default value set in constructor. 39 | float corner_radius{ 40 | 0.0f}; // TODO Utility function for calculating final radius (roundbox_radius * dpi_fac). 41 | }; 42 | 43 | } // namespace bWidgets 44 | -------------------------------------------------------------------------------- /bwidgets/widgets/bwScrollView.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "bwContainerWidget.h" 6 | 7 | namespace bWidgets { 8 | 9 | namespace bwScreenGraph { 10 | class WidgetNode; 11 | } 12 | class bwScrollBar; 13 | 14 | class bwScrollView : public bwContainerWidget { 15 | friend class bwScrollViewHandler; 16 | 17 | public: 18 | bwScrollView(bwScreenGraph::ContainerNode& node, 19 | unsigned int width = 0, 20 | unsigned int height = 0); 21 | 22 | auto getTypeIdentifier() const -> std::string_view override; 23 | 24 | void draw(bwStyle& style) override; 25 | 26 | auto createHandler() -> std::unique_ptr override; 27 | 28 | auto getScrollOffsetY() const -> int; 29 | auto getContentBounds(float interface_scale) const -> bwRectanglePixel; 30 | 31 | private: 32 | auto getVerticalScrollBar() const -> bwScrollBar&; 33 | auto getVerticalScrollbarRect(const bwStyle& style) const -> bwRectanglePixel; 34 | void drawScrollBars(bwStyle& style); 35 | auto isScrollable() const -> bool; 36 | void validizeScrollValues(); 37 | 38 | static auto getScrollbarWidth(float interface_scale) -> int; 39 | 40 | constexpr static int SCROLL_BAR_SIZE = 17; 41 | 42 | std::unique_ptr scrollbar_node; 43 | 44 | int vert_scroll{0}; 45 | }; 46 | 47 | } // namespace bWidgets 48 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/closest_point.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_closest_point 2 | /// @file glm/gtx/closest_point.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER tvec3 closestPointOnLine 8 | ( 9 | tvec3 const & point, 10 | tvec3 const & a, 11 | tvec3 const & b 12 | ) 13 | { 14 | T LineLength = distance(a, b); 15 | tvec3 Vector = point - a; 16 | tvec3 LineDirection = (b - a) / LineLength; 17 | 18 | // Project Vector to LineDirection to get the distance of point from a 19 | T Distance = dot(Vector, LineDirection); 20 | 21 | if(Distance <= T(0)) return a; 22 | if(Distance >= LineLength) return b; 23 | return a + LineDirection * Distance; 24 | } 25 | 26 | template 27 | GLM_FUNC_QUALIFIER tvec2 closestPointOnLine 28 | ( 29 | tvec2 const & point, 30 | tvec2 const & a, 31 | tvec2 const & b 32 | ) 33 | { 34 | T LineLength = distance(a, b); 35 | tvec2 Vector = point - a; 36 | tvec2 LineDirection = (b - a) / LineLength; 37 | 38 | // Project Vector to LineDirection to get the distance of point from a 39 | T Distance = dot(Vector, LineDirection); 40 | 41 | if(Distance <= T(0)) return a; 42 | if(Distance >= LineLength) return b; 43 | return a + LineDirection * Distance; 44 | } 45 | 46 | }//namespace glm 47 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/matrix_decompose.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_matrix_decompose 2 | /// @file glm/gtx/matrix_decompose.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_matrix_decompose GLM_GTX_matrix_decompose 7 | /// @ingroup gtx 8 | /// 9 | /// @brief Decomposes a model matrix to translations, rotation and scale components 10 | /// 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependencies 16 | #include "../mat4x4.hpp" 17 | #include "../vec3.hpp" 18 | #include "../vec4.hpp" 19 | #include "../geometric.hpp" 20 | #include "../gtc/quaternion.hpp" 21 | #include "../gtc/matrix_transform.hpp" 22 | 23 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 24 | # pragma message("GLM: GLM_GTX_matrix_decompose extension included") 25 | #endif 26 | 27 | namespace glm 28 | { 29 | /// @addtogroup gtx_matrix_decompose 30 | /// @{ 31 | 32 | /// Decomposes a model matrix to translations, rotation and scale components 33 | /// @see gtx_matrix_decompose 34 | template 35 | GLM_FUNC_DECL bool decompose( 36 | tmat4x4 const & modelMatrix, 37 | tvec3 & scale, tquat & orientation, tvec3 & translation, tvec3 & skew, tvec4 & perspective); 38 | 39 | /// @} 40 | }//namespace glm 41 | 42 | #include "matrix_decompose.inl" 43 | -------------------------------------------------------------------------------- /bwidgets/widgets/bwRadioButton.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "bwAbstractButton.h" 6 | 7 | namespace bWidgets { 8 | 9 | /** 10 | * \brief A radio-button like widget retaining a pressed state once pressed. 11 | * 12 | * \note: The way this works right now is not that nice. It's however made so it can work nicely 13 | * with Blender. 14 | * 15 | * Normally, there's a group of radio buttons, once one of them is pressed, the others get 16 | * un-pressed. It's an exclusive behavior: There should only ever be one pressed radio button in 17 | * the group. bWidgets doesn't ensure this behavior at all as of now. The host application needs to 18 | * do this. In future, there should be a group-widget that ensures the exclusive behavior within 19 | * bWidgets. We need to make Blender ready for it first, though (or make it optional). 20 | */ 21 | class bwRadioButton : public bwAbstractButton { 22 | public: 23 | bwRadioButton(const std::string& text, 24 | std::optional width_hint = std::nullopt, 25 | std::optional height_hint = std::nullopt); 26 | 27 | auto getTypeIdentifier() const -> std::string_view override; 28 | 29 | auto canAlign() const -> bool override; 30 | 31 | auto createHandler() -> std::unique_ptr override; 32 | }; 33 | 34 | } // namespace bWidgets 35 | -------------------------------------------------------------------------------- /demo/extern/gawain/gawain/gwn_primitive_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ***** BEGIN GPL LICENSE BLOCK ***** 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 2 7 | * of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | * 18 | * The Original Code is Copyright (C) 2016 by Mike Erwin. 19 | * All rights reserved. 20 | * 21 | * Contributor(s): Blender Foundation 22 | * 23 | * ***** END GPL LICENSE BLOCK ***** 24 | */ 25 | 26 | /** \file blender/gpu/gwn_primitive_private.h 27 | * \ingroup gpu 28 | * 29 | * Gawain geometric primitives 30 | */ 31 | 32 | #ifndef __GWN_PRIMITIVE_PRIVATE_H__ 33 | #define __GWN_PRIMITIVE_PRIVATE_H__ 34 | 35 | GLenum convert_prim_type_to_gl(Gwn_PrimType); 36 | 37 | #endif /* __GWN_PRIMITIVE_PRIVATE_H__ */ 38 | -------------------------------------------------------------------------------- /tests/gtest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if(NOT WITH_GTESTS) 2 | message(WARNING "Compiling tests even though WITH_GTESTS disabled") 3 | endif() 4 | 5 | if(CMAKE_COMPILER_IS_GNUCC) 6 | remove_cc_flag( 7 | "-Wundef" 8 | ) 9 | endif() 10 | 11 | set(INC 12 | . 13 | include 14 | ) 15 | 16 | set(SRC 17 | src/gtest.cc 18 | src/gtest-death-test.cc 19 | src/gtest-filepath.cc 20 | src/gtest-port.cc 21 | src/gtest-printers.cc 22 | src/gtest-test-part.cc 23 | src/gtest-typed-test.cc 24 | 25 | src/gtest-internal-inl.h 26 | include/gtest/gtest.h 27 | include/gtest/gtest-death-test.h 28 | include/gtest/gtest-message.h 29 | include/gtest/gtest-param-test.h 30 | include/gtest/gtest_pred_impl.h 31 | include/gtest/gtest-printers.h 32 | include/gtest/gtest_prod.h 33 | include/gtest/gtest-spi.h 34 | include/gtest/gtest-test-part.h 35 | include/gtest/gtest-typed-test.h 36 | include/gtest/internal/gtest-death-test-internal.h 37 | include/gtest/internal/gtest-filepath.h 38 | include/gtest/internal/gtest-internal.h 39 | include/gtest/internal/gtest-linked_ptr.h 40 | include/gtest/internal/gtest-param-util.h 41 | include/gtest/internal/gtest-param-util-generated.h 42 | include/gtest/internal/gtest-port.h 43 | include/gtest/internal/gtest-string.h 44 | include/gtest/internal/gtest-tuple.h 45 | include/gtest/internal/gtest-type-util.h 46 | ) 47 | 48 | add_library(testing_gtest ${SRC}) 49 | include_directories(${INC}) 50 | -------------------------------------------------------------------------------- /demo/extern/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ***** BEGIN GPL LICENSE BLOCK ***** 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License along 14 | # with this program; if not, see . 15 | # 16 | # Original work Copyright (c) 2018 Julian Eisel 17 | # 18 | # ***** END GPL LICENSE BLOCK ***** 19 | 20 | set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE) 21 | set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE) 22 | set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) 23 | set(GLFW_INSTALL OFF CACHE BOOL "" FORCE) 24 | 25 | set(GLM_STATIC_LIBRARY_ENABLE ON CACHE BOOL "" FORCE) 26 | 27 | # Disable all warnings for 3rd party libs. 28 | if (MSVC) 29 | add_compile_options(/W0) 30 | else() 31 | add_compile_options(-w) 32 | endif() 33 | 34 | add_subdirectory(gawain) 35 | add_subdirectory(glew) 36 | add_subdirectory(glfw) 37 | add_subdirectory(glm) 38 | add_subdirectory(katana-parser) 39 | -------------------------------------------------------------------------------- /bwidgets/widgets/bwWidget.cc: -------------------------------------------------------------------------------- 1 | #include "bwStyle.h" 2 | 3 | #include "bwWidget.h" 4 | 5 | namespace bWidgets { 6 | 7 | bwWidget::bwWidget(std::optional width_hint, std::optional height_hint) 8 | : state(State::NORMAL), 9 | rectangle(0, 0, 0, 0), 10 | width_hint(width_hint.value_or(bwStyle::s_default_widget_size_hint)), 11 | height_hint(height_hint.value_or(bwStyle::s_default_widget_size_hint)) 12 | { 13 | } 14 | 15 | auto bwWidget::getState() const -> State 16 | { 17 | return state; 18 | } 19 | 20 | auto bwWidget::setState(State value) -> bwWidget& 21 | { 22 | state = value; 23 | return *this; 24 | } 25 | 26 | auto bwWidget::hide(bool _hidden) -> bwWidget& 27 | { 28 | hidden = _hidden; 29 | return *this; 30 | } 31 | 32 | auto bwWidget::isHidden() -> bool 33 | { 34 | return hidden; 35 | } 36 | 37 | auto bwWidget::getLabel() const -> const std::string* 38 | { 39 | return nullptr; 40 | } 41 | 42 | auto bwWidget::canAlign() const -> bool 43 | { 44 | return false; 45 | } 46 | 47 | /** 48 | * \brief Additional initialization that can't be done in #bwWidget constructor. 49 | */ 50 | void bwWidget::initialize() 51 | { 52 | /* Has to be done in init, can't be called from bwWidget constructor (wouldn't call overwritten 53 | * function). */ 54 | registerProperties(); 55 | } 56 | 57 | void bwWidget::registerProperties() 58 | { 59 | } 60 | 61 | } // namespace bWidgets 62 | -------------------------------------------------------------------------------- /bwidgets/widgets/bwLabel.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "bwPainter.h" 4 | #include "bwStyle.h" 5 | 6 | #include "bwLabel.h" 7 | 8 | namespace bWidgets { 9 | 10 | bwLabel::bwLabel(std::string text, 11 | std::optional width_hint, 12 | std::optional height_hint) 13 | : bwWidget(width_hint, height_hint), text(std::move(text)) 14 | { 15 | initialize(); 16 | } 17 | 18 | auto bwLabel::getTypeIdentifier() const -> std::string_view 19 | { 20 | return "bwLabel"; 21 | } 22 | 23 | void bwLabel::draw(bwStyle& style) 24 | { 25 | bwPainter painter; 26 | 27 | painter.setContentMask(rectangle); 28 | painter.setActiveColor(text_color); 29 | painter.drawTextAndIcon(text, icon, rectangle, TextAlignment::LEFT, style.dpi_fac); 30 | } 31 | 32 | void bwLabel::registerProperties() 33 | { 34 | style_properties.addColor("color", text_color); 35 | } 36 | 37 | auto bwLabel::getLabel() const -> const std::string* 38 | { 39 | return &text; 40 | } 41 | 42 | auto bwLabel::setLabel(const std::string& label) -> bwLabel& 43 | { 44 | text = label; 45 | return *this; 46 | } 47 | 48 | auto bwLabel::createHandler() -> std::unique_ptr 49 | { 50 | return nullptr; 51 | } 52 | 53 | auto bwLabel::setIcon(const bwIconInterface& icon_interface) -> bwLabel& 54 | { 55 | icon = &icon_interface; 56 | return *this; 57 | } 58 | 59 | } // namespace bWidgets 60 | -------------------------------------------------------------------------------- /demo/window_manager/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ***** BEGIN GPL LICENSE BLOCK ***** 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License along 14 | # with this program; if not, see . 15 | # 16 | # Original work Copyright (c) 2018 Julian Eisel 17 | # 18 | # ***** END GPL LICENSE BLOCK ***** 19 | 20 | set(INC 21 | ${FREETYPE_INCLUDE_DIRS} # XXX Only needed because of ugly freetype includes in Font.h 22 | ${GPU_INC} 23 | .. 24 | ../gpu 25 | ../utils 26 | ../extern/gawain 27 | ) 28 | 29 | set(SRC 30 | Event.cc 31 | EventManager.cc 32 | Window.cc 33 | WindowManager.cc 34 | 35 | Event.h 36 | EventManager.h 37 | Window.h 38 | WindowManager.h 39 | ) 40 | 41 | set(LIB 42 | bwd_gpu 43 | ) 44 | 45 | add_library(bwd_window_manager) 46 | target_sources(bwd_window_manager PRIVATE ${SRC}) 47 | include_directories(${INC}) 48 | target_link_libraries(bwd_window_manager ${LIB}) 49 | -------------------------------------------------------------------------------- /demo/Application.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ***** BEGIN GPL LICENSE BLOCK ***** 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, see . 16 | * 17 | * Original work Copyright (c) 2018 Julian Eisel 18 | * 19 | * ***** END GPL LICENSE BLOCK ***** 20 | */ 21 | 22 | #pragma once 23 | 24 | namespace bWidgetsDemo { 25 | 26 | /** 27 | * Singleton class for general data of the bWidget Demo Application. 28 | */ 29 | class Application { 30 | public: 31 | static Application& ensureApplication(); 32 | 33 | void setup(); 34 | void mainLoop(); 35 | void exit(); 36 | 37 | static float interfaceScale(); 38 | 39 | private: 40 | Application() 41 | { 42 | } 43 | // Ensure uniqueness 44 | Application(Application const&) = delete; 45 | void operator=(Application const&) = delete; 46 | }; 47 | 48 | } // namespace bWidgetsDemo 49 | -------------------------------------------------------------------------------- /demo/File.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ***** BEGIN GPL LICENSE BLOCK ***** 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, see . 16 | * 17 | * Original work Copyright (c) 2018 Julian Eisel 18 | * 19 | * ***** END GPL LICENSE BLOCK ***** 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | namespace bWidgetsDemo { 29 | 30 | class File { 31 | public: 32 | explicit File(const std::string& path, std::ios::openmode mode = std::ios::in); 33 | ~File() = default; 34 | 35 | std::string readIntoString(); 36 | bool readBytes(char*, const unsigned int, bool reset_cursor); 37 | 38 | friend std::ostream& operator<<(std::ostream&, const File&); 39 | 40 | private: 41 | const std::string _path; 42 | std::ifstream _file_stream; 43 | }; 44 | 45 | } // namespace bWidgetsDemo 46 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/string_cast.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_string_cast 2 | /// @file glm/gtx/string_cast.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtc_half_float (dependence) 6 | /// @see gtx_integer (dependence) 7 | /// @see gtx_quaternion (dependence) 8 | /// 9 | /// @defgroup gtx_string_cast GLM_GTX_string_cast 10 | /// @ingroup gtx 11 | /// 12 | /// @brief Setup strings for GLM type values 13 | /// 14 | /// need to be included to use these functionalities. 15 | /// This extension is not supported with CUDA 16 | 17 | #pragma once 18 | 19 | // Dependency: 20 | #include "../glm.hpp" 21 | #include "../gtc/type_precision.hpp" 22 | #include "../gtc/quaternion.hpp" 23 | #include "../gtx/dual_quaternion.hpp" 24 | #include 25 | 26 | #if(GLM_COMPILER & GLM_COMPILER_CUDA) 27 | # error "GLM_GTX_string_cast is not supported on CUDA compiler" 28 | #endif 29 | 30 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 31 | # pragma message("GLM: GLM_GTX_string_cast extension included") 32 | #endif 33 | 34 | namespace glm 35 | { 36 | /// @addtogroup gtx_string_cast 37 | /// @{ 38 | 39 | /// Create a string from a GLM vector or matrix typed variable. 40 | /// @see gtx_string_cast extension. 41 | template