koffi 0.9.5 → 0.9.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +661 -0
- package/README.md +74 -9
- package/package.json +27 -7
- package/src/call.hh +2 -1
- package/src/call_arm32.cc +525 -0
- package/src/call_arm32_fwd.S +108 -0
- package/src/call_arm64.cc +90 -63
- package/src/call_arm64_fwd.S +24 -29
- package/src/call_x64_sysv.cc +61 -48
- package/src/call_x64_win.cc +69 -43
- package/src/call_x86.cc +83 -62
- package/src/ffi.cc +166 -37
- package/src/ffi.hh +43 -12
- package/src/util.cc +72 -32
- package/src/util.hh +127 -18
- package/test/files/node32.cmd +6 -0
- package/test/files/node64.cmd +6 -0
- package/test/registry/machines.json +185 -0
- package/test/registry/sha256sum.txt +24 -0
- package/test/test.js +625 -0
- package/test/tests/misc.c +40 -0
- package/test/tests/misc.js +54 -0
- package/test/tests/raylib.js +167 -0
- package/vendor/dragonbox/include/dragonbox/dragonbox.h +6 -2
- package/vendor/dragonbox/other_files/Dragonbox.pdf +0 -0
- package/vendor/libcc/libcc.cc +36 -18
- package/vendor/libcc/libcc.hh +23 -1
- package/vendor/raylib/BINDINGS.md +123 -0
- package/vendor/raylib/CHANGELOG +1495 -0
- package/vendor/raylib/CMakeLists.txt +33 -0
- package/vendor/raylib/CMakeOptions.txt +87 -0
- package/vendor/raylib/CONTRIBUTING.md +76 -0
- package/vendor/raylib/CONTRIBUTORS.md +63 -0
- package/vendor/raylib/CONVENTIONS.md +95 -0
- package/vendor/raylib/HISTORY.md +364 -0
- package/vendor/raylib/LICENSE +16 -0
- package/vendor/raylib/README.md +141 -0
- package/vendor/raylib/ROADMAP.md +76 -0
- package/vendor/raylib/SPONSORS.md +68 -0
- package/vendor/raylib/cmake/AddIfFlagCompiles.cmake +12 -0
- package/vendor/raylib/cmake/BuildOptions.cmake +18 -0
- package/vendor/raylib/cmake/CompileDefinitions.cmake +110 -0
- package/vendor/raylib/cmake/CompilerFlags.cmake +79 -0
- package/vendor/raylib/cmake/EnumOption.cmake +9 -0
- package/vendor/raylib/cmake/GlfwImport.cmake +34 -0
- package/vendor/raylib/cmake/InstallConfigurations.cmake +29 -0
- package/vendor/raylib/cmake/JoinPaths.cmake +26 -0
- package/vendor/raylib/cmake/LibraryConfigurations.cmake +108 -0
- package/vendor/raylib/cmake/LibraryPathToLinkerFlags.cmake +24 -0
- package/vendor/raylib/cmake/PackConfigurations.cmake +13 -0
- package/vendor/raylib/cmake/PopulateConfigVariablesLocally.cmake +11 -0
- package/vendor/raylib/cmake/raylib-config-version.cmake +21 -0
- package/vendor/raylib/cmake/raylib-config.cmake +76 -0
- package/vendor/raylib/examples/CMakeLists.txt +139 -0
- package/vendor/raylib/examples/Makefile +565 -0
- package/vendor/raylib/examples/Makefile.Android +405 -0
- package/vendor/raylib/examples/Makefile.Web +1053 -0
- package/vendor/raylib/examples/README.md +203 -0
- package/vendor/raylib/examples/audio/audio_module_playing.c +146 -0
- package/vendor/raylib/examples/audio/audio_module_playing.png +0 -0
- package/vendor/raylib/examples/audio/audio_multichannel_sound.c +73 -0
- package/vendor/raylib/examples/audio/audio_multichannel_sound.png +0 -0
- package/vendor/raylib/examples/audio/audio_music_stream.c +93 -0
- package/vendor/raylib/examples/audio/audio_music_stream.png +0 -0
- package/vendor/raylib/examples/audio/audio_raw_stream.c +167 -0
- package/vendor/raylib/examples/audio/audio_raw_stream.png +0 -0
- package/vendor/raylib/examples/audio/audio_sound_loading.c +64 -0
- package/vendor/raylib/examples/audio/audio_sound_loading.png +0 -0
- package/vendor/raylib/examples/audio/resources/LICENSE.md +10 -0
- package/vendor/raylib/examples/audio/resources/coin.wav +0 -0
- package/vendor/raylib/examples/audio/resources/country.mp3 +0 -0
- package/vendor/raylib/examples/audio/resources/mini1111.xm +0 -0
- package/vendor/raylib/examples/audio/resources/sound.wav +0 -0
- package/vendor/raylib/examples/audio/resources/spring.wav +0 -0
- package/vendor/raylib/examples/audio/resources/target.flac +0 -0
- package/vendor/raylib/examples/audio/resources/target.ogg +0 -0
- package/vendor/raylib/examples/audio/resources/weird.wav +0 -0
- package/vendor/raylib/examples/build.zig +86 -0
- package/vendor/raylib/examples/core/core_2d_camera.c +132 -0
- package/vendor/raylib/examples/core/core_2d_camera.png +0 -0
- package/vendor/raylib/examples/core/core_2d_camera_platformer.c +293 -0
- package/vendor/raylib/examples/core/core_2d_camera_platformer.png +0 -0
- package/vendor/raylib/examples/core/core_2d_camera_smooth_pixelperfect.png +0 -0
- package/vendor/raylib/examples/core/core_3d_camera_first_person.c +97 -0
- package/vendor/raylib/examples/core/core_3d_camera_first_person.png +0 -0
- package/vendor/raylib/examples/core/core_3d_camera_free.c +83 -0
- package/vendor/raylib/examples/core/core_3d_camera_free.png +0 -0
- package/vendor/raylib/examples/core/core_3d_camera_mode.c +73 -0
- package/vendor/raylib/examples/core/core_3d_camera_mode.png +0 -0
- package/vendor/raylib/examples/core/core_3d_picking.c +107 -0
- package/vendor/raylib/examples/core/core_3d_picking.png +0 -0
- package/vendor/raylib/examples/core/core_basic_screen_manager.c +150 -0
- package/vendor/raylib/examples/core/core_basic_screen_manager.png +0 -0
- package/vendor/raylib/examples/core/core_basic_window.c +62 -0
- package/vendor/raylib/examples/core/core_basic_window.png +0 -0
- package/vendor/raylib/examples/core/core_basic_window_web.c +85 -0
- package/vendor/raylib/examples/core/core_custom_frame_control.c +125 -0
- package/vendor/raylib/examples/core/core_custom_frame_control.png +0 -0
- package/vendor/raylib/examples/core/core_custom_logging.c +84 -0
- package/vendor/raylib/examples/core/core_custom_logging.png +0 -0
- package/vendor/raylib/examples/core/core_drop_files.c +76 -0
- package/vendor/raylib/examples/core/core_drop_files.png +0 -0
- package/vendor/raylib/examples/core/core_input_gamepad.c +195 -0
- package/vendor/raylib/examples/core/core_input_gamepad.png +0 -0
- package/vendor/raylib/examples/core/core_input_gestures.c +115 -0
- package/vendor/raylib/examples/core/core_input_gestures.png +0 -0
- package/vendor/raylib/examples/core/core_input_keys.c +59 -0
- package/vendor/raylib/examples/core/core_input_keys.png +0 -0
- package/vendor/raylib/examples/core/core_input_mouse.c +65 -0
- package/vendor/raylib/examples/core/core_input_mouse.png +0 -0
- package/vendor/raylib/examples/core/core_input_mouse_wheel.c +58 -0
- package/vendor/raylib/examples/core/core_input_mouse_wheel.png +0 -0
- package/vendor/raylib/examples/core/core_input_multitouch.c +70 -0
- package/vendor/raylib/examples/core/core_input_multitouch.png +0 -0
- package/vendor/raylib/examples/core/core_loading_thread.c +147 -0
- package/vendor/raylib/examples/core/core_loading_thread.png +0 -0
- package/vendor/raylib/examples/core/core_quat_conversion.c +132 -0
- package/vendor/raylib/examples/core/core_quat_conversion.png +0 -0
- package/vendor/raylib/examples/core/core_random_values.c +67 -0
- package/vendor/raylib/examples/core/core_random_values.png +0 -0
- package/vendor/raylib/examples/core/core_scissor_test.c +71 -0
- package/vendor/raylib/examples/core/core_scissor_test.png +0 -0
- package/vendor/raylib/examples/core/core_smooth_pixelperfect.c +117 -0
- package/vendor/raylib/examples/core/core_smooth_pixelperfect.png +0 -0
- package/vendor/raylib/examples/core/core_split_screen.c +155 -0
- package/vendor/raylib/examples/core/core_split_screen.png +0 -0
- package/vendor/raylib/examples/core/core_storage_values.c +87 -0
- package/vendor/raylib/examples/core/core_storage_values.png +0 -0
- package/vendor/raylib/examples/core/core_vr_simulator.c +143 -0
- package/vendor/raylib/examples/core/core_vr_simulator.png +0 -0
- package/vendor/raylib/examples/core/core_window_flags.c +191 -0
- package/vendor/raylib/examples/core/core_window_flags.png +0 -0
- package/vendor/raylib/examples/core/core_window_letterbox.c +112 -0
- package/vendor/raylib/examples/core/core_window_letterbox.png +0 -0
- package/vendor/raylib/examples/core/core_world_screen.c +78 -0
- package/vendor/raylib/examples/core/core_world_screen.png +0 -0
- package/vendor/raylib/examples/core/resources/LICENSE.md +4 -0
- package/vendor/raylib/examples/core/resources/distortion100.fs +52 -0
- package/vendor/raylib/examples/core/resources/distortion330.fs +53 -0
- package/vendor/raylib/examples/core/resources/ps3.png +0 -0
- package/vendor/raylib/examples/core/resources/xbox.png +0 -0
- package/vendor/raylib/examples/examples_template.c +100 -0
- package/vendor/raylib/examples/models/models_animation.c +114 -0
- package/vendor/raylib/examples/models/models_animation.png +0 -0
- package/vendor/raylib/examples/models/models_billboard.c +75 -0
- package/vendor/raylib/examples/models/models_billboard.png +0 -0
- package/vendor/raylib/examples/models/models_box_collisions.c +121 -0
- package/vendor/raylib/examples/models/models_box_collisions.png +0 -0
- package/vendor/raylib/examples/models/models_cubicmap.c +87 -0
- package/vendor/raylib/examples/models/models_cubicmap.png +0 -0
- package/vendor/raylib/examples/models/models_first_person_maze.c +122 -0
- package/vendor/raylib/examples/models/models_first_person_maze.png +0 -0
- package/vendor/raylib/examples/models/models_geometric_shapes.c +80 -0
- package/vendor/raylib/examples/models/models_geometric_shapes.png +0 -0
- package/vendor/raylib/examples/models/models_heightmap.c +82 -0
- package/vendor/raylib/examples/models/models_heightmap.png +0 -0
- package/vendor/raylib/examples/models/models_loading.c +146 -0
- package/vendor/raylib/examples/models/models_loading.png +0 -0
- package/vendor/raylib/examples/models/models_loading_gltf.c +105 -0
- package/vendor/raylib/examples/models/models_loading_gltf.png +0 -0
- package/vendor/raylib/examples/models/models_loading_vox.c +130 -0
- package/vendor/raylib/examples/models/models_loading_vox.png +0 -0
- package/vendor/raylib/examples/models/models_mesh_generation.c +179 -0
- package/vendor/raylib/examples/models/models_mesh_generation.png +0 -0
- package/vendor/raylib/examples/models/models_mesh_picking.c +223 -0
- package/vendor/raylib/examples/models/models_mesh_picking.png +0 -0
- package/vendor/raylib/examples/models/models_orthographic_projection.c +99 -0
- package/vendor/raylib/examples/models/models_orthographic_projection.png +0 -0
- package/vendor/raylib/examples/models/models_rlgl_solar_system.c +172 -0
- package/vendor/raylib/examples/models/models_rlgl_solar_system.png +0 -0
- package/vendor/raylib/examples/models/models_skybox.c +262 -0
- package/vendor/raylib/examples/models/models_skybox.png +0 -0
- package/vendor/raylib/examples/models/models_waving_cubes.c +112 -0
- package/vendor/raylib/examples/models/models_waving_cubes.png +0 -0
- package/vendor/raylib/examples/models/models_yaw_pitch_roll.c +117 -0
- package/vendor/raylib/examples/models/models_yaw_pitch_roll.png +0 -0
- package/vendor/raylib/examples/models/resources/LICENSE.md +23 -0
- package/vendor/raylib/examples/models/resources/billboard.png +0 -0
- package/vendor/raylib/examples/models/resources/cubicmap.png +0 -0
- package/vendor/raylib/examples/models/resources/cubicmap_atlas.png +0 -0
- package/vendor/raylib/examples/models/resources/dresden_square_1k.hdr +0 -0
- package/vendor/raylib/examples/models/resources/dresden_square_2k.hdr +0 -0
- package/vendor/raylib/examples/models/resources/heightmap.png +0 -0
- package/vendor/raylib/examples/models/resources/models/gltf/AnimatedMorphCube.glb +0 -0
- package/vendor/raylib/examples/models/resources/models/gltf/AnimatedTriangle.gltf +118 -0
- package/vendor/raylib/examples/models/resources/models/gltf/BoxAnimated.glb +0 -0
- package/vendor/raylib/examples/models/resources/models/gltf/LICENSE +23 -0
- package/vendor/raylib/examples/models/resources/models/gltf/girl.glb +0 -0
- package/vendor/raylib/examples/models/resources/models/gltf/raylib_32x32.glb +0 -0
- package/vendor/raylib/examples/models/resources/models/gltf/rigged_figure.glb +0 -0
- package/vendor/raylib/examples/models/resources/models/gltf/vertex_colored_object.glb +0 -0
- package/vendor/raylib/examples/models/resources/models/iqm/guy.blend +0 -0
- package/vendor/raylib/examples/models/resources/models/iqm/guy.iqm +0 -0
- package/vendor/raylib/examples/models/resources/models/iqm/guyanim.iqm +0 -0
- package/vendor/raylib/examples/models/resources/models/iqm/guytex.png +0 -0
- package/vendor/raylib/examples/models/resources/models/iqm/vertex_colored_object.iqm +0 -0
- package/vendor/raylib/examples/models/resources/models/obj/bridge.obj +1725 -0
- package/vendor/raylib/examples/models/resources/models/obj/bridge_diffuse.png +0 -0
- package/vendor/raylib/examples/models/resources/models/obj/castle.obj +12919 -0
- package/vendor/raylib/examples/models/resources/models/obj/castle_diffuse.png +0 -0
- package/vendor/raylib/examples/models/resources/models/obj/cube.obj +68 -0
- package/vendor/raylib/examples/models/resources/models/obj/cube_diffuse.png +0 -0
- package/vendor/raylib/examples/models/resources/models/obj/house.obj +4564 -0
- package/vendor/raylib/examples/models/resources/models/obj/house_diffuse.png +0 -0
- package/vendor/raylib/examples/models/resources/models/obj/market.obj +7301 -0
- package/vendor/raylib/examples/models/resources/models/obj/market_diffuse.png +0 -0
- package/vendor/raylib/examples/models/resources/models/obj/plane.obj +10858 -0
- package/vendor/raylib/examples/models/resources/models/obj/plane_diffuse.png +0 -0
- package/vendor/raylib/examples/models/resources/models/obj/turret.obj +1888 -0
- package/vendor/raylib/examples/models/resources/models/obj/turret_diffuse.png +0 -0
- package/vendor/raylib/examples/models/resources/models/obj/well.obj +1030 -0
- package/vendor/raylib/examples/models/resources/models/obj/well_diffuse.png +0 -0
- package/vendor/raylib/examples/models/resources/models/vox/LICENSE +9 -0
- package/vendor/raylib/examples/models/resources/models/vox/chr_knight.vox +0 -0
- package/vendor/raylib/examples/models/resources/models/vox/chr_sword.vox +0 -0
- package/vendor/raylib/examples/models/resources/models/vox/monu9.vox +0 -0
- package/vendor/raylib/examples/models/resources/shaders/glsl100/cubemap.fs +29 -0
- package/vendor/raylib/examples/models/resources/shaders/glsl100/cubemap.vs +20 -0
- package/vendor/raylib/examples/models/resources/shaders/glsl100/skybox.fs +31 -0
- package/vendor/raylib/examples/models/resources/shaders/glsl100/skybox.vs +24 -0
- package/vendor/raylib/examples/models/resources/shaders/glsl330/cubemap.fs +30 -0
- package/vendor/raylib/examples/models/resources/shaders/glsl330/cubemap.vs +20 -0
- package/vendor/raylib/examples/models/resources/shaders/glsl330/skybox.fs +30 -0
- package/vendor/raylib/examples/models/resources/shaders/glsl330/skybox.vs +24 -0
- package/vendor/raylib/examples/models/resources/skybox.png +0 -0
- package/vendor/raylib/examples/models/rlights.h +183 -0
- package/vendor/raylib/examples/others/easings.h +263 -0
- package/vendor/raylib/examples/others/easings_testbed.c +227 -0
- package/vendor/raylib/examples/others/embedded_files_loading.c +103 -0
- package/vendor/raylib/examples/others/external/include/GLFW/glfw3.h +5538 -0
- package/vendor/raylib/examples/others/external/include/GLFW/glfw3native.h +572 -0
- package/vendor/raylib/examples/others/external/include/glad.h +5466 -0
- package/vendor/raylib/examples/others/external/lib/libglfw3.a +0 -0
- package/vendor/raylib/examples/others/raudio_standalone.c +152 -0
- package/vendor/raylib/examples/others/raylib_opengl_interop.c +152 -0
- package/vendor/raylib/examples/others/raylib_opengl_interop.png +0 -0
- package/vendor/raylib/examples/others/resources/audio/country.mp3 +0 -0
- package/vendor/raylib/examples/others/resources/audio/target.ogg +0 -0
- package/vendor/raylib/examples/others/resources/audio/weird.wav +0 -0
- package/vendor/raylib/examples/others/resources/audio_data.h +4893 -0
- package/vendor/raylib/examples/others/resources/image_data.h +9848 -0
- package/vendor/raylib/examples/others/resources/shaders/glsl100/point_particle.fs +16 -0
- package/vendor/raylib/examples/others/resources/shaders/glsl100/point_particle.vs +24 -0
- package/vendor/raylib/examples/others/resources/shaders/glsl330/point_particle.fs +17 -0
- package/vendor/raylib/examples/others/resources/shaders/glsl330/point_particle.vs +24 -0
- package/vendor/raylib/examples/others/resources/shaders/glsl430/gol.glsl +41 -0
- package/vendor/raylib/examples/others/resources/shaders/glsl430/gol_render.glsl +29 -0
- package/vendor/raylib/examples/others/resources/shaders/glsl430/gol_transfert.glsl +51 -0
- package/vendor/raylib/examples/others/rlgl_compute_shader.c +173 -0
- package/vendor/raylib/examples/others/rlgl_standalone.c +469 -0
- package/vendor/raylib/examples/physics/physics_demo.c +128 -0
- package/vendor/raylib/examples/physics/physics_demo.png +0 -0
- package/vendor/raylib/examples/physics/physics_friction.c +142 -0
- package/vendor/raylib/examples/physics/physics_friction.png +0 -0
- package/vendor/raylib/examples/physics/physics_movement.c +128 -0
- package/vendor/raylib/examples/physics/physics_movement.png +0 -0
- package/vendor/raylib/examples/physics/physics_restitution.c +129 -0
- package/vendor/raylib/examples/physics/physics_restitution.png +0 -0
- package/vendor/raylib/examples/physics/physics_shatter.c +111 -0
- package/vendor/raylib/examples/physics/physics_shatter.png +0 -0
- package/vendor/raylib/examples/raylib_compile_execute.bat +32 -0
- package/vendor/raylib/examples/raylib_makefile_example.bat +27 -0
- package/vendor/raylib/examples/shaders/resources/LICENSE.md +11 -0
- package/vendor/raylib/examples/shaders/resources/fudesumi.png +0 -0
- package/vendor/raylib/examples/shaders/resources/mask.png +0 -0
- package/vendor/raylib/examples/shaders/resources/models/barracks.obj +22251 -0
- package/vendor/raylib/examples/shaders/resources/models/barracks_diffuse.png +0 -0
- package/vendor/raylib/examples/shaders/resources/models/church.obj +5116 -0
- package/vendor/raylib/examples/shaders/resources/models/church_diffuse.png +0 -0
- package/vendor/raylib/examples/shaders/resources/models/watermill.obj +5316 -0
- package/vendor/raylib/examples/shaders/resources/models/watermill_diffuse.png +0 -0
- package/vendor/raylib/examples/shaders/resources/plasma.png +0 -0
- package/vendor/raylib/examples/shaders/resources/raysan.png +0 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl100/base.fs +23 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl100/base.vs +26 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl100/base_lighting.vs +59 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl100/base_lighting_instanced.vs +36 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl100/bloom.fs +39 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl100/blur.fs +34 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl100/color_mix.fs +26 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl100/cross_hatching.fs +47 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl100/cross_stitching.fs +57 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl100/cubes_panning.fs +60 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl100/depth.fs +26 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl100/distortion.fs +54 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl100/dream_vision.fs +37 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl100/eratosthenes.fs +60 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl100/fisheye.fs +43 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl100/fog.fs +94 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl100/grayscale.fs +25 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl100/julia_set.fs +83 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl100/lighting.fs +81 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl100/mask.fs +24 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl100/outline.fs +34 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl100/palette_switch.fs +41 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl100/pixelizer.fs +32 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl100/posterization.fs +29 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl100/predator.fs +31 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl100/raymarching.fs +431 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl100/reload.fs +39 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl100/scanlines.fs +44 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl100/sobel.fs +40 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl100/spotlight.fs +77 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl100/swirl.fs +46 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl100/wave.fs +36 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl120/base.fs +22 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl120/base.vs +26 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl120/base_lighting.vs +59 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl120/bloom.fs +37 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl120/blur.fs +32 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl120/cross_hatching.fs +45 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl120/cross_stitching.fs +55 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl120/distortion.fs +52 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl120/dream_vision.fs +35 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl120/fisheye.fs +41 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl120/fog.fs +92 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl120/grayscale.fs +23 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl120/palette_switch.fs +27 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl120/pixelizer.fs +30 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl120/posterization.fs +27 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl120/predator.fs +29 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl120/scanlines.fs +42 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl120/sobel.fs +38 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl120/swirl.fs +44 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl330/base.fs +25 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl330/base.vs +26 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl330/base_lighting.vs +32 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl330/base_lighting_instanced.vs +36 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl330/bloom.fs +40 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl330/blur.fs +35 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl330/color_mix.fs +27 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl330/cross_hatching.fs +48 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl330/cross_stitching.fs +59 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl330/cubes_panning.fs +61 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl330/depth.fs +27 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl330/distortion.fs +56 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl330/dream_vision.fs +34 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl330/eratosthenes.fs +59 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl330/fisheye.fs +40 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl330/fog.fs +95 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl330/grayscale.fs +26 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl330/julia_set.fs +81 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl330/lighting.fs +82 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl330/mask.fs +22 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl330/outline.fs +35 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl330/overdraw.fs +26 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl330/palette_switch.fs +30 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl330/pixelizer.fs +33 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl330/posterization.fs +31 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl330/predator.fs +32 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl330/raymarching.fs +430 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl330/reload.fs +40 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl330/scanlines.fs +49 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl330/sobel.fs +41 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl330/spotlight.fs +65 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl330/swirl.fs +47 -0
- package/vendor/raylib/examples/shaders/resources/shaders/glsl330/wave.fs +37 -0
- package/vendor/raylib/examples/shaders/resources/space.png +0 -0
- package/vendor/raylib/examples/shaders/resources/texel_checker.png +0 -0
- package/vendor/raylib/examples/shaders/rlights.h +183 -0
- package/vendor/raylib/examples/shaders/shaders_basic_lighting.c +152 -0
- package/vendor/raylib/examples/shaders/shaders_basic_lighting.png +0 -0
- package/vendor/raylib/examples/shaders/shaders_custom_uniform.c +127 -0
- package/vendor/raylib/examples/shaders/shaders_custom_uniform.png +0 -0
- package/vendor/raylib/examples/shaders/shaders_eratosthenes.c +92 -0
- package/vendor/raylib/examples/shaders/shaders_eratosthenes.png +0 -0
- package/vendor/raylib/examples/shaders/shaders_fog.c +160 -0
- package/vendor/raylib/examples/shaders/shaders_fog.png +0 -0
- package/vendor/raylib/examples/shaders/shaders_hot_reloading.c +130 -0
- package/vendor/raylib/examples/shaders/shaders_hot_reloading.png +0 -0
- package/vendor/raylib/examples/shaders/shaders_julia_set.c +191 -0
- package/vendor/raylib/examples/shaders/shaders_julia_set.png +0 -0
- package/vendor/raylib/examples/shaders/shaders_mesh_instancing.c +224 -0
- package/vendor/raylib/examples/shaders/shaders_mesh_instancing.png +0 -0
- package/vendor/raylib/examples/shaders/shaders_model_shader.c +103 -0
- package/vendor/raylib/examples/shaders/shaders_model_shader.png +0 -0
- package/vendor/raylib/examples/shaders/shaders_multi_sample2d.c +105 -0
- package/vendor/raylib/examples/shaders/shaders_multi_sample2d.png +0 -0
- package/vendor/raylib/examples/shaders/shaders_palette_switch.c +147 -0
- package/vendor/raylib/examples/shaders/shaders_palette_switch.png +0 -0
- package/vendor/raylib/examples/shaders/shaders_postprocessing.c +170 -0
- package/vendor/raylib/examples/shaders/shaders_postprocessing.png +0 -0
- package/vendor/raylib/examples/shaders/shaders_raymarching.c +113 -0
- package/vendor/raylib/examples/shaders/shaders_raymarching.png +0 -0
- package/vendor/raylib/examples/shaders/shaders_shapes_textures.c +116 -0
- package/vendor/raylib/examples/shaders/shaders_shapes_textures.png +0 -0
- package/vendor/raylib/examples/shaders/shaders_simple_mask.c +144 -0
- package/vendor/raylib/examples/shaders/shaders_simple_mask.png +0 -0
- package/vendor/raylib/examples/shaders/shaders_spotlight.c +254 -0
- package/vendor/raylib/examples/shaders/shaders_spotlight.png +0 -0
- package/vendor/raylib/examples/shaders/shaders_texture_drawing.c +80 -0
- package/vendor/raylib/examples/shaders/shaders_texture_drawing.png +0 -0
- package/vendor/raylib/examples/shaders/shaders_texture_outline.c +97 -0
- package/vendor/raylib/examples/shaders/shaders_texture_outline.png +0 -0
- package/vendor/raylib/examples/shaders/shaders_texture_waves.c +110 -0
- package/vendor/raylib/examples/shaders/shaders_texture_waves.png +0 -0
- package/vendor/raylib/examples/shapes/shapes_basic_shapes.c +78 -0
- package/vendor/raylib/examples/shapes/shapes_basic_shapes.png +0 -0
- package/vendor/raylib/examples/shapes/shapes_bouncing_ball.c +76 -0
- package/vendor/raylib/examples/shapes/shapes_bouncing_ball.png +0 -0
- package/vendor/raylib/examples/shapes/shapes_collision_area.c +108 -0
- package/vendor/raylib/examples/shapes/shapes_collision_area.png +0 -0
- package/vendor/raylib/examples/shapes/shapes_colors_palette.c +99 -0
- package/vendor/raylib/examples/shapes/shapes_colors_palette.png +0 -0
- package/vendor/raylib/examples/shapes/shapes_draw_circle_sector.c +83 -0
- package/vendor/raylib/examples/shapes/shapes_draw_circle_sector.png +0 -0
- package/vendor/raylib/examples/shapes/shapes_draw_rectangle_rounded.c +89 -0
- package/vendor/raylib/examples/shapes/shapes_draw_rectangle_rounded.png +0 -0
- package/vendor/raylib/examples/shapes/shapes_draw_ring.c +96 -0
- package/vendor/raylib/examples/shapes/shapes_draw_ring.png +0 -0
- package/vendor/raylib/examples/shapes/shapes_easings_ball_anim.c +110 -0
- package/vendor/raylib/examples/shapes/shapes_easings_ball_anim.png +0 -0
- package/vendor/raylib/examples/shapes/shapes_easings_box_anim.c +136 -0
- package/vendor/raylib/examples/shapes/shapes_easings_box_anim.png +0 -0
- package/vendor/raylib/examples/shapes/shapes_easings_rectangle_array.c +118 -0
- package/vendor/raylib/examples/shapes/shapes_easings_rectangle_array.png +0 -0
- package/vendor/raylib/examples/shapes/shapes_following_eyes.c +104 -0
- package/vendor/raylib/examples/shapes/shapes_following_eyes.png +0 -0
- package/vendor/raylib/examples/shapes/shapes_lines_bezier.c +59 -0
- package/vendor/raylib/examples/shapes/shapes_lines_bezier.png +0 -0
- package/vendor/raylib/examples/shapes/shapes_logo_raylib.c +56 -0
- package/vendor/raylib/examples/shapes/shapes_logo_raylib.png +0 -0
- package/vendor/raylib/examples/shapes/shapes_logo_raylib_anim.c +160 -0
- package/vendor/raylib/examples/shapes/shapes_logo_raylib_anim.png +0 -0
- package/vendor/raylib/examples/shapes/shapes_rectangle_scaling.c +94 -0
- package/vendor/raylib/examples/shapes/shapes_rectangle_scaling.png +0 -0
- package/vendor/raylib/examples/text/resources/KAISG.ttf +0 -0
- package/vendor/raylib/examples/text/resources/LICENSE.md +20 -0
- package/vendor/raylib/examples/text/resources/anonymous_pro_bold.ttf +0 -0
- package/vendor/raylib/examples/text/resources/custom_alagard.png +0 -0
- package/vendor/raylib/examples/text/resources/custom_jupiter_crash.png +0 -0
- package/vendor/raylib/examples/text/resources/custom_mecha.png +0 -0
- package/vendor/raylib/examples/text/resources/dejavu.fnt +1115 -0
- package/vendor/raylib/examples/text/resources/dejavu.png +0 -0
- package/vendor/raylib/examples/text/resources/fonts/alagard.png +0 -0
- package/vendor/raylib/examples/text/resources/fonts/alpha_beta.png +0 -0
- package/vendor/raylib/examples/text/resources/fonts/jupiter_crash.png +0 -0
- package/vendor/raylib/examples/text/resources/fonts/mecha.png +0 -0
- package/vendor/raylib/examples/text/resources/fonts/pixantiqua.png +0 -0
- package/vendor/raylib/examples/text/resources/fonts/pixelplay.png +0 -0
- package/vendor/raylib/examples/text/resources/fonts/romulus.png +0 -0
- package/vendor/raylib/examples/text/resources/fonts/setback.png +0 -0
- package/vendor/raylib/examples/text/resources/noto_cjk.fnt +580 -0
- package/vendor/raylib/examples/text/resources/noto_cjk.png +0 -0
- package/vendor/raylib/examples/text/resources/pixantiqua.fnt +188 -0
- package/vendor/raylib/examples/text/resources/pixantiqua.png +0 -0
- package/vendor/raylib/examples/text/resources/pixantiqua.ttf +0 -0
- package/vendor/raylib/examples/text/resources/shaders/glsl100/alpha_discard.fs +20 -0
- package/vendor/raylib/examples/text/resources/shaders/glsl100/sdf.fs +25 -0
- package/vendor/raylib/examples/text/resources/shaders/glsl330/alpha_discard.fs +19 -0
- package/vendor/raylib/examples/text/resources/shaders/glsl330/sdf.fs +26 -0
- package/vendor/raylib/examples/text/resources/symbola.fnt +191 -0
- package/vendor/raylib/examples/text/resources/symbola.png +0 -0
- package/vendor/raylib/examples/text/text_draw_3d.c +739 -0
- package/vendor/raylib/examples/text/text_draw_3d.png +0 -0
- package/vendor/raylib/examples/text/text_font_filters.c +134 -0
- package/vendor/raylib/examples/text/text_font_filters.png +0 -0
- package/vendor/raylib/examples/text/text_font_loading.c +91 -0
- package/vendor/raylib/examples/text/text_font_loading.png +0 -0
- package/vendor/raylib/examples/text/text_font_sdf.c +141 -0
- package/vendor/raylib/examples/text/text_font_sdf.png +0 -0
- package/vendor/raylib/examples/text/text_font_spritefont.c +85 -0
- package/vendor/raylib/examples/text/text_font_spritefont.png +0 -0
- package/vendor/raylib/examples/text/text_format_text.c +62 -0
- package/vendor/raylib/examples/text/text_format_text.png +0 -0
- package/vendor/raylib/examples/text/text_input_box.c +127 -0
- package/vendor/raylib/examples/text/text_input_box.png +0 -0
- package/vendor/raylib/examples/text/text_raylib_fonts.c +105 -0
- package/vendor/raylib/examples/text/text_raylib_fonts.png +0 -0
- package/vendor/raylib/examples/text/text_rectangle_bounds.c +264 -0
- package/vendor/raylib/examples/text/text_rectangle_bounds.png +0 -0
- package/vendor/raylib/examples/text/text_unicode.c +465 -0
- package/vendor/raylib/examples/text/text_unicode.png +0 -0
- package/vendor/raylib/examples/text/text_writing_anim.c +62 -0
- package/vendor/raylib/examples/text/text_writing_anim.png +0 -0
- package/vendor/raylib/examples/textures/resources/KAISG.ttf +0 -0
- package/vendor/raylib/examples/textures/resources/LICENSE.md +18 -0
- package/vendor/raylib/examples/textures/resources/boom.wav +0 -0
- package/vendor/raylib/examples/textures/resources/button.png +0 -0
- package/vendor/raylib/examples/textures/resources/buttonfx.wav +0 -0
- package/vendor/raylib/examples/textures/resources/cat.png +0 -0
- package/vendor/raylib/examples/textures/resources/custom_jupiter_crash.png +0 -0
- package/vendor/raylib/examples/textures/resources/cyberpunk_street_background.png +0 -0
- package/vendor/raylib/examples/textures/resources/cyberpunk_street_foreground.png +0 -0
- package/vendor/raylib/examples/textures/resources/cyberpunk_street_midground.png +0 -0
- package/vendor/raylib/examples/textures/resources/explosion.png +0 -0
- package/vendor/raylib/examples/textures/resources/fudesumi.png +0 -0
- package/vendor/raylib/examples/textures/resources/fudesumi.raw +0 -0
- package/vendor/raylib/examples/textures/resources/ninepatch_button.png +0 -0
- package/vendor/raylib/examples/textures/resources/parrots.png +0 -0
- package/vendor/raylib/examples/textures/resources/patterns.png +0 -0
- package/vendor/raylib/examples/textures/resources/raylib_logo.png +0 -0
- package/vendor/raylib/examples/textures/resources/scarfy.png +0 -0
- package/vendor/raylib/examples/textures/resources/spark_flame.png +0 -0
- package/vendor/raylib/examples/textures/resources/wabbit_alpha.png +0 -0
- package/vendor/raylib/examples/textures/textures_background_scrolling.c +87 -0
- package/vendor/raylib/examples/textures/textures_background_scrolling.png +0 -0
- package/vendor/raylib/examples/textures/textures_blend_modes.c +93 -0
- package/vendor/raylib/examples/textures/textures_blend_modes.png +0 -0
- package/vendor/raylib/examples/textures/textures_bunnymark.c +120 -0
- package/vendor/raylib/examples/textures/textures_bunnymark.png +0 -0
- package/vendor/raylib/examples/textures/textures_draw_tiled.c +165 -0
- package/vendor/raylib/examples/textures/textures_draw_tiled.png +0 -0
- package/vendor/raylib/examples/textures/textures_image_drawing.c +91 -0
- package/vendor/raylib/examples/textures/textures_image_drawing.png +0 -0
- package/vendor/raylib/examples/textures/textures_image_generation.c +102 -0
- package/vendor/raylib/examples/textures/textures_image_generation.png +0 -0
- package/vendor/raylib/examples/textures/textures_image_loading.c +64 -0
- package/vendor/raylib/examples/textures/textures_image_loading.png +0 -0
- package/vendor/raylib/examples/textures/textures_image_processing.c +169 -0
- package/vendor/raylib/examples/textures/textures_image_processing.png +0 -0
- package/vendor/raylib/examples/textures/textures_image_text.c +83 -0
- package/vendor/raylib/examples/textures/textures_image_text.png +0 -0
- package/vendor/raylib/examples/textures/textures_logo_raylib.c +57 -0
- package/vendor/raylib/examples/textures/textures_logo_raylib.png +0 -0
- package/vendor/raylib/examples/textures/textures_mouse_painting.c +221 -0
- package/vendor/raylib/examples/textures/textures_mouse_painting.png +0 -0
- package/vendor/raylib/examples/textures/textures_npatch_drawing.c +109 -0
- package/vendor/raylib/examples/textures/textures_npatch_drawing.png +0 -0
- package/vendor/raylib/examples/textures/textures_particles_blending.c +135 -0
- package/vendor/raylib/examples/textures/textures_particles_blending.png +0 -0
- package/vendor/raylib/examples/textures/textures_polygon.c +100 -0
- package/vendor/raylib/examples/textures/textures_polygon.png +0 -0
- package/vendor/raylib/examples/textures/textures_raw_data.c +99 -0
- package/vendor/raylib/examples/textures/textures_raw_data.png +0 -0
- package/vendor/raylib/examples/textures/textures_rectangle.c +99 -0
- package/vendor/raylib/examples/textures/textures_rectangle.png +0 -0
- package/vendor/raylib/examples/textures/textures_sprite_button.c +97 -0
- package/vendor/raylib/examples/textures/textures_sprite_button.png +0 -0
- package/vendor/raylib/examples/textures/textures_sprite_explosion.c +120 -0
- package/vendor/raylib/examples/textures/textures_sprite_explosion.png +0 -0
- package/vendor/raylib/examples/textures/textures_srcrec_dstrec.c +82 -0
- package/vendor/raylib/examples/textures/textures_srcrec_dstrec.png +0 -0
- package/vendor/raylib/examples/textures/textures_to_image.c +68 -0
- package/vendor/raylib/examples/textures/textures_to_image.png +0 -0
- package/vendor/raylib/logo/raylib.ico +0 -0
- package/vendor/raylib/logo/raylib_128x128.png +0 -0
- package/vendor/raylib/logo/raylib_144x144.png +0 -0
- package/vendor/raylib/logo/raylib_16x16.png +0 -0
- package/vendor/raylib/logo/raylib_180x180.png +0 -0
- package/vendor/raylib/logo/raylib_24x24.png +0 -0
- package/vendor/raylib/logo/raylib_256x256.png +0 -0
- package/vendor/raylib/logo/raylib_32x32.png +0 -0
- package/vendor/raylib/logo/raylib_36x36.png +0 -0
- package/vendor/raylib/logo/raylib_48x48.png +0 -0
- package/vendor/raylib/logo/raylib_512x512.png +0 -0
- package/vendor/raylib/logo/raylib_64x64.png +0 -0
- package/vendor/raylib/logo/raylib_72x72.png +0 -0
- package/vendor/raylib/logo/raylib_96x96.png +0 -0
- package/vendor/raylib/logo/raylib_logo_animation.gif +0 -0
- package/vendor/raylib/parser/LICENSE +16 -0
- package/vendor/raylib/parser/README.md +63 -0
- package/vendor/raylib/parser/raylib_api.json +6668 -0
- package/vendor/raylib/parser/raylib_api.txt +3568 -0
- package/vendor/raylib/parser/raylib_api.xml +2509 -0
- package/vendor/raylib/parser/raylib_parser.c +1003 -0
- package/vendor/raylib/projects/4coder/Makefile +401 -0
- package/vendor/raylib/projects/4coder/Makefile.Android +300 -0
- package/vendor/raylib/projects/4coder/main.c +39 -0
- package/vendor/raylib/projects/4coder/project.4coder +54 -0
- package/vendor/raylib/projects/Builder/README.md +24 -0
- package/vendor/raylib/projects/Builder/examples/README.md +1 -0
- package/vendor/raylib/projects/Builder/examples/meson.build +25 -0
- package/vendor/raylib/projects/Builder/meson.build +25 -0
- package/vendor/raylib/projects/CMake/CMakeLists.txt +44 -0
- package/vendor/raylib/projects/CMake/core_basic_window.c +62 -0
- package/vendor/raylib/projects/CodeBlocks/README.md +22 -0
- package/vendor/raylib/projects/CodeBlocks/compiler_settings.png +0 -0
- package/vendor/raylib/projects/CodeBlocks/core_basic_window.c +58 -0
- package/vendor/raylib/projects/CodeBlocks/core_basic_window.cbp +137 -0
- package/vendor/raylib/projects/Geany/core_basic_window.c +52 -0
- package/vendor/raylib/projects/Geany/raylib.c.tags +452 -0
- package/vendor/raylib/projects/Geany/raylib_compile_execute.bat +21 -0
- package/vendor/raylib/projects/Geany/raylib_compile_sources.bat +42 -0
- package/vendor/raylib/projects/Geany/raylib_project.geany +41 -0
- package/vendor/raylib/projects/Notepad++/README.md +19 -0
- package/vendor/raylib/projects/Notepad++/c_raylib.xml +3104 -0
- package/vendor/raylib/projects/Notepad++/npes_saved_mingw.txt +0 -0
- package/vendor/raylib/projects/Notepad++/npes_saved_tcc.txt +0 -0
- package/vendor/raylib/projects/Notepad++/npes_saved_w64devkit.txt +0 -0
- package/vendor/raylib/projects/Notepad++/npes_saved_zig.txt +0 -0
- package/vendor/raylib/projects/Notepad++/raylib_npp_parser/raylib_npp.xml +3060 -0
- package/vendor/raylib/projects/Notepad++/raylib_npp_parser/raylib_npp_parser.c +150 -0
- package/vendor/raylib/projects/Notepad++/raylib_npp_parser/raylib_to_parse.h +631 -0
- package/vendor/raylib/projects/README.md +18 -0
- package/vendor/raylib/projects/SublimeText/README.md +13 -0
- package/vendor/raylib/projects/SublimeText/raylib.sublime-build +13 -0
- package/vendor/raylib/projects/SublimeText/raylib.sublime-project +8 -0
- package/vendor/raylib/projects/VS2019/examples/audio_module_playing.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/audio_multichannel_sound.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/audio_music_stream.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/audio_raw_stream.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/audio_sound_loading.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/core_2d_camera.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/core_2d_camera_platformer.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/core_3d_camera_first_person.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/core_3d_camera_free.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/core_3d_camera_mode.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/core_3d_picking.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/core_basic_window.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/core_custom_logging.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/core_drop_files.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/core_input_gamepad.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/core_input_gestures.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/core_input_keys.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/core_input_mouse.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/core_input_mouse_wheel.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/core_input_multitouch.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/core_loading_thread.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/core_quat_conversion.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/core_random_values.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/core_scissor_test.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/core_split_screen.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/core_storage_values.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/core_vr_simulator.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/core_window_flags.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/core_window_letterbox.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/core_world_screen.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/easings_testbed.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/embedded_files_loading.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/models_animation.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/models_billboard.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/models_box_collisions.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/models_cubicmap.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/models_first_person_maze.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/models_geometric_shapes.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/models_heightmap.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/models_loading.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/models_loading_gltf.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/models_loading_vox.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/models_mesh_generation.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/models_mesh_picking.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/models_orthographic_projection.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/models_rlgl_solar_system.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/models_skybox.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/models_waving_cubes.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/models_yaw_pitch_roll.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/physics_demo.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/physics_friction.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/physics_movement.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/physics_restitution.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/physics_shatter.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/raudio_standalone.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/rlgl_standalone.vcxproj +391 -0
- package/vendor/raylib/projects/VS2019/examples/shaders_basic_lighting.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/shaders_custom_uniform.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/shaders_eratosthenes.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/shaders_fog.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/shaders_hot_reloading.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/shaders_julia_set.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/shaders_mesh_instancing.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/shaders_model_shader.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/shaders_multi_sample2d.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/shaders_palette_switch.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/shaders_postprocessing.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/shaders_raymarching.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/shaders_shapes_textures.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/shaders_simple_mask.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/shaders_spotlight.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/shaders_texture_drawing.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/shaders_texture_waves.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/shapes_basic_shapes.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/shapes_bouncing_ball.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/shapes_collision_area.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/shapes_colors_palette.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/shapes_draw_circle_sector.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/shapes_draw_rectangle_rounded.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/shapes_draw_ring.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/shapes_easings_ball_anim.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/shapes_easings_box_anim.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/shapes_easings_rectangle_array.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/shapes_following_eyes.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/shapes_lines_bezier.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/shapes_logo_raylib.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/shapes_logo_raylib_anim.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/shapes_rectangle_scaling.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/text_font_filters.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/text_font_loading.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/text_font_sdf.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/text_font_spritefont.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/text_format_text.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/text_input_box.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/text_raylib_fonts.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/text_rectangle_bounds.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/text_unicode.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/text_writing_anim.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/textures_background_scrolling.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/textures_blend_modes.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/textures_bunnymark.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/textures_draw_tiled.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/textures_image_drawing.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/textures_image_generation.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/textures_image_loading.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/textures_image_processing.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/textures_image_text.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/textures_logo_raylib.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/textures_mouse_painting.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/textures_npatch_drawing.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/textures_particles_blending.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/textures_raw_data.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/textures_rectangle.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/textures_sprite_button.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/textures_sprite_explosion.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/textures_srcrec_dstrec.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/examples/textures_to_image.vcxproj +387 -0
- package/vendor/raylib/projects/VS2019/raylib/raylib.rc +0 -0
- package/vendor/raylib/projects/VS2019/raylib/raylib.vcxproj +341 -0
- package/vendor/raylib/projects/VS2019/raylib/resource.h +14 -0
- package/vendor/raylib/projects/VS2019/raylib.sln +2274 -0
- package/vendor/raylib/projects/VS2019-Android/raylib_android/raylib_android.NativeActivity/android_native_app_glue.c +437 -0
- package/vendor/raylib/projects/VS2019-Android/raylib_android/raylib_android.NativeActivity/android_native_app_glue.h +344 -0
- package/vendor/raylib/projects/VS2019-Android/raylib_android/raylib_android.NativeActivity/main.c +64 -0
- package/vendor/raylib/projects/VS2019-Android/raylib_android/raylib_android.NativeActivity/raylib_android.NativeActivity.vcxproj +226 -0
- package/vendor/raylib/projects/VS2019-Android/raylib_android/raylib_android.NativeActivity/raylib_android.NativeActivity.vcxproj.filters +10 -0
- package/vendor/raylib/projects/VS2019-Android/raylib_android/raylib_android.NativeActivity/raylib_android.NativeActivity.vcxproj.user +4 -0
- package/vendor/raylib/projects/VS2019-Android/raylib_android/raylib_android.Packaging/AndroidManifest.xml +22 -0
- package/vendor/raylib/projects/VS2019-Android/raylib_android/raylib_android.Packaging/build.xml +90 -0
- package/vendor/raylib/projects/VS2019-Android/raylib_android/raylib_android.Packaging/project.properties +3 -0
- package/vendor/raylib/projects/VS2019-Android/raylib_android/raylib_android.Packaging/raylib_android.Packaging.androidproj +134 -0
- package/vendor/raylib/projects/VS2019-Android/raylib_android/raylib_android.Packaging/res/values/strings.xml +4 -0
- package/vendor/raylib/projects/VS2019-Android/raylib_android.sln +75 -0
- package/vendor/raylib/projects/VSCode/.vscode/c_cpp_properties.json +63 -0
- package/vendor/raylib/projects/VSCode/.vscode/launch.json +60 -0
- package/vendor/raylib/projects/VSCode/.vscode/settings.json +11 -0
- package/vendor/raylib/projects/VSCode/.vscode/tasks.json +71 -0
- package/vendor/raylib/projects/VSCode/Makefile +408 -0
- package/vendor/raylib/projects/VSCode/Makefile.Android +300 -0
- package/vendor/raylib/projects/VSCode/main.c +83 -0
- package/vendor/raylib/projects/VSCode/main.code-workspace +16 -0
- package/vendor/raylib/projects/scripts/README.md +68 -0
- package/vendor/raylib/projects/scripts/build-linux.sh +169 -0
- package/vendor/raylib/projects/scripts/build-osx.sh +171 -0
- package/vendor/raylib/projects/scripts/build-rpi.sh +169 -0
- package/vendor/raylib/projects/scripts/build-windows.bat +219 -0
- package/vendor/raylib/projects/scripts/core_basic_window.c +61 -0
- package/vendor/raylib/raylib.pc.in +13 -0
- package/vendor/raylib/src/CMakeLists.txt +121 -0
- package/vendor/raylib/src/Makefile +696 -0
- package/vendor/raylib/src/build.zig +60 -0
- package/vendor/raylib/src/config.h +230 -0
- package/vendor/raylib/src/external/cgltf.h +6501 -0
- package/vendor/raylib/src/external/dirent.h +183 -0
- package/vendor/raylib/src/external/dr_flac.h +12269 -0
- package/vendor/raylib/src/external/dr_mp3.h +4787 -0
- package/vendor/raylib/src/external/dr_wav.h +8019 -0
- package/vendor/raylib/src/external/glad.h +8640 -0
- package/vendor/raylib/src/external/glfw/.mailmap +10 -0
- package/vendor/raylib/src/external/glfw/CMake/GenerateMappings.cmake +33 -0
- package/vendor/raylib/src/external/glfw/CMake/Info.plist.in +38 -0
- package/vendor/raylib/src/external/glfw/CMake/MacOSXBundleInfo.plist.in +38 -0
- package/vendor/raylib/src/external/glfw/CMake/cmake_uninstall.cmake.in +29 -0
- package/vendor/raylib/src/external/glfw/CMake/glfw3.pc.in +13 -0
- package/vendor/raylib/src/external/glfw/CMake/glfw3Config.cmake.in +3 -0
- package/vendor/raylib/src/external/glfw/CMake/i686-w64-mingw32-clang.cmake +13 -0
- package/vendor/raylib/src/external/glfw/CMake/i686-w64-mingw32.cmake +13 -0
- package/vendor/raylib/src/external/glfw/CMake/modules/FindEpollShim.cmake +17 -0
- package/vendor/raylib/src/external/glfw/CMake/modules/FindOSMesa.cmake +18 -0
- package/vendor/raylib/src/external/glfw/CMake/modules/FindWaylandProtocols.cmake +26 -0
- package/vendor/raylib/src/external/glfw/CMake/modules/FindXKBCommon.cmake +34 -0
- package/vendor/raylib/src/external/glfw/CMake/x86_64-w64-mingw32-clang.cmake +13 -0
- package/vendor/raylib/src/external/glfw/CMake/x86_64-w64-mingw32.cmake +13 -0
- package/vendor/raylib/src/external/glfw/CMakeLists.txt +323 -0
- package/vendor/raylib/src/external/glfw/LICENSE.md +23 -0
- package/vendor/raylib/src/external/glfw/README.md +477 -0
- package/vendor/raylib/src/external/glfw/deps/getopt.c +230 -0
- package/vendor/raylib/src/external/glfw/deps/getopt.h +57 -0
- package/vendor/raylib/src/external/glfw/deps/glad/gl.h +3840 -0
- package/vendor/raylib/src/external/glfw/deps/glad/khrplatform.h +282 -0
- package/vendor/raylib/src/external/glfw/deps/glad/vk_platform.h +92 -0
- package/vendor/raylib/src/external/glfw/deps/glad/vulkan.h +3480 -0
- package/vendor/raylib/src/external/glfw/deps/glad_gl.c +1791 -0
- package/vendor/raylib/src/external/glfw/deps/glad_vulkan.c +593 -0
- package/vendor/raylib/src/external/glfw/deps/mingw/_mingw_dxhelper.h +117 -0
- package/vendor/raylib/src/external/glfw/deps/mingw/dinput.h +2467 -0
- package/vendor/raylib/src/external/glfw/deps/mingw/xinput.h +239 -0
- package/vendor/raylib/src/external/glfw/deps/vs2008/stdint.h +247 -0
- package/vendor/raylib/src/external/glfw/include/GLFW/glfw3.h +6075 -0
- package/vendor/raylib/src/external/glfw/include/GLFW/glfw3native.h +530 -0
- package/vendor/raylib/src/external/glfw/src/CMakeLists.txt +246 -0
- package/vendor/raylib/src/external/glfw/src/cocoa_init.m +620 -0
- package/vendor/raylib/src/external/glfw/src/cocoa_joystick.h +46 -0
- package/vendor/raylib/src/external/glfw/src/cocoa_joystick.m +483 -0
- package/vendor/raylib/src/external/glfw/src/cocoa_monitor.m +631 -0
- package/vendor/raylib/src/external/glfw/src/cocoa_platform.h +206 -0
- package/vendor/raylib/src/external/glfw/src/cocoa_time.c +62 -0
- package/vendor/raylib/src/external/glfw/src/cocoa_window.m +1923 -0
- package/vendor/raylib/src/external/glfw/src/context.c +756 -0
- package/vendor/raylib/src/external/glfw/src/egl_context.c +846 -0
- package/vendor/raylib/src/external/glfw/src/egl_context.h +229 -0
- package/vendor/raylib/src/external/glfw/src/glfw.rc.in +30 -0
- package/vendor/raylib/src/external/glfw/src/glfw_config.h.in +58 -0
- package/vendor/raylib/src/external/glfw/src/glx_context.c +699 -0
- package/vendor/raylib/src/external/glfw/src/glx_context.h +181 -0
- package/vendor/raylib/src/external/glfw/src/init.c +357 -0
- package/vendor/raylib/src/external/glfw/src/input.c +1406 -0
- package/vendor/raylib/src/external/glfw/src/internal.h +799 -0
- package/vendor/raylib/src/external/glfw/src/linux_joystick.c +428 -0
- package/vendor/raylib/src/external/glfw/src/linux_joystick.h +59 -0
- package/vendor/raylib/src/external/glfw/src/mappings.h +1550 -0
- package/vendor/raylib/src/external/glfw/src/mappings.h.in +73 -0
- package/vendor/raylib/src/external/glfw/src/monitor.c +542 -0
- package/vendor/raylib/src/external/glfw/src/nsgl_context.h +66 -0
- package/vendor/raylib/src/external/glfw/src/nsgl_context.m +369 -0
- package/vendor/raylib/src/external/glfw/src/null_init.c +57 -0
- package/vendor/raylib/src/external/glfw/src/null_joystick.c +53 -0
- package/vendor/raylib/src/external/glfw/src/null_joystick.h +31 -0
- package/vendor/raylib/src/external/glfw/src/null_monitor.c +159 -0
- package/vendor/raylib/src/external/glfw/src/null_platform.h +89 -0
- package/vendor/raylib/src/external/glfw/src/null_window.c +670 -0
- package/vendor/raylib/src/external/glfw/src/osmesa_context.c +372 -0
- package/vendor/raylib/src/external/glfw/src/osmesa_context.h +90 -0
- package/vendor/raylib/src/external/glfw/src/posix_thread.c +105 -0
- package/vendor/raylib/src/external/glfw/src/posix_thread.h +51 -0
- package/vendor/raylib/src/external/glfw/src/posix_time.c +90 -0
- package/vendor/raylib/src/external/glfw/src/posix_time.h +44 -0
- package/vendor/raylib/src/external/glfw/src/vulkan.c +332 -0
- package/vendor/raylib/src/external/glfw/src/wgl_context.c +798 -0
- package/vendor/raylib/src/external/glfw/src/wgl_context.h +160 -0
- package/vendor/raylib/src/external/glfw/src/win32_init.c +636 -0
- package/vendor/raylib/src/external/glfw/src/win32_joystick.c +753 -0
- package/vendor/raylib/src/external/glfw/src/win32_joystick.h +53 -0
- package/vendor/raylib/src/external/glfw/src/win32_monitor.c +537 -0
- package/vendor/raylib/src/external/glfw/src/win32_platform.h +462 -0
- package/vendor/raylib/src/external/glfw/src/win32_thread.c +99 -0
- package/vendor/raylib/src/external/glfw/src/win32_time.c +76 -0
- package/vendor/raylib/src/external/glfw/src/win32_window.c +2405 -0
- package/vendor/raylib/src/external/glfw/src/window.c +1114 -0
- package/vendor/raylib/src/external/glfw/src/wl_init.c +1310 -0
- package/vendor/raylib/src/external/glfw/src/wl_monitor.c +231 -0
- package/vendor/raylib/src/external/glfw/src/wl_platform.h +352 -0
- package/vendor/raylib/src/external/glfw/src/wl_window.c +1814 -0
- package/vendor/raylib/src/external/glfw/src/x11_init.c +1500 -0
- package/vendor/raylib/src/external/glfw/src/x11_monitor.c +614 -0
- package/vendor/raylib/src/external/glfw/src/x11_platform.h +798 -0
- package/vendor/raylib/src/external/glfw/src/x11_window.c +3310 -0
- package/vendor/raylib/src/external/glfw/src/xkb_unicode.c +942 -0
- package/vendor/raylib/src/external/glfw/src/xkb_unicode.h +28 -0
- package/vendor/raylib/src/external/jar_mod.h +1596 -0
- package/vendor/raylib/src/external/jar_xm.h +2470 -0
- package/vendor/raylib/src/external/miniaudio.h +70273 -0
- package/vendor/raylib/src/external/msf_gif.h +717 -0
- package/vendor/raylib/src/external/par_shapes.h +2155 -0
- package/vendor/raylib/src/external/sdefl.h +696 -0
- package/vendor/raylib/src/external/sinfl.h +584 -0
- package/vendor/raylib/src/external/stb_image.h +7897 -0
- package/vendor/raylib/src/external/stb_image_resize.h +2634 -0
- package/vendor/raylib/src/external/stb_image_write.h +1724 -0
- package/vendor/raylib/src/external/stb_rect_pack.h +623 -0
- package/vendor/raylib/src/external/stb_truetype.h +5077 -0
- package/vendor/raylib/src/external/stb_vorbis.h +5475 -0
- package/vendor/raylib/src/external/tinyobj_loader_c.h +1589 -0
- package/vendor/raylib/src/external/vox_loader.h +710 -0
- package/vendor/raylib/src/extras/easings.h +263 -0
- package/vendor/raylib/src/extras/physac.h +1977 -0
- package/vendor/raylib/src/extras/raygui.h +4342 -0
- package/vendor/raylib/src/extras/rmem.h +751 -0
- package/vendor/raylib/src/raudio.c +2380 -0
- package/vendor/raylib/src/raudio.h +198 -0
- package/vendor/raylib/src/raylib.dll.rc +27 -0
- package/vendor/raylib/src/raylib.dll.rc.data +0 -0
- package/vendor/raylib/src/raylib.h +1536 -0
- package/vendor/raylib/src/raylib.ico +0 -0
- package/vendor/raylib/src/raylib.rc +27 -0
- package/vendor/raylib/src/raylib.rc.data +0 -0
- package/vendor/raylib/src/raymath.h +1853 -0
- package/vendor/raylib/src/rcamera.h +567 -0
- package/vendor/raylib/src/rcore.c +6772 -0
- package/vendor/raylib/src/rgestures.h +566 -0
- package/vendor/raylib/src/rglfw.c +126 -0
- package/vendor/raylib/src/rlgl.h +4677 -0
- package/vendor/raylib/src/rmodels.c +5041 -0
- package/vendor/raylib/src/rshapes.c +1759 -0
- package/vendor/raylib/src/rtext.c +1790 -0
- package/vendor/raylib/src/rtextures.c +4761 -0
- package/vendor/raylib/src/shell.html +328 -0
- package/vendor/raylib/src/utils.c +433 -0
- package/vendor/raylib/src/utils.h +81 -0
- package/vendor/sqlite3/shell.c +23487 -0
- package/vendor/sqlite3/sqlite3.c +239246 -0
- package/vendor/sqlite3/sqlite3.h +12802 -0
- package/vendor/sqlite3/sqlite3ext.h +689 -0
- package/CMakeLists.txt +0 -60
|
@@ -0,0 +1,4342 @@
|
|
|
1
|
+
/*******************************************************************************************
|
|
2
|
+
*
|
|
3
|
+
* raygui v3.0 - A simple and easy-to-use immediate-mode gui library
|
|
4
|
+
*
|
|
5
|
+
* DESCRIPTION:
|
|
6
|
+
*
|
|
7
|
+
* raygui is a tools-dev-focused immediate-mode-gui library based on raylib but also
|
|
8
|
+
* available as a standalone library, as long as input and drawing functions are provided.
|
|
9
|
+
*
|
|
10
|
+
* Controls provided:
|
|
11
|
+
*
|
|
12
|
+
* # Container/separators Controls
|
|
13
|
+
* - WindowBox
|
|
14
|
+
* - GroupBox
|
|
15
|
+
* - Line
|
|
16
|
+
* - Panel
|
|
17
|
+
*
|
|
18
|
+
* # Basic Controls
|
|
19
|
+
* - Label
|
|
20
|
+
* - Button
|
|
21
|
+
* - LabelButton --> Label
|
|
22
|
+
* - Toggle
|
|
23
|
+
* - ToggleGroup --> Toggle
|
|
24
|
+
* - CheckBox
|
|
25
|
+
* - ComboBox
|
|
26
|
+
* - DropdownBox
|
|
27
|
+
* - TextBox
|
|
28
|
+
* - TextBoxMulti
|
|
29
|
+
* - ValueBox --> TextBox
|
|
30
|
+
* - Spinner --> Button, ValueBox
|
|
31
|
+
* - Slider
|
|
32
|
+
* - SliderBar --> Slider
|
|
33
|
+
* - ProgressBar
|
|
34
|
+
* - StatusBar
|
|
35
|
+
* - ScrollBar
|
|
36
|
+
* - ScrollPanel
|
|
37
|
+
* - DummyRec
|
|
38
|
+
* - Grid
|
|
39
|
+
*
|
|
40
|
+
* # Advance Controls
|
|
41
|
+
* - ListView
|
|
42
|
+
* - ColorPicker --> ColorPanel, ColorBarHue
|
|
43
|
+
* - MessageBox --> Window, Label, Button
|
|
44
|
+
* - TextInputBox --> Window, Label, TextBox, Button
|
|
45
|
+
*
|
|
46
|
+
* It also provides a set of functions for styling the controls based on its properties (size, color).
|
|
47
|
+
*
|
|
48
|
+
*
|
|
49
|
+
* GUI STYLE (guiStyle):
|
|
50
|
+
*
|
|
51
|
+
* raygui uses a global data array for all gui style properties (allocated on data segment by default),
|
|
52
|
+
* when a new style is loaded, it is loaded over the global style... but a default gui style could always be
|
|
53
|
+
* recovered with GuiLoadStyleDefault() function, that overwrites the current style to the default one
|
|
54
|
+
*
|
|
55
|
+
* The global style array size is fixed and depends on the number of controls and properties:
|
|
56
|
+
*
|
|
57
|
+
* static unsigned int guiStyle[RAYGUI_MAX_CONTROLS*(RAYGUI_MAX_PROPS_BASE + RAYGUI_MAX_PROPS_EXTENDED)];
|
|
58
|
+
*
|
|
59
|
+
* guiStyle size is by default: 16*(16 + 8) = 384*4 = 1536 bytes = 1.5 KB
|
|
60
|
+
*
|
|
61
|
+
* Note that the first set of BASE properties (by default guiStyle[0..15]) belong to the generic style
|
|
62
|
+
* used for all controls, when any of those base values is set, it is automatically populated to all
|
|
63
|
+
* controls, so, specific control values overwriting generic style should be set after base values.
|
|
64
|
+
*
|
|
65
|
+
* After the first BASE set we have the EXTENDED properties (by default guiStyle[16..23]), those
|
|
66
|
+
* properties are actually common to all controls and can not be overwritten individually (like BASE ones)
|
|
67
|
+
* Some of those properties are: TEXT_SIZE, TEXT_SPACING, LINE_COLOR, BACKGROUND_COLOR
|
|
68
|
+
*
|
|
69
|
+
* Custom control properties can be defined using the EXTENDED properties for each independent control.
|
|
70
|
+
*
|
|
71
|
+
* TOOL: rGuiStyler is a visual tool to customize raygui style.
|
|
72
|
+
*
|
|
73
|
+
*
|
|
74
|
+
* GUI ICONS (guiIcons):
|
|
75
|
+
*
|
|
76
|
+
* raygui could use a global array containing icons data (allocated on data segment by default),
|
|
77
|
+
* a custom icons set could be loaded over this array using GuiLoadIcons(), but loaded icons set
|
|
78
|
+
* must be same RICON_SIZE and no more than RICON_MAX_ICONS will be loaded
|
|
79
|
+
*
|
|
80
|
+
* Every icon is codified in binary form, using 1 bit per pixel, so, every 16x16 icon
|
|
81
|
+
* requires 8 integers (16*16/32) to be stored in memory.
|
|
82
|
+
*
|
|
83
|
+
* When the icon is draw, actually one quad per pixel is drawn if the bit for that pixel is set.
|
|
84
|
+
*
|
|
85
|
+
* The global icons array size is fixed and depends on the number of icons and size:
|
|
86
|
+
*
|
|
87
|
+
* static unsigned int guiIcons[RICON_MAX_ICONS*RICON_DATA_ELEMENTS];
|
|
88
|
+
*
|
|
89
|
+
* guiIcons size is by default: 256*(16*16/32) = 2048*4 = 8192 bytes = 8 KB
|
|
90
|
+
*
|
|
91
|
+
* TOOL: rGuiIcons is a visual tool to customize raygui icons.
|
|
92
|
+
*
|
|
93
|
+
*
|
|
94
|
+
* CONFIGURATION:
|
|
95
|
+
*
|
|
96
|
+
* #define RAYGUI_IMPLEMENTATION
|
|
97
|
+
* Generates the implementation of the library into the included file.
|
|
98
|
+
* If not defined, the library is in header only mode and can be included in other headers
|
|
99
|
+
* or source files without problems. But only ONE file should hold the implementation.
|
|
100
|
+
*
|
|
101
|
+
* #define RAYGUI_STANDALONE
|
|
102
|
+
* Avoid raylib.h header inclusion in this file. Data types defined on raylib are defined
|
|
103
|
+
* internally in the library and input management and drawing functions must be provided by
|
|
104
|
+
* the user (check library implementation for further details).
|
|
105
|
+
*
|
|
106
|
+
* #define RAYGUI_NO_RICONS
|
|
107
|
+
* Avoid including embedded ricons data (256 icons, 16x16 pixels, 1-bit per pixel, 2KB)
|
|
108
|
+
*
|
|
109
|
+
* #define RAYGUI_CUSTOM_RICONS
|
|
110
|
+
* Includes custom ricons.h header defining a set of custom icons,
|
|
111
|
+
* this file can be generated using rGuiIcons tool
|
|
112
|
+
*
|
|
113
|
+
*
|
|
114
|
+
* VERSIONS HISTORY:
|
|
115
|
+
*
|
|
116
|
+
* 3.0 (xx-Sep-2021) Integrated ricons data to avoid external file
|
|
117
|
+
* REDESIGNED: GuiTextBoxMulti()
|
|
118
|
+
* REMOVED: GuiImageButton*()
|
|
119
|
+
* Multiple minor tweaks and bugs corrected
|
|
120
|
+
* 2.9 (17-Mar-2021) REMOVED: Tooltip API
|
|
121
|
+
* 2.8 (03-May-2020) Centralized rectangles drawing to GuiDrawRectangle()
|
|
122
|
+
* 2.7 (20-Feb-2020) ADDED: Possible tooltips API
|
|
123
|
+
* 2.6 (09-Sep-2019) ADDED: GuiTextInputBox()
|
|
124
|
+
* REDESIGNED: GuiListView*(), GuiDropdownBox(), GuiSlider*(), GuiProgressBar(), GuiMessageBox()
|
|
125
|
+
* REVIEWED: GuiTextBox(), GuiSpinner(), GuiValueBox(), GuiLoadStyle()
|
|
126
|
+
* Replaced property INNER_PADDING by TEXT_PADDING, renamed some properties
|
|
127
|
+
* ADDED: 8 new custom styles ready to use
|
|
128
|
+
* Multiple minor tweaks and bugs corrected
|
|
129
|
+
* 2.5 (28-May-2019) Implemented extended GuiTextBox(), GuiValueBox(), GuiSpinner()
|
|
130
|
+
* 2.3 (29-Apr-2019) ADDED: rIcons auxiliar library and support for it, multiple controls reviewed
|
|
131
|
+
* Refactor all controls drawing mechanism to use control state
|
|
132
|
+
* 2.2 (05-Feb-2019) ADDED: GuiScrollBar(), GuiScrollPanel(), reviewed GuiListView(), removed Gui*Ex() controls
|
|
133
|
+
* 2.1 (26-Dec-2018) REDESIGNED: GuiCheckBox(), GuiComboBox(), GuiDropdownBox(), GuiToggleGroup() > Use combined text string
|
|
134
|
+
* REDESIGNED: Style system (breaking change)
|
|
135
|
+
* 2.0 (08-Nov-2018) ADDED: Support controls guiLock and custom fonts
|
|
136
|
+
* REVIEWED: GuiComboBox(), GuiListView()...
|
|
137
|
+
* 1.9 (09-Oct-2018) REVIEWED: GuiGrid(), GuiTextBox(), GuiTextBoxMulti(), GuiValueBox()...
|
|
138
|
+
* 1.8 (01-May-2018) Lot of rework and redesign to align with rGuiStyler and rGuiLayout
|
|
139
|
+
* 1.5 (21-Jun-2017) Working in an improved styles system
|
|
140
|
+
* 1.4 (15-Jun-2017) Rewritten all GUI functions (removed useless ones)
|
|
141
|
+
* 1.3 (12-Jun-2017) Complete redesign of style system
|
|
142
|
+
* 1.1 (01-Jun-2017) Complete review of the library
|
|
143
|
+
* 1.0 (07-Jun-2016) Converted to header-only by Ramon Santamaria.
|
|
144
|
+
* 0.9 (07-Mar-2016) Reviewed and tested by Albert Martos, Ian Eito, Sergio Martinez and Ramon Santamaria.
|
|
145
|
+
* 0.8 (27-Aug-2015) Initial release. Implemented by Kevin Gato, Daniel Nicolás and Ramon Santamaria.
|
|
146
|
+
*
|
|
147
|
+
*
|
|
148
|
+
* CONTRIBUTORS:
|
|
149
|
+
*
|
|
150
|
+
* Ramon Santamaria: Supervision, review, redesign, update and maintenance
|
|
151
|
+
* Vlad Adrian: Complete rewrite of GuiTextBox() to support extended features (2019)
|
|
152
|
+
* Sergio Martinez: Review, testing (2015) and redesign of multiple controls (2018)
|
|
153
|
+
* Adria Arranz: Testing and Implementation of additional controls (2018)
|
|
154
|
+
* Jordi Jorba: Testing and Implementation of additional controls (2018)
|
|
155
|
+
* Albert Martos: Review and testing of the library (2015)
|
|
156
|
+
* Ian Eito: Review and testing of the library (2015)
|
|
157
|
+
* Kevin Gato: Initial implementation of basic components (2014)
|
|
158
|
+
* Daniel Nicolas: Initial implementation of basic components (2014)
|
|
159
|
+
*
|
|
160
|
+
*
|
|
161
|
+
* LICENSE: zlib/libpng
|
|
162
|
+
*
|
|
163
|
+
* Copyright (c) 2014-2021 Ramon Santamaria (@raysan5)
|
|
164
|
+
*
|
|
165
|
+
* This software is provided "as-is", without any express or implied warranty. In no event
|
|
166
|
+
* will the authors be held liable for any damages arising from the use of this software.
|
|
167
|
+
*
|
|
168
|
+
* Permission is granted to anyone to use this software for any purpose, including commercial
|
|
169
|
+
* applications, and to alter it and redistribute it freely, subject to the following restrictions:
|
|
170
|
+
*
|
|
171
|
+
* 1. The origin of this software must not be misrepresented; you must not claim that you
|
|
172
|
+
* wrote the original software. If you use this software in a product, an acknowledgment
|
|
173
|
+
* in the product documentation would be appreciated but is not required.
|
|
174
|
+
*
|
|
175
|
+
* 2. Altered source versions must be plainly marked as such, and must not be misrepresented
|
|
176
|
+
* as being the original software.
|
|
177
|
+
*
|
|
178
|
+
* 3. This notice may not be removed or altered from any source distribution.
|
|
179
|
+
*
|
|
180
|
+
**********************************************************************************************/
|
|
181
|
+
|
|
182
|
+
#ifndef RAYGUI_H
|
|
183
|
+
#define RAYGUI_H
|
|
184
|
+
|
|
185
|
+
#define RAYGUI_VERSION "3.0"
|
|
186
|
+
|
|
187
|
+
#if !defined(RAYGUI_STANDALONE)
|
|
188
|
+
#include "raylib.h"
|
|
189
|
+
#endif
|
|
190
|
+
|
|
191
|
+
// Function specifiers in case library is build/used as a shared library (Windows)
|
|
192
|
+
// NOTE: Microsoft specifiers to tell compiler that symbols are imported/exported from a .dll
|
|
193
|
+
#if defined(_WIN32)
|
|
194
|
+
#if defined(BUILD_LIBTYPE_SHARED)
|
|
195
|
+
#define RAYGUIAPI __declspec(dllexport) // We are building the library as a Win32 shared library (.dll)
|
|
196
|
+
#elif defined(USE_LIBTYPE_SHARED)
|
|
197
|
+
#define RAYGUIAPI __declspec(dllimport) // We are using the library as a Win32 shared library (.dll)
|
|
198
|
+
#endif
|
|
199
|
+
#endif
|
|
200
|
+
|
|
201
|
+
// Function specifiers definition
|
|
202
|
+
#ifndef RAYGUIAPI
|
|
203
|
+
#define RAYGUIAPI // Functions defined as 'extern' by default (implicit specifiers)
|
|
204
|
+
#endif
|
|
205
|
+
|
|
206
|
+
//----------------------------------------------------------------------------------
|
|
207
|
+
// Defines and Macros
|
|
208
|
+
//----------------------------------------------------------------------------------
|
|
209
|
+
|
|
210
|
+
// Allow custom memory allocators
|
|
211
|
+
#ifndef RAYGUI_MALLOC
|
|
212
|
+
#define RAYGUI_MALLOC(sz) malloc(sz)
|
|
213
|
+
#endif
|
|
214
|
+
#ifndef RAYGUI_CALLOC
|
|
215
|
+
#define RAYGUI_CALLOC(n,sz) calloc(n,sz)
|
|
216
|
+
#endif
|
|
217
|
+
#ifndef RAYGUI_FREE
|
|
218
|
+
#define RAYGUI_FREE(p) free(p)
|
|
219
|
+
#endif
|
|
220
|
+
|
|
221
|
+
// TODO: Implement custom TraceLog()
|
|
222
|
+
#define TRACELOG(level, ...) (void)0
|
|
223
|
+
|
|
224
|
+
//----------------------------------------------------------------------------------
|
|
225
|
+
// Types and Structures Definition
|
|
226
|
+
// NOTE: Some types are required for RAYGUI_STANDALONE usage
|
|
227
|
+
//----------------------------------------------------------------------------------
|
|
228
|
+
#if defined(RAYGUI_STANDALONE)
|
|
229
|
+
#ifndef __cplusplus
|
|
230
|
+
// Boolean type
|
|
231
|
+
#ifndef true
|
|
232
|
+
typedef enum { false, true } bool;
|
|
233
|
+
#endif
|
|
234
|
+
#endif
|
|
235
|
+
|
|
236
|
+
// Vector2 type
|
|
237
|
+
typedef struct Vector2 {
|
|
238
|
+
float x;
|
|
239
|
+
float y;
|
|
240
|
+
} Vector2;
|
|
241
|
+
|
|
242
|
+
// Vector3 type // -- ConvertHSVtoRGB(), ConvertRGBtoHSV()
|
|
243
|
+
typedef struct Vector3 {
|
|
244
|
+
float x;
|
|
245
|
+
float y;
|
|
246
|
+
float z;
|
|
247
|
+
} Vector3;
|
|
248
|
+
|
|
249
|
+
// Color type, RGBA (32bit)
|
|
250
|
+
typedef struct Color {
|
|
251
|
+
unsigned char r;
|
|
252
|
+
unsigned char g;
|
|
253
|
+
unsigned char b;
|
|
254
|
+
unsigned char a;
|
|
255
|
+
} Color;
|
|
256
|
+
|
|
257
|
+
// Rectangle type
|
|
258
|
+
typedef struct Rectangle {
|
|
259
|
+
float x;
|
|
260
|
+
float y;
|
|
261
|
+
float width;
|
|
262
|
+
float height;
|
|
263
|
+
} Rectangle;
|
|
264
|
+
|
|
265
|
+
// TODO: Texture2D type is very coupled to raylib, required by Font type
|
|
266
|
+
// It should be redesigned to be provided by user
|
|
267
|
+
typedef struct Texture2D {
|
|
268
|
+
unsigned int id; // OpenGL texture id
|
|
269
|
+
int width; // Texture base width
|
|
270
|
+
int height; // Texture base height
|
|
271
|
+
int mipmaps; // Mipmap levels, 1 by default
|
|
272
|
+
int format; // Data format (PixelFormat type)
|
|
273
|
+
} Texture2D;
|
|
274
|
+
|
|
275
|
+
// GlyphInfo, font characters glyphs info
|
|
276
|
+
typedef struct GlyphInfo {
|
|
277
|
+
int value; // Character value (Unicode)
|
|
278
|
+
int offsetX; // Character offset X when drawing
|
|
279
|
+
int offsetY; // Character offset Y when drawing
|
|
280
|
+
int advanceX; // Character advance position X
|
|
281
|
+
Image image; // Character image data
|
|
282
|
+
} GlyphInfo;
|
|
283
|
+
|
|
284
|
+
// TODO: Font type is very coupled to raylib, mostly required by GuiLoadStyle()
|
|
285
|
+
// It should be redesigned to be provided by user
|
|
286
|
+
typedef struct Font {
|
|
287
|
+
int baseSize; // Base size (default chars height)
|
|
288
|
+
int glyphCount; // Number of characters
|
|
289
|
+
Texture2D texture; // Characters texture atlas
|
|
290
|
+
Rectangle *recs; // Characters rectangles in texture
|
|
291
|
+
GlyphInfo *chars; // Characters info data
|
|
292
|
+
} Font;
|
|
293
|
+
#endif
|
|
294
|
+
|
|
295
|
+
// Style property
|
|
296
|
+
typedef struct GuiStyleProp {
|
|
297
|
+
unsigned short controlId;
|
|
298
|
+
unsigned short propertyId;
|
|
299
|
+
int propertyValue;
|
|
300
|
+
} GuiStyleProp;
|
|
301
|
+
|
|
302
|
+
// Gui control state
|
|
303
|
+
typedef enum {
|
|
304
|
+
GUI_STATE_NORMAL = 0,
|
|
305
|
+
GUI_STATE_FOCUSED,
|
|
306
|
+
GUI_STATE_PRESSED,
|
|
307
|
+
GUI_STATE_DISABLED,
|
|
308
|
+
} GuiControlState;
|
|
309
|
+
|
|
310
|
+
// Gui control text alignment
|
|
311
|
+
typedef enum {
|
|
312
|
+
GUI_TEXT_ALIGN_LEFT = 0,
|
|
313
|
+
GUI_TEXT_ALIGN_CENTER,
|
|
314
|
+
GUI_TEXT_ALIGN_RIGHT,
|
|
315
|
+
} GuiTextAlignment;
|
|
316
|
+
|
|
317
|
+
// Gui controls
|
|
318
|
+
typedef enum {
|
|
319
|
+
DEFAULT = 0, // Generic control -> populates to all controls when set
|
|
320
|
+
LABEL, // Used also for: LABELBUTTON
|
|
321
|
+
BUTTON,
|
|
322
|
+
TOGGLE, // Used also for: TOGGLEGROUP
|
|
323
|
+
SLIDER, // Used also for: SLIDERBAR
|
|
324
|
+
PROGRESSBAR,
|
|
325
|
+
CHECKBOX,
|
|
326
|
+
COMBOBOX,
|
|
327
|
+
DROPDOWNBOX,
|
|
328
|
+
TEXTBOX, // Used also for: TEXTBOXMULTI
|
|
329
|
+
VALUEBOX,
|
|
330
|
+
SPINNER,
|
|
331
|
+
LISTVIEW,
|
|
332
|
+
COLORPICKER,
|
|
333
|
+
SCROLLBAR,
|
|
334
|
+
STATUSBAR
|
|
335
|
+
} GuiControl;
|
|
336
|
+
|
|
337
|
+
// Gui base properties for every control
|
|
338
|
+
// NOTE: RAYGUI_MAX_PROPS_BASE properties (by default 16 properties)
|
|
339
|
+
typedef enum {
|
|
340
|
+
BORDER_COLOR_NORMAL = 0,
|
|
341
|
+
BASE_COLOR_NORMAL,
|
|
342
|
+
TEXT_COLOR_NORMAL,
|
|
343
|
+
BORDER_COLOR_FOCUSED,
|
|
344
|
+
BASE_COLOR_FOCUSED,
|
|
345
|
+
TEXT_COLOR_FOCUSED,
|
|
346
|
+
BORDER_COLOR_PRESSED,
|
|
347
|
+
BASE_COLOR_PRESSED,
|
|
348
|
+
TEXT_COLOR_PRESSED,
|
|
349
|
+
BORDER_COLOR_DISABLED,
|
|
350
|
+
BASE_COLOR_DISABLED,
|
|
351
|
+
TEXT_COLOR_DISABLED,
|
|
352
|
+
BORDER_WIDTH,
|
|
353
|
+
TEXT_PADDING,
|
|
354
|
+
TEXT_ALIGNMENT,
|
|
355
|
+
RESERVED
|
|
356
|
+
} GuiControlProperty;
|
|
357
|
+
|
|
358
|
+
// Gui extended properties depend on control
|
|
359
|
+
// NOTE: RAYGUI_MAX_PROPS_EXTENDED properties (by default 8 properties)
|
|
360
|
+
|
|
361
|
+
// DEFAULT extended properties
|
|
362
|
+
// NOTE: Those properties are actually common to all controls
|
|
363
|
+
typedef enum {
|
|
364
|
+
TEXT_SIZE = 16,
|
|
365
|
+
TEXT_SPACING,
|
|
366
|
+
LINE_COLOR,
|
|
367
|
+
BACKGROUND_COLOR,
|
|
368
|
+
} GuiDefaultProperty;
|
|
369
|
+
|
|
370
|
+
// Label
|
|
371
|
+
//typedef enum { } GuiLabelProperty;
|
|
372
|
+
|
|
373
|
+
// Button
|
|
374
|
+
//typedef enum { } GuiButtonProperty;
|
|
375
|
+
|
|
376
|
+
// Toggle/ToggleGroup
|
|
377
|
+
typedef enum {
|
|
378
|
+
GROUP_PADDING = 16,
|
|
379
|
+
} GuiToggleProperty;
|
|
380
|
+
|
|
381
|
+
// Slider/SliderBar
|
|
382
|
+
typedef enum {
|
|
383
|
+
SLIDER_WIDTH = 16,
|
|
384
|
+
SLIDER_PADDING
|
|
385
|
+
} GuiSliderProperty;
|
|
386
|
+
|
|
387
|
+
// ProgressBar
|
|
388
|
+
typedef enum {
|
|
389
|
+
PROGRESS_PADDING = 16,
|
|
390
|
+
} GuiProgressBarProperty;
|
|
391
|
+
|
|
392
|
+
// CheckBox
|
|
393
|
+
typedef enum {
|
|
394
|
+
CHECK_PADDING = 16
|
|
395
|
+
} GuiCheckBoxProperty;
|
|
396
|
+
|
|
397
|
+
// ComboBox
|
|
398
|
+
typedef enum {
|
|
399
|
+
COMBO_BUTTON_WIDTH = 16,
|
|
400
|
+
COMBO_BUTTON_PADDING
|
|
401
|
+
} GuiComboBoxProperty;
|
|
402
|
+
|
|
403
|
+
// DropdownBox
|
|
404
|
+
typedef enum {
|
|
405
|
+
ARROW_PADDING = 16,
|
|
406
|
+
DROPDOWN_ITEMS_PADDING
|
|
407
|
+
} GuiDropdownBoxProperty;
|
|
408
|
+
|
|
409
|
+
// TextBox/TextBoxMulti/ValueBox/Spinner
|
|
410
|
+
typedef enum {
|
|
411
|
+
TEXT_INNER_PADDING = 16,
|
|
412
|
+
TEXT_LINES_PADDING,
|
|
413
|
+
COLOR_SELECTED_FG,
|
|
414
|
+
COLOR_SELECTED_BG
|
|
415
|
+
} GuiTextBoxProperty;
|
|
416
|
+
|
|
417
|
+
// Spinner
|
|
418
|
+
typedef enum {
|
|
419
|
+
SPIN_BUTTON_WIDTH = 16,
|
|
420
|
+
SPIN_BUTTON_PADDING,
|
|
421
|
+
} GuiSpinnerProperty;
|
|
422
|
+
|
|
423
|
+
// ScrollBar
|
|
424
|
+
typedef enum {
|
|
425
|
+
ARROWS_SIZE = 16,
|
|
426
|
+
ARROWS_VISIBLE,
|
|
427
|
+
SCROLL_SLIDER_PADDING,
|
|
428
|
+
SCROLL_SLIDER_SIZE,
|
|
429
|
+
SCROLL_PADDING,
|
|
430
|
+
SCROLL_SPEED,
|
|
431
|
+
} GuiScrollBarProperty;
|
|
432
|
+
|
|
433
|
+
// ScrollBar side
|
|
434
|
+
typedef enum {
|
|
435
|
+
SCROLLBAR_LEFT_SIDE = 0,
|
|
436
|
+
SCROLLBAR_RIGHT_SIDE
|
|
437
|
+
} GuiScrollBarSide;
|
|
438
|
+
|
|
439
|
+
// ListView
|
|
440
|
+
typedef enum {
|
|
441
|
+
LIST_ITEMS_HEIGHT = 16,
|
|
442
|
+
LIST_ITEMS_PADDING,
|
|
443
|
+
SCROLLBAR_WIDTH,
|
|
444
|
+
SCROLLBAR_SIDE,
|
|
445
|
+
} GuiListViewProperty;
|
|
446
|
+
|
|
447
|
+
// ColorPicker
|
|
448
|
+
typedef enum {
|
|
449
|
+
COLOR_SELECTOR_SIZE = 16,
|
|
450
|
+
HUEBAR_WIDTH, // Right hue bar width
|
|
451
|
+
HUEBAR_PADDING, // Right hue bar separation from panel
|
|
452
|
+
HUEBAR_SELECTOR_HEIGHT, // Right hue bar selector height
|
|
453
|
+
HUEBAR_SELECTOR_OVERFLOW // Right hue bar selector overflow
|
|
454
|
+
} GuiColorPickerProperty;
|
|
455
|
+
|
|
456
|
+
//----------------------------------------------------------------------------------
|
|
457
|
+
// Global Variables Definition
|
|
458
|
+
//----------------------------------------------------------------------------------
|
|
459
|
+
// ...
|
|
460
|
+
|
|
461
|
+
//----------------------------------------------------------------------------------
|
|
462
|
+
// Module Functions Declaration
|
|
463
|
+
//----------------------------------------------------------------------------------
|
|
464
|
+
|
|
465
|
+
#if defined(__cplusplus)
|
|
466
|
+
extern "C" { // Prevents name mangling of functions
|
|
467
|
+
#endif
|
|
468
|
+
|
|
469
|
+
// Global gui state control functions
|
|
470
|
+
RAYGUIAPI void GuiEnable(void); // Enable gui controls (global state)
|
|
471
|
+
RAYGUIAPI void GuiDisable(void); // Disable gui controls (global state)
|
|
472
|
+
RAYGUIAPI void GuiLock(void); // Lock gui controls (global state)
|
|
473
|
+
RAYGUIAPI void GuiUnlock(void); // Unlock gui controls (global state)
|
|
474
|
+
RAYGUIAPI bool GuiIsLocked(void); // Check if gui is locked (global state)
|
|
475
|
+
RAYGUIAPI void GuiFade(float alpha); // Set gui controls alpha (global state), alpha goes from 0.0f to 1.0f
|
|
476
|
+
RAYGUIAPI void GuiSetState(int state); // Set gui state (global state)
|
|
477
|
+
RAYGUIAPI int GuiGetState(void); // Get gui state (global state)
|
|
478
|
+
|
|
479
|
+
// Font set/get functions
|
|
480
|
+
RAYGUIAPI void GuiSetFont(Font font); // Set gui custom font (global state)
|
|
481
|
+
RAYGUIAPI Font GuiGetFont(void); // Get gui custom font (global state)
|
|
482
|
+
|
|
483
|
+
// Style set/get functions
|
|
484
|
+
RAYGUIAPI void GuiSetStyle(int control, int property, int value); // Set one style property
|
|
485
|
+
RAYGUIAPI int GuiGetStyle(int control, int property); // Get one style property
|
|
486
|
+
|
|
487
|
+
// Container/separator controls, useful for controls organization
|
|
488
|
+
RAYGUIAPI bool GuiWindowBox(Rectangle bounds, const char *title); // Window Box control, shows a window that can be closed
|
|
489
|
+
RAYGUIAPI void GuiGroupBox(Rectangle bounds, const char *text); // Group Box control with text name
|
|
490
|
+
RAYGUIAPI void GuiLine(Rectangle bounds, const char *text); // Line separator control, could contain text
|
|
491
|
+
RAYGUIAPI void GuiPanel(Rectangle bounds); // Panel control, useful to group controls
|
|
492
|
+
RAYGUIAPI Rectangle GuiScrollPanel(Rectangle bounds, Rectangle content, Vector2 *scroll); // Scroll Panel control
|
|
493
|
+
|
|
494
|
+
// Basic controls set
|
|
495
|
+
RAYGUIAPI void GuiLabel(Rectangle bounds, const char *text); // Label control, shows text
|
|
496
|
+
RAYGUIAPI bool GuiButton(Rectangle bounds, const char *text); // Button control, returns true when clicked
|
|
497
|
+
RAYGUIAPI bool GuiLabelButton(Rectangle bounds, const char *text); // Label button control, show true when clicked
|
|
498
|
+
RAYGUIAPI bool GuiToggle(Rectangle bounds, const char *text, bool active); // Toggle Button control, returns true when active
|
|
499
|
+
RAYGUIAPI int GuiToggleGroup(Rectangle bounds, const char *text, int active); // Toggle Group control, returns active toggle index
|
|
500
|
+
RAYGUIAPI bool GuiCheckBox(Rectangle bounds, const char *text, bool checked); // Check Box control, returns true when active
|
|
501
|
+
RAYGUIAPI int GuiComboBox(Rectangle bounds, const char *text, int active); // Combo Box control, returns selected item index
|
|
502
|
+
RAYGUIAPI bool GuiDropdownBox(Rectangle bounds, const char *text, int *active, bool editMode); // Dropdown Box control, returns selected item
|
|
503
|
+
RAYGUIAPI bool GuiSpinner(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode); // Spinner control, returns selected value
|
|
504
|
+
RAYGUIAPI bool GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode); // Value Box control, updates input text with numbers
|
|
505
|
+
RAYGUIAPI bool GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode); // Text Box control, updates input text
|
|
506
|
+
RAYGUIAPI bool GuiTextBoxMulti(Rectangle bounds, char *text, int textSize, bool editMode); // Text Box control with multiple lines
|
|
507
|
+
RAYGUIAPI float GuiSlider(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue); // Slider control, returns selected value
|
|
508
|
+
RAYGUIAPI float GuiSliderBar(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue); // Slider Bar control, returns selected value
|
|
509
|
+
RAYGUIAPI float GuiProgressBar(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue); // Progress Bar control, shows current progress value
|
|
510
|
+
RAYGUIAPI void GuiStatusBar(Rectangle bounds, const char *text); // Status Bar control, shows info text
|
|
511
|
+
RAYGUIAPI void GuiDummyRec(Rectangle bounds, const char *text); // Dummy control for placeholders
|
|
512
|
+
RAYGUIAPI int GuiScrollBar(Rectangle bounds, int value, int minValue, int maxValue); // Scroll Bar control
|
|
513
|
+
RAYGUIAPI Vector2 GuiGrid(Rectangle bounds, float spacing, int subdivs); // Grid control
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
// Advance controls set
|
|
517
|
+
RAYGUIAPI int GuiListView(Rectangle bounds, const char *text, int *scrollIndex, int active); // List View control, returns selected list item index
|
|
518
|
+
RAYGUIAPI int GuiListViewEx(Rectangle bounds, const char **text, int count, int *focus, int *scrollIndex, int active); // List View with extended parameters
|
|
519
|
+
RAYGUIAPI int GuiMessageBox(Rectangle bounds, const char *title, const char *message, const char *buttons); // Message Box control, displays a message
|
|
520
|
+
RAYGUIAPI int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, const char *buttons, char *text); // Text Input Box control, ask for text
|
|
521
|
+
RAYGUIAPI Color GuiColorPicker(Rectangle bounds, Color color); // Color Picker control (multiple color controls)
|
|
522
|
+
RAYGUIAPI Color GuiColorPanel(Rectangle bounds, Color color); // Color Panel control
|
|
523
|
+
RAYGUIAPI float GuiColorBarAlpha(Rectangle bounds, float alpha); // Color Bar Alpha control
|
|
524
|
+
RAYGUIAPI float GuiColorBarHue(Rectangle bounds, float value); // Color Bar Hue control
|
|
525
|
+
|
|
526
|
+
// Styles loading functions
|
|
527
|
+
RAYGUIAPI void GuiLoadStyle(const char *fileName); // Load style file over global style variable (.rgs)
|
|
528
|
+
RAYGUIAPI void GuiLoadStyleDefault(void); // Load style default over global style
|
|
529
|
+
|
|
530
|
+
/*
|
|
531
|
+
typedef GuiStyle (unsigned int *)
|
|
532
|
+
RAYGUIAPI GuiStyle LoadGuiStyle(const char *fileName); // Load style from file (.rgs)
|
|
533
|
+
RAYGUIAPI void UnloadGuiStyle(GuiStyle style); // Unload style
|
|
534
|
+
*/
|
|
535
|
+
|
|
536
|
+
RAYGUIAPI const char *GuiIconText(int iconId, const char *text); // Get text with icon id prepended (if supported)
|
|
537
|
+
|
|
538
|
+
#if !defined(RAYGUI_NO_RICONS)
|
|
539
|
+
// Gui icons functionality
|
|
540
|
+
RAYGUIAPI void GuiDrawIcon(int iconId, int posX, int posY, int pixelSize, Color color);
|
|
541
|
+
|
|
542
|
+
RAYGUIAPI unsigned int *GuiGetIcons(void); // Get full icons data pointer
|
|
543
|
+
RAYGUIAPI unsigned int *GuiGetIconData(int iconId); // Get icon bit data
|
|
544
|
+
RAYGUIAPI void GuiSetIconData(int iconId, unsigned int *data); // Set icon bit data
|
|
545
|
+
|
|
546
|
+
RAYGUIAPI void GuiSetIconPixel(int iconId, int x, int y); // Set icon pixel value
|
|
547
|
+
RAYGUIAPI void GuiClearIconPixel(int iconId, int x, int y); // Clear icon pixel value
|
|
548
|
+
RAYGUIAPI bool GuiCheckIconPixel(int iconId, int x, int y); // Check icon pixel value
|
|
549
|
+
#endif
|
|
550
|
+
|
|
551
|
+
#if defined(__cplusplus)
|
|
552
|
+
} // Prevents name mangling of functions
|
|
553
|
+
#endif
|
|
554
|
+
|
|
555
|
+
#endif // RAYGUI_H
|
|
556
|
+
|
|
557
|
+
/***********************************************************************************
|
|
558
|
+
*
|
|
559
|
+
* RAYGUI IMPLEMENTATION
|
|
560
|
+
*
|
|
561
|
+
************************************************************************************/
|
|
562
|
+
|
|
563
|
+
#if defined(RAYGUI_IMPLEMENTATION)
|
|
564
|
+
|
|
565
|
+
#include <stdio.h> // Required for: FILE, fopen(), fclose(), fprintf(), feof(), fscanf(), vsprintf() [GuiLoadStyle(), GuiLoadIcons()]
|
|
566
|
+
#include <stdlib.h> // Required for: malloc(), calloc(), free() [GuiLoadStyle(), GuiLoadIcons()]
|
|
567
|
+
#include <string.h> // Required for: strlen() [GuiTextBox(), GuiTextBoxMulti(), GuiValueBox()], memset(), memcpy()
|
|
568
|
+
#include <stdarg.h> // Required for: va_list, va_start(), vfprintf(), va_end() [TextFormat()]
|
|
569
|
+
#include <math.h> // Required for: roundf() [GuiColorPicker()]
|
|
570
|
+
|
|
571
|
+
#ifdef __cplusplus
|
|
572
|
+
#define RAYGUI_CLITERAL(name) name
|
|
573
|
+
#else
|
|
574
|
+
#define RAYGUI_CLITERAL(name) (name)
|
|
575
|
+
#endif
|
|
576
|
+
|
|
577
|
+
#if !defined(RAYGUI_NO_RICONS)
|
|
578
|
+
|
|
579
|
+
#if defined(RAYGUI_CUSTOM_RICONS)
|
|
580
|
+
|
|
581
|
+
#define RICONS_IMPLEMENTATION
|
|
582
|
+
#include "ricons.h" // External icons data provided, it can be generated with rGuiIcons tool
|
|
583
|
+
|
|
584
|
+
#else // Embedded raygui icons, no external file provided
|
|
585
|
+
|
|
586
|
+
#define RICON_SIZE 16 // Size of icons (squared)
|
|
587
|
+
#define RICON_MAX_ICONS 256 // Maximum number of icons
|
|
588
|
+
#define RICON_MAX_NAME_LENGTH 32 // Maximum length of icon name id
|
|
589
|
+
|
|
590
|
+
// Icons data is defined by bit array (every bit represents one pixel)
|
|
591
|
+
// Those arrays are stored as unsigned int data arrays, so every array
|
|
592
|
+
// element defines 32 pixels (bits) of information
|
|
593
|
+
// Number of elemens depend on RICON_SIZE (by default 16x16 pixels)
|
|
594
|
+
#define RICON_DATA_ELEMENTS (RICON_SIZE*RICON_SIZE/32)
|
|
595
|
+
|
|
596
|
+
//----------------------------------------------------------------------------------
|
|
597
|
+
// Icons enumeration
|
|
598
|
+
//----------------------------------------------------------------------------------
|
|
599
|
+
typedef enum {
|
|
600
|
+
RICON_NONE = 0,
|
|
601
|
+
RICON_FOLDER_FILE_OPEN = 1,
|
|
602
|
+
RICON_FILE_SAVE_CLASSIC = 2,
|
|
603
|
+
RICON_FOLDER_OPEN = 3,
|
|
604
|
+
RICON_FOLDER_SAVE = 4,
|
|
605
|
+
RICON_FILE_OPEN = 5,
|
|
606
|
+
RICON_FILE_SAVE = 6,
|
|
607
|
+
RICON_FILE_EXPORT = 7,
|
|
608
|
+
RICON_FILE_NEW = 8,
|
|
609
|
+
RICON_FILE_DELETE = 9,
|
|
610
|
+
RICON_FILETYPE_TEXT = 10,
|
|
611
|
+
RICON_FILETYPE_AUDIO = 11,
|
|
612
|
+
RICON_FILETYPE_IMAGE = 12,
|
|
613
|
+
RICON_FILETYPE_PLAY = 13,
|
|
614
|
+
RICON_FILETYPE_VIDEO = 14,
|
|
615
|
+
RICON_FILETYPE_INFO = 15,
|
|
616
|
+
RICON_FILE_COPY = 16,
|
|
617
|
+
RICON_FILE_CUT = 17,
|
|
618
|
+
RICON_FILE_PASTE = 18,
|
|
619
|
+
RICON_CURSOR_HAND = 19,
|
|
620
|
+
RICON_CURSOR_POINTER = 20,
|
|
621
|
+
RICON_CURSOR_CLASSIC = 21,
|
|
622
|
+
RICON_PENCIL = 22,
|
|
623
|
+
RICON_PENCIL_BIG = 23,
|
|
624
|
+
RICON_BRUSH_CLASSIC = 24,
|
|
625
|
+
RICON_BRUSH_PAINTER = 25,
|
|
626
|
+
RICON_WATER_DROP = 26,
|
|
627
|
+
RICON_COLOR_PICKER = 27,
|
|
628
|
+
RICON_RUBBER = 28,
|
|
629
|
+
RICON_COLOR_BUCKET = 29,
|
|
630
|
+
RICON_TEXT_T = 30,
|
|
631
|
+
RICON_TEXT_A = 31,
|
|
632
|
+
RICON_SCALE = 32,
|
|
633
|
+
RICON_RESIZE = 33,
|
|
634
|
+
RICON_FILTER_POINT = 34,
|
|
635
|
+
RICON_FILTER_BILINEAR = 35,
|
|
636
|
+
RICON_CROP = 36,
|
|
637
|
+
RICON_CROP_ALPHA = 37,
|
|
638
|
+
RICON_SQUARE_TOGGLE = 38,
|
|
639
|
+
RICON_SYMMETRY = 39,
|
|
640
|
+
RICON_SYMMETRY_HORIZONTAL = 40,
|
|
641
|
+
RICON_SYMMETRY_VERTICAL = 41,
|
|
642
|
+
RICON_LENS = 42,
|
|
643
|
+
RICON_LENS_BIG = 43,
|
|
644
|
+
RICON_EYE_ON = 44,
|
|
645
|
+
RICON_EYE_OFF = 45,
|
|
646
|
+
RICON_FILTER_TOP = 46,
|
|
647
|
+
RICON_FILTER = 47,
|
|
648
|
+
RICON_TARGET_POINT = 48,
|
|
649
|
+
RICON_TARGET_SMALL = 49,
|
|
650
|
+
RICON_TARGET_BIG = 50,
|
|
651
|
+
RICON_TARGET_MOVE = 51,
|
|
652
|
+
RICON_CURSOR_MOVE = 52,
|
|
653
|
+
RICON_CURSOR_SCALE = 53,
|
|
654
|
+
RICON_CURSOR_SCALE_RIGHT = 54,
|
|
655
|
+
RICON_CURSOR_SCALE_LEFT = 55,
|
|
656
|
+
RICON_UNDO = 56,
|
|
657
|
+
RICON_REDO = 57,
|
|
658
|
+
RICON_REREDO = 58,
|
|
659
|
+
RICON_MUTATE = 59,
|
|
660
|
+
RICON_ROTATE = 60,
|
|
661
|
+
RICON_REPEAT = 61,
|
|
662
|
+
RICON_SHUFFLE = 62,
|
|
663
|
+
RICON_EMPTYBOX = 63,
|
|
664
|
+
RICON_TARGET = 64,
|
|
665
|
+
RICON_TARGET_SMALL_FILL = 65,
|
|
666
|
+
RICON_TARGET_BIG_FILL = 66,
|
|
667
|
+
RICON_TARGET_MOVE_FILL = 67,
|
|
668
|
+
RICON_CURSOR_MOVE_FILL = 68,
|
|
669
|
+
RICON_CURSOR_SCALE_FILL = 69,
|
|
670
|
+
RICON_CURSOR_SCALE_RIGHT_FILL = 70,
|
|
671
|
+
RICON_CURSOR_SCALE_LEFT_FILL = 71,
|
|
672
|
+
RICON_UNDO_FILL = 72,
|
|
673
|
+
RICON_REDO_FILL = 73,
|
|
674
|
+
RICON_REREDO_FILL = 74,
|
|
675
|
+
RICON_MUTATE_FILL = 75,
|
|
676
|
+
RICON_ROTATE_FILL = 76,
|
|
677
|
+
RICON_REPEAT_FILL = 77,
|
|
678
|
+
RICON_SHUFFLE_FILL = 78,
|
|
679
|
+
RICON_EMPTYBOX_SMALL = 79,
|
|
680
|
+
RICON_BOX = 80,
|
|
681
|
+
RICON_BOX_TOP = 81,
|
|
682
|
+
RICON_BOX_TOP_RIGHT = 82,
|
|
683
|
+
RICON_BOX_RIGHT = 83,
|
|
684
|
+
RICON_BOX_BOTTOM_RIGHT = 84,
|
|
685
|
+
RICON_BOX_BOTTOM = 85,
|
|
686
|
+
RICON_BOX_BOTTOM_LEFT = 86,
|
|
687
|
+
RICON_BOX_LEFT = 87,
|
|
688
|
+
RICON_BOX_TOP_LEFT = 88,
|
|
689
|
+
RICON_BOX_CENTER = 89,
|
|
690
|
+
RICON_BOX_CIRCLE_MASK = 90,
|
|
691
|
+
RICON_POT = 91,
|
|
692
|
+
RICON_ALPHA_MULTIPLY = 92,
|
|
693
|
+
RICON_ALPHA_CLEAR = 93,
|
|
694
|
+
RICON_DITHERING = 94,
|
|
695
|
+
RICON_MIPMAPS = 95,
|
|
696
|
+
RICON_BOX_GRID = 96,
|
|
697
|
+
RICON_GRID = 97,
|
|
698
|
+
RICON_BOX_CORNERS_SMALL = 98,
|
|
699
|
+
RICON_BOX_CORNERS_BIG = 99,
|
|
700
|
+
RICON_FOUR_BOXES = 100,
|
|
701
|
+
RICON_GRID_FILL = 101,
|
|
702
|
+
RICON_BOX_MULTISIZE = 102,
|
|
703
|
+
RICON_ZOOM_SMALL = 103,
|
|
704
|
+
RICON_ZOOM_MEDIUM = 104,
|
|
705
|
+
RICON_ZOOM_BIG = 105,
|
|
706
|
+
RICON_ZOOM_ALL = 106,
|
|
707
|
+
RICON_ZOOM_CENTER = 107,
|
|
708
|
+
RICON_BOX_DOTS_SMALL = 108,
|
|
709
|
+
RICON_BOX_DOTS_BIG = 109,
|
|
710
|
+
RICON_BOX_CONCENTRIC = 110,
|
|
711
|
+
RICON_BOX_GRID_BIG = 111,
|
|
712
|
+
RICON_OK_TICK = 112,
|
|
713
|
+
RICON_CROSS = 113,
|
|
714
|
+
RICON_ARROW_LEFT = 114,
|
|
715
|
+
RICON_ARROW_RIGHT = 115,
|
|
716
|
+
RICON_ARROW_DOWN = 116,
|
|
717
|
+
RICON_ARROW_UP = 117,
|
|
718
|
+
RICON_ARROW_LEFT_FILL = 118,
|
|
719
|
+
RICON_ARROW_RIGHT_FILL = 119,
|
|
720
|
+
RICON_ARROW_DOWN_FILL = 120,
|
|
721
|
+
RICON_ARROW_UP_FILL = 121,
|
|
722
|
+
RICON_AUDIO = 122,
|
|
723
|
+
RICON_FX = 123,
|
|
724
|
+
RICON_WAVE = 124,
|
|
725
|
+
RICON_WAVE_SINUS = 125,
|
|
726
|
+
RICON_WAVE_SQUARE = 126,
|
|
727
|
+
RICON_WAVE_TRIANGULAR = 127,
|
|
728
|
+
RICON_CROSS_SMALL = 128,
|
|
729
|
+
RICON_PLAYER_PREVIOUS = 129,
|
|
730
|
+
RICON_PLAYER_PLAY_BACK = 130,
|
|
731
|
+
RICON_PLAYER_PLAY = 131,
|
|
732
|
+
RICON_PLAYER_PAUSE = 132,
|
|
733
|
+
RICON_PLAYER_STOP = 133,
|
|
734
|
+
RICON_PLAYER_NEXT = 134,
|
|
735
|
+
RICON_PLAYER_RECORD = 135,
|
|
736
|
+
RICON_MAGNET = 136,
|
|
737
|
+
RICON_LOCK_CLOSE = 137,
|
|
738
|
+
RICON_LOCK_OPEN = 138,
|
|
739
|
+
RICON_CLOCK = 139,
|
|
740
|
+
RICON_TOOLS = 140,
|
|
741
|
+
RICON_GEAR = 141,
|
|
742
|
+
RICON_GEAR_BIG = 142,
|
|
743
|
+
RICON_BIN = 143,
|
|
744
|
+
RICON_HAND_POINTER = 144,
|
|
745
|
+
RICON_LASER = 145,
|
|
746
|
+
RICON_COIN = 146,
|
|
747
|
+
RICON_EXPLOSION = 147,
|
|
748
|
+
RICON_1UP = 148,
|
|
749
|
+
RICON_PLAYER = 149,
|
|
750
|
+
RICON_PLAYER_JUMP = 150,
|
|
751
|
+
RICON_KEY = 151,
|
|
752
|
+
RICON_DEMON = 152,
|
|
753
|
+
RICON_TEXT_POPUP = 153,
|
|
754
|
+
RICON_GEAR_EX = 154,
|
|
755
|
+
RICON_CRACK = 155,
|
|
756
|
+
RICON_CRACK_POINTS = 156,
|
|
757
|
+
RICON_STAR = 157,
|
|
758
|
+
RICON_DOOR = 158,
|
|
759
|
+
RICON_EXIT = 159,
|
|
760
|
+
RICON_MODE_2D = 160,
|
|
761
|
+
RICON_MODE_3D = 161,
|
|
762
|
+
RICON_CUBE = 162,
|
|
763
|
+
RICON_CUBE_FACE_TOP = 163,
|
|
764
|
+
RICON_CUBE_FACE_LEFT = 164,
|
|
765
|
+
RICON_CUBE_FACE_FRONT = 165,
|
|
766
|
+
RICON_CUBE_FACE_BOTTOM = 166,
|
|
767
|
+
RICON_CUBE_FACE_RIGHT = 167,
|
|
768
|
+
RICON_CUBE_FACE_BACK = 168,
|
|
769
|
+
RICON_CAMERA = 169,
|
|
770
|
+
RICON_SPECIAL = 170,
|
|
771
|
+
RICON_LINK_NET = 171,
|
|
772
|
+
RICON_LINK_BOXES = 172,
|
|
773
|
+
RICON_LINK_MULTI = 173,
|
|
774
|
+
RICON_LINK = 174,
|
|
775
|
+
RICON_LINK_BROKE = 175,
|
|
776
|
+
RICON_TEXT_NOTES = 176,
|
|
777
|
+
RICON_NOTEBOOK = 177,
|
|
778
|
+
RICON_SUITCASE = 178,
|
|
779
|
+
RICON_SUITCASE_ZIP = 179,
|
|
780
|
+
RICON_MAILBOX = 180,
|
|
781
|
+
RICON_MONITOR = 181,
|
|
782
|
+
RICON_PRINTER = 182,
|
|
783
|
+
RICON_PHOTO_CAMERA = 183,
|
|
784
|
+
RICON_PHOTO_CAMERA_FLASH = 184,
|
|
785
|
+
RICON_HOUSE = 185,
|
|
786
|
+
RICON_HEART = 186,
|
|
787
|
+
RICON_CORNER = 187,
|
|
788
|
+
RICON_VERTICAL_BARS = 188,
|
|
789
|
+
RICON_VERTICAL_BARS_FILL = 189,
|
|
790
|
+
RICON_LIFE_BARS = 190,
|
|
791
|
+
RICON_INFO = 191,
|
|
792
|
+
RICON_CROSSLINE = 192,
|
|
793
|
+
RICON_HELP = 193,
|
|
794
|
+
RICON_FILETYPE_ALPHA = 194,
|
|
795
|
+
RICON_FILETYPE_HOME = 195,
|
|
796
|
+
RICON_LAYERS_VISIBLE = 196,
|
|
797
|
+
RICON_LAYERS = 197,
|
|
798
|
+
RICON_WINDOW = 198,
|
|
799
|
+
RICON_HIDPI = 199,
|
|
800
|
+
RICON_200 = 200,
|
|
801
|
+
RICON_201 = 201,
|
|
802
|
+
RICON_202 = 202,
|
|
803
|
+
RICON_203 = 203,
|
|
804
|
+
RICON_204 = 204,
|
|
805
|
+
RICON_205 = 205,
|
|
806
|
+
RICON_206 = 206,
|
|
807
|
+
RICON_207 = 207,
|
|
808
|
+
RICON_208 = 208,
|
|
809
|
+
RICON_209 = 209,
|
|
810
|
+
RICON_210 = 210,
|
|
811
|
+
RICON_211 = 211,
|
|
812
|
+
RICON_212 = 212,
|
|
813
|
+
RICON_213 = 213,
|
|
814
|
+
RICON_214 = 214,
|
|
815
|
+
RICON_215 = 215,
|
|
816
|
+
RICON_216 = 216,
|
|
817
|
+
RICON_217 = 217,
|
|
818
|
+
RICON_218 = 218,
|
|
819
|
+
RICON_219 = 219,
|
|
820
|
+
RICON_220 = 220,
|
|
821
|
+
RICON_221 = 221,
|
|
822
|
+
RICON_222 = 222,
|
|
823
|
+
RICON_223 = 223,
|
|
824
|
+
RICON_224 = 224,
|
|
825
|
+
RICON_225 = 225,
|
|
826
|
+
RICON_226 = 226,
|
|
827
|
+
RICON_227 = 227,
|
|
828
|
+
RICON_228 = 228,
|
|
829
|
+
RICON_229 = 229,
|
|
830
|
+
RICON_230 = 230,
|
|
831
|
+
RICON_231 = 231,
|
|
832
|
+
RICON_232 = 232,
|
|
833
|
+
RICON_233 = 233,
|
|
834
|
+
RICON_234 = 234,
|
|
835
|
+
RICON_235 = 235,
|
|
836
|
+
RICON_236 = 236,
|
|
837
|
+
RICON_237 = 237,
|
|
838
|
+
RICON_238 = 238,
|
|
839
|
+
RICON_239 = 239,
|
|
840
|
+
RICON_240 = 240,
|
|
841
|
+
RICON_241 = 241,
|
|
842
|
+
RICON_242 = 242,
|
|
843
|
+
RICON_243 = 243,
|
|
844
|
+
RICON_244 = 244,
|
|
845
|
+
RICON_245 = 245,
|
|
846
|
+
RICON_246 = 246,
|
|
847
|
+
RICON_247 = 247,
|
|
848
|
+
RICON_248 = 248,
|
|
849
|
+
RICON_249 = 249,
|
|
850
|
+
RICON_250 = 250,
|
|
851
|
+
RICON_251 = 251,
|
|
852
|
+
RICON_252 = 252,
|
|
853
|
+
RICON_253 = 253,
|
|
854
|
+
RICON_254 = 254,
|
|
855
|
+
RICON_255 = 255,
|
|
856
|
+
} guiIconName;
|
|
857
|
+
|
|
858
|
+
//----------------------------------------------------------------------------------
|
|
859
|
+
// Icons data for all gui possible icons (allocated on data segment by default)
|
|
860
|
+
//
|
|
861
|
+
// NOTE 1: Every icon is codified in binary form, using 1 bit per pixel, so,
|
|
862
|
+
// every 16x16 icon requires 8 integers (16*16/32) to be stored
|
|
863
|
+
//
|
|
864
|
+
// NOTE 2: A new icon set could be loaded over this array using GuiLoadIcons(),
|
|
865
|
+
// but loaded icons set must be same RICON_SIZE and no more than RICON_MAX_ICONS
|
|
866
|
+
//
|
|
867
|
+
// guiIcons size is by default: 256*(16*16/32) = 2048*4 = 8192 bytes = 8 KB
|
|
868
|
+
//----------------------------------------------------------------------------------
|
|
869
|
+
static unsigned int guiIcons[RICON_MAX_ICONS*RICON_DATA_ELEMENTS] = {
|
|
870
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_NONE
|
|
871
|
+
0x3ff80000, 0x2f082008, 0x2042207e, 0x40027fc2, 0x40024002, 0x40024002, 0x40024002, 0x00007ffe, // RICON_FOLDER_FILE_OPEN
|
|
872
|
+
0x3ffe0000, 0x44226422, 0x400247e2, 0x5ffa4002, 0x57ea500a, 0x500a500a, 0x40025ffa, 0x00007ffe, // RICON_FILE_SAVE_CLASSIC
|
|
873
|
+
0x00000000, 0x0042007e, 0x40027fc2, 0x40024002, 0x41024002, 0x44424282, 0x793e4102, 0x00000100, // RICON_FOLDER_OPEN
|
|
874
|
+
0x00000000, 0x0042007e, 0x40027fc2, 0x40024002, 0x41024102, 0x44424102, 0x793e4282, 0x00000000, // RICON_FOLDER_SAVE
|
|
875
|
+
0x3ff00000, 0x201c2010, 0x20042004, 0x21042004, 0x24442284, 0x21042104, 0x20042104, 0x00003ffc, // RICON_FILE_OPEN
|
|
876
|
+
0x3ff00000, 0x201c2010, 0x20042004, 0x21042004, 0x21042104, 0x22842444, 0x20042104, 0x00003ffc, // RICON_FILE_SAVE
|
|
877
|
+
0x3ff00000, 0x201c2010, 0x00042004, 0x20041004, 0x20844784, 0x00841384, 0x20042784, 0x00003ffc, // RICON_FILE_EXPORT
|
|
878
|
+
0x3ff00000, 0x201c2010, 0x20042004, 0x20042004, 0x22042204, 0x22042f84, 0x20042204, 0x00003ffc, // RICON_FILE_NEW
|
|
879
|
+
0x3ff00000, 0x201c2010, 0x20042004, 0x20042004, 0x25042884, 0x25042204, 0x20042884, 0x00003ffc, // RICON_FILE_DELETE
|
|
880
|
+
0x3ff00000, 0x201c2010, 0x20042004, 0x20042ff4, 0x20042ff4, 0x20042ff4, 0x20042004, 0x00003ffc, // RICON_FILETYPE_TEXT
|
|
881
|
+
0x3ff00000, 0x201c2010, 0x27042004, 0x244424c4, 0x26442444, 0x20642664, 0x20042004, 0x00003ffc, // RICON_FILETYPE_AUDIO
|
|
882
|
+
0x3ff00000, 0x201c2010, 0x26042604, 0x20042004, 0x35442884, 0x2414222c, 0x20042004, 0x00003ffc, // RICON_FILETYPE_IMAGE
|
|
883
|
+
0x3ff00000, 0x201c2010, 0x20c42004, 0x22442144, 0x22442444, 0x20c42144, 0x20042004, 0x00003ffc, // RICON_FILETYPE_PLAY
|
|
884
|
+
0x3ff00000, 0x3ffc2ff0, 0x3f3c2ff4, 0x3dbc2eb4, 0x3dbc2bb4, 0x3f3c2eb4, 0x3ffc2ff4, 0x00002ff4, // RICON_FILETYPE_VIDEO
|
|
885
|
+
0x3ff00000, 0x201c2010, 0x21842184, 0x21842004, 0x21842184, 0x21842184, 0x20042184, 0x00003ffc, // RICON_FILETYPE_INFO
|
|
886
|
+
0x0ff00000, 0x381c0810, 0x28042804, 0x28042804, 0x28042804, 0x28042804, 0x20102ffc, 0x00003ff0, // RICON_FILE_COPY
|
|
887
|
+
0x00000000, 0x701c0000, 0x079c1e14, 0x55a000f0, 0x079c00f0, 0x701c1e14, 0x00000000, 0x00000000, // RICON_FILE_CUT
|
|
888
|
+
0x01c00000, 0x13e41bec, 0x3f841004, 0x204420c4, 0x20442044, 0x20442044, 0x207c2044, 0x00003fc0, // RICON_FILE_PASTE
|
|
889
|
+
0x00000000, 0x3aa00fe0, 0x2abc2aa0, 0x2aa42aa4, 0x20042aa4, 0x20042004, 0x3ffc2004, 0x00000000, // RICON_CURSOR_HAND
|
|
890
|
+
0x00000000, 0x003c000c, 0x030800c8, 0x30100c10, 0x10202020, 0x04400840, 0x01800280, 0x00000000, // RICON_CURSOR_POINTER
|
|
891
|
+
0x00000000, 0x00180000, 0x01f00078, 0x03e007f0, 0x07c003e0, 0x04000e40, 0x00000000, 0x00000000, // RICON_CURSOR_CLASSIC
|
|
892
|
+
0x00000000, 0x04000000, 0x11000a00, 0x04400a80, 0x01100220, 0x00580088, 0x00000038, 0x00000000, // RICON_PENCIL
|
|
893
|
+
0x04000000, 0x15000a00, 0x50402880, 0x14102820, 0x05040a08, 0x015c028c, 0x007c00bc, 0x00000000, // RICON_PENCIL_BIG
|
|
894
|
+
0x01c00000, 0x01400140, 0x01400140, 0x0ff80140, 0x0ff80808, 0x0aa80808, 0x0aa80aa8, 0x00000ff8, // RICON_BRUSH_CLASSIC
|
|
895
|
+
0x1ffc0000, 0x5ffc7ffe, 0x40004000, 0x00807f80, 0x01c001c0, 0x01c001c0, 0x01c001c0, 0x00000080, // RICON_BRUSH_PAINTER
|
|
896
|
+
0x00000000, 0x00800000, 0x01c00080, 0x03e001c0, 0x07f003e0, 0x036006f0, 0x000001c0, 0x00000000, // RICON_WATER_DROP
|
|
897
|
+
0x00000000, 0x3e003800, 0x1f803f80, 0x0c201e40, 0x02080c10, 0x00840104, 0x00380044, 0x00000000, // RICON_COLOR_PICKER
|
|
898
|
+
0x00000000, 0x07800300, 0x1fe00fc0, 0x3f883fd0, 0x0e021f04, 0x02040402, 0x00f00108, 0x00000000, // RICON_RUBBER
|
|
899
|
+
0x00c00000, 0x02800140, 0x08200440, 0x20081010, 0x2ffe3004, 0x03f807fc, 0x00e001f0, 0x00000040, // RICON_COLOR_BUCKET
|
|
900
|
+
0x00000000, 0x21843ffc, 0x01800180, 0x01800180, 0x01800180, 0x01800180, 0x03c00180, 0x00000000, // RICON_TEXT_T
|
|
901
|
+
0x00800000, 0x01400180, 0x06200340, 0x0c100620, 0x1ff80c10, 0x380c1808, 0x70067004, 0x0000f80f, // RICON_TEXT_A
|
|
902
|
+
0x78000000, 0x50004000, 0x00004800, 0x03c003c0, 0x03c003c0, 0x00100000, 0x0002000a, 0x0000000e, // RICON_SCALE
|
|
903
|
+
0x75560000, 0x5e004002, 0x54001002, 0x41001202, 0x408200fe, 0x40820082, 0x40820082, 0x00006afe, // RICON_RESIZE
|
|
904
|
+
0x00000000, 0x3f003f00, 0x3f003f00, 0x3f003f00, 0x00400080, 0x001c0020, 0x001c001c, 0x00000000, // RICON_FILTER_POINT
|
|
905
|
+
0x6d800000, 0x00004080, 0x40804080, 0x40800000, 0x00406d80, 0x001c0020, 0x001c001c, 0x00000000, // RICON_FILTER_BILINEAR
|
|
906
|
+
0x40080000, 0x1ffe2008, 0x14081008, 0x11081208, 0x10481088, 0x10081028, 0x10047ff8, 0x00001002, // RICON_CROP
|
|
907
|
+
0x00100000, 0x3ffc0010, 0x2ab03550, 0x22b02550, 0x20b02150, 0x20302050, 0x2000fff0, 0x00002000, // RICON_CROP_ALPHA
|
|
908
|
+
0x40000000, 0x1ff82000, 0x04082808, 0x01082208, 0x00482088, 0x00182028, 0x35542008, 0x00000002, // RICON_SQUARE_TOGGLE
|
|
909
|
+
0x00000000, 0x02800280, 0x06c006c0, 0x0ea00ee0, 0x1e901eb0, 0x3e883e98, 0x7efc7e8c, 0x00000000, // RICON_SIMMETRY
|
|
910
|
+
0x01000000, 0x05600100, 0x1d480d50, 0x7d423d44, 0x3d447d42, 0x0d501d48, 0x01000560, 0x00000100, // RICON_SIMMETRY_HORIZONTAL
|
|
911
|
+
0x01800000, 0x04200240, 0x10080810, 0x00001ff8, 0x00007ffe, 0x0ff01ff8, 0x03c007e0, 0x00000180, // RICON_SIMMETRY_VERTICAL
|
|
912
|
+
0x00000000, 0x010800f0, 0x02040204, 0x02040204, 0x07f00308, 0x1c000e00, 0x30003800, 0x00000000, // RICON_LENS
|
|
913
|
+
0x00000000, 0x061803f0, 0x08240c0c, 0x08040814, 0x0c0c0804, 0x23f01618, 0x18002400, 0x00000000, // RICON_LENS_BIG
|
|
914
|
+
0x00000000, 0x00000000, 0x1c7007c0, 0x638e3398, 0x1c703398, 0x000007c0, 0x00000000, 0x00000000, // RICON_EYE_ON
|
|
915
|
+
0x00000000, 0x10002000, 0x04700fc0, 0x610e3218, 0x1c703098, 0x001007a0, 0x00000008, 0x00000000, // RICON_EYE_OFF
|
|
916
|
+
0x00000000, 0x00007ffc, 0x40047ffc, 0x10102008, 0x04400820, 0x02800280, 0x02800280, 0x00000100, // RICON_FILTER_TOP
|
|
917
|
+
0x00000000, 0x40027ffe, 0x10082004, 0x04200810, 0x02400240, 0x02400240, 0x01400240, 0x000000c0, // RICON_FILTER
|
|
918
|
+
0x00800000, 0x00800080, 0x00000080, 0x3c9e0000, 0x00000000, 0x00800080, 0x00800080, 0x00000000, // RICON_TARGET_POINT
|
|
919
|
+
0x00800000, 0x00800080, 0x00800080, 0x3f7e01c0, 0x008001c0, 0x00800080, 0x00800080, 0x00000000, // RICON_TARGET_SMALL
|
|
920
|
+
0x00800000, 0x00800080, 0x03e00080, 0x3e3e0220, 0x03e00220, 0x00800080, 0x00800080, 0x00000000, // RICON_TARGET_BIG
|
|
921
|
+
0x01000000, 0x04400280, 0x01000100, 0x43842008, 0x43849ab2, 0x01002008, 0x04400100, 0x01000280, // RICON_TARGET_MOVE
|
|
922
|
+
0x01000000, 0x04400280, 0x01000100, 0x41042108, 0x41049ff2, 0x01002108, 0x04400100, 0x01000280, // RICON_CURSOR_MOVE
|
|
923
|
+
0x781e0000, 0x500a4002, 0x04204812, 0x00000240, 0x02400000, 0x48120420, 0x4002500a, 0x0000781e, // RICON_CURSOR_SCALE
|
|
924
|
+
0x00000000, 0x20003c00, 0x24002800, 0x01000200, 0x00400080, 0x00140024, 0x003c0004, 0x00000000, // RICON_CURSOR_SCALE_RIGHT
|
|
925
|
+
0x00000000, 0x0004003c, 0x00240014, 0x00800040, 0x02000100, 0x28002400, 0x3c002000, 0x00000000, // RICON_CURSOR_SCALE_LEFT
|
|
926
|
+
0x00000000, 0x00100020, 0x10101fc8, 0x10001020, 0x10001000, 0x10001000, 0x00001fc0, 0x00000000, // RICON_UNDO
|
|
927
|
+
0x00000000, 0x08000400, 0x080813f8, 0x00080408, 0x00080008, 0x00080008, 0x000003f8, 0x00000000, // RICON_REDO
|
|
928
|
+
0x00000000, 0x3ffc0000, 0x20042004, 0x20002000, 0x20402000, 0x3f902020, 0x00400020, 0x00000000, // RICON_REREDO
|
|
929
|
+
0x00000000, 0x3ffc0000, 0x20042004, 0x27fc2004, 0x20202000, 0x3fc82010, 0x00200010, 0x00000000, // RICON_MUTATE
|
|
930
|
+
0x00000000, 0x0ff00000, 0x10081818, 0x11801008, 0x10001180, 0x18101020, 0x00100fc8, 0x00000020, // RICON_ROTATE
|
|
931
|
+
0x00000000, 0x04000200, 0x240429fc, 0x20042204, 0x20442004, 0x3f942024, 0x00400020, 0x00000000, // RICON_REPEAT
|
|
932
|
+
0x00000000, 0x20001000, 0x22104c0e, 0x00801120, 0x11200040, 0x4c0e2210, 0x10002000, 0x00000000, // RICON_SHUFFLE
|
|
933
|
+
0x7ffe0000, 0x50024002, 0x44024802, 0x41024202, 0x40424082, 0x40124022, 0x4002400a, 0x00007ffe, // RICON_EMPTYBOX
|
|
934
|
+
0x00800000, 0x03e00080, 0x08080490, 0x3c9e0808, 0x08080808, 0x03e00490, 0x00800080, 0x00000000, // RICON_TARGET
|
|
935
|
+
0x00800000, 0x00800080, 0x00800080, 0x3ffe01c0, 0x008001c0, 0x00800080, 0x00800080, 0x00000000, // RICON_TARGET_SMALL_FILL
|
|
936
|
+
0x00800000, 0x00800080, 0x03e00080, 0x3ffe03e0, 0x03e003e0, 0x00800080, 0x00800080, 0x00000000, // RICON_TARGET_BIG_FILL
|
|
937
|
+
0x01000000, 0x07c00380, 0x01000100, 0x638c2008, 0x638cfbbe, 0x01002008, 0x07c00100, 0x01000380, // RICON_TARGET_MOVE_FILL
|
|
938
|
+
0x01000000, 0x07c00380, 0x01000100, 0x610c2108, 0x610cfffe, 0x01002108, 0x07c00100, 0x01000380, // RICON_CURSOR_MOVE_FILL
|
|
939
|
+
0x781e0000, 0x6006700e, 0x04204812, 0x00000240, 0x02400000, 0x48120420, 0x700e6006, 0x0000781e, // RICON_CURSOR_SCALE_FILL
|
|
940
|
+
0x00000000, 0x38003c00, 0x24003000, 0x01000200, 0x00400080, 0x000c0024, 0x003c001c, 0x00000000, // RICON_CURSOR_SCALE_RIGHT
|
|
941
|
+
0x00000000, 0x001c003c, 0x0024000c, 0x00800040, 0x02000100, 0x30002400, 0x3c003800, 0x00000000, // RICON_CURSOR_SCALE_LEFT
|
|
942
|
+
0x00000000, 0x00300020, 0x10301ff8, 0x10001020, 0x10001000, 0x10001000, 0x00001fc0, 0x00000000, // RICON_UNDO_FILL
|
|
943
|
+
0x00000000, 0x0c000400, 0x0c081ff8, 0x00080408, 0x00080008, 0x00080008, 0x000003f8, 0x00000000, // RICON_REDO_FILL
|
|
944
|
+
0x00000000, 0x3ffc0000, 0x20042004, 0x20002000, 0x20402000, 0x3ff02060, 0x00400060, 0x00000000, // RICON_REREDO_FILL
|
|
945
|
+
0x00000000, 0x3ffc0000, 0x20042004, 0x27fc2004, 0x20202000, 0x3ff82030, 0x00200030, 0x00000000, // RICON_MUTATE_FILL
|
|
946
|
+
0x00000000, 0x0ff00000, 0x10081818, 0x11801008, 0x10001180, 0x18301020, 0x00300ff8, 0x00000020, // RICON_ROTATE_FILL
|
|
947
|
+
0x00000000, 0x06000200, 0x26042ffc, 0x20042204, 0x20442004, 0x3ff42064, 0x00400060, 0x00000000, // RICON_REPEAT_FILL
|
|
948
|
+
0x00000000, 0x30001000, 0x32107c0e, 0x00801120, 0x11200040, 0x7c0e3210, 0x10003000, 0x00000000, // RICON_SHUFFLE_FILL
|
|
949
|
+
0x00000000, 0x30043ffc, 0x24042804, 0x21042204, 0x20442084, 0x20142024, 0x3ffc200c, 0x00000000, // RICON_EMPTYBOX_SMALL
|
|
950
|
+
0x00000000, 0x20043ffc, 0x20042004, 0x20042004, 0x20042004, 0x20042004, 0x3ffc2004, 0x00000000, // RICON_BOX
|
|
951
|
+
0x00000000, 0x23c43ffc, 0x23c423c4, 0x200423c4, 0x20042004, 0x20042004, 0x3ffc2004, 0x00000000, // RICON_BOX_TOP
|
|
952
|
+
0x00000000, 0x3e043ffc, 0x3e043e04, 0x20043e04, 0x20042004, 0x20042004, 0x3ffc2004, 0x00000000, // RICON_BOX_TOP_RIGHT
|
|
953
|
+
0x00000000, 0x20043ffc, 0x20042004, 0x3e043e04, 0x3e043e04, 0x20042004, 0x3ffc2004, 0x00000000, // RICON_BOX_RIGHT
|
|
954
|
+
0x00000000, 0x20043ffc, 0x20042004, 0x20042004, 0x3e042004, 0x3e043e04, 0x3ffc3e04, 0x00000000, // RICON_BOX_BOTTOM_RIGHT
|
|
955
|
+
0x00000000, 0x20043ffc, 0x20042004, 0x20042004, 0x23c42004, 0x23c423c4, 0x3ffc23c4, 0x00000000, // RICON_BOX_BOTTOM
|
|
956
|
+
0x00000000, 0x20043ffc, 0x20042004, 0x20042004, 0x207c2004, 0x207c207c, 0x3ffc207c, 0x00000000, // RICON_BOX_BOTTOM_LEFT
|
|
957
|
+
0x00000000, 0x20043ffc, 0x20042004, 0x207c207c, 0x207c207c, 0x20042004, 0x3ffc2004, 0x00000000, // RICON_BOX_LEFT
|
|
958
|
+
0x00000000, 0x207c3ffc, 0x207c207c, 0x2004207c, 0x20042004, 0x20042004, 0x3ffc2004, 0x00000000, // RICON_BOX_TOP_LEFT
|
|
959
|
+
0x00000000, 0x20043ffc, 0x20042004, 0x23c423c4, 0x23c423c4, 0x20042004, 0x3ffc2004, 0x00000000, // RICON_BOX_CIRCLE_MASK
|
|
960
|
+
0x7ffe0000, 0x40024002, 0x47e24182, 0x4ff247e2, 0x47e24ff2, 0x418247e2, 0x40024002, 0x00007ffe, // RICON_BOX_CENTER
|
|
961
|
+
0x7fff0000, 0x40014001, 0x40014001, 0x49555ddd, 0x4945495d, 0x400149c5, 0x40014001, 0x00007fff, // RICON_POT
|
|
962
|
+
0x7ffe0000, 0x53327332, 0x44ce4cce, 0x41324332, 0x404e40ce, 0x48125432, 0x4006540e, 0x00007ffe, // RICON_ALPHA_MULTIPLY
|
|
963
|
+
0x7ffe0000, 0x53327332, 0x44ce4cce, 0x41324332, 0x5c4e40ce, 0x44124432, 0x40065c0e, 0x00007ffe, // RICON_ALPHA_CLEAR
|
|
964
|
+
0x7ffe0000, 0x42fe417e, 0x42fe417e, 0x42fe417e, 0x42fe417e, 0x42fe417e, 0x42fe417e, 0x00007ffe, // RICON_DITHERING
|
|
965
|
+
0x07fe0000, 0x1ffa0002, 0x7fea000a, 0x402a402a, 0x5b2a512a, 0x5128552a, 0x40205128, 0x00007fe0, // RICON_MIPMAPS
|
|
966
|
+
0x00000000, 0x1ff80000, 0x12481248, 0x12481ff8, 0x1ff81248, 0x12481248, 0x00001ff8, 0x00000000, // RICON_BOX_GRID
|
|
967
|
+
0x12480000, 0x7ffe1248, 0x12481248, 0x12487ffe, 0x7ffe1248, 0x12481248, 0x12487ffe, 0x00001248, // RICON_GRID
|
|
968
|
+
0x00000000, 0x1c380000, 0x1c3817e8, 0x08100810, 0x08100810, 0x17e81c38, 0x00001c38, 0x00000000, // RICON_BOX_CORNERS_SMALL
|
|
969
|
+
0x700e0000, 0x700e5ffa, 0x20042004, 0x20042004, 0x20042004, 0x20042004, 0x5ffa700e, 0x0000700e, // RICON_BOX_CORNERS_BIG
|
|
970
|
+
0x3f7e0000, 0x21422142, 0x21422142, 0x00003f7e, 0x21423f7e, 0x21422142, 0x3f7e2142, 0x00000000, // RICON_FOUR_BOXES
|
|
971
|
+
0x00000000, 0x3bb80000, 0x3bb83bb8, 0x3bb80000, 0x3bb83bb8, 0x3bb80000, 0x3bb83bb8, 0x00000000, // RICON_GRID_FILL
|
|
972
|
+
0x7ffe0000, 0x7ffe7ffe, 0x77fe7000, 0x77fe77fe, 0x777e7700, 0x777e777e, 0x777e777e, 0x0000777e, // RICON_BOX_MULTISIZE
|
|
973
|
+
0x781e0000, 0x40024002, 0x00004002, 0x01800000, 0x00000180, 0x40020000, 0x40024002, 0x0000781e, // RICON_ZOOM_SMALL
|
|
974
|
+
0x781e0000, 0x40024002, 0x00004002, 0x03c003c0, 0x03c003c0, 0x40020000, 0x40024002, 0x0000781e, // RICON_ZOOM_MEDIUM
|
|
975
|
+
0x781e0000, 0x40024002, 0x07e04002, 0x07e007e0, 0x07e007e0, 0x400207e0, 0x40024002, 0x0000781e, // RICON_ZOOM_BIG
|
|
976
|
+
0x781e0000, 0x5ffa4002, 0x1ff85ffa, 0x1ff81ff8, 0x1ff81ff8, 0x5ffa1ff8, 0x40025ffa, 0x0000781e, // RICON_ZOOM_ALL
|
|
977
|
+
0x00000000, 0x2004381c, 0x00002004, 0x00000000, 0x00000000, 0x20040000, 0x381c2004, 0x00000000, // RICON_ZOOM_CENTER
|
|
978
|
+
0x00000000, 0x1db80000, 0x10081008, 0x10080000, 0x00001008, 0x10081008, 0x00001db8, 0x00000000, // RICON_BOX_DOTS_SMALL
|
|
979
|
+
0x35560000, 0x00002002, 0x00002002, 0x00002002, 0x00002002, 0x00002002, 0x35562002, 0x00000000, // RICON_BOX_DOTS_BIG
|
|
980
|
+
0x7ffe0000, 0x40024002, 0x48124ff2, 0x49924812, 0x48124992, 0x4ff24812, 0x40024002, 0x00007ffe, // RICON_BOX_CONCENTRIC
|
|
981
|
+
0x00000000, 0x10841ffc, 0x10841084, 0x1ffc1084, 0x10841084, 0x10841084, 0x00001ffc, 0x00000000, // RICON_BOX_GRID_BIG
|
|
982
|
+
0x00000000, 0x00000000, 0x10000000, 0x04000800, 0x01040200, 0x00500088, 0x00000020, 0x00000000, // RICON_OK_TICK
|
|
983
|
+
0x00000000, 0x10080000, 0x04200810, 0x01800240, 0x02400180, 0x08100420, 0x00001008, 0x00000000, // RICON_CROSS
|
|
984
|
+
0x00000000, 0x02000000, 0x00800100, 0x00200040, 0x00200010, 0x00800040, 0x02000100, 0x00000000, // RICON_ARROW_LEFT
|
|
985
|
+
0x00000000, 0x00400000, 0x01000080, 0x04000200, 0x04000800, 0x01000200, 0x00400080, 0x00000000, // RICON_ARROW_RIGHT
|
|
986
|
+
0x00000000, 0x00000000, 0x00000000, 0x08081004, 0x02200410, 0x00800140, 0x00000000, 0x00000000, // RICON_ARROW_DOWN
|
|
987
|
+
0x00000000, 0x00000000, 0x01400080, 0x04100220, 0x10040808, 0x00000000, 0x00000000, 0x00000000, // RICON_ARROW_UP
|
|
988
|
+
0x00000000, 0x02000000, 0x03800300, 0x03e003c0, 0x03e003f0, 0x038003c0, 0x02000300, 0x00000000, // RICON_ARROW_LEFT_FILL
|
|
989
|
+
0x00000000, 0x00400000, 0x01c000c0, 0x07c003c0, 0x07c00fc0, 0x01c003c0, 0x004000c0, 0x00000000, // RICON_ARROW_RIGHT_FILL
|
|
990
|
+
0x00000000, 0x00000000, 0x00000000, 0x0ff81ffc, 0x03e007f0, 0x008001c0, 0x00000000, 0x00000000, // RICON_ARROW_DOWN_FILL
|
|
991
|
+
0x00000000, 0x00000000, 0x01c00080, 0x07f003e0, 0x1ffc0ff8, 0x00000000, 0x00000000, 0x00000000, // RICON_ARROW_UP_FILL
|
|
992
|
+
0x00000000, 0x18a008c0, 0x32881290, 0x24822686, 0x26862482, 0x12903288, 0x08c018a0, 0x00000000, // RICON_AUDIO
|
|
993
|
+
0x00000000, 0x04800780, 0x004000c0, 0x662000f0, 0x08103c30, 0x130a0e18, 0x0000318e, 0x00000000, // RICON_FX
|
|
994
|
+
0x00000000, 0x00800000, 0x08880888, 0x2aaa0a8a, 0x0a8a2aaa, 0x08880888, 0x00000080, 0x00000000, // RICON_WAVE
|
|
995
|
+
0x00000000, 0x00600000, 0x01080090, 0x02040108, 0x42044204, 0x24022402, 0x00001800, 0x00000000, // RICON_WAVE_SINUS
|
|
996
|
+
0x00000000, 0x07f80000, 0x04080408, 0x04080408, 0x04080408, 0x7c0e0408, 0x00000000, 0x00000000, // RICON_WAVE_SQUARE
|
|
997
|
+
0x00000000, 0x00000000, 0x00a00040, 0x22084110, 0x08021404, 0x00000000, 0x00000000, 0x00000000, // RICON_WAVE_TRIANGULAR
|
|
998
|
+
0x00000000, 0x00000000, 0x04200000, 0x01800240, 0x02400180, 0x00000420, 0x00000000, 0x00000000, // RICON_CROSS_SMALL
|
|
999
|
+
0x00000000, 0x18380000, 0x12281428, 0x10a81128, 0x112810a8, 0x14281228, 0x00001838, 0x00000000, // RICON_PLAYER_PREVIOUS
|
|
1000
|
+
0x00000000, 0x18000000, 0x11801600, 0x10181060, 0x10601018, 0x16001180, 0x00001800, 0x00000000, // RICON_PLAYER_PLAY_BACK
|
|
1001
|
+
0x00000000, 0x00180000, 0x01880068, 0x18080608, 0x06081808, 0x00680188, 0x00000018, 0x00000000, // RICON_PLAYER_PLAY
|
|
1002
|
+
0x00000000, 0x1e780000, 0x12481248, 0x12481248, 0x12481248, 0x12481248, 0x00001e78, 0x00000000, // RICON_PLAYER_PAUSE
|
|
1003
|
+
0x00000000, 0x1ff80000, 0x10081008, 0x10081008, 0x10081008, 0x10081008, 0x00001ff8, 0x00000000, // RICON_PLAYER_STOP
|
|
1004
|
+
0x00000000, 0x1c180000, 0x14481428, 0x15081488, 0x14881508, 0x14281448, 0x00001c18, 0x00000000, // RICON_PLAYER_NEXT
|
|
1005
|
+
0x00000000, 0x03c00000, 0x08100420, 0x10081008, 0x10081008, 0x04200810, 0x000003c0, 0x00000000, // RICON_PLAYER_RECORD
|
|
1006
|
+
0x00000000, 0x0c3007e0, 0x13c81818, 0x14281668, 0x14281428, 0x1c381c38, 0x08102244, 0x00000000, // RICON_MAGNET
|
|
1007
|
+
0x07c00000, 0x08200820, 0x3ff80820, 0x23882008, 0x21082388, 0x20082108, 0x1ff02008, 0x00000000, // RICON_LOCK_CLOSE
|
|
1008
|
+
0x07c00000, 0x08000800, 0x3ff80800, 0x23882008, 0x21082388, 0x20082108, 0x1ff02008, 0x00000000, // RICON_LOCK_OPEN
|
|
1009
|
+
0x01c00000, 0x0c180770, 0x3086188c, 0x60832082, 0x60034781, 0x30062002, 0x0c18180c, 0x01c00770, // RICON_CLOCK
|
|
1010
|
+
0x0a200000, 0x1b201b20, 0x04200e20, 0x04200420, 0x04700420, 0x0e700e70, 0x0e700e70, 0x04200e70, // RICON_TOOLS
|
|
1011
|
+
0x01800000, 0x3bdc318c, 0x0ff01ff8, 0x7c3e1e78, 0x1e787c3e, 0x1ff80ff0, 0x318c3bdc, 0x00000180, // RICON_GEAR
|
|
1012
|
+
0x01800000, 0x3ffc318c, 0x1c381ff8, 0x781e1818, 0x1818781e, 0x1ff81c38, 0x318c3ffc, 0x00000180, // RICON_GEAR_BIG
|
|
1013
|
+
0x00000000, 0x08080ff8, 0x08081ffc, 0x0aa80aa8, 0x0aa80aa8, 0x0aa80aa8, 0x08080aa8, 0x00000ff8, // RICON_BIN
|
|
1014
|
+
0x00000000, 0x00000000, 0x20043ffc, 0x08043f84, 0x04040f84, 0x04040784, 0x000007fc, 0x00000000, // RICON_HAND_POINTER
|
|
1015
|
+
0x00000000, 0x24400400, 0x00001480, 0x6efe0e00, 0x00000e00, 0x24401480, 0x00000400, 0x00000000, // RICON_LASER
|
|
1016
|
+
0x00000000, 0x03c00000, 0x08300460, 0x11181118, 0x11181118, 0x04600830, 0x000003c0, 0x00000000, // RICON_COIN
|
|
1017
|
+
0x00000000, 0x10880080, 0x06c00810, 0x366c07e0, 0x07e00240, 0x00001768, 0x04200240, 0x00000000, // RICON_EXPLOSION
|
|
1018
|
+
0x00000000, 0x3d280000, 0x2528252c, 0x3d282528, 0x05280528, 0x05e80528, 0x00000000, 0x00000000, // RICON_1UP
|
|
1019
|
+
0x01800000, 0x03c003c0, 0x018003c0, 0x0ff007e0, 0x0bd00bd0, 0x0a500bd0, 0x02400240, 0x02400240, // RICON_PLAYER
|
|
1020
|
+
0x01800000, 0x03c003c0, 0x118013c0, 0x03c81ff8, 0x07c003c8, 0x04400440, 0x0c080478, 0x00000000, // RICON_PLAYER_JUMP
|
|
1021
|
+
0x3ff80000, 0x30183ff8, 0x30183018, 0x3ff83ff8, 0x03000300, 0x03c003c0, 0x03e00300, 0x000003e0, // RICON_KEY
|
|
1022
|
+
0x3ff80000, 0x3ff83ff8, 0x33983ff8, 0x3ff83398, 0x3ff83ff8, 0x00000540, 0x0fe00aa0, 0x00000fe0, // RICON_DEMON
|
|
1023
|
+
0x00000000, 0x0ff00000, 0x20041008, 0x25442004, 0x10082004, 0x06000bf0, 0x00000300, 0x00000000, // RICON_TEXT_POPUP
|
|
1024
|
+
0x00000000, 0x11440000, 0x07f00be8, 0x1c1c0e38, 0x1c1c0c18, 0x07f00e38, 0x11440be8, 0x00000000, // RICON_GEAR_EX
|
|
1025
|
+
0x00000000, 0x20080000, 0x0c601010, 0x07c00fe0, 0x07c007c0, 0x0c600fe0, 0x20081010, 0x00000000, // RICON_CRACK
|
|
1026
|
+
0x00000000, 0x20080000, 0x0c601010, 0x04400fe0, 0x04405554, 0x0c600fe0, 0x20081010, 0x00000000, // RICON_CRACK_POINTS
|
|
1027
|
+
0x00000000, 0x00800080, 0x01c001c0, 0x1ffc3ffe, 0x03e007f0, 0x07f003e0, 0x0c180770, 0x00000808, // RICON_STAR
|
|
1028
|
+
0x0ff00000, 0x08180810, 0x08100818, 0x0a100810, 0x08180810, 0x08100818, 0x08100810, 0x00001ff8, // RICON_DOOR
|
|
1029
|
+
0x0ff00000, 0x08100810, 0x08100810, 0x10100010, 0x4f902010, 0x10102010, 0x08100010, 0x00000ff0, // RICON_EXIT
|
|
1030
|
+
0x00040000, 0x001f000e, 0x0ef40004, 0x12f41284, 0x0ef41214, 0x10040004, 0x7ffc3004, 0x10003000, // RICON_MODE_2D
|
|
1031
|
+
0x78040000, 0x501f600e, 0x0ef44004, 0x12f41284, 0x0ef41284, 0x10140004, 0x7ffc300c, 0x10003000, // RICON_MODE_3D
|
|
1032
|
+
0x7fe00000, 0x50286030, 0x47fe4804, 0x44224402, 0x44224422, 0x241275e2, 0x0c06140a, 0x000007fe, // RICON_CUBE
|
|
1033
|
+
0x7fe00000, 0x5ff87ff0, 0x47fe4ffc, 0x44224402, 0x44224422, 0x241275e2, 0x0c06140a, 0x000007fe, // RICON_CUBE_FACE_TOP
|
|
1034
|
+
0x7fe00000, 0x50386030, 0x47fe483c, 0x443e443e, 0x443e443e, 0x241e75fe, 0x0c06140e, 0x000007fe, // RICON_CUBE_FACE_LEFT
|
|
1035
|
+
0x7fe00000, 0x50286030, 0x47fe4804, 0x47fe47fe, 0x47fe47fe, 0x27fe77fe, 0x0ffe17fe, 0x000007fe, // RICON_CUBE_FACE_FRONT
|
|
1036
|
+
0x7fe00000, 0x50286030, 0x47fe4804, 0x44224402, 0x44224422, 0x3ff27fe2, 0x0ffe1ffa, 0x000007fe, // RICON_CUBE_FACE_BOTTOM
|
|
1037
|
+
0x7fe00000, 0x70286030, 0x7ffe7804, 0x7c227c02, 0x7c227c22, 0x3c127de2, 0x0c061c0a, 0x000007fe, // RICON_CUBE_FACE_RIGHT
|
|
1038
|
+
0x7fe00000, 0x7fe87ff0, 0x7ffe7fe4, 0x7fe27fe2, 0x7fe27fe2, 0x24127fe2, 0x0c06140a, 0x000007fe, // RICON_CUBE_FACE_BACK
|
|
1039
|
+
0x00000000, 0x2a0233fe, 0x22022602, 0x22022202, 0x2a022602, 0x00a033fe, 0x02080110, 0x00000000, // RICON_CAMERA
|
|
1040
|
+
0x00000000, 0x200c3ffc, 0x000c000c, 0x3ffc000c, 0x30003000, 0x30003000, 0x3ffc3004, 0x00000000, // RICON_SPECIAL
|
|
1041
|
+
0x00000000, 0x0022003e, 0x012201e2, 0x0100013e, 0x01000100, 0x79000100, 0x4f004900, 0x00007800, // RICON_LINK_NET
|
|
1042
|
+
0x00000000, 0x44007c00, 0x45004600, 0x00627cbe, 0x00620022, 0x45007cbe, 0x44004600, 0x00007c00, // RICON_LINK_BOXES
|
|
1043
|
+
0x00000000, 0x0044007c, 0x0010007c, 0x3f100010, 0x3f1021f0, 0x3f100010, 0x3f0021f0, 0x00000000, // RICON_LINK_MULTI
|
|
1044
|
+
0x00000000, 0x0044007c, 0x00440044, 0x0010007c, 0x00100010, 0x44107c10, 0x440047f0, 0x00007c00, // RICON_LINK
|
|
1045
|
+
0x00000000, 0x0044007c, 0x00440044, 0x0000007c, 0x00000010, 0x44007c10, 0x44004550, 0x00007c00, // RICON_LINK_BROKE
|
|
1046
|
+
0x02a00000, 0x22a43ffc, 0x20042004, 0x20042ff4, 0x20042ff4, 0x20042ff4, 0x20042004, 0x00003ffc, // RICON_TEXT_NOTES
|
|
1047
|
+
0x3ffc0000, 0x20042004, 0x245e27c4, 0x27c42444, 0x2004201e, 0x201e2004, 0x20042004, 0x00003ffc, // RICON_NOTEBOOK
|
|
1048
|
+
0x00000000, 0x07e00000, 0x04200420, 0x24243ffc, 0x24242424, 0x24242424, 0x3ffc2424, 0x00000000, // RICON_SUITCASE
|
|
1049
|
+
0x00000000, 0x0fe00000, 0x08200820, 0x40047ffc, 0x7ffc5554, 0x40045554, 0x7ffc4004, 0x00000000, // RICON_SUITCASE_ZIP
|
|
1050
|
+
0x00000000, 0x20043ffc, 0x3ffc2004, 0x13c81008, 0x100813c8, 0x10081008, 0x1ff81008, 0x00000000, // RICON_MAILBOX
|
|
1051
|
+
0x00000000, 0x40027ffe, 0x5ffa5ffa, 0x5ffa5ffa, 0x40025ffa, 0x03c07ffe, 0x1ff81ff8, 0x00000000, // RICON_MONITOR
|
|
1052
|
+
0x0ff00000, 0x6bfe7ffe, 0x7ffe7ffe, 0x68167ffe, 0x08106816, 0x08100810, 0x0ff00810, 0x00000000, // RICON_PRINTER
|
|
1053
|
+
0x3ff80000, 0xfffe2008, 0x870a8002, 0x904a888a, 0x904a904a, 0x870a888a, 0xfffe8002, 0x00000000, // RICON_PHOTO_CAMERA
|
|
1054
|
+
0x0fc00000, 0xfcfe0cd8, 0x8002fffe, 0x84428382, 0x84428442, 0x80028382, 0xfffe8002, 0x00000000, // RICON_PHOTO_CAMERA_FLASH
|
|
1055
|
+
0x00000000, 0x02400180, 0x08100420, 0x20041008, 0x23c42004, 0x22442244, 0x3ffc2244, 0x00000000, // RICON_HOUSE
|
|
1056
|
+
0x00000000, 0x1c700000, 0x3ff83ef8, 0x3ff83ff8, 0x0fe01ff0, 0x038007c0, 0x00000100, 0x00000000, // RICON_HEART
|
|
1057
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x80000000, 0xe000c000, // RICON_CORNER
|
|
1058
|
+
0x00000000, 0x14001c00, 0x15c01400, 0x15401540, 0x155c1540, 0x15541554, 0x1ddc1554, 0x00000000, // RICON_VERTICAL_BARS
|
|
1059
|
+
0x00000000, 0x03000300, 0x1b001b00, 0x1b601b60, 0x1b6c1b60, 0x1b6c1b6c, 0x1b6c1b6c, 0x00000000, // RICON_VERTICAL_BARS_FILL
|
|
1060
|
+
0x00000000, 0x00000000, 0x403e7ffe, 0x7ffe403e, 0x7ffe0000, 0x43fe43fe, 0x00007ffe, 0x00000000, // RICON_LIFE_BARS
|
|
1061
|
+
0x7ffc0000, 0x43844004, 0x43844284, 0x43844004, 0x42844284, 0x42844284, 0x40044384, 0x00007ffc, // RICON_INFO
|
|
1062
|
+
0x40008000, 0x10002000, 0x04000800, 0x01000200, 0x00400080, 0x00100020, 0x00040008, 0x00010002, // RICON_CROSSLINE
|
|
1063
|
+
0x00000000, 0x1ff01ff0, 0x18301830, 0x1f001830, 0x03001f00, 0x00000300, 0x03000300, 0x00000000, // RICON_HELP
|
|
1064
|
+
0x3ff00000, 0x2abc3550, 0x2aac3554, 0x2aac3554, 0x2aac3554, 0x2aac3554, 0x2aac3554, 0x00003ffc, // RICON_FILETYPE_ALPHA
|
|
1065
|
+
0x3ff00000, 0x201c2010, 0x22442184, 0x28142424, 0x29942814, 0x2ff42994, 0x20042004, 0x00003ffc, // RICON_FILETYPE_HOME
|
|
1066
|
+
0x07fe0000, 0x04020402, 0x7fe20402, 0x44224422, 0x44224422, 0x402047fe, 0x40204020, 0x00007fe0, // RICON_LAYERS_VISIBLE
|
|
1067
|
+
0x07fe0000, 0x04020402, 0x7c020402, 0x44024402, 0x44024402, 0x402047fe, 0x40204020, 0x00007fe0, // RICON_LAYERS
|
|
1068
|
+
0x00000000, 0x40027ffe, 0x7ffe4002, 0x40024002, 0x40024002, 0x40024002, 0x7ffe4002, 0x00000000, // RICON_WINDOW
|
|
1069
|
+
0x09100000, 0x09f00910, 0x09100910, 0x00000910, 0x24a2779e, 0x27a224a2, 0x709e20a2, 0x00000000, // RICON_HIDPI
|
|
1070
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_200
|
|
1071
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_201
|
|
1072
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_202
|
|
1073
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_203
|
|
1074
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_204
|
|
1075
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_205
|
|
1076
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_206
|
|
1077
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_207
|
|
1078
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_208
|
|
1079
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_209
|
|
1080
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_210
|
|
1081
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_211
|
|
1082
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_212
|
|
1083
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_213
|
|
1084
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_214
|
|
1085
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_215
|
|
1086
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_216
|
|
1087
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_217
|
|
1088
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_218
|
|
1089
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_219
|
|
1090
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_220
|
|
1091
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_221
|
|
1092
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_222
|
|
1093
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_223
|
|
1094
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_224
|
|
1095
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_225
|
|
1096
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_226
|
|
1097
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_227
|
|
1098
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_228
|
|
1099
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_229
|
|
1100
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_230
|
|
1101
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_231
|
|
1102
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_232
|
|
1103
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_233
|
|
1104
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_234
|
|
1105
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_235
|
|
1106
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_236
|
|
1107
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_237
|
|
1108
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_238
|
|
1109
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_239
|
|
1110
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_240
|
|
1111
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_241
|
|
1112
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_242
|
|
1113
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_243
|
|
1114
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_244
|
|
1115
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_245
|
|
1116
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_246
|
|
1117
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_247
|
|
1118
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_248
|
|
1119
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_249
|
|
1120
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_250
|
|
1121
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_251
|
|
1122
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_252
|
|
1123
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_253
|
|
1124
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_254
|
|
1125
|
+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_255
|
|
1126
|
+
};
|
|
1127
|
+
|
|
1128
|
+
#endif // RAYGUI_CUSTOM_RICONS
|
|
1129
|
+
|
|
1130
|
+
#endif // !RAYGUI_NO_RICONS
|
|
1131
|
+
|
|
1132
|
+
#ifndef RICON_SIZE
|
|
1133
|
+
#define RICON_SIZE 0
|
|
1134
|
+
#endif
|
|
1135
|
+
|
|
1136
|
+
#define RAYGUI_MAX_CONTROLS 16 // Maximum number of standard controls
|
|
1137
|
+
#define RAYGUI_MAX_PROPS_BASE 16 // Maximum number of standard properties
|
|
1138
|
+
#define RAYGUI_MAX_PROPS_EXTENDED 8 // Maximum number of extended properties
|
|
1139
|
+
|
|
1140
|
+
//----------------------------------------------------------------------------------
|
|
1141
|
+
// Types and Structures Definition
|
|
1142
|
+
//----------------------------------------------------------------------------------
|
|
1143
|
+
// Gui control property style color element
|
|
1144
|
+
typedef enum { BORDER = 0, BASE, TEXT, OTHER } GuiPropertyElement;
|
|
1145
|
+
|
|
1146
|
+
//----------------------------------------------------------------------------------
|
|
1147
|
+
// Global Variables Definition
|
|
1148
|
+
//----------------------------------------------------------------------------------
|
|
1149
|
+
static GuiControlState guiState = GUI_STATE_NORMAL;
|
|
1150
|
+
|
|
1151
|
+
static Font guiFont = { 0 }; // Gui current font (WARNING: highly coupled to raylib)
|
|
1152
|
+
static bool guiLocked = false; // Gui lock state (no inputs processed)
|
|
1153
|
+
static float guiAlpha = 1.0f; // Gui element transpacency on drawing
|
|
1154
|
+
|
|
1155
|
+
//----------------------------------------------------------------------------------
|
|
1156
|
+
// Style data array for all gui style properties (allocated on data segment by default)
|
|
1157
|
+
//
|
|
1158
|
+
// NOTE 1: First set of BASE properties are generic to all controls but could be individually
|
|
1159
|
+
// overwritten per control, first set of EXTENDED properties are generic to all controls and
|
|
1160
|
+
// can not be overwritten individually but custom EXTENDED properties can be used by control
|
|
1161
|
+
//
|
|
1162
|
+
// NOTE 2: A new style set could be loaded over this array using GuiLoadStyle(),
|
|
1163
|
+
// but default gui style could always be recovered with GuiLoadStyleDefault()
|
|
1164
|
+
//
|
|
1165
|
+
// guiStyle size is by default: 16*(16 + 8) = 384*4 = 1536 bytes = 1.5 KB
|
|
1166
|
+
//----------------------------------------------------------------------------------
|
|
1167
|
+
static unsigned int guiStyle[RAYGUI_MAX_CONTROLS*(RAYGUI_MAX_PROPS_BASE + RAYGUI_MAX_PROPS_EXTENDED)] = { 0 };
|
|
1168
|
+
|
|
1169
|
+
static bool guiStyleLoaded = false; // Style loaded flag for lazy style initialization
|
|
1170
|
+
|
|
1171
|
+
//----------------------------------------------------------------------------------
|
|
1172
|
+
// Standalone Mode Functions Declaration
|
|
1173
|
+
//
|
|
1174
|
+
// NOTE: raygui depend on some raylib input and drawing functions
|
|
1175
|
+
// To use raygui as standalone library, below functions must be defined by the user
|
|
1176
|
+
//----------------------------------------------------------------------------------
|
|
1177
|
+
#if defined(RAYGUI_STANDALONE)
|
|
1178
|
+
|
|
1179
|
+
#define KEY_RIGHT 262
|
|
1180
|
+
#define KEY_LEFT 263
|
|
1181
|
+
#define KEY_DOWN 264
|
|
1182
|
+
#define KEY_UP 265
|
|
1183
|
+
#define KEY_BACKSPACE 259
|
|
1184
|
+
#define KEY_ENTER 257
|
|
1185
|
+
|
|
1186
|
+
#define MOUSE_LEFT_BUTTON 0
|
|
1187
|
+
|
|
1188
|
+
// Input required functions
|
|
1189
|
+
//-------------------------------------------------------------------------------
|
|
1190
|
+
static Vector2 GetMousePosition(void);
|
|
1191
|
+
static float GetMouseWheelMove(void);
|
|
1192
|
+
static bool IsMouseButtonDown(int button);
|
|
1193
|
+
static bool IsMouseButtonPressed(int button);
|
|
1194
|
+
static bool IsMouseButtonReleased(int button);
|
|
1195
|
+
|
|
1196
|
+
static bool IsKeyDown(int key);
|
|
1197
|
+
static bool IsKeyPressed(int key);
|
|
1198
|
+
static int GetCharPressed(void); // -- GuiTextBox(), GuiTextBoxMulti(), GuiValueBox()
|
|
1199
|
+
//-------------------------------------------------------------------------------
|
|
1200
|
+
|
|
1201
|
+
// Drawing required functions
|
|
1202
|
+
//-------------------------------------------------------------------------------
|
|
1203
|
+
static void DrawRectangle(int x, int y, int width, int height, Color color); // -- GuiDrawRectangle(), GuiDrawIcon()
|
|
1204
|
+
|
|
1205
|
+
static void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4); // -- GuiColorPicker()
|
|
1206
|
+
//-------------------------------------------------------------------------------
|
|
1207
|
+
|
|
1208
|
+
// Text required functions
|
|
1209
|
+
//-------------------------------------------------------------------------------
|
|
1210
|
+
static Font LoadFontEx(const char *fileName, int fontSize, int *fontChars, int glyphCount); // -- GuiLoadStyle()
|
|
1211
|
+
static Font GetFontDefault(void); // -- GuiLoadStyleDefault()
|
|
1212
|
+
static Texture2D LoadTextureFromImage(Image image); // -- GuiLoadStyle()
|
|
1213
|
+
static void SetShapesTexture(Texture2D tex, Rectangle rec); // -- GuiLoadStyle()
|
|
1214
|
+
static char *LoadFileText(const char *fileName); // -- GuiLoadStyle()
|
|
1215
|
+
static const char *GetDirectoryPath(const char *filePath); // -- GuiLoadStyle()
|
|
1216
|
+
|
|
1217
|
+
static Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing); // -- GetTextWidth(), GuiTextBoxMulti()
|
|
1218
|
+
static void DrawTextEx(Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); // -- GuiDrawText()
|
|
1219
|
+
//-------------------------------------------------------------------------------
|
|
1220
|
+
|
|
1221
|
+
// raylib functions already implemented in raygui
|
|
1222
|
+
//-------------------------------------------------------------------------------
|
|
1223
|
+
static Color GetColor(int hexValue); // Returns a Color struct from hexadecimal value
|
|
1224
|
+
static int ColorToInt(Color color); // Returns hexadecimal value for a Color
|
|
1225
|
+
static Color Fade(Color color, float alpha); // Color fade-in or fade-out, alpha goes from 0.0f to 1.0f
|
|
1226
|
+
static bool CheckCollisionPointRec(Vector2 point, Rectangle rec); // Check if point is inside rectangle
|
|
1227
|
+
static const char *TextFormat(const char *text, ...); // Formatting of text with variables to 'embed'
|
|
1228
|
+
static const char **TextSplit(const char *text, char delimiter, int *count); // Split text into multiple strings
|
|
1229
|
+
static int TextToInteger(const char *text); // Get integer value from text
|
|
1230
|
+
static int GetCodepoint(const char *text, int *bytesProcessed); // Get next codepoint in a UTF-8 encoded text
|
|
1231
|
+
static const char *CodepointToUTF8(int codepoint, int *byteSize); // Encode codepoint into UTF-8 text (char array size returned as parameter)
|
|
1232
|
+
|
|
1233
|
+
static void DrawRectangleGradientV(int posX, int posY, int width, int height, Color color1, Color color2); // Draw rectangle vertical gradient
|
|
1234
|
+
//-------------------------------------------------------------------------------
|
|
1235
|
+
|
|
1236
|
+
#endif // RAYGUI_STANDALONE
|
|
1237
|
+
|
|
1238
|
+
//----------------------------------------------------------------------------------
|
|
1239
|
+
// Module specific Functions Declaration
|
|
1240
|
+
//----------------------------------------------------------------------------------
|
|
1241
|
+
static int GetTextWidth(const char *text); // Gui get text width using default font
|
|
1242
|
+
static Rectangle GetTextBounds(int control, Rectangle bounds); // Get text bounds considering control bounds
|
|
1243
|
+
static const char *GetTextIcon(const char *text, int *iconId); // Get text icon if provided and move text cursor
|
|
1244
|
+
|
|
1245
|
+
static void GuiDrawText(const char *text, Rectangle bounds, int alignment, Color tint); // Gui draw text using default font
|
|
1246
|
+
static void GuiDrawRectangle(Rectangle rec, int borderWidth, Color borderColor, Color color); // Gui draw rectangle using default raygui style
|
|
1247
|
+
|
|
1248
|
+
static const char **GuiTextSplit(const char *text, int *count, int *textRow); // Split controls text into multiple strings
|
|
1249
|
+
static Vector3 ConvertHSVtoRGB(Vector3 hsv); // Convert color data from HSV to RGB
|
|
1250
|
+
static Vector3 ConvertRGBtoHSV(Vector3 rgb); // Convert color data from RGB to HSV
|
|
1251
|
+
|
|
1252
|
+
//----------------------------------------------------------------------------------
|
|
1253
|
+
// Gui Setup Functions Definition
|
|
1254
|
+
//----------------------------------------------------------------------------------
|
|
1255
|
+
// Enable gui global state
|
|
1256
|
+
void GuiEnable(void) { guiState = GUI_STATE_NORMAL; }
|
|
1257
|
+
|
|
1258
|
+
// Disable gui global state
|
|
1259
|
+
void GuiDisable(void) { guiState = GUI_STATE_DISABLED; }
|
|
1260
|
+
|
|
1261
|
+
// Lock gui global state
|
|
1262
|
+
void GuiLock(void) { guiLocked = true; }
|
|
1263
|
+
|
|
1264
|
+
// Unlock gui global state
|
|
1265
|
+
void GuiUnlock(void) { guiLocked = false; }
|
|
1266
|
+
|
|
1267
|
+
// Check if gui is locked (global state)
|
|
1268
|
+
bool GuiIsLocked(void) { return guiLocked; }
|
|
1269
|
+
|
|
1270
|
+
// Set gui controls alpha global state
|
|
1271
|
+
void GuiFade(float alpha)
|
|
1272
|
+
{
|
|
1273
|
+
if (alpha < 0.0f) alpha = 0.0f;
|
|
1274
|
+
else if (alpha > 1.0f) alpha = 1.0f;
|
|
1275
|
+
|
|
1276
|
+
guiAlpha = alpha;
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
// Set gui state (global state)
|
|
1280
|
+
void GuiSetState(int state) { guiState = (GuiControlState)state; }
|
|
1281
|
+
|
|
1282
|
+
// Get gui state (global state)
|
|
1283
|
+
int GuiGetState(void) { return guiState; }
|
|
1284
|
+
|
|
1285
|
+
// Set custom gui font
|
|
1286
|
+
// NOTE: Font loading/unloading is external to raygui
|
|
1287
|
+
void GuiSetFont(Font font)
|
|
1288
|
+
{
|
|
1289
|
+
if (font.texture.id > 0)
|
|
1290
|
+
{
|
|
1291
|
+
// NOTE: If we try to setup a font but default style has not been
|
|
1292
|
+
// lazily loaded before, it will be overwritten, so we need to force
|
|
1293
|
+
// default style loading first
|
|
1294
|
+
if (!guiStyleLoaded) GuiLoadStyleDefault();
|
|
1295
|
+
|
|
1296
|
+
guiFont = font;
|
|
1297
|
+
GuiSetStyle(DEFAULT, TEXT_SIZE, font.baseSize);
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
// Get custom gui font
|
|
1302
|
+
Font GuiGetFont(void)
|
|
1303
|
+
{
|
|
1304
|
+
return guiFont;
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
// Set control style property value
|
|
1308
|
+
void GuiSetStyle(int control, int property, int value)
|
|
1309
|
+
{
|
|
1310
|
+
if (!guiStyleLoaded) GuiLoadStyleDefault();
|
|
1311
|
+
guiStyle[control*(RAYGUI_MAX_PROPS_BASE + RAYGUI_MAX_PROPS_EXTENDED) + property] = value;
|
|
1312
|
+
|
|
1313
|
+
// Default properties are propagated to all controls
|
|
1314
|
+
if ((control == 0) && (property < RAYGUI_MAX_PROPS_BASE))
|
|
1315
|
+
{
|
|
1316
|
+
for (int i = 1; i < RAYGUI_MAX_CONTROLS; i++) guiStyle[i*(RAYGUI_MAX_PROPS_BASE + RAYGUI_MAX_PROPS_EXTENDED) + property] = value;
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
// Get control style property value
|
|
1321
|
+
int GuiGetStyle(int control, int property)
|
|
1322
|
+
{
|
|
1323
|
+
if (!guiStyleLoaded) GuiLoadStyleDefault();
|
|
1324
|
+
return guiStyle[control*(RAYGUI_MAX_PROPS_BASE + RAYGUI_MAX_PROPS_EXTENDED) + property];
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
//----------------------------------------------------------------------------------
|
|
1328
|
+
// Gui Controls Functions Definition
|
|
1329
|
+
//----------------------------------------------------------------------------------
|
|
1330
|
+
|
|
1331
|
+
// Window Box control
|
|
1332
|
+
bool GuiWindowBox(Rectangle bounds, const char *title)
|
|
1333
|
+
{
|
|
1334
|
+
// NOTE: This define is also used by GuiMessageBox() and GuiTextInputBox()
|
|
1335
|
+
#define WINDOW_STATUSBAR_HEIGHT 22
|
|
1336
|
+
|
|
1337
|
+
//GuiControlState state = guiState;
|
|
1338
|
+
bool clicked = false;
|
|
1339
|
+
|
|
1340
|
+
int statusBarHeight = WINDOW_STATUSBAR_HEIGHT + 2*GuiGetStyle(STATUSBAR, BORDER_WIDTH);
|
|
1341
|
+
statusBarHeight += (statusBarHeight%2);
|
|
1342
|
+
|
|
1343
|
+
Rectangle statusBar = { bounds.x, bounds.y, bounds.width, (float)statusBarHeight };
|
|
1344
|
+
if (bounds.height < statusBarHeight*2.0f) bounds.height = statusBarHeight*2.0f;
|
|
1345
|
+
|
|
1346
|
+
Rectangle windowPanel = { bounds.x, bounds.y + (float)statusBarHeight - 1, bounds.width, bounds.height - (float)statusBarHeight };
|
|
1347
|
+
Rectangle closeButtonRec = { statusBar.x + statusBar.width - GuiGetStyle(STATUSBAR, BORDER_WIDTH) - 20,
|
|
1348
|
+
statusBar.y + statusBarHeight/2.0f - 18.0f/2.0f, 18, 18 };
|
|
1349
|
+
|
|
1350
|
+
// Update control
|
|
1351
|
+
//--------------------------------------------------------------------
|
|
1352
|
+
// NOTE: Logic is directly managed by button
|
|
1353
|
+
//--------------------------------------------------------------------
|
|
1354
|
+
|
|
1355
|
+
// Draw control
|
|
1356
|
+
//--------------------------------------------------------------------
|
|
1357
|
+
GuiStatusBar(statusBar, title); // Draw window header as status bar
|
|
1358
|
+
GuiPanel(windowPanel); // Draw window base
|
|
1359
|
+
|
|
1360
|
+
// Draw window close button
|
|
1361
|
+
int tempBorderWidth = GuiGetStyle(BUTTON, BORDER_WIDTH);
|
|
1362
|
+
int tempTextAlignment = GuiGetStyle(BUTTON, TEXT_ALIGNMENT);
|
|
1363
|
+
GuiSetStyle(BUTTON, BORDER_WIDTH, 1);
|
|
1364
|
+
GuiSetStyle(BUTTON, TEXT_ALIGNMENT, GUI_TEXT_ALIGN_CENTER);
|
|
1365
|
+
#if defined(RAYGUI_NO_RICONS)
|
|
1366
|
+
clicked = GuiButton(closeButtonRec, "x");
|
|
1367
|
+
#else
|
|
1368
|
+
clicked = GuiButton(closeButtonRec, GuiIconText(RICON_CROSS_SMALL, NULL));
|
|
1369
|
+
#endif
|
|
1370
|
+
GuiSetStyle(BUTTON, BORDER_WIDTH, tempBorderWidth);
|
|
1371
|
+
GuiSetStyle(BUTTON, TEXT_ALIGNMENT, tempTextAlignment);
|
|
1372
|
+
//--------------------------------------------------------------------
|
|
1373
|
+
|
|
1374
|
+
return clicked;
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
// Group Box control with text name
|
|
1378
|
+
void GuiGroupBox(Rectangle bounds, const char *text)
|
|
1379
|
+
{
|
|
1380
|
+
#define GROUPBOX_LINE_THICK 1
|
|
1381
|
+
#define GROUPBOX_TEXT_PADDING 10
|
|
1382
|
+
|
|
1383
|
+
GuiControlState state = guiState;
|
|
1384
|
+
|
|
1385
|
+
// Draw control
|
|
1386
|
+
//--------------------------------------------------------------------
|
|
1387
|
+
GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y, GROUPBOX_LINE_THICK, bounds.height }, 0, BLANK, Fade(GetColor(GuiGetStyle(DEFAULT, (state == GUI_STATE_DISABLED)? BORDER_COLOR_DISABLED : LINE_COLOR)), guiAlpha));
|
|
1388
|
+
GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y + bounds.height - 1, bounds.width, GROUPBOX_LINE_THICK }, 0, BLANK, Fade(GetColor(GuiGetStyle(DEFAULT, (state == GUI_STATE_DISABLED)? BORDER_COLOR_DISABLED : LINE_COLOR)), guiAlpha));
|
|
1389
|
+
GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x + bounds.width - 1, bounds.y, GROUPBOX_LINE_THICK, bounds.height }, 0, BLANK, Fade(GetColor(GuiGetStyle(DEFAULT, (state == GUI_STATE_DISABLED)? BORDER_COLOR_DISABLED : LINE_COLOR)), guiAlpha));
|
|
1390
|
+
|
|
1391
|
+
GuiLine(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y, bounds.width, 1 }, text);
|
|
1392
|
+
//--------------------------------------------------------------------
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
// Line control
|
|
1396
|
+
void GuiLine(Rectangle bounds, const char *text)
|
|
1397
|
+
{
|
|
1398
|
+
#define LINE_TEXT_PADDING 10
|
|
1399
|
+
|
|
1400
|
+
GuiControlState state = guiState;
|
|
1401
|
+
|
|
1402
|
+
Color color = Fade(GetColor(GuiGetStyle(DEFAULT, (state == GUI_STATE_DISABLED)? BORDER_COLOR_DISABLED : LINE_COLOR)), guiAlpha);
|
|
1403
|
+
|
|
1404
|
+
// Draw control
|
|
1405
|
+
//--------------------------------------------------------------------
|
|
1406
|
+
if (text == NULL) GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y + bounds.height/2, bounds.width, 1 }, 0, BLANK, color);
|
|
1407
|
+
else
|
|
1408
|
+
{
|
|
1409
|
+
Rectangle textBounds = { 0 };
|
|
1410
|
+
textBounds.width = (float)GetTextWidth(text);
|
|
1411
|
+
textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE);
|
|
1412
|
+
textBounds.x = bounds.x + LINE_TEXT_PADDING;
|
|
1413
|
+
textBounds.y = bounds.y - (float)GuiGetStyle(DEFAULT, TEXT_SIZE)/2;
|
|
1414
|
+
|
|
1415
|
+
// Draw line with embedded text label: "--- text --------------"
|
|
1416
|
+
GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y, LINE_TEXT_PADDING - 2, 1 }, 0, BLANK, color);
|
|
1417
|
+
GuiLabel(textBounds, text);
|
|
1418
|
+
GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x + LINE_TEXT_PADDING + textBounds.width + 4, bounds.y, bounds.width - textBounds.width - LINE_TEXT_PADDING - 4, 1 }, 0, BLANK, color);
|
|
1419
|
+
}
|
|
1420
|
+
//--------------------------------------------------------------------
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
// Panel control
|
|
1424
|
+
void GuiPanel(Rectangle bounds)
|
|
1425
|
+
{
|
|
1426
|
+
#define PANEL_BORDER_WIDTH 1
|
|
1427
|
+
|
|
1428
|
+
GuiControlState state = guiState;
|
|
1429
|
+
|
|
1430
|
+
// Draw control
|
|
1431
|
+
//--------------------------------------------------------------------
|
|
1432
|
+
GuiDrawRectangle(bounds, PANEL_BORDER_WIDTH, Fade(GetColor(GuiGetStyle(DEFAULT, (state == GUI_STATE_DISABLED)? BORDER_COLOR_DISABLED: LINE_COLOR)), guiAlpha),
|
|
1433
|
+
Fade(GetColor(GuiGetStyle(DEFAULT, (state == GUI_STATE_DISABLED)? BASE_COLOR_DISABLED : BACKGROUND_COLOR)), guiAlpha));
|
|
1434
|
+
//--------------------------------------------------------------------
|
|
1435
|
+
}
|
|
1436
|
+
|
|
1437
|
+
// Scroll Panel control
|
|
1438
|
+
Rectangle GuiScrollPanel(Rectangle bounds, Rectangle content, Vector2 *scroll)
|
|
1439
|
+
{
|
|
1440
|
+
GuiControlState state = guiState;
|
|
1441
|
+
|
|
1442
|
+
Vector2 scrollPos = { 0.0f, 0.0f };
|
|
1443
|
+
if (scroll != NULL) scrollPos = *scroll;
|
|
1444
|
+
|
|
1445
|
+
bool hasHorizontalScrollBar = (content.width > bounds.width - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH))? true : false;
|
|
1446
|
+
bool hasVerticalScrollBar = (content.height > bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH))? true : false;
|
|
1447
|
+
|
|
1448
|
+
// Recheck to account for the other scrollbar being visible
|
|
1449
|
+
if (!hasHorizontalScrollBar) hasHorizontalScrollBar = (hasVerticalScrollBar && (content.width > (bounds.width - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH))))? true : false;
|
|
1450
|
+
if (!hasVerticalScrollBar) hasVerticalScrollBar = (hasHorizontalScrollBar && (content.height > (bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH))))? true : false;
|
|
1451
|
+
|
|
1452
|
+
const int horizontalScrollBarWidth = hasHorizontalScrollBar? GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH) : 0;
|
|
1453
|
+
const int verticalScrollBarWidth = hasVerticalScrollBar? GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH) : 0;
|
|
1454
|
+
const Rectangle horizontalScrollBar = { (float)((GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)? (float)bounds.x + verticalScrollBarWidth : (float)bounds.x) + GuiGetStyle(DEFAULT, BORDER_WIDTH), (float)bounds.y + bounds.height - horizontalScrollBarWidth - GuiGetStyle(DEFAULT, BORDER_WIDTH), (float)bounds.width - verticalScrollBarWidth - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH), (float)horizontalScrollBarWidth };
|
|
1455
|
+
const Rectangle verticalScrollBar = { (float)((GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)? (float)bounds.x + GuiGetStyle(DEFAULT, BORDER_WIDTH) : (float)bounds.x + bounds.width - verticalScrollBarWidth - GuiGetStyle(DEFAULT, BORDER_WIDTH)), (float)bounds.y + GuiGetStyle(DEFAULT, BORDER_WIDTH), (float)verticalScrollBarWidth, (float)bounds.height - horizontalScrollBarWidth - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) };
|
|
1456
|
+
|
|
1457
|
+
// Calculate view area (area without the scrollbars)
|
|
1458
|
+
Rectangle view = (GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)?
|
|
1459
|
+
RAYGUI_CLITERAL(Rectangle){ bounds.x + verticalScrollBarWidth + GuiGetStyle(DEFAULT, BORDER_WIDTH), bounds.y + GuiGetStyle(DEFAULT, BORDER_WIDTH), bounds.width - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - verticalScrollBarWidth, bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - horizontalScrollBarWidth } :
|
|
1460
|
+
RAYGUI_CLITERAL(Rectangle){ bounds.x + GuiGetStyle(DEFAULT, BORDER_WIDTH), bounds.y + GuiGetStyle(DEFAULT, BORDER_WIDTH), bounds.width - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - verticalScrollBarWidth, bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - horizontalScrollBarWidth };
|
|
1461
|
+
|
|
1462
|
+
// Clip view area to the actual content size
|
|
1463
|
+
if (view.width > content.width) view.width = content.width;
|
|
1464
|
+
if (view.height > content.height) view.height = content.height;
|
|
1465
|
+
|
|
1466
|
+
const float horizontalMin = hasHorizontalScrollBar? ((GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)? (float)-verticalScrollBarWidth : 0) - (float)GuiGetStyle(DEFAULT, BORDER_WIDTH) : (((float)GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)? (float)-verticalScrollBarWidth : 0) - (float)GuiGetStyle(DEFAULT, BORDER_WIDTH);
|
|
1467
|
+
const float horizontalMax = hasHorizontalScrollBar? content.width - bounds.width + (float)verticalScrollBarWidth + GuiGetStyle(DEFAULT, BORDER_WIDTH) - (((float)GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)? (float)verticalScrollBarWidth : 0) : (float)-GuiGetStyle(DEFAULT, BORDER_WIDTH);
|
|
1468
|
+
const float verticalMin = hasVerticalScrollBar? (float)-GuiGetStyle(DEFAULT, BORDER_WIDTH) : (float)-GuiGetStyle(DEFAULT, BORDER_WIDTH);
|
|
1469
|
+
const float verticalMax = hasVerticalScrollBar? content.height - bounds.height + (float)horizontalScrollBarWidth + (float)GuiGetStyle(DEFAULT, BORDER_WIDTH) : (float)-GuiGetStyle(DEFAULT, BORDER_WIDTH);
|
|
1470
|
+
|
|
1471
|
+
// Update control
|
|
1472
|
+
//--------------------------------------------------------------------
|
|
1473
|
+
if ((state != GUI_STATE_DISABLED) && !guiLocked)
|
|
1474
|
+
{
|
|
1475
|
+
Vector2 mousePoint = GetMousePosition();
|
|
1476
|
+
|
|
1477
|
+
// Check button state
|
|
1478
|
+
if (CheckCollisionPointRec(mousePoint, bounds))
|
|
1479
|
+
{
|
|
1480
|
+
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = GUI_STATE_PRESSED;
|
|
1481
|
+
else state = GUI_STATE_FOCUSED;
|
|
1482
|
+
|
|
1483
|
+
if (hasHorizontalScrollBar)
|
|
1484
|
+
{
|
|
1485
|
+
if (IsKeyDown(KEY_RIGHT)) scrollPos.x -= GuiGetStyle(SCROLLBAR, SCROLL_SPEED);
|
|
1486
|
+
if (IsKeyDown(KEY_LEFT)) scrollPos.x += GuiGetStyle(SCROLLBAR, SCROLL_SPEED);
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
if (hasVerticalScrollBar)
|
|
1490
|
+
{
|
|
1491
|
+
if (IsKeyDown(KEY_DOWN)) scrollPos.y -= GuiGetStyle(SCROLLBAR, SCROLL_SPEED);
|
|
1492
|
+
if (IsKeyDown(KEY_UP)) scrollPos.y += GuiGetStyle(SCROLLBAR, SCROLL_SPEED);
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
float wheelMove = GetMouseWheelMove();
|
|
1496
|
+
|
|
1497
|
+
// Horizontal scroll (Shift + Mouse wheel)
|
|
1498
|
+
if (hasHorizontalScrollBar && (IsKeyDown(KEY_LEFT_SHIFT) || IsKeyDown(KEY_RIGHT_SHIFT))) scrollPos.x += wheelMove*20;
|
|
1499
|
+
else scrollPos.y += wheelMove*20; // Vertical scroll
|
|
1500
|
+
}
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1503
|
+
// Normalize scroll values
|
|
1504
|
+
if (scrollPos.x > -horizontalMin) scrollPos.x = -horizontalMin;
|
|
1505
|
+
if (scrollPos.x < -horizontalMax) scrollPos.x = -horizontalMax;
|
|
1506
|
+
if (scrollPos.y > -verticalMin) scrollPos.y = -verticalMin;
|
|
1507
|
+
if (scrollPos.y < -verticalMax) scrollPos.y = -verticalMax;
|
|
1508
|
+
//--------------------------------------------------------------------
|
|
1509
|
+
|
|
1510
|
+
// Draw control
|
|
1511
|
+
//--------------------------------------------------------------------
|
|
1512
|
+
GuiDrawRectangle(bounds, 0, BLANK, GetColor(GuiGetStyle(DEFAULT, BACKGROUND_COLOR))); // Draw background
|
|
1513
|
+
|
|
1514
|
+
// Save size of the scrollbar slider
|
|
1515
|
+
const int slider = GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE);
|
|
1516
|
+
|
|
1517
|
+
// Draw horizontal scrollbar if visible
|
|
1518
|
+
if (hasHorizontalScrollBar)
|
|
1519
|
+
{
|
|
1520
|
+
// Change scrollbar slider size to show the diff in size between the content width and the widget width
|
|
1521
|
+
GuiSetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE, (int)(((bounds.width - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - verticalScrollBarWidth)/(int)content.width)*((int)bounds.width - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - verticalScrollBarWidth)));
|
|
1522
|
+
scrollPos.x = (float)-GuiScrollBar(horizontalScrollBar, (int)-scrollPos.x, (int)horizontalMin, (int)horizontalMax);
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
// Draw vertical scrollbar if visible
|
|
1526
|
+
if (hasVerticalScrollBar)
|
|
1527
|
+
{
|
|
1528
|
+
// Change scrollbar slider size to show the diff in size between the content height and the widget height
|
|
1529
|
+
GuiSetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE, (int)(((bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - horizontalScrollBarWidth)/(int)content.height)*((int)bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - horizontalScrollBarWidth)));
|
|
1530
|
+
scrollPos.y = (float)-GuiScrollBar(verticalScrollBar, (int)-scrollPos.y, (int)verticalMin, (int)verticalMax);
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1533
|
+
// Draw detail corner rectangle if both scroll bars are visible
|
|
1534
|
+
if (hasHorizontalScrollBar && hasVerticalScrollBar)
|
|
1535
|
+
{
|
|
1536
|
+
Rectangle corner = { (GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE) ? (bounds.x + GuiGetStyle(DEFAULT, BORDER_WIDTH) + 2) : (horizontalScrollBar.x + horizontalScrollBar.width + 2), verticalScrollBar.y + verticalScrollBar.height + 2, (float)horizontalScrollBarWidth - 4, (float)verticalScrollBarWidth - 4 };
|
|
1537
|
+
GuiDrawRectangle(corner, 0, BLANK, Fade(GetColor(GuiGetStyle(LISTVIEW, TEXT + (state*3))), guiAlpha));
|
|
1538
|
+
}
|
|
1539
|
+
|
|
1540
|
+
// Draw scrollbar lines depending on current state
|
|
1541
|
+
GuiDrawRectangle(bounds, GuiGetStyle(DEFAULT, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(LISTVIEW, BORDER + (state*3))), guiAlpha), BLANK);
|
|
1542
|
+
|
|
1543
|
+
// Set scrollbar slider size back to the way it was before
|
|
1544
|
+
GuiSetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE, slider);
|
|
1545
|
+
//--------------------------------------------------------------------
|
|
1546
|
+
|
|
1547
|
+
if (scroll != NULL) *scroll = scrollPos;
|
|
1548
|
+
|
|
1549
|
+
return view;
|
|
1550
|
+
}
|
|
1551
|
+
|
|
1552
|
+
// Label control
|
|
1553
|
+
void GuiLabel(Rectangle bounds, const char *text)
|
|
1554
|
+
{
|
|
1555
|
+
GuiControlState state = guiState;
|
|
1556
|
+
|
|
1557
|
+
// Update control
|
|
1558
|
+
//--------------------------------------------------------------------
|
|
1559
|
+
// ...
|
|
1560
|
+
//--------------------------------------------------------------------
|
|
1561
|
+
|
|
1562
|
+
// Draw control
|
|
1563
|
+
//--------------------------------------------------------------------
|
|
1564
|
+
GuiDrawText(text, GetTextBounds(LABEL, bounds), GuiGetStyle(LABEL, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(LABEL, (state == GUI_STATE_DISABLED)? TEXT_COLOR_DISABLED : TEXT_COLOR_NORMAL)), guiAlpha));
|
|
1565
|
+
//--------------------------------------------------------------------
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1568
|
+
// Button control, returns true when clicked
|
|
1569
|
+
bool GuiButton(Rectangle bounds, const char *text)
|
|
1570
|
+
{
|
|
1571
|
+
GuiControlState state = guiState;
|
|
1572
|
+
bool pressed = false;
|
|
1573
|
+
|
|
1574
|
+
// Update control
|
|
1575
|
+
//--------------------------------------------------------------------
|
|
1576
|
+
if ((state != GUI_STATE_DISABLED) && !guiLocked)
|
|
1577
|
+
{
|
|
1578
|
+
Vector2 mousePoint = GetMousePosition();
|
|
1579
|
+
|
|
1580
|
+
// Check button state
|
|
1581
|
+
if (CheckCollisionPointRec(mousePoint, bounds))
|
|
1582
|
+
{
|
|
1583
|
+
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = GUI_STATE_PRESSED;
|
|
1584
|
+
else state = GUI_STATE_FOCUSED;
|
|
1585
|
+
|
|
1586
|
+
if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) pressed = true;
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1589
|
+
//--------------------------------------------------------------------
|
|
1590
|
+
|
|
1591
|
+
// Draw control
|
|
1592
|
+
//--------------------------------------------------------------------
|
|
1593
|
+
GuiDrawRectangle(bounds, GuiGetStyle(BUTTON, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(BUTTON, BORDER + (state*3))), guiAlpha), Fade(GetColor(GuiGetStyle(BUTTON, BASE + (state*3))), guiAlpha));
|
|
1594
|
+
GuiDrawText(text, GetTextBounds(BUTTON, bounds), GuiGetStyle(BUTTON, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(BUTTON, TEXT + (state*3))), guiAlpha));
|
|
1595
|
+
//------------------------------------------------------------------
|
|
1596
|
+
|
|
1597
|
+
return pressed;
|
|
1598
|
+
}
|
|
1599
|
+
|
|
1600
|
+
// Label button control
|
|
1601
|
+
bool GuiLabelButton(Rectangle bounds, const char *text)
|
|
1602
|
+
{
|
|
1603
|
+
GuiControlState state = guiState;
|
|
1604
|
+
bool pressed = false;
|
|
1605
|
+
|
|
1606
|
+
// NOTE: We force bounds.width to be all text
|
|
1607
|
+
float textWidth = MeasureTextEx(guiFont, text, (float)GuiGetStyle(DEFAULT, TEXT_SIZE), (float)GuiGetStyle(DEFAULT, TEXT_SPACING)).x;
|
|
1608
|
+
if (bounds.width < textWidth) bounds.width = textWidth;
|
|
1609
|
+
|
|
1610
|
+
// Update control
|
|
1611
|
+
//--------------------------------------------------------------------
|
|
1612
|
+
if ((state != GUI_STATE_DISABLED) && !guiLocked)
|
|
1613
|
+
{
|
|
1614
|
+
Vector2 mousePoint = GetMousePosition();
|
|
1615
|
+
|
|
1616
|
+
// Check checkbox state
|
|
1617
|
+
if (CheckCollisionPointRec(mousePoint, bounds))
|
|
1618
|
+
{
|
|
1619
|
+
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = GUI_STATE_PRESSED;
|
|
1620
|
+
else state = GUI_STATE_FOCUSED;
|
|
1621
|
+
|
|
1622
|
+
if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) pressed = true;
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
//--------------------------------------------------------------------
|
|
1626
|
+
|
|
1627
|
+
// Draw control
|
|
1628
|
+
//--------------------------------------------------------------------
|
|
1629
|
+
GuiDrawText(text, GetTextBounds(LABEL, bounds), GuiGetStyle(LABEL, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(LABEL, TEXT + (state*3))), guiAlpha));
|
|
1630
|
+
//--------------------------------------------------------------------
|
|
1631
|
+
|
|
1632
|
+
return pressed;
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1635
|
+
// Toggle Button control, returns true when active
|
|
1636
|
+
bool GuiToggle(Rectangle bounds, const char *text, bool active)
|
|
1637
|
+
{
|
|
1638
|
+
GuiControlState state = guiState;
|
|
1639
|
+
|
|
1640
|
+
// Update control
|
|
1641
|
+
//--------------------------------------------------------------------
|
|
1642
|
+
if ((state != GUI_STATE_DISABLED) && !guiLocked)
|
|
1643
|
+
{
|
|
1644
|
+
Vector2 mousePoint = GetMousePosition();
|
|
1645
|
+
|
|
1646
|
+
// Check toggle button state
|
|
1647
|
+
if (CheckCollisionPointRec(mousePoint, bounds))
|
|
1648
|
+
{
|
|
1649
|
+
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = GUI_STATE_PRESSED;
|
|
1650
|
+
else if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON))
|
|
1651
|
+
{
|
|
1652
|
+
state = GUI_STATE_NORMAL;
|
|
1653
|
+
active = !active;
|
|
1654
|
+
}
|
|
1655
|
+
else state = GUI_STATE_FOCUSED;
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1658
|
+
//--------------------------------------------------------------------
|
|
1659
|
+
|
|
1660
|
+
// Draw control
|
|
1661
|
+
//--------------------------------------------------------------------
|
|
1662
|
+
if (state == GUI_STATE_NORMAL)
|
|
1663
|
+
{
|
|
1664
|
+
GuiDrawRectangle(bounds, GuiGetStyle(TOGGLE, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(TOGGLE, (active? BORDER_COLOR_PRESSED : (BORDER + state*3)))), guiAlpha), Fade(GetColor(GuiGetStyle(TOGGLE, (active? BASE_COLOR_PRESSED : (BASE + state*3)))), guiAlpha));
|
|
1665
|
+
GuiDrawText(text, GetTextBounds(TOGGLE, bounds), GuiGetStyle(TOGGLE, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(TOGGLE, (active? TEXT_COLOR_PRESSED : (TEXT + state*3)))), guiAlpha));
|
|
1666
|
+
}
|
|
1667
|
+
else
|
|
1668
|
+
{
|
|
1669
|
+
GuiDrawRectangle(bounds, GuiGetStyle(TOGGLE, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(TOGGLE, BORDER + state*3)), guiAlpha), Fade(GetColor(GuiGetStyle(TOGGLE, BASE + state*3)), guiAlpha));
|
|
1670
|
+
GuiDrawText(text, GetTextBounds(TOGGLE, bounds), GuiGetStyle(TOGGLE, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(TOGGLE, TEXT + state*3)), guiAlpha));
|
|
1671
|
+
}
|
|
1672
|
+
//--------------------------------------------------------------------
|
|
1673
|
+
|
|
1674
|
+
return active;
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1677
|
+
// Toggle Group control, returns toggled button index
|
|
1678
|
+
int GuiToggleGroup(Rectangle bounds, const char *text, int active)
|
|
1679
|
+
{
|
|
1680
|
+
#if !defined(TOGGLEGROUP_MAX_ELEMENTS)
|
|
1681
|
+
#define TOGGLEGROUP_MAX_ELEMENTS 32
|
|
1682
|
+
#endif
|
|
1683
|
+
|
|
1684
|
+
float initBoundsX = bounds.x;
|
|
1685
|
+
|
|
1686
|
+
// Get substrings items from text (items pointers)
|
|
1687
|
+
int rows[TOGGLEGROUP_MAX_ELEMENTS] = { 0 };
|
|
1688
|
+
int itemCount = 0;
|
|
1689
|
+
const char **items = GuiTextSplit(text, &itemCount, rows);
|
|
1690
|
+
|
|
1691
|
+
int prevRow = rows[0];
|
|
1692
|
+
|
|
1693
|
+
for (int i = 0; i < itemCount; i++)
|
|
1694
|
+
{
|
|
1695
|
+
if (prevRow != rows[i])
|
|
1696
|
+
{
|
|
1697
|
+
bounds.x = initBoundsX;
|
|
1698
|
+
bounds.y += (bounds.height + GuiGetStyle(TOGGLE, GROUP_PADDING));
|
|
1699
|
+
prevRow = rows[i];
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1702
|
+
if (i == active) GuiToggle(bounds, items[i], true);
|
|
1703
|
+
else if (GuiToggle(bounds, items[i], false) == true) active = i;
|
|
1704
|
+
|
|
1705
|
+
bounds.x += (bounds.width + GuiGetStyle(TOGGLE, GROUP_PADDING));
|
|
1706
|
+
}
|
|
1707
|
+
|
|
1708
|
+
return active;
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1711
|
+
// Check Box control, returns true when active
|
|
1712
|
+
bool GuiCheckBox(Rectangle bounds, const char *text, bool checked)
|
|
1713
|
+
{
|
|
1714
|
+
GuiControlState state = guiState;
|
|
1715
|
+
|
|
1716
|
+
Rectangle textBounds = { 0 };
|
|
1717
|
+
|
|
1718
|
+
if (text != NULL)
|
|
1719
|
+
{
|
|
1720
|
+
textBounds.width = (float)GetTextWidth(text);
|
|
1721
|
+
textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE);
|
|
1722
|
+
textBounds.x = bounds.x + bounds.width + GuiGetStyle(CHECKBOX, TEXT_PADDING);
|
|
1723
|
+
textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2;
|
|
1724
|
+
if (GuiGetStyle(CHECKBOX, TEXT_ALIGNMENT) == GUI_TEXT_ALIGN_LEFT) textBounds.x = bounds.x - textBounds.width - GuiGetStyle(CHECKBOX, TEXT_PADDING);
|
|
1725
|
+
}
|
|
1726
|
+
|
|
1727
|
+
// Update control
|
|
1728
|
+
//--------------------------------------------------------------------
|
|
1729
|
+
if ((state != GUI_STATE_DISABLED) && !guiLocked)
|
|
1730
|
+
{
|
|
1731
|
+
Vector2 mousePoint = GetMousePosition();
|
|
1732
|
+
|
|
1733
|
+
Rectangle totalBounds = {
|
|
1734
|
+
(GuiGetStyle(CHECKBOX, TEXT_ALIGNMENT) == GUI_TEXT_ALIGN_LEFT)? textBounds.x : bounds.x,
|
|
1735
|
+
bounds.y,
|
|
1736
|
+
bounds.width + textBounds.width + GuiGetStyle(CHECKBOX, TEXT_PADDING),
|
|
1737
|
+
bounds.height,
|
|
1738
|
+
};
|
|
1739
|
+
|
|
1740
|
+
// Check checkbox state
|
|
1741
|
+
if (CheckCollisionPointRec(mousePoint, totalBounds))
|
|
1742
|
+
{
|
|
1743
|
+
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = GUI_STATE_PRESSED;
|
|
1744
|
+
else state = GUI_STATE_FOCUSED;
|
|
1745
|
+
|
|
1746
|
+
if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) checked = !checked;
|
|
1747
|
+
}
|
|
1748
|
+
}
|
|
1749
|
+
//--------------------------------------------------------------------
|
|
1750
|
+
|
|
1751
|
+
// Draw control
|
|
1752
|
+
//--------------------------------------------------------------------
|
|
1753
|
+
GuiDrawRectangle(bounds, GuiGetStyle(CHECKBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(CHECKBOX, BORDER + (state*3))), guiAlpha), BLANK);
|
|
1754
|
+
|
|
1755
|
+
if (checked)
|
|
1756
|
+
{
|
|
1757
|
+
Rectangle check = { bounds.x + GuiGetStyle(CHECKBOX, BORDER_WIDTH) + GuiGetStyle(CHECKBOX, CHECK_PADDING),
|
|
1758
|
+
bounds.y + GuiGetStyle(CHECKBOX, BORDER_WIDTH) + GuiGetStyle(CHECKBOX, CHECK_PADDING),
|
|
1759
|
+
bounds.width - 2*(GuiGetStyle(CHECKBOX, BORDER_WIDTH) + GuiGetStyle(CHECKBOX, CHECK_PADDING)),
|
|
1760
|
+
bounds.height - 2*(GuiGetStyle(CHECKBOX, BORDER_WIDTH) + GuiGetStyle(CHECKBOX, CHECK_PADDING)) };
|
|
1761
|
+
GuiDrawRectangle(check, 0, BLANK, Fade(GetColor(GuiGetStyle(CHECKBOX, TEXT + state*3)), guiAlpha));
|
|
1762
|
+
}
|
|
1763
|
+
|
|
1764
|
+
GuiDrawText(text, textBounds, (GuiGetStyle(CHECKBOX, TEXT_ALIGNMENT) == GUI_TEXT_ALIGN_RIGHT)? GUI_TEXT_ALIGN_LEFT : GUI_TEXT_ALIGN_RIGHT, Fade(GetColor(GuiGetStyle(LABEL, TEXT + (state*3))), guiAlpha));
|
|
1765
|
+
//--------------------------------------------------------------------
|
|
1766
|
+
|
|
1767
|
+
return checked;
|
|
1768
|
+
}
|
|
1769
|
+
|
|
1770
|
+
// Combo Box control, returns selected item index
|
|
1771
|
+
int GuiComboBox(Rectangle bounds, const char *text, int active)
|
|
1772
|
+
{
|
|
1773
|
+
GuiControlState state = guiState;
|
|
1774
|
+
|
|
1775
|
+
bounds.width -= (GuiGetStyle(COMBOBOX, COMBO_BUTTON_WIDTH) + GuiGetStyle(COMBOBOX, COMBO_BUTTON_PADDING));
|
|
1776
|
+
|
|
1777
|
+
Rectangle selector = { (float)bounds.x + bounds.width + GuiGetStyle(COMBOBOX, COMBO_BUTTON_PADDING),
|
|
1778
|
+
(float)bounds.y, (float)GuiGetStyle(COMBOBOX, COMBO_BUTTON_WIDTH), (float)bounds.height };
|
|
1779
|
+
|
|
1780
|
+
// Get substrings items from text (items pointers, lengths and count)
|
|
1781
|
+
int itemCount = 0;
|
|
1782
|
+
const char **items = GuiTextSplit(text, &itemCount, NULL);
|
|
1783
|
+
|
|
1784
|
+
if (active < 0) active = 0;
|
|
1785
|
+
else if (active > itemCount - 1) active = itemCount - 1;
|
|
1786
|
+
|
|
1787
|
+
// Update control
|
|
1788
|
+
//--------------------------------------------------------------------
|
|
1789
|
+
if ((state != GUI_STATE_DISABLED) && !guiLocked && (itemCount > 1))
|
|
1790
|
+
{
|
|
1791
|
+
Vector2 mousePoint = GetMousePosition();
|
|
1792
|
+
|
|
1793
|
+
if (CheckCollisionPointRec(mousePoint, bounds) ||
|
|
1794
|
+
CheckCollisionPointRec(mousePoint, selector))
|
|
1795
|
+
{
|
|
1796
|
+
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
|
|
1797
|
+
{
|
|
1798
|
+
active += 1;
|
|
1799
|
+
if (active >= itemCount) active = 0;
|
|
1800
|
+
}
|
|
1801
|
+
|
|
1802
|
+
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = GUI_STATE_PRESSED;
|
|
1803
|
+
else state = GUI_STATE_FOCUSED;
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
//--------------------------------------------------------------------
|
|
1807
|
+
|
|
1808
|
+
// Draw control
|
|
1809
|
+
//--------------------------------------------------------------------
|
|
1810
|
+
// Draw combo box main
|
|
1811
|
+
GuiDrawRectangle(bounds, GuiGetStyle(COMBOBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(COMBOBOX, BORDER + (state*3))), guiAlpha), Fade(GetColor(GuiGetStyle(COMBOBOX, BASE + (state*3))), guiAlpha));
|
|
1812
|
+
GuiDrawText(items[active], GetTextBounds(COMBOBOX, bounds), GuiGetStyle(COMBOBOX, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(COMBOBOX, TEXT + (state*3))), guiAlpha));
|
|
1813
|
+
|
|
1814
|
+
// Draw selector using a custom button
|
|
1815
|
+
// NOTE: BORDER_WIDTH and TEXT_ALIGNMENT forced values
|
|
1816
|
+
int tempBorderWidth = GuiGetStyle(BUTTON, BORDER_WIDTH);
|
|
1817
|
+
int tempTextAlign = GuiGetStyle(BUTTON, TEXT_ALIGNMENT);
|
|
1818
|
+
GuiSetStyle(BUTTON, BORDER_WIDTH, 1);
|
|
1819
|
+
GuiSetStyle(BUTTON, TEXT_ALIGNMENT, GUI_TEXT_ALIGN_CENTER);
|
|
1820
|
+
|
|
1821
|
+
GuiButton(selector, TextFormat("%i/%i", active + 1, itemCount));
|
|
1822
|
+
|
|
1823
|
+
GuiSetStyle(BUTTON, TEXT_ALIGNMENT, tempTextAlign);
|
|
1824
|
+
GuiSetStyle(BUTTON, BORDER_WIDTH, tempBorderWidth);
|
|
1825
|
+
//--------------------------------------------------------------------
|
|
1826
|
+
|
|
1827
|
+
return active;
|
|
1828
|
+
}
|
|
1829
|
+
|
|
1830
|
+
// Dropdown Box control
|
|
1831
|
+
// NOTE: Returns mouse click
|
|
1832
|
+
bool GuiDropdownBox(Rectangle bounds, const char *text, int *active, bool editMode)
|
|
1833
|
+
{
|
|
1834
|
+
GuiControlState state = guiState;
|
|
1835
|
+
int itemSelected = *active;
|
|
1836
|
+
int itemFocused = -1;
|
|
1837
|
+
|
|
1838
|
+
// Get substrings items from text (items pointers, lengths and count)
|
|
1839
|
+
int itemCount = 0;
|
|
1840
|
+
const char **items = GuiTextSplit(text, &itemCount, NULL);
|
|
1841
|
+
|
|
1842
|
+
Rectangle boundsOpen = bounds;
|
|
1843
|
+
boundsOpen.height = (itemCount + 1)*(bounds.height + GuiGetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_PADDING));
|
|
1844
|
+
|
|
1845
|
+
Rectangle itemBounds = bounds;
|
|
1846
|
+
|
|
1847
|
+
bool pressed = false; // Check mouse button pressed
|
|
1848
|
+
|
|
1849
|
+
// Update control
|
|
1850
|
+
//--------------------------------------------------------------------
|
|
1851
|
+
if ((state != GUI_STATE_DISABLED) && (editMode || !guiLocked) && (itemCount > 1))
|
|
1852
|
+
{
|
|
1853
|
+
Vector2 mousePoint = GetMousePosition();
|
|
1854
|
+
|
|
1855
|
+
if (editMode)
|
|
1856
|
+
{
|
|
1857
|
+
state = GUI_STATE_PRESSED;
|
|
1858
|
+
|
|
1859
|
+
// Check if mouse has been pressed or released outside limits
|
|
1860
|
+
if (!CheckCollisionPointRec(mousePoint, boundsOpen))
|
|
1861
|
+
{
|
|
1862
|
+
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON) || IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) pressed = true;
|
|
1863
|
+
}
|
|
1864
|
+
|
|
1865
|
+
// Check if already selected item has been pressed again
|
|
1866
|
+
if (CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true;
|
|
1867
|
+
|
|
1868
|
+
// Check focused and selected item
|
|
1869
|
+
for (int i = 0; i < itemCount; i++)
|
|
1870
|
+
{
|
|
1871
|
+
// Update item rectangle y position for next item
|
|
1872
|
+
itemBounds.y += (bounds.height + GuiGetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_PADDING));
|
|
1873
|
+
|
|
1874
|
+
if (CheckCollisionPointRec(mousePoint, itemBounds))
|
|
1875
|
+
{
|
|
1876
|
+
itemFocused = i;
|
|
1877
|
+
if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON))
|
|
1878
|
+
{
|
|
1879
|
+
itemSelected = i;
|
|
1880
|
+
pressed = true; // Item selected, change to editMode = false
|
|
1881
|
+
}
|
|
1882
|
+
break;
|
|
1883
|
+
}
|
|
1884
|
+
}
|
|
1885
|
+
|
|
1886
|
+
itemBounds = bounds;
|
|
1887
|
+
}
|
|
1888
|
+
else
|
|
1889
|
+
{
|
|
1890
|
+
if (CheckCollisionPointRec(mousePoint, bounds))
|
|
1891
|
+
{
|
|
1892
|
+
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
|
|
1893
|
+
{
|
|
1894
|
+
pressed = true;
|
|
1895
|
+
state = GUI_STATE_PRESSED;
|
|
1896
|
+
}
|
|
1897
|
+
else state = GUI_STATE_FOCUSED;
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
}
|
|
1901
|
+
//--------------------------------------------------------------------
|
|
1902
|
+
|
|
1903
|
+
// Draw control
|
|
1904
|
+
//--------------------------------------------------------------------
|
|
1905
|
+
if (editMode) GuiPanel(boundsOpen);
|
|
1906
|
+
|
|
1907
|
+
GuiDrawRectangle(bounds, GuiGetStyle(DROPDOWNBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(DROPDOWNBOX, BORDER + state*3)), guiAlpha), Fade(GetColor(GuiGetStyle(DROPDOWNBOX, BASE + state*3)), guiAlpha));
|
|
1908
|
+
GuiDrawText(items[itemSelected], GetTextBounds(DEFAULT, bounds), GuiGetStyle(DROPDOWNBOX, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(DROPDOWNBOX, TEXT + state*3)), guiAlpha));
|
|
1909
|
+
|
|
1910
|
+
if (editMode)
|
|
1911
|
+
{
|
|
1912
|
+
// Draw visible items
|
|
1913
|
+
for (int i = 0; i < itemCount; i++)
|
|
1914
|
+
{
|
|
1915
|
+
// Update item rectangle y position for next item
|
|
1916
|
+
itemBounds.y += (bounds.height + GuiGetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_PADDING));
|
|
1917
|
+
|
|
1918
|
+
if (i == itemSelected)
|
|
1919
|
+
{
|
|
1920
|
+
GuiDrawRectangle(itemBounds, GuiGetStyle(DROPDOWNBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(DROPDOWNBOX, BORDER_COLOR_PRESSED)), guiAlpha), Fade(GetColor(GuiGetStyle(DROPDOWNBOX, BASE_COLOR_PRESSED)), guiAlpha));
|
|
1921
|
+
GuiDrawText(items[i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(DROPDOWNBOX, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(DROPDOWNBOX, TEXT_COLOR_PRESSED)), guiAlpha));
|
|
1922
|
+
}
|
|
1923
|
+
else if (i == itemFocused)
|
|
1924
|
+
{
|
|
1925
|
+
GuiDrawRectangle(itemBounds, GuiGetStyle(DROPDOWNBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(DROPDOWNBOX, BORDER_COLOR_FOCUSED)), guiAlpha), Fade(GetColor(GuiGetStyle(DROPDOWNBOX, BASE_COLOR_FOCUSED)), guiAlpha));
|
|
1926
|
+
GuiDrawText(items[i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(DROPDOWNBOX, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(DROPDOWNBOX, TEXT_COLOR_FOCUSED)), guiAlpha));
|
|
1927
|
+
}
|
|
1928
|
+
else GuiDrawText(items[i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(DROPDOWNBOX, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(DROPDOWNBOX, TEXT_COLOR_NORMAL)), guiAlpha));
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1931
|
+
|
|
1932
|
+
// Draw arrows (using icon if available)
|
|
1933
|
+
#if defined(RAYGUI_NO_RICONS)
|
|
1934
|
+
GuiDrawText("v", RAYGUI_CLITERAL(Rectangle){ bounds.x + bounds.width - GuiGetStyle(DROPDOWNBOX, ARROW_PADDING), bounds.y + bounds.height/2 - 2, 10, 10 },
|
|
1935
|
+
GUI_TEXT_ALIGN_CENTER, Fade(GetColor(GuiGetStyle(DROPDOWNBOX, TEXT + (state*3))), guiAlpha));
|
|
1936
|
+
#else
|
|
1937
|
+
GuiDrawText("#120#", RAYGUI_CLITERAL(Rectangle){ bounds.x + bounds.width - GuiGetStyle(DROPDOWNBOX, ARROW_PADDING), bounds.y + bounds.height/2 - 6, 10, 10 },
|
|
1938
|
+
GUI_TEXT_ALIGN_CENTER, Fade(GetColor(GuiGetStyle(DROPDOWNBOX, TEXT + (state*3))), guiAlpha)); // RICON_ARROW_DOWN_FILL
|
|
1939
|
+
#endif
|
|
1940
|
+
//--------------------------------------------------------------------
|
|
1941
|
+
|
|
1942
|
+
*active = itemSelected;
|
|
1943
|
+
return pressed;
|
|
1944
|
+
}
|
|
1945
|
+
|
|
1946
|
+
// Text Box control, updates input text
|
|
1947
|
+
// NOTE 2: Returns if KEY_ENTER pressed (useful for data validation)
|
|
1948
|
+
bool GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode)
|
|
1949
|
+
{
|
|
1950
|
+
GuiControlState state = guiState;
|
|
1951
|
+
bool pressed = false;
|
|
1952
|
+
|
|
1953
|
+
Rectangle cursor = {
|
|
1954
|
+
bounds.x + GuiGetStyle(TEXTBOX, TEXT_PADDING) + GetTextWidth(text) + 2,
|
|
1955
|
+
bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE),
|
|
1956
|
+
4,
|
|
1957
|
+
(float)GuiGetStyle(DEFAULT, TEXT_SIZE)*2
|
|
1958
|
+
};
|
|
1959
|
+
|
|
1960
|
+
if (cursor.height > bounds.height) cursor.height = bounds.height - GuiGetStyle(TEXTBOX, BORDER_WIDTH)*2;
|
|
1961
|
+
|
|
1962
|
+
// Update control
|
|
1963
|
+
//--------------------------------------------------------------------
|
|
1964
|
+
if ((state != GUI_STATE_DISABLED) && !guiLocked)
|
|
1965
|
+
{
|
|
1966
|
+
Vector2 mousePoint = GetMousePosition();
|
|
1967
|
+
|
|
1968
|
+
if (editMode)
|
|
1969
|
+
{
|
|
1970
|
+
state = GUI_STATE_PRESSED;
|
|
1971
|
+
|
|
1972
|
+
int key = GetCharPressed(); // Returns codepoint as Unicode
|
|
1973
|
+
int keyCount = (int)strlen(text);
|
|
1974
|
+
|
|
1975
|
+
// Only allow keys in range [32..125]
|
|
1976
|
+
if (keyCount < (textSize - 1))
|
|
1977
|
+
{
|
|
1978
|
+
float maxWidth = (bounds.width - (GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING)*2));
|
|
1979
|
+
|
|
1980
|
+
if ((GetTextWidth(text) < (maxWidth - GuiGetStyle(DEFAULT, TEXT_SIZE))) && (key >= 32))
|
|
1981
|
+
{
|
|
1982
|
+
int byteSize = 0;
|
|
1983
|
+
const char *textUTF8 = CodepointToUTF8(key, &byteSize);
|
|
1984
|
+
|
|
1985
|
+
for (int i = 0; i < byteSize; i++)
|
|
1986
|
+
{
|
|
1987
|
+
text[keyCount] = textUTF8[i];
|
|
1988
|
+
keyCount++;
|
|
1989
|
+
}
|
|
1990
|
+
|
|
1991
|
+
text[keyCount] = '\0';
|
|
1992
|
+
}
|
|
1993
|
+
}
|
|
1994
|
+
|
|
1995
|
+
// Delete text
|
|
1996
|
+
if (keyCount > 0)
|
|
1997
|
+
{
|
|
1998
|
+
if (IsKeyPressed(KEY_BACKSPACE))
|
|
1999
|
+
{
|
|
2000
|
+
keyCount--;
|
|
2001
|
+
text[keyCount] = '\0';
|
|
2002
|
+
if (keyCount < 0) keyCount = 0;
|
|
2003
|
+
}
|
|
2004
|
+
}
|
|
2005
|
+
|
|
2006
|
+
if (IsKeyPressed(KEY_ENTER) || (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) pressed = true;
|
|
2007
|
+
|
|
2008
|
+
// Check text alignment to position cursor properly
|
|
2009
|
+
int textAlignment = GuiGetStyle(TEXTBOX, TEXT_ALIGNMENT);
|
|
2010
|
+
if (textAlignment == GUI_TEXT_ALIGN_CENTER) cursor.x = bounds.x + GetTextWidth(text)/2 + bounds.width/2 + 1;
|
|
2011
|
+
else if (textAlignment == GUI_TEXT_ALIGN_RIGHT) cursor.x = bounds.x + bounds.width - GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING);
|
|
2012
|
+
}
|
|
2013
|
+
else
|
|
2014
|
+
{
|
|
2015
|
+
if (CheckCollisionPointRec(mousePoint, bounds))
|
|
2016
|
+
{
|
|
2017
|
+
state = GUI_STATE_FOCUSED;
|
|
2018
|
+
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true;
|
|
2019
|
+
}
|
|
2020
|
+
}
|
|
2021
|
+
}
|
|
2022
|
+
//--------------------------------------------------------------------
|
|
2023
|
+
|
|
2024
|
+
// Draw control
|
|
2025
|
+
//--------------------------------------------------------------------
|
|
2026
|
+
if (state == GUI_STATE_PRESSED)
|
|
2027
|
+
{
|
|
2028
|
+
GuiDrawRectangle(bounds, GuiGetStyle(TEXTBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), guiAlpha), Fade(GetColor(GuiGetStyle(TEXTBOX, BASE_COLOR_PRESSED)), guiAlpha));
|
|
2029
|
+
}
|
|
2030
|
+
else if (state == GUI_STATE_DISABLED)
|
|
2031
|
+
{
|
|
2032
|
+
GuiDrawRectangle(bounds, GuiGetStyle(TEXTBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), guiAlpha), Fade(GetColor(GuiGetStyle(TEXTBOX, BASE_COLOR_DISABLED)), guiAlpha));
|
|
2033
|
+
}
|
|
2034
|
+
else GuiDrawRectangle(bounds, 1, Fade(GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), guiAlpha), BLANK);
|
|
2035
|
+
|
|
2036
|
+
GuiDrawText(text, GetTextBounds(TEXTBOX, bounds), GuiGetStyle(TEXTBOX, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(TEXTBOX, TEXT + (state*3))), guiAlpha));
|
|
2037
|
+
|
|
2038
|
+
// Draw cursor
|
|
2039
|
+
if (editMode) GuiDrawRectangle(cursor, 0, BLANK, Fade(GetColor(GuiGetStyle(TEXTBOX, BORDER_COLOR_PRESSED)), guiAlpha));
|
|
2040
|
+
//--------------------------------------------------------------------
|
|
2041
|
+
|
|
2042
|
+
return pressed;
|
|
2043
|
+
}
|
|
2044
|
+
|
|
2045
|
+
// Spinner control, returns selected value
|
|
2046
|
+
bool GuiSpinner(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode)
|
|
2047
|
+
{
|
|
2048
|
+
GuiControlState state = guiState;
|
|
2049
|
+
|
|
2050
|
+
bool pressed = false;
|
|
2051
|
+
int tempValue = *value;
|
|
2052
|
+
|
|
2053
|
+
Rectangle spinner = { bounds.x + GuiGetStyle(SPINNER, SPIN_BUTTON_WIDTH) + GuiGetStyle(SPINNER, SPIN_BUTTON_PADDING), bounds.y,
|
|
2054
|
+
bounds.width - 2*(GuiGetStyle(SPINNER, SPIN_BUTTON_WIDTH) + GuiGetStyle(SPINNER, SPIN_BUTTON_PADDING)), bounds.height };
|
|
2055
|
+
Rectangle leftButtonBound = { (float)bounds.x, (float)bounds.y, (float)GuiGetStyle(SPINNER, SPIN_BUTTON_WIDTH), (float)bounds.height };
|
|
2056
|
+
Rectangle rightButtonBound = { (float)bounds.x + bounds.width - GuiGetStyle(SPINNER, SPIN_BUTTON_WIDTH), (float)bounds.y, (float)GuiGetStyle(SPINNER, SPIN_BUTTON_WIDTH), (float)bounds.height };
|
|
2057
|
+
|
|
2058
|
+
Rectangle textBounds = { 0 };
|
|
2059
|
+
if (text != NULL)
|
|
2060
|
+
{
|
|
2061
|
+
textBounds.width = (float)GetTextWidth(text);
|
|
2062
|
+
textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE);
|
|
2063
|
+
textBounds.x = bounds.x + bounds.width + GuiGetStyle(SPINNER, TEXT_PADDING);
|
|
2064
|
+
textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2;
|
|
2065
|
+
if (GuiGetStyle(SPINNER, TEXT_ALIGNMENT) == GUI_TEXT_ALIGN_LEFT) textBounds.x = bounds.x - textBounds.width - GuiGetStyle(SPINNER, TEXT_PADDING);
|
|
2066
|
+
}
|
|
2067
|
+
|
|
2068
|
+
// Update control
|
|
2069
|
+
//--------------------------------------------------------------------
|
|
2070
|
+
if ((state != GUI_STATE_DISABLED) && !guiLocked)
|
|
2071
|
+
{
|
|
2072
|
+
Vector2 mousePoint = GetMousePosition();
|
|
2073
|
+
|
|
2074
|
+
// Check spinner state
|
|
2075
|
+
if (CheckCollisionPointRec(mousePoint, bounds))
|
|
2076
|
+
{
|
|
2077
|
+
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = GUI_STATE_PRESSED;
|
|
2078
|
+
else state = GUI_STATE_FOCUSED;
|
|
2079
|
+
}
|
|
2080
|
+
}
|
|
2081
|
+
|
|
2082
|
+
if (!editMode)
|
|
2083
|
+
{
|
|
2084
|
+
if (tempValue < minValue) tempValue = minValue;
|
|
2085
|
+
if (tempValue > maxValue) tempValue = maxValue;
|
|
2086
|
+
}
|
|
2087
|
+
//--------------------------------------------------------------------
|
|
2088
|
+
|
|
2089
|
+
// Draw control
|
|
2090
|
+
//--------------------------------------------------------------------
|
|
2091
|
+
// TODO: Set Spinner properties for ValueBox
|
|
2092
|
+
pressed = GuiValueBox(spinner, NULL, &tempValue, minValue, maxValue, editMode);
|
|
2093
|
+
|
|
2094
|
+
// Draw value selector custom buttons
|
|
2095
|
+
// NOTE: BORDER_WIDTH and TEXT_ALIGNMENT forced values
|
|
2096
|
+
int tempBorderWidth = GuiGetStyle(BUTTON, BORDER_WIDTH);
|
|
2097
|
+
int tempTextAlign = GuiGetStyle(BUTTON, TEXT_ALIGNMENT);
|
|
2098
|
+
GuiSetStyle(BUTTON, BORDER_WIDTH, GuiGetStyle(SPINNER, BORDER_WIDTH));
|
|
2099
|
+
GuiSetStyle(BUTTON, TEXT_ALIGNMENT, GUI_TEXT_ALIGN_CENTER);
|
|
2100
|
+
|
|
2101
|
+
#if defined(RAYGUI_NO_RICONS)
|
|
2102
|
+
if (GuiButton(leftButtonBound, "<")) tempValue--;
|
|
2103
|
+
if (GuiButton(rightButtonBound, ">")) tempValue++;
|
|
2104
|
+
#else
|
|
2105
|
+
if (GuiButton(leftButtonBound, GuiIconText(RICON_ARROW_LEFT_FILL, NULL))) tempValue--;
|
|
2106
|
+
if (GuiButton(rightButtonBound, GuiIconText(RICON_ARROW_RIGHT_FILL, NULL))) tempValue++;
|
|
2107
|
+
#endif
|
|
2108
|
+
|
|
2109
|
+
GuiSetStyle(BUTTON, TEXT_ALIGNMENT, tempTextAlign);
|
|
2110
|
+
GuiSetStyle(BUTTON, BORDER_WIDTH, tempBorderWidth);
|
|
2111
|
+
|
|
2112
|
+
// Draw text label if provided
|
|
2113
|
+
GuiDrawText(text, textBounds, (GuiGetStyle(SPINNER, TEXT_ALIGNMENT) == GUI_TEXT_ALIGN_RIGHT)? GUI_TEXT_ALIGN_LEFT : GUI_TEXT_ALIGN_RIGHT, Fade(GetColor(GuiGetStyle(LABEL, TEXT + (state*3))), guiAlpha));
|
|
2114
|
+
//--------------------------------------------------------------------
|
|
2115
|
+
|
|
2116
|
+
*value = tempValue;
|
|
2117
|
+
return pressed;
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2120
|
+
// Value Box control, updates input text with numbers
|
|
2121
|
+
// NOTE: Requires static variables: frameCounter
|
|
2122
|
+
bool GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode)
|
|
2123
|
+
{
|
|
2124
|
+
#if !defined(VALUEBOX_MAX_CHARS)
|
|
2125
|
+
#define VALUEBOX_MAX_CHARS 32
|
|
2126
|
+
#endif
|
|
2127
|
+
|
|
2128
|
+
GuiControlState state = guiState;
|
|
2129
|
+
bool pressed = false;
|
|
2130
|
+
|
|
2131
|
+
char textValue[VALUEBOX_MAX_CHARS + 1] = "\0";
|
|
2132
|
+
sprintf(textValue, "%i", *value);
|
|
2133
|
+
|
|
2134
|
+
Rectangle textBounds = { 0 };
|
|
2135
|
+
if (text != NULL)
|
|
2136
|
+
{
|
|
2137
|
+
textBounds.width = (float)GetTextWidth(text);
|
|
2138
|
+
textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE);
|
|
2139
|
+
textBounds.x = bounds.x + bounds.width + GuiGetStyle(VALUEBOX, TEXT_PADDING);
|
|
2140
|
+
textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2;
|
|
2141
|
+
if (GuiGetStyle(VALUEBOX, TEXT_ALIGNMENT) == GUI_TEXT_ALIGN_LEFT) textBounds.x = bounds.x - textBounds.width - GuiGetStyle(VALUEBOX, TEXT_PADDING);
|
|
2142
|
+
}
|
|
2143
|
+
|
|
2144
|
+
// Update control
|
|
2145
|
+
//--------------------------------------------------------------------
|
|
2146
|
+
if ((state != GUI_STATE_DISABLED) && !guiLocked)
|
|
2147
|
+
{
|
|
2148
|
+
Vector2 mousePoint = GetMousePosition();
|
|
2149
|
+
|
|
2150
|
+
bool valueHasChanged = false;
|
|
2151
|
+
|
|
2152
|
+
if (editMode)
|
|
2153
|
+
{
|
|
2154
|
+
state = GUI_STATE_PRESSED;
|
|
2155
|
+
|
|
2156
|
+
int keyCount = (int)strlen(textValue);
|
|
2157
|
+
|
|
2158
|
+
// Only allow keys in range [48..57]
|
|
2159
|
+
if (keyCount < VALUEBOX_MAX_CHARS)
|
|
2160
|
+
{
|
|
2161
|
+
if (GetTextWidth(textValue) < bounds.width)
|
|
2162
|
+
{
|
|
2163
|
+
int key = GetCharPressed();
|
|
2164
|
+
if ((key >= 48) && (key <= 57))
|
|
2165
|
+
{
|
|
2166
|
+
textValue[keyCount] = (char)key;
|
|
2167
|
+
keyCount++;
|
|
2168
|
+
valueHasChanged = true;
|
|
2169
|
+
}
|
|
2170
|
+
}
|
|
2171
|
+
}
|
|
2172
|
+
|
|
2173
|
+
// Delete text
|
|
2174
|
+
if (keyCount > 0)
|
|
2175
|
+
{
|
|
2176
|
+
if (IsKeyPressed(KEY_BACKSPACE))
|
|
2177
|
+
{
|
|
2178
|
+
keyCount--;
|
|
2179
|
+
textValue[keyCount] = '\0';
|
|
2180
|
+
if (keyCount < 0) keyCount = 0;
|
|
2181
|
+
valueHasChanged = true;
|
|
2182
|
+
}
|
|
2183
|
+
}
|
|
2184
|
+
|
|
2185
|
+
if (valueHasChanged) *value = TextToInteger(textValue);
|
|
2186
|
+
|
|
2187
|
+
if (IsKeyPressed(KEY_ENTER) || (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) pressed = true;
|
|
2188
|
+
}
|
|
2189
|
+
else
|
|
2190
|
+
{
|
|
2191
|
+
if (*value > maxValue) *value = maxValue;
|
|
2192
|
+
else if (*value < minValue) *value = minValue;
|
|
2193
|
+
|
|
2194
|
+
if (CheckCollisionPointRec(mousePoint, bounds))
|
|
2195
|
+
{
|
|
2196
|
+
state = GUI_STATE_FOCUSED;
|
|
2197
|
+
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true;
|
|
2198
|
+
}
|
|
2199
|
+
}
|
|
2200
|
+
}
|
|
2201
|
+
//--------------------------------------------------------------------
|
|
2202
|
+
|
|
2203
|
+
// Draw control
|
|
2204
|
+
//--------------------------------------------------------------------
|
|
2205
|
+
Color baseColor = BLANK;
|
|
2206
|
+
if (state == GUI_STATE_PRESSED) baseColor = GetColor(GuiGetStyle(VALUEBOX, BASE_COLOR_PRESSED));
|
|
2207
|
+
else if (state == GUI_STATE_DISABLED) baseColor = GetColor(GuiGetStyle(VALUEBOX, BASE_COLOR_DISABLED));
|
|
2208
|
+
|
|
2209
|
+
// WARNING: BLANK color does not work properly with Fade()
|
|
2210
|
+
GuiDrawRectangle(bounds, GuiGetStyle(VALUEBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(VALUEBOX, BORDER + (state*3))), guiAlpha), baseColor);
|
|
2211
|
+
GuiDrawText(textValue, GetTextBounds(VALUEBOX, bounds), GUI_TEXT_ALIGN_CENTER, Fade(GetColor(GuiGetStyle(VALUEBOX, TEXT + (state*3))), guiAlpha));
|
|
2212
|
+
|
|
2213
|
+
// Draw cursor
|
|
2214
|
+
if (editMode)
|
|
2215
|
+
{
|
|
2216
|
+
// NOTE: ValueBox internal text is always centered
|
|
2217
|
+
Rectangle cursor = { bounds.x + GetTextWidth(textValue)/2 + bounds.width/2 + 2, bounds.y + 2*GuiGetStyle(VALUEBOX, BORDER_WIDTH), 4, bounds.height - 4*GuiGetStyle(VALUEBOX, BORDER_WIDTH) };
|
|
2218
|
+
GuiDrawRectangle(cursor, 0, BLANK, Fade(GetColor(GuiGetStyle(VALUEBOX, BORDER_COLOR_PRESSED)), guiAlpha));
|
|
2219
|
+
}
|
|
2220
|
+
|
|
2221
|
+
// Draw text label if provided
|
|
2222
|
+
GuiDrawText(text, textBounds, (GuiGetStyle(VALUEBOX, TEXT_ALIGNMENT) == GUI_TEXT_ALIGN_RIGHT)? GUI_TEXT_ALIGN_LEFT : GUI_TEXT_ALIGN_RIGHT, Fade(GetColor(GuiGetStyle(LABEL, TEXT + (state*3))), guiAlpha));
|
|
2223
|
+
//--------------------------------------------------------------------
|
|
2224
|
+
|
|
2225
|
+
return pressed;
|
|
2226
|
+
}
|
|
2227
|
+
|
|
2228
|
+
// Text Box control with multiple lines
|
|
2229
|
+
bool GuiTextBoxMulti(Rectangle bounds, char *text, int textSize, bool editMode)
|
|
2230
|
+
{
|
|
2231
|
+
GuiControlState state = guiState;
|
|
2232
|
+
bool pressed = false;
|
|
2233
|
+
|
|
2234
|
+
Rectangle textAreaBounds = {
|
|
2235
|
+
bounds.x + GuiGetStyle(TEXTBOX, BORDER_WIDTH) + GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING),
|
|
2236
|
+
bounds.y + GuiGetStyle(TEXTBOX, BORDER_WIDTH) + GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING),
|
|
2237
|
+
bounds.width - 2*(GuiGetStyle(TEXTBOX, BORDER_WIDTH) + GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING)),
|
|
2238
|
+
bounds.height - 2*(GuiGetStyle(TEXTBOX, BORDER_WIDTH) + GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING))
|
|
2239
|
+
};
|
|
2240
|
+
|
|
2241
|
+
// Cursor position, [x, y] values should be updated
|
|
2242
|
+
Rectangle cursor = { 0, -1, 4, (float)GuiGetStyle(DEFAULT, TEXT_SIZE) + 2 };
|
|
2243
|
+
|
|
2244
|
+
float scaleFactor = (float)GuiGetStyle(DEFAULT, TEXT_SIZE)/(float)guiFont.baseSize; // Character rectangle scaling factor
|
|
2245
|
+
|
|
2246
|
+
// Update control
|
|
2247
|
+
//--------------------------------------------------------------------
|
|
2248
|
+
if ((state != GUI_STATE_DISABLED) && !guiLocked)
|
|
2249
|
+
{
|
|
2250
|
+
Vector2 mousePoint = GetMousePosition();
|
|
2251
|
+
|
|
2252
|
+
if (editMode)
|
|
2253
|
+
{
|
|
2254
|
+
state = GUI_STATE_PRESSED;
|
|
2255
|
+
|
|
2256
|
+
// We get an Unicode codepoint
|
|
2257
|
+
int codepoint = GetCharPressed();
|
|
2258
|
+
int textLength = (int)strlen(text); // Length in bytes (UTF-8 string)
|
|
2259
|
+
|
|
2260
|
+
// Introduce characters
|
|
2261
|
+
if (textLength < (textSize - 1))
|
|
2262
|
+
{
|
|
2263
|
+
if (IsKeyPressed(KEY_ENTER))
|
|
2264
|
+
{
|
|
2265
|
+
text[textLength] = '\n';
|
|
2266
|
+
textLength++;
|
|
2267
|
+
}
|
|
2268
|
+
else if (codepoint >= 32)
|
|
2269
|
+
{
|
|
2270
|
+
// Supports Unicode inputs -> Encoded to UTF-8
|
|
2271
|
+
int charUTF8Length = 0;
|
|
2272
|
+
const char *charEncoded = CodepointToUTF8(codepoint, &charUTF8Length);
|
|
2273
|
+
memcpy(text + textLength, charEncoded, charUTF8Length);
|
|
2274
|
+
textLength += charUTF8Length;
|
|
2275
|
+
}
|
|
2276
|
+
}
|
|
2277
|
+
|
|
2278
|
+
// Delete characters
|
|
2279
|
+
if (textLength > 0)
|
|
2280
|
+
{
|
|
2281
|
+
if (IsKeyPressed(KEY_BACKSPACE))
|
|
2282
|
+
{
|
|
2283
|
+
if ((unsigned char)text[textLength - 1] < 127)
|
|
2284
|
+
{
|
|
2285
|
+
// Remove ASCII equivalent character (1 byte)
|
|
2286
|
+
textLength--;
|
|
2287
|
+
text[textLength] = '\0';
|
|
2288
|
+
}
|
|
2289
|
+
else
|
|
2290
|
+
{
|
|
2291
|
+
// Remove latest UTF-8 unicode character introduced (n bytes)
|
|
2292
|
+
int charUTF8Length = 0;
|
|
2293
|
+
while (((unsigned char)text[textLength - 1 - charUTF8Length] & 0b01000000) == 0) charUTF8Length++;
|
|
2294
|
+
|
|
2295
|
+
textLength -= (charUTF8Length + 1);
|
|
2296
|
+
text[textLength] = '\0';
|
|
2297
|
+
}
|
|
2298
|
+
}
|
|
2299
|
+
}
|
|
2300
|
+
|
|
2301
|
+
// Exit edit mode
|
|
2302
|
+
if (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true;
|
|
2303
|
+
}
|
|
2304
|
+
else
|
|
2305
|
+
{
|
|
2306
|
+
if (CheckCollisionPointRec(mousePoint, bounds))
|
|
2307
|
+
{
|
|
2308
|
+
state = GUI_STATE_FOCUSED;
|
|
2309
|
+
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true;
|
|
2310
|
+
}
|
|
2311
|
+
}
|
|
2312
|
+
}
|
|
2313
|
+
//--------------------------------------------------------------------
|
|
2314
|
+
|
|
2315
|
+
// Draw control
|
|
2316
|
+
//--------------------------------------------------------------------
|
|
2317
|
+
if (state == GUI_STATE_PRESSED)
|
|
2318
|
+
{
|
|
2319
|
+
GuiDrawRectangle(bounds, GuiGetStyle(TEXTBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), guiAlpha), Fade(GetColor(GuiGetStyle(TEXTBOX, BASE_COLOR_PRESSED)), guiAlpha));
|
|
2320
|
+
}
|
|
2321
|
+
else if (state == GUI_STATE_DISABLED)
|
|
2322
|
+
{
|
|
2323
|
+
GuiDrawRectangle(bounds, GuiGetStyle(TEXTBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), guiAlpha), Fade(GetColor(GuiGetStyle(TEXTBOX, BASE_COLOR_DISABLED)), guiAlpha));
|
|
2324
|
+
}
|
|
2325
|
+
else GuiDrawRectangle(bounds, 1, Fade(GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), guiAlpha), BLANK);
|
|
2326
|
+
|
|
2327
|
+
int wrapMode = 1; // 0-No wrap, 1-Char wrap, 2-Word wrap
|
|
2328
|
+
Vector2 cursorPos = { textAreaBounds.x, textAreaBounds.y };
|
|
2329
|
+
|
|
2330
|
+
//int lastSpacePos = 0;
|
|
2331
|
+
//int lastSpaceWidth = 0;
|
|
2332
|
+
//int lastSpaceCursorPos = 0;
|
|
2333
|
+
|
|
2334
|
+
for (int i = 0, codepointLength = 0; text[i] != '\0'; i += codepointLength)
|
|
2335
|
+
{
|
|
2336
|
+
int codepoint = GetCodepoint(text + i, &codepointLength);
|
|
2337
|
+
int index = GetGlyphIndex(guiFont, codepoint); // If requested codepoint is not found, we get '?' (0x3f)
|
|
2338
|
+
Rectangle atlasRec = guiFont.recs[index];
|
|
2339
|
+
GlyphInfo glyphInfo = guiFont.glyphs[index]; // Glyph measures
|
|
2340
|
+
|
|
2341
|
+
if ((codepointLength == 1) && (codepoint == '\n'))
|
|
2342
|
+
{
|
|
2343
|
+
cursorPos.y += (guiFont.baseSize*scaleFactor + GuiGetStyle(TEXTBOX, TEXT_LINES_PADDING)); // Line feed
|
|
2344
|
+
cursorPos.x = textAreaBounds.x; // Carriage return
|
|
2345
|
+
}
|
|
2346
|
+
else
|
|
2347
|
+
{
|
|
2348
|
+
if (wrapMode == 1)
|
|
2349
|
+
{
|
|
2350
|
+
int glyphWidth = 0;
|
|
2351
|
+
if (glyphInfo.advanceX != 0) glyphWidth += glyphInfo.advanceX;
|
|
2352
|
+
else glyphWidth += (atlasRec.width + glyphInfo.offsetX);
|
|
2353
|
+
|
|
2354
|
+
// Jump line if the end of the text box area has been reached
|
|
2355
|
+
if ((cursorPos.x + (glyphWidth*scaleFactor)) > (textAreaBounds.x + textAreaBounds.width))
|
|
2356
|
+
{
|
|
2357
|
+
cursorPos.y += (guiFont.baseSize*scaleFactor + GuiGetStyle(TEXTBOX, TEXT_LINES_PADDING)); // Line feed
|
|
2358
|
+
cursorPos.x = textAreaBounds.x; // Carriage return
|
|
2359
|
+
}
|
|
2360
|
+
}
|
|
2361
|
+
else if (wrapMode == 2)
|
|
2362
|
+
{
|
|
2363
|
+
/*
|
|
2364
|
+
if ((codepointLength == 1) && (codepoint == ' '))
|
|
2365
|
+
{
|
|
2366
|
+
lastSpacePos = i;
|
|
2367
|
+
lastSpaceWidth = 0;
|
|
2368
|
+
lastSpaceCursorPos = cursorPos.x;
|
|
2369
|
+
}
|
|
2370
|
+
|
|
2371
|
+
// Jump line if last word reaches end of text box area
|
|
2372
|
+
if ((lastSpaceCursorPos + lastSpaceWidth) > (textAreaBounds.x + textAreaBounds.width))
|
|
2373
|
+
{
|
|
2374
|
+
cursorPos.y += 12; // Line feed
|
|
2375
|
+
cursorPos.x = textAreaBounds.x; // Carriage return
|
|
2376
|
+
}
|
|
2377
|
+
*/
|
|
2378
|
+
}
|
|
2379
|
+
|
|
2380
|
+
// Draw current character glyph
|
|
2381
|
+
DrawTextCodepoint(guiFont, codepoint, cursorPos, (float)GuiGetStyle(DEFAULT, TEXT_SIZE), Fade(GetColor(GuiGetStyle(TEXTBOX, TEXT + (state*3))), guiAlpha));
|
|
2382
|
+
|
|
2383
|
+
int glyphWidth = 0;
|
|
2384
|
+
if (glyphInfo.advanceX != 0) glyphWidth += glyphInfo.advanceX;
|
|
2385
|
+
else glyphWidth += (atlasRec.width + glyphInfo.offsetX);
|
|
2386
|
+
|
|
2387
|
+
cursorPos.x += (glyphWidth*scaleFactor + (float)GuiGetStyle(DEFAULT, TEXT_SPACING));
|
|
2388
|
+
//if (i > lastSpacePos) lastSpaceWidth += (atlasRec.width + (float)GuiGetStyle(DEFAULT, TEXT_SPACING));
|
|
2389
|
+
}
|
|
2390
|
+
}
|
|
2391
|
+
|
|
2392
|
+
cursor.x = cursorPos.x;
|
|
2393
|
+
cursor.y = cursorPos.y;
|
|
2394
|
+
|
|
2395
|
+
// Draw cursor position considering text glyphs
|
|
2396
|
+
if (editMode) GuiDrawRectangle(cursor, 0, BLANK, Fade(GetColor(GuiGetStyle(TEXTBOX, BORDER_COLOR_PRESSED)), guiAlpha));
|
|
2397
|
+
//--------------------------------------------------------------------
|
|
2398
|
+
|
|
2399
|
+
return pressed;
|
|
2400
|
+
}
|
|
2401
|
+
|
|
2402
|
+
// Slider control with pro parameters
|
|
2403
|
+
// NOTE: Other GuiSlider*() controls use this one
|
|
2404
|
+
float GuiSliderPro(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue, int sliderWidth)
|
|
2405
|
+
{
|
|
2406
|
+
GuiControlState state = guiState;
|
|
2407
|
+
|
|
2408
|
+
int sliderValue = (int)(((value - minValue)/(maxValue - minValue))*(bounds.width - 2*GuiGetStyle(SLIDER, BORDER_WIDTH)));
|
|
2409
|
+
|
|
2410
|
+
Rectangle slider = { bounds.x, bounds.y + GuiGetStyle(SLIDER, BORDER_WIDTH) + GuiGetStyle(SLIDER, SLIDER_PADDING),
|
|
2411
|
+
0, bounds.height - 2*GuiGetStyle(SLIDER, BORDER_WIDTH) - 2*GuiGetStyle(SLIDER, SLIDER_PADDING) };
|
|
2412
|
+
|
|
2413
|
+
if (sliderWidth > 0) // Slider
|
|
2414
|
+
{
|
|
2415
|
+
slider.x += (sliderValue - sliderWidth/2);
|
|
2416
|
+
slider.width = (float)sliderWidth;
|
|
2417
|
+
}
|
|
2418
|
+
else if (sliderWidth == 0) // SliderBar
|
|
2419
|
+
{
|
|
2420
|
+
slider.x += GuiGetStyle(SLIDER, BORDER_WIDTH);
|
|
2421
|
+
slider.width = (float)sliderValue;
|
|
2422
|
+
}
|
|
2423
|
+
|
|
2424
|
+
// Update control
|
|
2425
|
+
//--------------------------------------------------------------------
|
|
2426
|
+
if ((state != GUI_STATE_DISABLED) && !guiLocked)
|
|
2427
|
+
{
|
|
2428
|
+
Vector2 mousePoint = GetMousePosition();
|
|
2429
|
+
|
|
2430
|
+
if (CheckCollisionPointRec(mousePoint, bounds))
|
|
2431
|
+
{
|
|
2432
|
+
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON))
|
|
2433
|
+
{
|
|
2434
|
+
state = GUI_STATE_PRESSED;
|
|
2435
|
+
|
|
2436
|
+
// Get equivalent value and slider position from mousePoint.x
|
|
2437
|
+
value = ((maxValue - minValue)*(mousePoint.x - (float)(bounds.x + sliderWidth/2)))/(float)(bounds.width - sliderWidth) + minValue;
|
|
2438
|
+
|
|
2439
|
+
if (sliderWidth > 0) slider.x = mousePoint.x - slider.width/2; // Slider
|
|
2440
|
+
else if (sliderWidth == 0) slider.width = (float)sliderValue; // SliderBar
|
|
2441
|
+
}
|
|
2442
|
+
else state = GUI_STATE_FOCUSED;
|
|
2443
|
+
}
|
|
2444
|
+
|
|
2445
|
+
if (value > maxValue) value = maxValue;
|
|
2446
|
+
else if (value < minValue) value = minValue;
|
|
2447
|
+
}
|
|
2448
|
+
|
|
2449
|
+
// Bar limits check
|
|
2450
|
+
if (sliderWidth > 0) // Slider
|
|
2451
|
+
{
|
|
2452
|
+
if (slider.x <= (bounds.x + GuiGetStyle(SLIDER, BORDER_WIDTH))) slider.x = bounds.x + GuiGetStyle(SLIDER, BORDER_WIDTH);
|
|
2453
|
+
else if ((slider.x + slider.width) >= (bounds.x + bounds.width)) slider.x = bounds.x + bounds.width - slider.width - GuiGetStyle(SLIDER, BORDER_WIDTH);
|
|
2454
|
+
}
|
|
2455
|
+
else if (sliderWidth == 0) // SliderBar
|
|
2456
|
+
{
|
|
2457
|
+
if (slider.width > bounds.width) slider.width = bounds.width - 2*GuiGetStyle(SLIDER, BORDER_WIDTH);
|
|
2458
|
+
}
|
|
2459
|
+
//--------------------------------------------------------------------
|
|
2460
|
+
|
|
2461
|
+
// Draw control
|
|
2462
|
+
//--------------------------------------------------------------------
|
|
2463
|
+
GuiDrawRectangle(bounds, GuiGetStyle(SLIDER, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(SLIDER, BORDER + (state*3))), guiAlpha), Fade(GetColor(GuiGetStyle(SLIDER, (state != GUI_STATE_DISABLED)? BASE_COLOR_NORMAL : BASE_COLOR_DISABLED)), guiAlpha));
|
|
2464
|
+
|
|
2465
|
+
// Draw slider internal bar (depends on state)
|
|
2466
|
+
if ((state == GUI_STATE_NORMAL) || (state == GUI_STATE_PRESSED)) GuiDrawRectangle(slider, 0, BLANK, Fade(GetColor(GuiGetStyle(SLIDER, BASE_COLOR_PRESSED)), guiAlpha));
|
|
2467
|
+
else if (state == GUI_STATE_FOCUSED) GuiDrawRectangle(slider, 0, BLANK, Fade(GetColor(GuiGetStyle(SLIDER, TEXT_COLOR_FOCUSED)), guiAlpha));
|
|
2468
|
+
|
|
2469
|
+
// Draw left/right text if provided
|
|
2470
|
+
if (textLeft != NULL)
|
|
2471
|
+
{
|
|
2472
|
+
Rectangle textBounds = { 0 };
|
|
2473
|
+
textBounds.width = (float)GetTextWidth(textLeft);
|
|
2474
|
+
textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE);
|
|
2475
|
+
textBounds.x = bounds.x - textBounds.width - GuiGetStyle(SLIDER, TEXT_PADDING);
|
|
2476
|
+
textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2;
|
|
2477
|
+
|
|
2478
|
+
GuiDrawText(textLeft, textBounds, GUI_TEXT_ALIGN_RIGHT, Fade(GetColor(GuiGetStyle(SLIDER, TEXT + (state*3))), guiAlpha));
|
|
2479
|
+
}
|
|
2480
|
+
|
|
2481
|
+
if (textRight != NULL)
|
|
2482
|
+
{
|
|
2483
|
+
Rectangle textBounds = { 0 };
|
|
2484
|
+
textBounds.width = (float)GetTextWidth(textRight);
|
|
2485
|
+
textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE);
|
|
2486
|
+
textBounds.x = bounds.x + bounds.width + GuiGetStyle(SLIDER, TEXT_PADDING);
|
|
2487
|
+
textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2;
|
|
2488
|
+
|
|
2489
|
+
GuiDrawText(textRight, textBounds, GUI_TEXT_ALIGN_LEFT, Fade(GetColor(GuiGetStyle(SLIDER, TEXT + (state*3))), guiAlpha));
|
|
2490
|
+
}
|
|
2491
|
+
//--------------------------------------------------------------------
|
|
2492
|
+
|
|
2493
|
+
return value;
|
|
2494
|
+
}
|
|
2495
|
+
|
|
2496
|
+
// Slider control extended, returns selected value and has text
|
|
2497
|
+
float GuiSlider(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue)
|
|
2498
|
+
{
|
|
2499
|
+
return GuiSliderPro(bounds, textLeft, textRight, value, minValue, maxValue, GuiGetStyle(SLIDER, SLIDER_WIDTH));
|
|
2500
|
+
}
|
|
2501
|
+
|
|
2502
|
+
// Slider Bar control extended, returns selected value
|
|
2503
|
+
float GuiSliderBar(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue)
|
|
2504
|
+
{
|
|
2505
|
+
return GuiSliderPro(bounds, textLeft, textRight, value, minValue, maxValue, 0);
|
|
2506
|
+
}
|
|
2507
|
+
|
|
2508
|
+
// Progress Bar control extended, shows current progress value
|
|
2509
|
+
float GuiProgressBar(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue)
|
|
2510
|
+
{
|
|
2511
|
+
GuiControlState state = guiState;
|
|
2512
|
+
|
|
2513
|
+
Rectangle progress = { bounds.x + GuiGetStyle(PROGRESSBAR, BORDER_WIDTH),
|
|
2514
|
+
bounds.y + GuiGetStyle(PROGRESSBAR, BORDER_WIDTH) + GuiGetStyle(PROGRESSBAR, PROGRESS_PADDING), 0,
|
|
2515
|
+
bounds.height - 2*GuiGetStyle(PROGRESSBAR, BORDER_WIDTH) - 2*GuiGetStyle(PROGRESSBAR, PROGRESS_PADDING) };
|
|
2516
|
+
|
|
2517
|
+
// Update control
|
|
2518
|
+
//--------------------------------------------------------------------
|
|
2519
|
+
if (state != GUI_STATE_DISABLED) progress.width = ((float)(value/(maxValue - minValue))*(float)(bounds.width - 2*GuiGetStyle(PROGRESSBAR, BORDER_WIDTH)));
|
|
2520
|
+
//--------------------------------------------------------------------
|
|
2521
|
+
|
|
2522
|
+
// Draw control
|
|
2523
|
+
//--------------------------------------------------------------------
|
|
2524
|
+
GuiDrawRectangle(bounds, GuiGetStyle(PROGRESSBAR, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(PROGRESSBAR, BORDER + (state*3))), guiAlpha), BLANK);
|
|
2525
|
+
|
|
2526
|
+
// Draw slider internal progress bar (depends on state)
|
|
2527
|
+
if ((state == GUI_STATE_NORMAL) || (state == GUI_STATE_PRESSED)) GuiDrawRectangle(progress, 0, BLANK, Fade(GetColor(GuiGetStyle(PROGRESSBAR, BASE_COLOR_PRESSED)), guiAlpha));
|
|
2528
|
+
else if (state == GUI_STATE_FOCUSED) GuiDrawRectangle(progress, 0, BLANK, Fade(GetColor(GuiGetStyle(PROGRESSBAR, TEXT_COLOR_FOCUSED)), guiAlpha));
|
|
2529
|
+
|
|
2530
|
+
// Draw left/right text if provided
|
|
2531
|
+
if (textLeft != NULL)
|
|
2532
|
+
{
|
|
2533
|
+
Rectangle textBounds = { 0 };
|
|
2534
|
+
textBounds.width = (float)GetTextWidth(textLeft);
|
|
2535
|
+
textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE);
|
|
2536
|
+
textBounds.x = bounds.x - textBounds.width - GuiGetStyle(PROGRESSBAR, TEXT_PADDING);
|
|
2537
|
+
textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2;
|
|
2538
|
+
|
|
2539
|
+
GuiDrawText(textLeft, textBounds, GUI_TEXT_ALIGN_RIGHT, Fade(GetColor(GuiGetStyle(PROGRESSBAR, TEXT + (state*3))), guiAlpha));
|
|
2540
|
+
}
|
|
2541
|
+
|
|
2542
|
+
if (textRight != NULL)
|
|
2543
|
+
{
|
|
2544
|
+
Rectangle textBounds = { 0 };
|
|
2545
|
+
textBounds.width = (float)GetTextWidth(textRight);
|
|
2546
|
+
textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE);
|
|
2547
|
+
textBounds.x = bounds.x + bounds.width + GuiGetStyle(PROGRESSBAR, TEXT_PADDING);
|
|
2548
|
+
textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2;
|
|
2549
|
+
|
|
2550
|
+
GuiDrawText(textRight, textBounds, GUI_TEXT_ALIGN_LEFT, Fade(GetColor(GuiGetStyle(PROGRESSBAR, TEXT + (state*3))), guiAlpha));
|
|
2551
|
+
}
|
|
2552
|
+
//--------------------------------------------------------------------
|
|
2553
|
+
|
|
2554
|
+
return value;
|
|
2555
|
+
}
|
|
2556
|
+
|
|
2557
|
+
// Status Bar control
|
|
2558
|
+
void GuiStatusBar(Rectangle bounds, const char *text)
|
|
2559
|
+
{
|
|
2560
|
+
GuiControlState state = guiState;
|
|
2561
|
+
|
|
2562
|
+
// Draw control
|
|
2563
|
+
//--------------------------------------------------------------------
|
|
2564
|
+
GuiDrawRectangle(bounds, GuiGetStyle(STATUSBAR, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(STATUSBAR, (state != GUI_STATE_DISABLED)? BORDER_COLOR_NORMAL : BORDER_COLOR_DISABLED)), guiAlpha),
|
|
2565
|
+
Fade(GetColor(GuiGetStyle(STATUSBAR, (state != GUI_STATE_DISABLED)? BASE_COLOR_NORMAL : BASE_COLOR_DISABLED)), guiAlpha));
|
|
2566
|
+
GuiDrawText(text, GetTextBounds(STATUSBAR, bounds), GuiGetStyle(STATUSBAR, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(STATUSBAR, (state != GUI_STATE_DISABLED)? TEXT_COLOR_NORMAL : TEXT_COLOR_DISABLED)), guiAlpha));
|
|
2567
|
+
//--------------------------------------------------------------------
|
|
2568
|
+
}
|
|
2569
|
+
|
|
2570
|
+
// Dummy rectangle control, intended for placeholding
|
|
2571
|
+
void GuiDummyRec(Rectangle bounds, const char *text)
|
|
2572
|
+
{
|
|
2573
|
+
GuiControlState state = guiState;
|
|
2574
|
+
|
|
2575
|
+
// Update control
|
|
2576
|
+
//--------------------------------------------------------------------
|
|
2577
|
+
if ((state != GUI_STATE_DISABLED) && !guiLocked)
|
|
2578
|
+
{
|
|
2579
|
+
Vector2 mousePoint = GetMousePosition();
|
|
2580
|
+
|
|
2581
|
+
// Check button state
|
|
2582
|
+
if (CheckCollisionPointRec(mousePoint, bounds))
|
|
2583
|
+
{
|
|
2584
|
+
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = GUI_STATE_PRESSED;
|
|
2585
|
+
else state = GUI_STATE_FOCUSED;
|
|
2586
|
+
}
|
|
2587
|
+
}
|
|
2588
|
+
//--------------------------------------------------------------------
|
|
2589
|
+
|
|
2590
|
+
// Draw control
|
|
2591
|
+
//--------------------------------------------------------------------
|
|
2592
|
+
GuiDrawRectangle(bounds, 0, BLANK, Fade(GetColor(GuiGetStyle(DEFAULT, (state != GUI_STATE_DISABLED)? BASE_COLOR_NORMAL : BASE_COLOR_DISABLED)), guiAlpha));
|
|
2593
|
+
GuiDrawText(text, GetTextBounds(DEFAULT, bounds), GUI_TEXT_ALIGN_CENTER, Fade(GetColor(GuiGetStyle(BUTTON, (state != GUI_STATE_DISABLED)? TEXT_COLOR_NORMAL : TEXT_COLOR_DISABLED)), guiAlpha));
|
|
2594
|
+
//------------------------------------------------------------------
|
|
2595
|
+
}
|
|
2596
|
+
|
|
2597
|
+
// Scroll Bar control
|
|
2598
|
+
int GuiScrollBar(Rectangle bounds, int value, int minValue, int maxValue)
|
|
2599
|
+
{
|
|
2600
|
+
GuiControlState state = guiState;
|
|
2601
|
+
|
|
2602
|
+
// Is the scrollbar horizontal or vertical?
|
|
2603
|
+
bool isVertical = (bounds.width > bounds.height)? false : true;
|
|
2604
|
+
|
|
2605
|
+
// The size (width or height depending on scrollbar type) of the spinner buttons
|
|
2606
|
+
const int spinnerSize = GuiGetStyle(SCROLLBAR, ARROWS_VISIBLE)? (isVertical? (int)bounds.width - 2*GuiGetStyle(SCROLLBAR, BORDER_WIDTH) : (int)bounds.height - 2*GuiGetStyle(SCROLLBAR, BORDER_WIDTH)) : 0;
|
|
2607
|
+
|
|
2608
|
+
// Arrow buttons [<] [>] [∧] [∨]
|
|
2609
|
+
Rectangle arrowUpLeft = { 0 };
|
|
2610
|
+
Rectangle arrowDownRight = { 0 };
|
|
2611
|
+
|
|
2612
|
+
// Actual area of the scrollbar excluding the arrow buttons
|
|
2613
|
+
Rectangle scrollbar = { 0 };
|
|
2614
|
+
|
|
2615
|
+
// Slider bar that moves --[///]-----
|
|
2616
|
+
Rectangle slider = { 0 };
|
|
2617
|
+
|
|
2618
|
+
// Normalize value
|
|
2619
|
+
if (value > maxValue) value = maxValue;
|
|
2620
|
+
if (value < minValue) value = minValue;
|
|
2621
|
+
|
|
2622
|
+
const int range = maxValue - minValue;
|
|
2623
|
+
int sliderSize = GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE);
|
|
2624
|
+
|
|
2625
|
+
// Calculate rectangles for all of the components
|
|
2626
|
+
arrowUpLeft = RAYGUI_CLITERAL(Rectangle){ (float)bounds.x + GuiGetStyle(SCROLLBAR, BORDER_WIDTH), (float)bounds.y + GuiGetStyle(SCROLLBAR, BORDER_WIDTH), (float)spinnerSize, (float)spinnerSize };
|
|
2627
|
+
|
|
2628
|
+
if (isVertical)
|
|
2629
|
+
{
|
|
2630
|
+
arrowDownRight = RAYGUI_CLITERAL(Rectangle){ (float)bounds.x + GuiGetStyle(SCROLLBAR, BORDER_WIDTH), (float)bounds.y + bounds.height - spinnerSize - GuiGetStyle(SCROLLBAR, BORDER_WIDTH), (float)spinnerSize, (float)spinnerSize};
|
|
2631
|
+
scrollbar = RAYGUI_CLITERAL(Rectangle){ bounds.x + GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_PADDING), arrowUpLeft.y + arrowUpLeft.height, bounds.width - 2*(GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_PADDING)), bounds.height - arrowUpLeft.height - arrowDownRight.height - 2*GuiGetStyle(SCROLLBAR, BORDER_WIDTH) };
|
|
2632
|
+
sliderSize = (sliderSize >= scrollbar.height)? ((int)scrollbar.height - 2) : sliderSize; // Make sure the slider won't get outside of the scrollbar
|
|
2633
|
+
slider = RAYGUI_CLITERAL(Rectangle){ (float)bounds.x + GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_PADDING), (float)scrollbar.y + (int)(((float)(value - minValue)/range)*(scrollbar.height - sliderSize)), (float)bounds.width - 2*(GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_PADDING)), (float)sliderSize };
|
|
2634
|
+
}
|
|
2635
|
+
else
|
|
2636
|
+
{
|
|
2637
|
+
arrowDownRight = RAYGUI_CLITERAL(Rectangle){ (float)bounds.x + bounds.width - spinnerSize - GuiGetStyle(SCROLLBAR, BORDER_WIDTH), (float)bounds.y + GuiGetStyle(SCROLLBAR, BORDER_WIDTH), (float)spinnerSize, (float)spinnerSize};
|
|
2638
|
+
scrollbar = RAYGUI_CLITERAL(Rectangle){ arrowUpLeft.x + arrowUpLeft.width, bounds.y + GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_PADDING), bounds.width - arrowUpLeft.width - arrowDownRight.width - 2*GuiGetStyle(SCROLLBAR, BORDER_WIDTH), bounds.height - 2*(GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_PADDING))};
|
|
2639
|
+
sliderSize = (sliderSize >= scrollbar.width)? ((int)scrollbar.width - 2) : sliderSize; // Make sure the slider won't get outside of the scrollbar
|
|
2640
|
+
slider = RAYGUI_CLITERAL(Rectangle){ (float)scrollbar.x + (int)(((float)(value - minValue)/range)*(scrollbar.width - sliderSize)), (float)bounds.y + GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_PADDING), (float)sliderSize, (float)bounds.height - 2*(GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_PADDING)) };
|
|
2641
|
+
}
|
|
2642
|
+
|
|
2643
|
+
// Update control
|
|
2644
|
+
//--------------------------------------------------------------------
|
|
2645
|
+
if ((state != GUI_STATE_DISABLED) && !guiLocked)
|
|
2646
|
+
{
|
|
2647
|
+
Vector2 mousePoint = GetMousePosition();
|
|
2648
|
+
|
|
2649
|
+
if (CheckCollisionPointRec(mousePoint, bounds))
|
|
2650
|
+
{
|
|
2651
|
+
state = GUI_STATE_FOCUSED;
|
|
2652
|
+
|
|
2653
|
+
// Handle mouse wheel
|
|
2654
|
+
int wheel = (int)GetMouseWheelMove();
|
|
2655
|
+
if (wheel != 0) value += wheel;
|
|
2656
|
+
|
|
2657
|
+
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
|
|
2658
|
+
{
|
|
2659
|
+
if (CheckCollisionPointRec(mousePoint, arrowUpLeft)) value -= range/GuiGetStyle(SCROLLBAR, SCROLL_SPEED);
|
|
2660
|
+
else if (CheckCollisionPointRec(mousePoint, arrowDownRight)) value += range/GuiGetStyle(SCROLLBAR, SCROLL_SPEED);
|
|
2661
|
+
|
|
2662
|
+
state = GUI_STATE_PRESSED;
|
|
2663
|
+
}
|
|
2664
|
+
else if (IsMouseButtonDown(MOUSE_LEFT_BUTTON))
|
|
2665
|
+
{
|
|
2666
|
+
if (!isVertical)
|
|
2667
|
+
{
|
|
2668
|
+
Rectangle scrollArea = { arrowUpLeft.x + arrowUpLeft.width, arrowUpLeft.y, scrollbar.width, bounds.height - 2*GuiGetStyle(SCROLLBAR, BORDER_WIDTH)};
|
|
2669
|
+
if (CheckCollisionPointRec(mousePoint, scrollArea)) value = (int)(((float)(mousePoint.x - scrollArea.x - slider.width/2)*range)/(scrollArea.width - slider.width) + minValue);
|
|
2670
|
+
}
|
|
2671
|
+
else
|
|
2672
|
+
{
|
|
2673
|
+
Rectangle scrollArea = { arrowUpLeft.x, arrowUpLeft.y+arrowUpLeft.height, bounds.width - 2*GuiGetStyle(SCROLLBAR, BORDER_WIDTH), scrollbar.height};
|
|
2674
|
+
if (CheckCollisionPointRec(mousePoint, scrollArea)) value = (int)(((float)(mousePoint.y - scrollArea.y - slider.height/2)*range)/(scrollArea.height - slider.height) + minValue);
|
|
2675
|
+
}
|
|
2676
|
+
}
|
|
2677
|
+
}
|
|
2678
|
+
|
|
2679
|
+
// Normalize value
|
|
2680
|
+
if (value > maxValue) value = maxValue;
|
|
2681
|
+
if (value < minValue) value = minValue;
|
|
2682
|
+
}
|
|
2683
|
+
//--------------------------------------------------------------------
|
|
2684
|
+
|
|
2685
|
+
// Draw control
|
|
2686
|
+
//--------------------------------------------------------------------
|
|
2687
|
+
GuiDrawRectangle(bounds, GuiGetStyle(SCROLLBAR, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(LISTVIEW, BORDER + state*3)), guiAlpha), Fade(GetColor(GuiGetStyle(DEFAULT, BORDER_COLOR_DISABLED)), guiAlpha)); // Draw the background
|
|
2688
|
+
|
|
2689
|
+
GuiDrawRectangle(scrollbar, 0, BLANK, Fade(GetColor(GuiGetStyle(BUTTON, BASE_COLOR_NORMAL)), guiAlpha)); // Draw the scrollbar active area background
|
|
2690
|
+
GuiDrawRectangle(slider, 0, BLANK, Fade(GetColor(GuiGetStyle(SLIDER, BORDER + state*3)), guiAlpha)); // Draw the slider bar
|
|
2691
|
+
|
|
2692
|
+
// Draw arrows (using icon if available)
|
|
2693
|
+
if (GuiGetStyle(SCROLLBAR, ARROWS_VISIBLE))
|
|
2694
|
+
{
|
|
2695
|
+
#if defined(RAYGUI_NO_RICONS)
|
|
2696
|
+
GuiDrawText(isVertical? "^" : "<", RAYGUI_CLITERAL(Rectangle){ arrowUpLeft.x, arrowUpLeft.y, isVertical? bounds.width : bounds.height, isVertical? bounds.width : bounds.height },
|
|
2697
|
+
GUI_TEXT_ALIGN_CENTER, Fade(GetColor(GuiGetStyle(DROPDOWNBOX, TEXT + (state*3))), guiAlpha));
|
|
2698
|
+
GuiDrawText(isVertical? "v" : ">", RAYGUI_CLITERAL(Rectangle){ arrowDownRight.x, arrowDownRight.y, isVertical? bounds.width : bounds.height, isVertical? bounds.width : bounds.height },
|
|
2699
|
+
GUI_TEXT_ALIGN_CENTER, Fade(GetColor(GuiGetStyle(DROPDOWNBOX, TEXT + (state*3))), guiAlpha));
|
|
2700
|
+
#else
|
|
2701
|
+
GuiDrawText(isVertical? "#121#" : "#118#", RAYGUI_CLITERAL(Rectangle){ arrowUpLeft.x, arrowUpLeft.y, isVertical? bounds.width : bounds.height, isVertical? bounds.width : bounds.height },
|
|
2702
|
+
GUI_TEXT_ALIGN_CENTER, Fade(GetColor(GuiGetStyle(SCROLLBAR, TEXT + state*3)), guiAlpha)); // RICON_ARROW_UP_FILL / RICON_ARROW_LEFT_FILL
|
|
2703
|
+
GuiDrawText(isVertical? "#120#" : "#119#", RAYGUI_CLITERAL(Rectangle){ arrowDownRight.x, arrowDownRight.y, isVertical? bounds.width : bounds.height, isVertical? bounds.width : bounds.height },
|
|
2704
|
+
GUI_TEXT_ALIGN_CENTER, Fade(GetColor(GuiGetStyle(SCROLLBAR, TEXT + state*3)), guiAlpha)); // RICON_ARROW_DOWN_FILL / RICON_ARROW_RIGHT_FILL
|
|
2705
|
+
#endif
|
|
2706
|
+
}
|
|
2707
|
+
//--------------------------------------------------------------------
|
|
2708
|
+
|
|
2709
|
+
return value;
|
|
2710
|
+
}
|
|
2711
|
+
|
|
2712
|
+
// List View control
|
|
2713
|
+
int GuiListView(Rectangle bounds, const char *text, int *scrollIndex, int active)
|
|
2714
|
+
{
|
|
2715
|
+
int itemCount = 0;
|
|
2716
|
+
const char **items = NULL;
|
|
2717
|
+
|
|
2718
|
+
if (text != NULL) items = GuiTextSplit(text, &itemCount, NULL);
|
|
2719
|
+
|
|
2720
|
+
return GuiListViewEx(bounds, items, itemCount, NULL, scrollIndex, active);
|
|
2721
|
+
}
|
|
2722
|
+
|
|
2723
|
+
// List View control with extended parameters
|
|
2724
|
+
int GuiListViewEx(Rectangle bounds, const char **text, int count, int *focus, int *scrollIndex, int active)
|
|
2725
|
+
{
|
|
2726
|
+
GuiControlState state = guiState;
|
|
2727
|
+
int itemFocused = (focus == NULL)? -1 : *focus;
|
|
2728
|
+
int itemSelected = active;
|
|
2729
|
+
|
|
2730
|
+
// Check if we need a scroll bar
|
|
2731
|
+
bool useScrollBar = false;
|
|
2732
|
+
if ((GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT) + GuiGetStyle(LISTVIEW, LIST_ITEMS_PADDING))*count > bounds.height) useScrollBar = true;
|
|
2733
|
+
|
|
2734
|
+
// Define base item rectangle [0]
|
|
2735
|
+
Rectangle itemBounds = { 0 };
|
|
2736
|
+
itemBounds.x = bounds.x + GuiGetStyle(LISTVIEW, LIST_ITEMS_PADDING);
|
|
2737
|
+
itemBounds.y = bounds.y + GuiGetStyle(LISTVIEW, LIST_ITEMS_PADDING) + GuiGetStyle(DEFAULT, BORDER_WIDTH);
|
|
2738
|
+
itemBounds.width = bounds.width - 2*GuiGetStyle(LISTVIEW, LIST_ITEMS_PADDING) - GuiGetStyle(DEFAULT, BORDER_WIDTH);
|
|
2739
|
+
itemBounds.height = (float)GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT);
|
|
2740
|
+
if (useScrollBar) itemBounds.width -= GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH);
|
|
2741
|
+
|
|
2742
|
+
// Get items on the list
|
|
2743
|
+
int visibleItems = (int)bounds.height/(GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT) + GuiGetStyle(LISTVIEW, LIST_ITEMS_PADDING));
|
|
2744
|
+
if (visibleItems > count) visibleItems = count;
|
|
2745
|
+
|
|
2746
|
+
int startIndex = (scrollIndex == NULL)? 0 : *scrollIndex;
|
|
2747
|
+
if ((startIndex < 0) || (startIndex > (count - visibleItems))) startIndex = 0;
|
|
2748
|
+
int endIndex = startIndex + visibleItems;
|
|
2749
|
+
|
|
2750
|
+
// Update control
|
|
2751
|
+
//--------------------------------------------------------------------
|
|
2752
|
+
if ((state != GUI_STATE_DISABLED) && !guiLocked)
|
|
2753
|
+
{
|
|
2754
|
+
Vector2 mousePoint = GetMousePosition();
|
|
2755
|
+
|
|
2756
|
+
// Check mouse inside list view
|
|
2757
|
+
if (CheckCollisionPointRec(mousePoint, bounds))
|
|
2758
|
+
{
|
|
2759
|
+
state = GUI_STATE_FOCUSED;
|
|
2760
|
+
|
|
2761
|
+
// Check focused and selected item
|
|
2762
|
+
for (int i = 0; i < visibleItems; i++)
|
|
2763
|
+
{
|
|
2764
|
+
if (CheckCollisionPointRec(mousePoint, itemBounds))
|
|
2765
|
+
{
|
|
2766
|
+
itemFocused = startIndex + i;
|
|
2767
|
+
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
|
|
2768
|
+
{
|
|
2769
|
+
if (itemSelected == (startIndex + i)) itemSelected = -1;
|
|
2770
|
+
else itemSelected = startIndex + i;
|
|
2771
|
+
}
|
|
2772
|
+
break;
|
|
2773
|
+
}
|
|
2774
|
+
|
|
2775
|
+
// Update item rectangle y position for next item
|
|
2776
|
+
itemBounds.y += (GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT) + GuiGetStyle(LISTVIEW, LIST_ITEMS_PADDING));
|
|
2777
|
+
}
|
|
2778
|
+
|
|
2779
|
+
if (useScrollBar)
|
|
2780
|
+
{
|
|
2781
|
+
int wheelMove = (int)GetMouseWheelMove();
|
|
2782
|
+
startIndex -= wheelMove;
|
|
2783
|
+
|
|
2784
|
+
if (startIndex < 0) startIndex = 0;
|
|
2785
|
+
else if (startIndex > (count - visibleItems)) startIndex = count - visibleItems;
|
|
2786
|
+
|
|
2787
|
+
endIndex = startIndex + visibleItems;
|
|
2788
|
+
if (endIndex > count) endIndex = count;
|
|
2789
|
+
}
|
|
2790
|
+
}
|
|
2791
|
+
else itemFocused = -1;
|
|
2792
|
+
|
|
2793
|
+
// Reset item rectangle y to [0]
|
|
2794
|
+
itemBounds.y = bounds.y + GuiGetStyle(LISTVIEW, LIST_ITEMS_PADDING) + GuiGetStyle(DEFAULT, BORDER_WIDTH);
|
|
2795
|
+
}
|
|
2796
|
+
//--------------------------------------------------------------------
|
|
2797
|
+
|
|
2798
|
+
// Draw control
|
|
2799
|
+
//--------------------------------------------------------------------
|
|
2800
|
+
GuiDrawRectangle(bounds, GuiGetStyle(DEFAULT, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(LISTVIEW, BORDER + state*3)), guiAlpha), GetColor(GuiGetStyle(DEFAULT, BACKGROUND_COLOR))); // Draw background
|
|
2801
|
+
|
|
2802
|
+
// Draw visible items
|
|
2803
|
+
for (int i = 0; ((i < visibleItems) && (text != NULL)); i++)
|
|
2804
|
+
{
|
|
2805
|
+
if (state == GUI_STATE_DISABLED)
|
|
2806
|
+
{
|
|
2807
|
+
if ((startIndex + i) == itemSelected) GuiDrawRectangle(itemBounds, GuiGetStyle(LISTVIEW, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(LISTVIEW, BORDER_COLOR_DISABLED)), guiAlpha), Fade(GetColor(GuiGetStyle(LISTVIEW, BASE_COLOR_DISABLED)), guiAlpha));
|
|
2808
|
+
|
|
2809
|
+
GuiDrawText(text[startIndex + i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_DISABLED)), guiAlpha));
|
|
2810
|
+
}
|
|
2811
|
+
else
|
|
2812
|
+
{
|
|
2813
|
+
if ((startIndex + i) == itemSelected)
|
|
2814
|
+
{
|
|
2815
|
+
// Draw item selected
|
|
2816
|
+
GuiDrawRectangle(itemBounds, GuiGetStyle(LISTVIEW, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(LISTVIEW, BORDER_COLOR_PRESSED)), guiAlpha), Fade(GetColor(GuiGetStyle(LISTVIEW, BASE_COLOR_PRESSED)), guiAlpha));
|
|
2817
|
+
GuiDrawText(text[startIndex + i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_PRESSED)), guiAlpha));
|
|
2818
|
+
}
|
|
2819
|
+
else if ((startIndex + i) == itemFocused)
|
|
2820
|
+
{
|
|
2821
|
+
// Draw item focused
|
|
2822
|
+
GuiDrawRectangle(itemBounds, GuiGetStyle(LISTVIEW, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(LISTVIEW, BORDER_COLOR_FOCUSED)), guiAlpha), Fade(GetColor(GuiGetStyle(LISTVIEW, BASE_COLOR_FOCUSED)), guiAlpha));
|
|
2823
|
+
GuiDrawText(text[startIndex + i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_FOCUSED)), guiAlpha));
|
|
2824
|
+
}
|
|
2825
|
+
else
|
|
2826
|
+
{
|
|
2827
|
+
// Draw item normal
|
|
2828
|
+
GuiDrawText(text[startIndex + i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_NORMAL)), guiAlpha));
|
|
2829
|
+
}
|
|
2830
|
+
}
|
|
2831
|
+
|
|
2832
|
+
// Update item rectangle y position for next item
|
|
2833
|
+
itemBounds.y += (GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT) + GuiGetStyle(LISTVIEW, LIST_ITEMS_PADDING));
|
|
2834
|
+
}
|
|
2835
|
+
|
|
2836
|
+
if (useScrollBar)
|
|
2837
|
+
{
|
|
2838
|
+
Rectangle scrollBarBounds = {
|
|
2839
|
+
bounds.x + bounds.width - GuiGetStyle(LISTVIEW, BORDER_WIDTH) - GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH),
|
|
2840
|
+
bounds.y + GuiGetStyle(LISTVIEW, BORDER_WIDTH), (float)GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH),
|
|
2841
|
+
bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH)
|
|
2842
|
+
};
|
|
2843
|
+
|
|
2844
|
+
// Calculate percentage of visible items and apply same percentage to scrollbar
|
|
2845
|
+
float percentVisible = (float)(endIndex - startIndex)/count;
|
|
2846
|
+
float sliderSize = bounds.height*percentVisible;
|
|
2847
|
+
|
|
2848
|
+
int prevSliderSize = GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE); // Save default slider size
|
|
2849
|
+
int prevScrollSpeed = GuiGetStyle(SCROLLBAR, SCROLL_SPEED); // Save default scroll speed
|
|
2850
|
+
GuiSetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE, (int)sliderSize); // Change slider size
|
|
2851
|
+
GuiSetStyle(SCROLLBAR, SCROLL_SPEED, count - visibleItems); // Change scroll speed
|
|
2852
|
+
|
|
2853
|
+
startIndex = GuiScrollBar(scrollBarBounds, startIndex, 0, count - visibleItems);
|
|
2854
|
+
|
|
2855
|
+
GuiSetStyle(SCROLLBAR, SCROLL_SPEED, prevScrollSpeed); // Reset scroll speed to default
|
|
2856
|
+
GuiSetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE, prevSliderSize); // Reset slider size to default
|
|
2857
|
+
}
|
|
2858
|
+
//--------------------------------------------------------------------
|
|
2859
|
+
|
|
2860
|
+
if (focus != NULL) *focus = itemFocused;
|
|
2861
|
+
if (scrollIndex != NULL) *scrollIndex = startIndex;
|
|
2862
|
+
|
|
2863
|
+
return itemSelected;
|
|
2864
|
+
}
|
|
2865
|
+
|
|
2866
|
+
// Color Panel control
|
|
2867
|
+
Color GuiColorPanel(Rectangle bounds, Color color)
|
|
2868
|
+
{
|
|
2869
|
+
const Color colWhite = { 255, 255, 255, 255 };
|
|
2870
|
+
const Color colBlack = { 0, 0, 0, 255 };
|
|
2871
|
+
|
|
2872
|
+
GuiControlState state = guiState;
|
|
2873
|
+
Vector2 pickerSelector = { 0 };
|
|
2874
|
+
|
|
2875
|
+
Vector3 vcolor = { (float)color.r/255.0f, (float)color.g/255.0f, (float)color.b/255.0f };
|
|
2876
|
+
Vector3 hsv = ConvertRGBtoHSV(vcolor);
|
|
2877
|
+
|
|
2878
|
+
pickerSelector.x = bounds.x + (float)hsv.y*bounds.width; // HSV: Saturation
|
|
2879
|
+
pickerSelector.y = bounds.y + (1.0f - (float)hsv.z)*bounds.height; // HSV: Value
|
|
2880
|
+
|
|
2881
|
+
float hue = -1.0f;
|
|
2882
|
+
Vector3 maxHue = { hue >= 0.0f ? hue : hsv.x, 1.0f, 1.0f };
|
|
2883
|
+
Vector3 rgbHue = ConvertHSVtoRGB(maxHue);
|
|
2884
|
+
Color maxHueCol = { (unsigned char)(255.0f*rgbHue.x),
|
|
2885
|
+
(unsigned char)(255.0f*rgbHue.y),
|
|
2886
|
+
(unsigned char)(255.0f*rgbHue.z), 255 };
|
|
2887
|
+
|
|
2888
|
+
// Update control
|
|
2889
|
+
//--------------------------------------------------------------------
|
|
2890
|
+
if ((state != GUI_STATE_DISABLED) && !guiLocked)
|
|
2891
|
+
{
|
|
2892
|
+
Vector2 mousePoint = GetMousePosition();
|
|
2893
|
+
|
|
2894
|
+
if (CheckCollisionPointRec(mousePoint, bounds))
|
|
2895
|
+
{
|
|
2896
|
+
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON))
|
|
2897
|
+
{
|
|
2898
|
+
state = GUI_STATE_PRESSED;
|
|
2899
|
+
pickerSelector = mousePoint;
|
|
2900
|
+
|
|
2901
|
+
// Calculate color from picker
|
|
2902
|
+
Vector2 colorPick = { pickerSelector.x - bounds.x, pickerSelector.y - bounds.y };
|
|
2903
|
+
|
|
2904
|
+
colorPick.x /= (float)bounds.width; // Get normalized value on x
|
|
2905
|
+
colorPick.y /= (float)bounds.height; // Get normalized value on y
|
|
2906
|
+
|
|
2907
|
+
hsv.y = colorPick.x;
|
|
2908
|
+
hsv.z = 1.0f - colorPick.y;
|
|
2909
|
+
|
|
2910
|
+
Vector3 rgb = ConvertHSVtoRGB(hsv);
|
|
2911
|
+
|
|
2912
|
+
// NOTE: Vector3ToColor() only available on raylib 1.8.1
|
|
2913
|
+
color = RAYGUI_CLITERAL(Color){ (unsigned char)(255.0f*rgb.x),
|
|
2914
|
+
(unsigned char)(255.0f*rgb.y),
|
|
2915
|
+
(unsigned char)(255.0f*rgb.z),
|
|
2916
|
+
(unsigned char)(255.0f*(float)color.a/255.0f) };
|
|
2917
|
+
|
|
2918
|
+
}
|
|
2919
|
+
else state = GUI_STATE_FOCUSED;
|
|
2920
|
+
}
|
|
2921
|
+
}
|
|
2922
|
+
//--------------------------------------------------------------------
|
|
2923
|
+
|
|
2924
|
+
// Draw control
|
|
2925
|
+
//--------------------------------------------------------------------
|
|
2926
|
+
if (state != GUI_STATE_DISABLED)
|
|
2927
|
+
{
|
|
2928
|
+
DrawRectangleGradientEx(bounds, Fade(colWhite, guiAlpha), Fade(colWhite, guiAlpha), Fade(maxHueCol, guiAlpha), Fade(maxHueCol, guiAlpha));
|
|
2929
|
+
DrawRectangleGradientEx(bounds, Fade(colBlack, 0), Fade(colBlack, guiAlpha), Fade(colBlack, guiAlpha), Fade(colBlack, 0));
|
|
2930
|
+
|
|
2931
|
+
// Draw color picker: selector
|
|
2932
|
+
Rectangle selector = { pickerSelector.x - GuiGetStyle(COLORPICKER, COLOR_SELECTOR_SIZE)/2, pickerSelector.y - GuiGetStyle(COLORPICKER, COLOR_SELECTOR_SIZE)/2, (float)GuiGetStyle(COLORPICKER, COLOR_SELECTOR_SIZE), (float)GuiGetStyle(COLORPICKER, COLOR_SELECTOR_SIZE) };
|
|
2933
|
+
GuiDrawRectangle(selector, 0, BLANK, Fade(colWhite, guiAlpha));
|
|
2934
|
+
}
|
|
2935
|
+
else
|
|
2936
|
+
{
|
|
2937
|
+
DrawRectangleGradientEx(bounds, Fade(Fade(GetColor(GuiGetStyle(COLORPICKER, BASE_COLOR_DISABLED)), 0.1f), guiAlpha), Fade(Fade(colBlack, 0.6f), guiAlpha), Fade(Fade(colBlack, 0.6f), guiAlpha), Fade(Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER_COLOR_DISABLED)), 0.6f), guiAlpha));
|
|
2938
|
+
}
|
|
2939
|
+
|
|
2940
|
+
GuiDrawRectangle(bounds, GuiGetStyle(COLORPICKER, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3)), guiAlpha), BLANK);
|
|
2941
|
+
//--------------------------------------------------------------------
|
|
2942
|
+
|
|
2943
|
+
return color;
|
|
2944
|
+
}
|
|
2945
|
+
|
|
2946
|
+
// Color Bar Alpha control
|
|
2947
|
+
// NOTE: Returns alpha value normalized [0..1]
|
|
2948
|
+
float GuiColorBarAlpha(Rectangle bounds, float alpha)
|
|
2949
|
+
{
|
|
2950
|
+
#define COLORBARALPHA_CHECKED_SIZE 10
|
|
2951
|
+
|
|
2952
|
+
GuiControlState state = guiState;
|
|
2953
|
+
Rectangle selector = { (float)bounds.x + alpha*bounds.width - GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_HEIGHT)/2, (float)bounds.y - GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_OVERFLOW), (float)GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_HEIGHT), (float)bounds.height + GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_OVERFLOW)*2 };
|
|
2954
|
+
|
|
2955
|
+
// Update control
|
|
2956
|
+
//--------------------------------------------------------------------
|
|
2957
|
+
if ((state != GUI_STATE_DISABLED) && !guiLocked)
|
|
2958
|
+
{
|
|
2959
|
+
Vector2 mousePoint = GetMousePosition();
|
|
2960
|
+
|
|
2961
|
+
if (CheckCollisionPointRec(mousePoint, bounds) ||
|
|
2962
|
+
CheckCollisionPointRec(mousePoint, selector))
|
|
2963
|
+
{
|
|
2964
|
+
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON))
|
|
2965
|
+
{
|
|
2966
|
+
state = GUI_STATE_PRESSED;
|
|
2967
|
+
|
|
2968
|
+
alpha = (mousePoint.x - bounds.x)/bounds.width;
|
|
2969
|
+
if (alpha <= 0.0f) alpha = 0.0f;
|
|
2970
|
+
if (alpha >= 1.0f) alpha = 1.0f;
|
|
2971
|
+
//selector.x = bounds.x + (int)(((alpha - 0)/(100 - 0))*(bounds.width - 2*GuiGetStyle(SLIDER, BORDER_WIDTH))) - selector.width/2;
|
|
2972
|
+
}
|
|
2973
|
+
else state = GUI_STATE_FOCUSED;
|
|
2974
|
+
}
|
|
2975
|
+
}
|
|
2976
|
+
//--------------------------------------------------------------------
|
|
2977
|
+
|
|
2978
|
+
// Draw control
|
|
2979
|
+
//--------------------------------------------------------------------
|
|
2980
|
+
|
|
2981
|
+
// Draw alpha bar: checked background
|
|
2982
|
+
if (state != GUI_STATE_DISABLED)
|
|
2983
|
+
{
|
|
2984
|
+
int checksX = (int)bounds.width/COLORBARALPHA_CHECKED_SIZE;
|
|
2985
|
+
int checksY = (int)bounds.height/COLORBARALPHA_CHECKED_SIZE;
|
|
2986
|
+
|
|
2987
|
+
for (int x = 0; x < checksX; x++)
|
|
2988
|
+
{
|
|
2989
|
+
for (int y = 0; y < checksY; y++)
|
|
2990
|
+
{
|
|
2991
|
+
Rectangle check = { bounds.x + x*COLORBARALPHA_CHECKED_SIZE, bounds.y + y*COLORBARALPHA_CHECKED_SIZE, COLORBARALPHA_CHECKED_SIZE, COLORBARALPHA_CHECKED_SIZE };
|
|
2992
|
+
GuiDrawRectangle(check, 0, BLANK, ((x + y)%2)? Fade(Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER_COLOR_DISABLED)), 0.4f), guiAlpha) : Fade(Fade(GetColor(GuiGetStyle(COLORPICKER, BASE_COLOR_DISABLED)), 0.4f), guiAlpha));
|
|
2993
|
+
}
|
|
2994
|
+
}
|
|
2995
|
+
|
|
2996
|
+
DrawRectangleGradientEx(bounds, RAYGUI_CLITERAL(Color){ 255, 255, 255, 0 }, RAYGUI_CLITERAL(Color){ 255, 255, 255, 0 }, Fade(RAYGUI_CLITERAL(Color){ 0, 0, 0, 255 }, guiAlpha), Fade(RAYGUI_CLITERAL(Color){ 0, 0, 0, 255 }, guiAlpha));
|
|
2997
|
+
}
|
|
2998
|
+
else DrawRectangleGradientEx(bounds, Fade(GetColor(GuiGetStyle(COLORPICKER, BASE_COLOR_DISABLED)), 0.1f), Fade(GetColor(GuiGetStyle(COLORPICKER, BASE_COLOR_DISABLED)), 0.1f), Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER_COLOR_DISABLED)), guiAlpha), Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER_COLOR_DISABLED)), guiAlpha));
|
|
2999
|
+
|
|
3000
|
+
GuiDrawRectangle(bounds, GuiGetStyle(COLORPICKER, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3)), guiAlpha), BLANK);
|
|
3001
|
+
|
|
3002
|
+
// Draw alpha bar: selector
|
|
3003
|
+
GuiDrawRectangle(selector, 0, BLANK, Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3)), guiAlpha));
|
|
3004
|
+
//--------------------------------------------------------------------
|
|
3005
|
+
|
|
3006
|
+
return alpha;
|
|
3007
|
+
}
|
|
3008
|
+
|
|
3009
|
+
// Color Bar Hue control
|
|
3010
|
+
// Returns hue value normalized [0..1]
|
|
3011
|
+
// NOTE: Other similar bars (for reference):
|
|
3012
|
+
// Color GuiColorBarSat() [WHITE->color]
|
|
3013
|
+
// Color GuiColorBarValue() [BLACK->color], HSV/HSL
|
|
3014
|
+
// float GuiColorBarLuminance() [BLACK->WHITE]
|
|
3015
|
+
float GuiColorBarHue(Rectangle bounds, float hue)
|
|
3016
|
+
{
|
|
3017
|
+
GuiControlState state = guiState;
|
|
3018
|
+
Rectangle selector = { (float)bounds.x - GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_OVERFLOW), (float)bounds.y + hue/360.0f*bounds.height - GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_HEIGHT)/2, (float)bounds.width + GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_OVERFLOW)*2, (float)GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_HEIGHT) };
|
|
3019
|
+
|
|
3020
|
+
// Update control
|
|
3021
|
+
//--------------------------------------------------------------------
|
|
3022
|
+
if ((state != GUI_STATE_DISABLED) && !guiLocked)
|
|
3023
|
+
{
|
|
3024
|
+
Vector2 mousePoint = GetMousePosition();
|
|
3025
|
+
|
|
3026
|
+
if (CheckCollisionPointRec(mousePoint, bounds) ||
|
|
3027
|
+
CheckCollisionPointRec(mousePoint, selector))
|
|
3028
|
+
{
|
|
3029
|
+
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON))
|
|
3030
|
+
{
|
|
3031
|
+
state = GUI_STATE_PRESSED;
|
|
3032
|
+
|
|
3033
|
+
hue = (mousePoint.y - bounds.y)*360/bounds.height;
|
|
3034
|
+
if (hue <= 0.0f) hue = 0.0f;
|
|
3035
|
+
if (hue >= 359.0f) hue = 359.0f;
|
|
3036
|
+
|
|
3037
|
+
}
|
|
3038
|
+
else state = GUI_STATE_FOCUSED;
|
|
3039
|
+
|
|
3040
|
+
/*if (IsKeyDown(KEY_UP))
|
|
3041
|
+
{
|
|
3042
|
+
hue -= 2.0f;
|
|
3043
|
+
if (hue <= 0.0f) hue = 0.0f;
|
|
3044
|
+
}
|
|
3045
|
+
else if (IsKeyDown(KEY_DOWN))
|
|
3046
|
+
{
|
|
3047
|
+
hue += 2.0f;
|
|
3048
|
+
if (hue >= 360.0f) hue = 360.0f;
|
|
3049
|
+
}*/
|
|
3050
|
+
}
|
|
3051
|
+
}
|
|
3052
|
+
//--------------------------------------------------------------------
|
|
3053
|
+
|
|
3054
|
+
// Draw control
|
|
3055
|
+
//--------------------------------------------------------------------
|
|
3056
|
+
if (state != GUI_STATE_DISABLED)
|
|
3057
|
+
{
|
|
3058
|
+
// Draw hue bar:color bars
|
|
3059
|
+
DrawRectangleGradientV((int)bounds.x, (int)(bounds.y), (int)bounds.width, ceil(bounds.height/6), Fade(RAYGUI_CLITERAL(Color) { 255, 0, 0, 255 }, guiAlpha), Fade(RAYGUI_CLITERAL(Color) { 255, 255, 0, 255 }, guiAlpha));
|
|
3060
|
+
DrawRectangleGradientV((int)bounds.x, (int)(bounds.y + bounds.height/6), (int)bounds.width, ceil(bounds.height/6), Fade(RAYGUI_CLITERAL(Color) { 255, 255, 0, 255 }, guiAlpha), Fade(RAYGUI_CLITERAL(Color) { 0, 255, 0, 255 }, guiAlpha));
|
|
3061
|
+
DrawRectangleGradientV((int)bounds.x, (int)(bounds.y + 2*(bounds.height/6)), (int)bounds.width, ceil(bounds.height/6), Fade(RAYGUI_CLITERAL(Color) { 0, 255, 0, 255 }, guiAlpha), Fade(RAYGUI_CLITERAL(Color) { 0, 255, 255, 255 }, guiAlpha));
|
|
3062
|
+
DrawRectangleGradientV((int)bounds.x, (int)(bounds.y + 3*(bounds.height/6)), (int)bounds.width, ceil(bounds.height/6), Fade(RAYGUI_CLITERAL(Color) { 0, 255, 255, 255 }, guiAlpha), Fade(RAYGUI_CLITERAL(Color) { 0, 0, 255, 255 }, guiAlpha));
|
|
3063
|
+
DrawRectangleGradientV((int)bounds.x, (int)(bounds.y + 4*(bounds.height/6)), (int)bounds.width, ceil(bounds.height/6), Fade(RAYGUI_CLITERAL(Color) { 0, 0, 255, 255 }, guiAlpha), Fade(RAYGUI_CLITERAL(Color) { 255, 0, 255, 255 }, guiAlpha));
|
|
3064
|
+
DrawRectangleGradientV((int)bounds.x, (int)(bounds.y + 5*(bounds.height/6)), (int)bounds.width, (int)(bounds.height/6), Fade(RAYGUI_CLITERAL(Color) { 255, 0, 255, 255 }, guiAlpha), Fade(RAYGUI_CLITERAL(Color) { 255, 0, 0, 255 }, guiAlpha));
|
|
3065
|
+
}
|
|
3066
|
+
else DrawRectangleGradientV((int)bounds.x, (int)bounds.y, (int)bounds.width, (int)bounds.height, Fade(Fade(GetColor(GuiGetStyle(COLORPICKER, BASE_COLOR_DISABLED)), 0.1f), guiAlpha), Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER_COLOR_DISABLED)), guiAlpha));
|
|
3067
|
+
|
|
3068
|
+
GuiDrawRectangle(bounds, GuiGetStyle(COLORPICKER, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3)), guiAlpha), BLANK);
|
|
3069
|
+
|
|
3070
|
+
// Draw hue bar: selector
|
|
3071
|
+
GuiDrawRectangle(selector, 0, BLANK, Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3)), guiAlpha));
|
|
3072
|
+
//--------------------------------------------------------------------
|
|
3073
|
+
|
|
3074
|
+
return hue;
|
|
3075
|
+
}
|
|
3076
|
+
|
|
3077
|
+
// Color Picker control
|
|
3078
|
+
// NOTE: It's divided in multiple controls:
|
|
3079
|
+
// Color GuiColorPanel(Rectangle bounds, Color color)
|
|
3080
|
+
// float GuiColorBarAlpha(Rectangle bounds, float alpha)
|
|
3081
|
+
// float GuiColorBarHue(Rectangle bounds, float value)
|
|
3082
|
+
// NOTE: bounds define GuiColorPanel() size
|
|
3083
|
+
Color GuiColorPicker(Rectangle bounds, Color color)
|
|
3084
|
+
{
|
|
3085
|
+
color = GuiColorPanel(bounds, color);
|
|
3086
|
+
|
|
3087
|
+
Rectangle boundsHue = { (float)bounds.x + bounds.width + GuiGetStyle(COLORPICKER, HUEBAR_PADDING), (float)bounds.y, (float)GuiGetStyle(COLORPICKER, HUEBAR_WIDTH), (float)bounds.height };
|
|
3088
|
+
//Rectangle boundsAlpha = { bounds.x, bounds.y + bounds.height + GuiGetStyle(COLORPICKER, BARS_PADDING), bounds.width, GuiGetStyle(COLORPICKER, BARS_THICK) };
|
|
3089
|
+
|
|
3090
|
+
Vector3 hsv = ConvertRGBtoHSV(RAYGUI_CLITERAL(Vector3){ color.r/255.0f, color.g/255.0f, color.b/255.0f });
|
|
3091
|
+
hsv.x = GuiColorBarHue(boundsHue, hsv.x);
|
|
3092
|
+
//color.a = (unsigned char)(GuiColorBarAlpha(boundsAlpha, (float)color.a/255.0f)*255.0f);
|
|
3093
|
+
Vector3 rgb = ConvertHSVtoRGB(hsv);
|
|
3094
|
+
|
|
3095
|
+
color = RAYGUI_CLITERAL(Color){ (unsigned char)roundf(rgb.x*255.0f), (unsigned char)roundf(rgb.y*255.0f), (unsigned char)roundf(rgb.z*255.0f), color.a };
|
|
3096
|
+
|
|
3097
|
+
return color;
|
|
3098
|
+
}
|
|
3099
|
+
|
|
3100
|
+
// Message Box control
|
|
3101
|
+
int GuiMessageBox(Rectangle bounds, const char *title, const char *message, const char *buttons)
|
|
3102
|
+
{
|
|
3103
|
+
#define MESSAGEBOX_BUTTON_HEIGHT 24
|
|
3104
|
+
#define MESSAGEBOX_BUTTON_PADDING 10
|
|
3105
|
+
|
|
3106
|
+
int clicked = -1; // Returns clicked button from buttons list, 0 refers to closed window button
|
|
3107
|
+
|
|
3108
|
+
int buttonCount = 0;
|
|
3109
|
+
const char **buttonsText = GuiTextSplit(buttons, &buttonCount, NULL);
|
|
3110
|
+
Rectangle buttonBounds = { 0 };
|
|
3111
|
+
buttonBounds.x = bounds.x + MESSAGEBOX_BUTTON_PADDING;
|
|
3112
|
+
buttonBounds.y = bounds.y + bounds.height - MESSAGEBOX_BUTTON_HEIGHT - MESSAGEBOX_BUTTON_PADDING;
|
|
3113
|
+
buttonBounds.width = (bounds.width - MESSAGEBOX_BUTTON_PADDING*(buttonCount + 1))/buttonCount;
|
|
3114
|
+
buttonBounds.height = MESSAGEBOX_BUTTON_HEIGHT;
|
|
3115
|
+
|
|
3116
|
+
Vector2 textSize = MeasureTextEx(guiFont, message, (float)GuiGetStyle(DEFAULT, TEXT_SIZE), 1);
|
|
3117
|
+
|
|
3118
|
+
Rectangle textBounds = { 0 };
|
|
3119
|
+
textBounds.x = bounds.x + bounds.width/2 - textSize.x/2;
|
|
3120
|
+
textBounds.y = bounds.y + WINDOW_STATUSBAR_HEIGHT + (bounds.height - WINDOW_STATUSBAR_HEIGHT - MESSAGEBOX_BUTTON_HEIGHT - MESSAGEBOX_BUTTON_PADDING)/2 - textSize.y/2;
|
|
3121
|
+
textBounds.width = textSize.x;
|
|
3122
|
+
textBounds.height = textSize.y;
|
|
3123
|
+
|
|
3124
|
+
// Draw control
|
|
3125
|
+
//--------------------------------------------------------------------
|
|
3126
|
+
if (GuiWindowBox(bounds, title)) clicked = 0;
|
|
3127
|
+
|
|
3128
|
+
int prevTextAlignment = GuiGetStyle(LABEL, TEXT_ALIGNMENT);
|
|
3129
|
+
GuiSetStyle(LABEL, TEXT_ALIGNMENT, GUI_TEXT_ALIGN_CENTER);
|
|
3130
|
+
GuiLabel(textBounds, message);
|
|
3131
|
+
GuiSetStyle(LABEL, TEXT_ALIGNMENT, prevTextAlignment);
|
|
3132
|
+
|
|
3133
|
+
prevTextAlignment = GuiGetStyle(BUTTON, TEXT_ALIGNMENT);
|
|
3134
|
+
GuiSetStyle(BUTTON, TEXT_ALIGNMENT, GUI_TEXT_ALIGN_CENTER);
|
|
3135
|
+
|
|
3136
|
+
for (int i = 0; i < buttonCount; i++)
|
|
3137
|
+
{
|
|
3138
|
+
if (GuiButton(buttonBounds, buttonsText[i])) clicked = i + 1;
|
|
3139
|
+
buttonBounds.x += (buttonBounds.width + MESSAGEBOX_BUTTON_PADDING);
|
|
3140
|
+
}
|
|
3141
|
+
|
|
3142
|
+
GuiSetStyle(BUTTON, TEXT_ALIGNMENT, prevTextAlignment);
|
|
3143
|
+
//--------------------------------------------------------------------
|
|
3144
|
+
|
|
3145
|
+
return clicked;
|
|
3146
|
+
}
|
|
3147
|
+
|
|
3148
|
+
// Text Input Box control, ask for text
|
|
3149
|
+
int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, const char *buttons, char *text)
|
|
3150
|
+
{
|
|
3151
|
+
#define TEXTINPUTBOX_BUTTON_HEIGHT 24
|
|
3152
|
+
#define TEXTINPUTBOX_BUTTON_PADDING 10
|
|
3153
|
+
#define TEXTINPUTBOX_HEIGHT 30
|
|
3154
|
+
|
|
3155
|
+
#define TEXTINPUTBOX_MAX_TEXT_LENGTH 256
|
|
3156
|
+
|
|
3157
|
+
// Used to enable text edit mode
|
|
3158
|
+
// WARNING: No more than one GuiTextInputBox() should be open at the same time
|
|
3159
|
+
static bool textEditMode = false;
|
|
3160
|
+
|
|
3161
|
+
int btnIndex = -1;
|
|
3162
|
+
|
|
3163
|
+
int buttonCount = 0;
|
|
3164
|
+
const char **buttonsText = GuiTextSplit(buttons, &buttonCount, NULL);
|
|
3165
|
+
Rectangle buttonBounds = { 0 };
|
|
3166
|
+
buttonBounds.x = bounds.x + TEXTINPUTBOX_BUTTON_PADDING;
|
|
3167
|
+
buttonBounds.y = bounds.y + bounds.height - TEXTINPUTBOX_BUTTON_HEIGHT - TEXTINPUTBOX_BUTTON_PADDING;
|
|
3168
|
+
buttonBounds.width = (bounds.width - TEXTINPUTBOX_BUTTON_PADDING*(buttonCount + 1))/buttonCount;
|
|
3169
|
+
buttonBounds.height = TEXTINPUTBOX_BUTTON_HEIGHT;
|
|
3170
|
+
|
|
3171
|
+
int messageInputHeight = (int)bounds.height - WINDOW_STATUSBAR_HEIGHT - GuiGetStyle(STATUSBAR, BORDER_WIDTH) - TEXTINPUTBOX_BUTTON_HEIGHT - 2*TEXTINPUTBOX_BUTTON_PADDING;
|
|
3172
|
+
|
|
3173
|
+
Rectangle textBounds = { 0 };
|
|
3174
|
+
if (message != NULL)
|
|
3175
|
+
{
|
|
3176
|
+
Vector2 textSize = MeasureTextEx(guiFont, message, (float)GuiGetStyle(DEFAULT, TEXT_SIZE), 1);
|
|
3177
|
+
|
|
3178
|
+
textBounds.x = bounds.x + bounds.width/2 - textSize.x/2;
|
|
3179
|
+
textBounds.y = bounds.y + WINDOW_STATUSBAR_HEIGHT + messageInputHeight/4 - textSize.y/2;
|
|
3180
|
+
textBounds.width = textSize.x;
|
|
3181
|
+
textBounds.height = textSize.y;
|
|
3182
|
+
}
|
|
3183
|
+
|
|
3184
|
+
Rectangle textBoxBounds = { 0 };
|
|
3185
|
+
textBoxBounds.x = bounds.x + TEXTINPUTBOX_BUTTON_PADDING;
|
|
3186
|
+
textBoxBounds.y = bounds.y + WINDOW_STATUSBAR_HEIGHT - TEXTINPUTBOX_HEIGHT/2;
|
|
3187
|
+
if (message == NULL) textBoxBounds.y += messageInputHeight/2;
|
|
3188
|
+
else textBoxBounds.y += (messageInputHeight/2 + messageInputHeight/4);
|
|
3189
|
+
textBoxBounds.width = bounds.width - TEXTINPUTBOX_BUTTON_PADDING*2;
|
|
3190
|
+
textBoxBounds.height = TEXTINPUTBOX_HEIGHT;
|
|
3191
|
+
|
|
3192
|
+
// Draw control
|
|
3193
|
+
//--------------------------------------------------------------------
|
|
3194
|
+
if (GuiWindowBox(bounds, title)) btnIndex = 0;
|
|
3195
|
+
|
|
3196
|
+
// Draw message if available
|
|
3197
|
+
if (message != NULL)
|
|
3198
|
+
{
|
|
3199
|
+
int prevTextAlignment = GuiGetStyle(LABEL, TEXT_ALIGNMENT);
|
|
3200
|
+
GuiSetStyle(LABEL, TEXT_ALIGNMENT, GUI_TEXT_ALIGN_CENTER);
|
|
3201
|
+
GuiLabel(textBounds, message);
|
|
3202
|
+
GuiSetStyle(LABEL, TEXT_ALIGNMENT, prevTextAlignment);
|
|
3203
|
+
}
|
|
3204
|
+
|
|
3205
|
+
if (GuiTextBox(textBoxBounds, text, TEXTINPUTBOX_MAX_TEXT_LENGTH, textEditMode)) textEditMode = !textEditMode;
|
|
3206
|
+
|
|
3207
|
+
int prevBtnTextAlignment = GuiGetStyle(BUTTON, TEXT_ALIGNMENT);
|
|
3208
|
+
GuiSetStyle(BUTTON, TEXT_ALIGNMENT, GUI_TEXT_ALIGN_CENTER);
|
|
3209
|
+
|
|
3210
|
+
for (int i = 0; i < buttonCount; i++)
|
|
3211
|
+
{
|
|
3212
|
+
if (GuiButton(buttonBounds, buttonsText[i])) btnIndex = i + 1;
|
|
3213
|
+
buttonBounds.x += (buttonBounds.width + MESSAGEBOX_BUTTON_PADDING);
|
|
3214
|
+
}
|
|
3215
|
+
|
|
3216
|
+
GuiSetStyle(BUTTON, TEXT_ALIGNMENT, prevBtnTextAlignment);
|
|
3217
|
+
//--------------------------------------------------------------------
|
|
3218
|
+
|
|
3219
|
+
return btnIndex;
|
|
3220
|
+
}
|
|
3221
|
+
|
|
3222
|
+
// Grid control
|
|
3223
|
+
// NOTE: Returns grid mouse-hover selected cell
|
|
3224
|
+
// About drawing lines at subpixel spacing, simple put, not easy solution:
|
|
3225
|
+
// https://stackoverflow.com/questions/4435450/2d-opengl-drawing-lines-that-dont-exactly-fit-pixel-raster
|
|
3226
|
+
Vector2 GuiGrid(Rectangle bounds, float spacing, int subdivs)
|
|
3227
|
+
{
|
|
3228
|
+
#if !defined(GRID_COLOR_ALPHA)
|
|
3229
|
+
#define GRID_COLOR_ALPHA 0.15f // Grid lines alpha amount
|
|
3230
|
+
#endif
|
|
3231
|
+
|
|
3232
|
+
GuiControlState state = guiState;
|
|
3233
|
+
Vector2 mousePoint = GetMousePosition();
|
|
3234
|
+
Vector2 currentCell = { -1, -1 };
|
|
3235
|
+
|
|
3236
|
+
int linesV = ((int)(bounds.width/spacing))*subdivs + 1;
|
|
3237
|
+
int linesH = ((int)(bounds.height/spacing))*subdivs + 1;
|
|
3238
|
+
|
|
3239
|
+
// Update control
|
|
3240
|
+
//--------------------------------------------------------------------
|
|
3241
|
+
if ((state != GUI_STATE_DISABLED) && !guiLocked)
|
|
3242
|
+
{
|
|
3243
|
+
if (CheckCollisionPointRec(mousePoint, bounds))
|
|
3244
|
+
{
|
|
3245
|
+
currentCell.x = (mousePoint.x - bounds.x)/spacing;
|
|
3246
|
+
currentCell.y = (mousePoint.y - bounds.y)/spacing;
|
|
3247
|
+
}
|
|
3248
|
+
}
|
|
3249
|
+
//--------------------------------------------------------------------
|
|
3250
|
+
|
|
3251
|
+
// Draw control
|
|
3252
|
+
//--------------------------------------------------------------------
|
|
3253
|
+
switch (state)
|
|
3254
|
+
{
|
|
3255
|
+
case GUI_STATE_NORMAL:
|
|
3256
|
+
{
|
|
3257
|
+
if (subdivs > 0)
|
|
3258
|
+
{
|
|
3259
|
+
// Draw vertical grid lines
|
|
3260
|
+
for (int i = 0; i < linesV; i++)
|
|
3261
|
+
{
|
|
3262
|
+
Rectangle lineV = { bounds.x + spacing*i/subdivs, bounds.y, 1, bounds.height };
|
|
3263
|
+
GuiDrawRectangle(lineV, 0, BLANK, ((i%subdivs) == 0) ? Fade(GetColor(GuiGetStyle(DEFAULT, LINE_COLOR)), GRID_COLOR_ALPHA*4) : Fade(GetColor(GuiGetStyle(DEFAULT, LINE_COLOR)), GRID_COLOR_ALPHA));
|
|
3264
|
+
}
|
|
3265
|
+
|
|
3266
|
+
// Draw horizontal grid lines
|
|
3267
|
+
for (int i = 0; i < linesH; i++)
|
|
3268
|
+
{
|
|
3269
|
+
Rectangle lineH = { bounds.x, bounds.y + spacing*i/subdivs, bounds.width, 1 };
|
|
3270
|
+
GuiDrawRectangle(lineH, 0, BLANK, ((i%subdivs) == 0) ? Fade(GetColor(GuiGetStyle(DEFAULT, LINE_COLOR)), GRID_COLOR_ALPHA*4) : Fade(GetColor(GuiGetStyle(DEFAULT, LINE_COLOR)), GRID_COLOR_ALPHA));
|
|
3271
|
+
}
|
|
3272
|
+
}
|
|
3273
|
+
} break;
|
|
3274
|
+
default: break;
|
|
3275
|
+
}
|
|
3276
|
+
|
|
3277
|
+
return currentCell;
|
|
3278
|
+
}
|
|
3279
|
+
|
|
3280
|
+
//----------------------------------------------------------------------------------
|
|
3281
|
+
// Styles loading functions
|
|
3282
|
+
//----------------------------------------------------------------------------------
|
|
3283
|
+
|
|
3284
|
+
// Load raygui style file (.rgs)
|
|
3285
|
+
void GuiLoadStyle(const char *fileName)
|
|
3286
|
+
{
|
|
3287
|
+
bool tryBinary = false;
|
|
3288
|
+
|
|
3289
|
+
// Try reading the files as text file first
|
|
3290
|
+
FILE *rgsFile = fopen(fileName, "rt");
|
|
3291
|
+
|
|
3292
|
+
if (rgsFile != NULL)
|
|
3293
|
+
{
|
|
3294
|
+
char buffer[256] = { 0 };
|
|
3295
|
+
fgets(buffer, 256, rgsFile);
|
|
3296
|
+
|
|
3297
|
+
if (buffer[0] == '#')
|
|
3298
|
+
{
|
|
3299
|
+
int controlId = 0;
|
|
3300
|
+
int propertyId = 0;
|
|
3301
|
+
unsigned int propertyValue = 0;
|
|
3302
|
+
|
|
3303
|
+
while (!feof(rgsFile))
|
|
3304
|
+
{
|
|
3305
|
+
switch (buffer[0])
|
|
3306
|
+
{
|
|
3307
|
+
case 'p':
|
|
3308
|
+
{
|
|
3309
|
+
// Style property: p <control_id> <property_id> <property_value> <property_name>
|
|
3310
|
+
|
|
3311
|
+
sscanf(buffer, "p %d %d 0x%x", &controlId, &propertyId, &propertyValue);
|
|
3312
|
+
|
|
3313
|
+
GuiSetStyle(controlId, propertyId, (int)propertyValue);
|
|
3314
|
+
|
|
3315
|
+
} break;
|
|
3316
|
+
case 'f':
|
|
3317
|
+
{
|
|
3318
|
+
// Style font: f <gen_font_size> <charmap_file> <font_file>
|
|
3319
|
+
|
|
3320
|
+
int fontSize = 0;
|
|
3321
|
+
char charmapFileName[256] = { 0 };
|
|
3322
|
+
char fontFileName[256] = { 0 };
|
|
3323
|
+
sscanf(buffer, "f %d %s %[^\r\n]s", &fontSize, charmapFileName, fontFileName);
|
|
3324
|
+
|
|
3325
|
+
Font font = { 0 };
|
|
3326
|
+
|
|
3327
|
+
if (charmapFileName[0] != '0')
|
|
3328
|
+
{
|
|
3329
|
+
// Load characters from charmap file,
|
|
3330
|
+
// expected '\n' separated list of integer values
|
|
3331
|
+
char *charValues = LoadFileText(charmapFileName);
|
|
3332
|
+
if (charValues != NULL)
|
|
3333
|
+
{
|
|
3334
|
+
int glyphCount = 0;
|
|
3335
|
+
const char **chars = TextSplit(charValues, '\n', &glyphCount);
|
|
3336
|
+
|
|
3337
|
+
int *values = (int *)RAYGUI_MALLOC(glyphCount*sizeof(int));
|
|
3338
|
+
for (int i = 0; i < glyphCount; i++) values[i] = TextToInteger(chars[i]);
|
|
3339
|
+
|
|
3340
|
+
font = LoadFontEx(TextFormat("%s/%s", GetDirectoryPath(fileName), fontFileName), fontSize, values, glyphCount);
|
|
3341
|
+
|
|
3342
|
+
RAYGUI_FREE(values);
|
|
3343
|
+
}
|
|
3344
|
+
}
|
|
3345
|
+
else font = LoadFontEx(TextFormat("%s/%s", GetDirectoryPath(fileName), fontFileName), fontSize, NULL, 0);
|
|
3346
|
+
|
|
3347
|
+
if ((font.texture.id > 0) && (font.glyphCount > 0)) GuiSetFont(font);
|
|
3348
|
+
|
|
3349
|
+
} break;
|
|
3350
|
+
default: break;
|
|
3351
|
+
}
|
|
3352
|
+
|
|
3353
|
+
fgets(buffer, 256, rgsFile);
|
|
3354
|
+
}
|
|
3355
|
+
}
|
|
3356
|
+
else tryBinary = true;
|
|
3357
|
+
|
|
3358
|
+
fclose(rgsFile);
|
|
3359
|
+
}
|
|
3360
|
+
|
|
3361
|
+
if (tryBinary)
|
|
3362
|
+
{
|
|
3363
|
+
rgsFile = fopen(fileName, "rb");
|
|
3364
|
+
|
|
3365
|
+
if (rgsFile == NULL) return;
|
|
3366
|
+
|
|
3367
|
+
char signature[5] = "";
|
|
3368
|
+
short version = 0;
|
|
3369
|
+
short reserved = 0;
|
|
3370
|
+
int propertyCount = 0;
|
|
3371
|
+
|
|
3372
|
+
fread(signature, 1, 4, rgsFile);
|
|
3373
|
+
fread(&version, 1, sizeof(short), rgsFile);
|
|
3374
|
+
fread(&reserved, 1, sizeof(short), rgsFile);
|
|
3375
|
+
fread(&propertyCount, 1, sizeof(int), rgsFile);
|
|
3376
|
+
|
|
3377
|
+
if ((signature[0] == 'r') &&
|
|
3378
|
+
(signature[1] == 'G') &&
|
|
3379
|
+
(signature[2] == 'S') &&
|
|
3380
|
+
(signature[3] == ' '))
|
|
3381
|
+
{
|
|
3382
|
+
short controlId = 0;
|
|
3383
|
+
short propertyId = 0;
|
|
3384
|
+
int propertyValue = 0;
|
|
3385
|
+
|
|
3386
|
+
for (int i = 0; i < propertyCount; i++)
|
|
3387
|
+
{
|
|
3388
|
+
fread(&controlId, 1, sizeof(short), rgsFile);
|
|
3389
|
+
fread(&propertyId, 1, sizeof(short), rgsFile);
|
|
3390
|
+
fread(&propertyValue, 1, sizeof(int), rgsFile);
|
|
3391
|
+
|
|
3392
|
+
if (controlId == 0) // DEFAULT control
|
|
3393
|
+
{
|
|
3394
|
+
// If a DEFAULT property is loaded, it is propagated to all controls
|
|
3395
|
+
// NOTE: All DEFAULT properties should be defined first in the file
|
|
3396
|
+
GuiSetStyle(0, (int)propertyId, propertyValue);
|
|
3397
|
+
|
|
3398
|
+
if (propertyId < RAYGUI_MAX_PROPS_BASE) for (int i = 1; i < RAYGUI_MAX_CONTROLS; i++) GuiSetStyle(i, (int)propertyId, propertyValue);
|
|
3399
|
+
}
|
|
3400
|
+
else GuiSetStyle((int)controlId, (int)propertyId, propertyValue);
|
|
3401
|
+
}
|
|
3402
|
+
|
|
3403
|
+
// Font loading is highly dependant on raylib API to load font data and image
|
|
3404
|
+
#if !defined(RAYGUI_STANDALONE)
|
|
3405
|
+
// Load custom font if available
|
|
3406
|
+
int fontDataSize = 0;
|
|
3407
|
+
fread(&fontDataSize, 1, sizeof(int), rgsFile);
|
|
3408
|
+
|
|
3409
|
+
if (fontDataSize > 0)
|
|
3410
|
+
{
|
|
3411
|
+
Font font = { 0 };
|
|
3412
|
+
int fontType = 0; // 0-Normal, 1-SDF
|
|
3413
|
+
Rectangle whiteRec = { 0 };
|
|
3414
|
+
|
|
3415
|
+
fread(&font.baseSize, 1, sizeof(int), rgsFile);
|
|
3416
|
+
fread(&font.glyphCount, 1, sizeof(int), rgsFile);
|
|
3417
|
+
fread(&fontType, 1, sizeof(int), rgsFile);
|
|
3418
|
+
|
|
3419
|
+
// Load font white rectangle
|
|
3420
|
+
fread(&whiteRec, 1, sizeof(Rectangle), rgsFile);
|
|
3421
|
+
|
|
3422
|
+
// Load font image parameters
|
|
3423
|
+
int fontImageSize = 0;
|
|
3424
|
+
fread(&fontImageSize, 1, sizeof(int), rgsFile);
|
|
3425
|
+
|
|
3426
|
+
if (fontImageSize > 0)
|
|
3427
|
+
{
|
|
3428
|
+
Image imFont = { 0 };
|
|
3429
|
+
imFont.mipmaps = 1;
|
|
3430
|
+
fread(&imFont.width, 1, sizeof(int), rgsFile);
|
|
3431
|
+
fread(&imFont.height, 1, sizeof(int), rgsFile);
|
|
3432
|
+
fread(&imFont.format, 1, sizeof(int), rgsFile);
|
|
3433
|
+
|
|
3434
|
+
imFont.data = (unsigned char *)RAYGUI_MALLOC(fontImageSize);
|
|
3435
|
+
fread(imFont.data, 1, fontImageSize, rgsFile);
|
|
3436
|
+
|
|
3437
|
+
font.texture = LoadTextureFromImage(imFont);
|
|
3438
|
+
|
|
3439
|
+
RAYGUI_FREE(imFont.data);
|
|
3440
|
+
}
|
|
3441
|
+
|
|
3442
|
+
// Load font recs data
|
|
3443
|
+
font.recs = (Rectangle *)RAYGUI_CALLOC(font.glyphCount, sizeof(Rectangle));
|
|
3444
|
+
for (int i = 0; i < font.glyphCount; i++) fread(&font.recs[i], 1, sizeof(Rectangle), rgsFile);
|
|
3445
|
+
|
|
3446
|
+
// Load font chars info data
|
|
3447
|
+
font.glyphs = (GlyphInfo *)RAYGUI_CALLOC(font.glyphCount, sizeof(GlyphInfo));
|
|
3448
|
+
for (int i = 0; i < font.glyphCount; i++)
|
|
3449
|
+
{
|
|
3450
|
+
fread(&font.glyphs[i].value, 1, sizeof(int), rgsFile);
|
|
3451
|
+
fread(&font.glyphs[i].offsetX, 1, sizeof(int), rgsFile);
|
|
3452
|
+
fread(&font.glyphs[i].offsetY, 1, sizeof(int), rgsFile);
|
|
3453
|
+
fread(&font.glyphs[i].advanceX, 1, sizeof(int), rgsFile);
|
|
3454
|
+
}
|
|
3455
|
+
|
|
3456
|
+
GuiSetFont(font);
|
|
3457
|
+
|
|
3458
|
+
// Set font texture source rectangle to be used as white texture to draw shapes
|
|
3459
|
+
// NOTE: This way, all gui can be draw using a single draw call
|
|
3460
|
+
if ((whiteRec.width != 0) && (whiteRec.height != 0)) SetShapesTexture(font.texture, whiteRec);
|
|
3461
|
+
}
|
|
3462
|
+
#endif
|
|
3463
|
+
}
|
|
3464
|
+
|
|
3465
|
+
fclose(rgsFile);
|
|
3466
|
+
}
|
|
3467
|
+
}
|
|
3468
|
+
|
|
3469
|
+
// Load style default over global style
|
|
3470
|
+
void GuiLoadStyleDefault(void)
|
|
3471
|
+
{
|
|
3472
|
+
// We set this variable first to avoid cyclic function calls
|
|
3473
|
+
// when calling GuiSetStyle() and GuiGetStyle()
|
|
3474
|
+
guiStyleLoaded = true;
|
|
3475
|
+
|
|
3476
|
+
// Initialize default LIGHT style property values
|
|
3477
|
+
GuiSetStyle(DEFAULT, BORDER_COLOR_NORMAL, 0x838383ff);
|
|
3478
|
+
GuiSetStyle(DEFAULT, BASE_COLOR_NORMAL, 0xc9c9c9ff);
|
|
3479
|
+
GuiSetStyle(DEFAULT, TEXT_COLOR_NORMAL, 0x686868ff);
|
|
3480
|
+
GuiSetStyle(DEFAULT, BORDER_COLOR_FOCUSED, 0x5bb2d9ff);
|
|
3481
|
+
GuiSetStyle(DEFAULT, BASE_COLOR_FOCUSED, 0xc9effeff);
|
|
3482
|
+
GuiSetStyle(DEFAULT, TEXT_COLOR_FOCUSED, 0x6c9bbcff);
|
|
3483
|
+
GuiSetStyle(DEFAULT, BORDER_COLOR_PRESSED, 0x0492c7ff);
|
|
3484
|
+
GuiSetStyle(DEFAULT, BASE_COLOR_PRESSED, 0x97e8ffff);
|
|
3485
|
+
GuiSetStyle(DEFAULT, TEXT_COLOR_PRESSED, 0x368bafff);
|
|
3486
|
+
GuiSetStyle(DEFAULT, BORDER_COLOR_DISABLED, 0xb5c1c2ff);
|
|
3487
|
+
GuiSetStyle(DEFAULT, BASE_COLOR_DISABLED, 0xe6e9e9ff);
|
|
3488
|
+
GuiSetStyle(DEFAULT, TEXT_COLOR_DISABLED, 0xaeb7b8ff);
|
|
3489
|
+
GuiSetStyle(DEFAULT, BORDER_WIDTH, 1); // WARNING: Some controls use other values
|
|
3490
|
+
GuiSetStyle(DEFAULT, TEXT_PADDING, 0); // WARNING: Some controls use other values
|
|
3491
|
+
GuiSetStyle(DEFAULT, TEXT_ALIGNMENT, GUI_TEXT_ALIGN_CENTER); // WARNING: Some controls use other values
|
|
3492
|
+
|
|
3493
|
+
// Initialize control-specific property values
|
|
3494
|
+
// NOTE: Those properties are in default list but require specific values by control type
|
|
3495
|
+
GuiSetStyle(LABEL, TEXT_ALIGNMENT, GUI_TEXT_ALIGN_LEFT);
|
|
3496
|
+
GuiSetStyle(BUTTON, BORDER_WIDTH, 2);
|
|
3497
|
+
GuiSetStyle(SLIDER, TEXT_PADDING, 5);
|
|
3498
|
+
GuiSetStyle(CHECKBOX, TEXT_PADDING, 5);
|
|
3499
|
+
GuiSetStyle(CHECKBOX, TEXT_ALIGNMENT, GUI_TEXT_ALIGN_RIGHT);
|
|
3500
|
+
GuiSetStyle(TEXTBOX, TEXT_PADDING, 5);
|
|
3501
|
+
GuiSetStyle(TEXTBOX, TEXT_ALIGNMENT, GUI_TEXT_ALIGN_LEFT);
|
|
3502
|
+
GuiSetStyle(VALUEBOX, TEXT_PADDING, 4);
|
|
3503
|
+
GuiSetStyle(VALUEBOX, TEXT_ALIGNMENT, GUI_TEXT_ALIGN_LEFT);
|
|
3504
|
+
GuiSetStyle(SPINNER, TEXT_PADDING, 4);
|
|
3505
|
+
GuiSetStyle(SPINNER, TEXT_ALIGNMENT, GUI_TEXT_ALIGN_LEFT);
|
|
3506
|
+
GuiSetStyle(STATUSBAR, TEXT_PADDING, 6);
|
|
3507
|
+
GuiSetStyle(STATUSBAR, TEXT_ALIGNMENT, GUI_TEXT_ALIGN_LEFT);
|
|
3508
|
+
|
|
3509
|
+
// Initialize extended property values
|
|
3510
|
+
// NOTE: By default, extended property values are initialized to 0
|
|
3511
|
+
GuiSetStyle(DEFAULT, TEXT_SIZE, 10); // DEFAULT, shared by all controls
|
|
3512
|
+
GuiSetStyle(DEFAULT, TEXT_SPACING, 1); // DEFAULT, shared by all controls
|
|
3513
|
+
GuiSetStyle(DEFAULT, LINE_COLOR, 0x90abb5ff); // DEFAULT specific property
|
|
3514
|
+
GuiSetStyle(DEFAULT, BACKGROUND_COLOR, 0xf5f5f5ff); // DEFAULT specific property
|
|
3515
|
+
GuiSetStyle(TOGGLE, GROUP_PADDING, 2);
|
|
3516
|
+
GuiSetStyle(SLIDER, SLIDER_WIDTH, 15);
|
|
3517
|
+
GuiSetStyle(SLIDER, SLIDER_PADDING, 1);
|
|
3518
|
+
GuiSetStyle(PROGRESSBAR, PROGRESS_PADDING, 1);
|
|
3519
|
+
GuiSetStyle(CHECKBOX, CHECK_PADDING, 1);
|
|
3520
|
+
GuiSetStyle(COMBOBOX, COMBO_BUTTON_WIDTH, 30);
|
|
3521
|
+
GuiSetStyle(COMBOBOX, COMBO_BUTTON_PADDING, 2);
|
|
3522
|
+
GuiSetStyle(DROPDOWNBOX, ARROW_PADDING, 16);
|
|
3523
|
+
GuiSetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_PADDING, 2);
|
|
3524
|
+
GuiSetStyle(TEXTBOX, TEXT_LINES_PADDING, 5);
|
|
3525
|
+
GuiSetStyle(TEXTBOX, TEXT_INNER_PADDING, 4);
|
|
3526
|
+
GuiSetStyle(TEXTBOX, COLOR_SELECTED_FG, 0xf0fffeff);
|
|
3527
|
+
GuiSetStyle(TEXTBOX, COLOR_SELECTED_BG, 0x839affe0);
|
|
3528
|
+
GuiSetStyle(SPINNER, SPIN_BUTTON_WIDTH, 20);
|
|
3529
|
+
GuiSetStyle(SPINNER, SPIN_BUTTON_PADDING, 2);
|
|
3530
|
+
GuiSetStyle(SCROLLBAR, BORDER_WIDTH, 0);
|
|
3531
|
+
GuiSetStyle(SCROLLBAR, ARROWS_VISIBLE, 0);
|
|
3532
|
+
GuiSetStyle(SCROLLBAR, ARROWS_SIZE, 6);
|
|
3533
|
+
GuiSetStyle(SCROLLBAR, SCROLL_SLIDER_PADDING, 0);
|
|
3534
|
+
GuiSetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE, 16);
|
|
3535
|
+
GuiSetStyle(SCROLLBAR, SCROLL_PADDING, 0);
|
|
3536
|
+
GuiSetStyle(SCROLLBAR, SCROLL_SPEED, 10);
|
|
3537
|
+
GuiSetStyle(LISTVIEW, LIST_ITEMS_HEIGHT, 0x1e);
|
|
3538
|
+
GuiSetStyle(LISTVIEW, LIST_ITEMS_PADDING, 2);
|
|
3539
|
+
GuiSetStyle(LISTVIEW, SCROLLBAR_WIDTH, 10);
|
|
3540
|
+
GuiSetStyle(LISTVIEW, SCROLLBAR_SIDE, SCROLLBAR_RIGHT_SIDE);
|
|
3541
|
+
GuiSetStyle(COLORPICKER, COLOR_SELECTOR_SIZE, 6);
|
|
3542
|
+
GuiSetStyle(COLORPICKER, HUEBAR_WIDTH, 0x14);
|
|
3543
|
+
GuiSetStyle(COLORPICKER, HUEBAR_PADDING, 0xa);
|
|
3544
|
+
GuiSetStyle(COLORPICKER, HUEBAR_SELECTOR_HEIGHT, 6);
|
|
3545
|
+
GuiSetStyle(COLORPICKER, HUEBAR_SELECTOR_OVERFLOW, 2);
|
|
3546
|
+
|
|
3547
|
+
guiFont = GetFontDefault(); // Initialize default font
|
|
3548
|
+
}
|
|
3549
|
+
|
|
3550
|
+
// Get text with icon id prepended
|
|
3551
|
+
// NOTE: Useful to add icons by name id (enum) instead of
|
|
3552
|
+
// a number that can change between ricon versions
|
|
3553
|
+
const char *GuiIconText(int iconId, const char *text)
|
|
3554
|
+
{
|
|
3555
|
+
#if defined(RAYGUI_NO_RICONS)
|
|
3556
|
+
return NULL;
|
|
3557
|
+
#else
|
|
3558
|
+
static char buffer[1024] = { 0 };
|
|
3559
|
+
memset(buffer, 0, 1024);
|
|
3560
|
+
|
|
3561
|
+
sprintf(buffer, "#%03i#", iconId);
|
|
3562
|
+
|
|
3563
|
+
if (text != NULL)
|
|
3564
|
+
{
|
|
3565
|
+
for (int i = 5; i < 1024; i++)
|
|
3566
|
+
{
|
|
3567
|
+
buffer[i] = text[i - 5];
|
|
3568
|
+
if (text[i - 5] == '\0') break;
|
|
3569
|
+
}
|
|
3570
|
+
}
|
|
3571
|
+
|
|
3572
|
+
return buffer;
|
|
3573
|
+
#endif
|
|
3574
|
+
}
|
|
3575
|
+
|
|
3576
|
+
#if !defined(RAYGUI_NO_RICONS)
|
|
3577
|
+
|
|
3578
|
+
// Get full icons data pointer
|
|
3579
|
+
unsigned int *GuiGetIcons(void) { return guiIcons; }
|
|
3580
|
+
|
|
3581
|
+
// Load raygui icons file (.rgi)
|
|
3582
|
+
// NOTE: In case nameIds are required, they can be requested with loadIconsName,
|
|
3583
|
+
// they are returned as a guiIconsName[iconCount][RICON_MAX_NAME_LENGTH],
|
|
3584
|
+
// WARNING: guiIconsName[]][] memory should be manually freed!
|
|
3585
|
+
char **GuiLoadIcons(const char *fileName, bool loadIconsName)
|
|
3586
|
+
{
|
|
3587
|
+
// Style File Structure (.rgi)
|
|
3588
|
+
// ------------------------------------------------------
|
|
3589
|
+
// Offset | Size | Type | Description
|
|
3590
|
+
// ------------------------------------------------------
|
|
3591
|
+
// 0 | 4 | char | Signature: "rGI "
|
|
3592
|
+
// 4 | 2 | short | Version: 100
|
|
3593
|
+
// 6 | 2 | short | reserved
|
|
3594
|
+
|
|
3595
|
+
// 8 | 2 | short | Num icons (N)
|
|
3596
|
+
// 10 | 2 | short | Icons size (Options: 16, 32, 64) (S)
|
|
3597
|
+
|
|
3598
|
+
// Icons name id (32 bytes per name id)
|
|
3599
|
+
// foreach (icon)
|
|
3600
|
+
// {
|
|
3601
|
+
// 12+32*i | 32 | char | Icon NameId
|
|
3602
|
+
// }
|
|
3603
|
+
|
|
3604
|
+
// Icons data: One bit per pixel, stored as unsigned int array (depends on icon size)
|
|
3605
|
+
// S*S pixels/32bit per unsigned int = K unsigned int per icon
|
|
3606
|
+
// foreach (icon)
|
|
3607
|
+
// {
|
|
3608
|
+
// ... | K | unsigned int | Icon Data
|
|
3609
|
+
// }
|
|
3610
|
+
|
|
3611
|
+
FILE *rgiFile = fopen(fileName, "rb");
|
|
3612
|
+
|
|
3613
|
+
char **guiIconsName = NULL;
|
|
3614
|
+
|
|
3615
|
+
if (rgiFile != NULL)
|
|
3616
|
+
{
|
|
3617
|
+
char signature[5] = "";
|
|
3618
|
+
short version = 0;
|
|
3619
|
+
short reserved = 0;
|
|
3620
|
+
short iconCount = 0;
|
|
3621
|
+
short iconSize = 0;
|
|
3622
|
+
|
|
3623
|
+
fread(signature, 1, 4, rgiFile);
|
|
3624
|
+
fread(&version, 1, sizeof(short), rgiFile);
|
|
3625
|
+
fread(&reserved, 1, sizeof(short), rgiFile);
|
|
3626
|
+
fread(&iconCount, 1, sizeof(short), rgiFile);
|
|
3627
|
+
fread(&iconSize, 1, sizeof(short), rgiFile);
|
|
3628
|
+
|
|
3629
|
+
if ((signature[0] == 'r') &&
|
|
3630
|
+
(signature[1] == 'G') &&
|
|
3631
|
+
(signature[2] == 'I') &&
|
|
3632
|
+
(signature[3] == ' '))
|
|
3633
|
+
{
|
|
3634
|
+
if (loadIconsName)
|
|
3635
|
+
{
|
|
3636
|
+
guiIconsName = (char **)RAYGUI_MALLOC(iconCount*sizeof(char **));
|
|
3637
|
+
for (int i = 0; i < iconCount; i++)
|
|
3638
|
+
{
|
|
3639
|
+
guiIconsName[i] = (char *)RAYGUI_MALLOC(RICON_MAX_NAME_LENGTH);
|
|
3640
|
+
fread(guiIconsName[i], RICON_MAX_NAME_LENGTH, 1, rgiFile);
|
|
3641
|
+
}
|
|
3642
|
+
}
|
|
3643
|
+
else fseek(rgiFile, iconCount*RICON_MAX_NAME_LENGTH, SEEK_CUR);
|
|
3644
|
+
|
|
3645
|
+
// Read icons data directly over guiIcons data array
|
|
3646
|
+
fread(guiIcons, iconCount*(iconSize*iconSize/32), sizeof(unsigned int), rgiFile);
|
|
3647
|
+
}
|
|
3648
|
+
|
|
3649
|
+
fclose(rgiFile);
|
|
3650
|
+
}
|
|
3651
|
+
|
|
3652
|
+
return guiIconsName;
|
|
3653
|
+
}
|
|
3654
|
+
|
|
3655
|
+
// Draw selected icon using rectangles pixel-by-pixel
|
|
3656
|
+
void GuiDrawIcon(int iconId, int posX, int posY, int pixelSize, Color color)
|
|
3657
|
+
{
|
|
3658
|
+
#define BIT_CHECK(a,b) ((a) & (1<<(b)))
|
|
3659
|
+
|
|
3660
|
+
for (int i = 0, y = 0; i < RICON_SIZE*RICON_SIZE/32; i++)
|
|
3661
|
+
{
|
|
3662
|
+
for (int k = 0; k < 32; k++)
|
|
3663
|
+
{
|
|
3664
|
+
if (BIT_CHECK(guiIcons[iconId*RICON_DATA_ELEMENTS + i], k))
|
|
3665
|
+
{
|
|
3666
|
+
#if !defined(RAYGUI_STANDALONE)
|
|
3667
|
+
DrawRectangle(posX + (k%RICON_SIZE)*pixelSize, posY + y*pixelSize, pixelSize, pixelSize, color);
|
|
3668
|
+
#endif
|
|
3669
|
+
}
|
|
3670
|
+
|
|
3671
|
+
if ((k == 15) || (k == 31)) y++;
|
|
3672
|
+
}
|
|
3673
|
+
}
|
|
3674
|
+
}
|
|
3675
|
+
|
|
3676
|
+
// Get icon bit data
|
|
3677
|
+
// NOTE: Bit data array grouped as unsigned int (ICON_SIZE*ICON_SIZE/32 elements)
|
|
3678
|
+
unsigned int *GuiGetIconData(int iconId)
|
|
3679
|
+
{
|
|
3680
|
+
static unsigned int iconData[RICON_DATA_ELEMENTS] = { 0 };
|
|
3681
|
+
memset(iconData, 0, RICON_DATA_ELEMENTS*sizeof(unsigned int));
|
|
3682
|
+
|
|
3683
|
+
if (iconId < RICON_MAX_ICONS) memcpy(iconData, &guiIcons[iconId*RICON_DATA_ELEMENTS], RICON_DATA_ELEMENTS*sizeof(unsigned int));
|
|
3684
|
+
|
|
3685
|
+
return iconData;
|
|
3686
|
+
}
|
|
3687
|
+
|
|
3688
|
+
// Set icon bit data
|
|
3689
|
+
// NOTE: Data must be provided as unsigned int array (ICON_SIZE*ICON_SIZE/32 elements)
|
|
3690
|
+
void GuiSetIconData(int iconId, unsigned int *data)
|
|
3691
|
+
{
|
|
3692
|
+
if (iconId < RICON_MAX_ICONS) memcpy(&guiIcons[iconId*RICON_DATA_ELEMENTS], data, RICON_DATA_ELEMENTS*sizeof(unsigned int));
|
|
3693
|
+
}
|
|
3694
|
+
|
|
3695
|
+
// Set icon pixel value
|
|
3696
|
+
void GuiSetIconPixel(int iconId, int x, int y)
|
|
3697
|
+
{
|
|
3698
|
+
#define BIT_SET(a,b) ((a) |= (1<<(b)))
|
|
3699
|
+
|
|
3700
|
+
// This logic works for any RICON_SIZE pixels icons,
|
|
3701
|
+
// For example, in case of 16x16 pixels, every 2 lines fit in one unsigned int data element
|
|
3702
|
+
BIT_SET(guiIcons[iconId*RICON_DATA_ELEMENTS + y/(sizeof(unsigned int)*8/RICON_SIZE)], x + (y%(sizeof(unsigned int)*8/RICON_SIZE)*RICON_SIZE));
|
|
3703
|
+
}
|
|
3704
|
+
|
|
3705
|
+
// Clear icon pixel value
|
|
3706
|
+
void GuiClearIconPixel(int iconId, int x, int y)
|
|
3707
|
+
{
|
|
3708
|
+
#define BIT_CLEAR(a,b) ((a) &= ~((1)<<(b)))
|
|
3709
|
+
|
|
3710
|
+
// This logic works for any RICON_SIZE pixels icons,
|
|
3711
|
+
// For example, in case of 16x16 pixels, every 2 lines fit in one unsigned int data element
|
|
3712
|
+
BIT_CLEAR(guiIcons[iconId*RICON_DATA_ELEMENTS + y/(sizeof(unsigned int)*8/RICON_SIZE)], x + (y%(sizeof(unsigned int)*8/RICON_SIZE)*RICON_SIZE));
|
|
3713
|
+
}
|
|
3714
|
+
|
|
3715
|
+
// Check icon pixel value
|
|
3716
|
+
bool GuiCheckIconPixel(int iconId, int x, int y)
|
|
3717
|
+
{
|
|
3718
|
+
#define BIT_CHECK(a,b) ((a) & (1<<(b)))
|
|
3719
|
+
|
|
3720
|
+
return (BIT_CHECK(guiIcons[iconId*8 + y/2], x + (y%2*16)));
|
|
3721
|
+
}
|
|
3722
|
+
#endif // !RAYGUI_NO_RICONS
|
|
3723
|
+
|
|
3724
|
+
//----------------------------------------------------------------------------------
|
|
3725
|
+
// Module specific Functions Definition
|
|
3726
|
+
//----------------------------------------------------------------------------------
|
|
3727
|
+
// Gui get text width using default font
|
|
3728
|
+
// NOTE: Icon is not considered here
|
|
3729
|
+
static int GetTextWidth(const char *text)
|
|
3730
|
+
{
|
|
3731
|
+
Vector2 size = { 0 };
|
|
3732
|
+
|
|
3733
|
+
if ((text != NULL) && (text[0] != '\0'))
|
|
3734
|
+
{
|
|
3735
|
+
size = MeasureTextEx(guiFont, text, (float)GuiGetStyle(DEFAULT, TEXT_SIZE), (float)GuiGetStyle(DEFAULT, TEXT_SPACING));
|
|
3736
|
+
}
|
|
3737
|
+
|
|
3738
|
+
return (int)size.x;
|
|
3739
|
+
}
|
|
3740
|
+
|
|
3741
|
+
// Get text bounds considering control bounds
|
|
3742
|
+
static Rectangle GetTextBounds(int control, Rectangle bounds)
|
|
3743
|
+
{
|
|
3744
|
+
Rectangle textBounds = bounds;
|
|
3745
|
+
|
|
3746
|
+
textBounds.x = bounds.x + GuiGetStyle(control, BORDER_WIDTH);
|
|
3747
|
+
textBounds.y = bounds.y + GuiGetStyle(control, BORDER_WIDTH);
|
|
3748
|
+
textBounds.width = bounds.width - 2*GuiGetStyle(control, BORDER_WIDTH);
|
|
3749
|
+
textBounds.height = bounds.height - 2*GuiGetStyle(control, BORDER_WIDTH);
|
|
3750
|
+
|
|
3751
|
+
// Consider TEXT_PADDING properly, depends on control type and TEXT_ALIGNMENT
|
|
3752
|
+
switch (control)
|
|
3753
|
+
{
|
|
3754
|
+
case COMBOBOX: bounds.width -= (GuiGetStyle(control, COMBO_BUTTON_WIDTH) + GuiGetStyle(control, COMBO_BUTTON_PADDING)); break;
|
|
3755
|
+
case VALUEBOX: break; // NOTE: ValueBox text value always centered, text padding applies to label
|
|
3756
|
+
default:
|
|
3757
|
+
{
|
|
3758
|
+
if (GuiGetStyle(control, TEXT_ALIGNMENT) == GUI_TEXT_ALIGN_RIGHT) textBounds.x -= GuiGetStyle(control, TEXT_PADDING);
|
|
3759
|
+
else textBounds.x += GuiGetStyle(control, TEXT_PADDING);
|
|
3760
|
+
} break;
|
|
3761
|
+
}
|
|
3762
|
+
|
|
3763
|
+
// TODO: Special cases (no label): COMBOBOX, DROPDOWNBOX, LISTVIEW (scrollbar?)
|
|
3764
|
+
// More special cases (label on side): CHECKBOX, SLIDER, VALUEBOX, SPINNER
|
|
3765
|
+
|
|
3766
|
+
return textBounds;
|
|
3767
|
+
}
|
|
3768
|
+
|
|
3769
|
+
// Get text icon if provided and move text cursor
|
|
3770
|
+
// NOTE: We support up to 999 values for iconId
|
|
3771
|
+
static const char *GetTextIcon(const char *text, int *iconId)
|
|
3772
|
+
{
|
|
3773
|
+
#if !defined(RAYGUI_NO_RICONS)
|
|
3774
|
+
*iconId = -1;
|
|
3775
|
+
if (text[0] == '#') // Maybe we have an icon!
|
|
3776
|
+
{
|
|
3777
|
+
char iconValue[4] = { 0 }; // Maximum length for icon value: 3 digits + '\0'
|
|
3778
|
+
|
|
3779
|
+
int pos = 1;
|
|
3780
|
+
while ((pos < 4) && (text[pos] >= '0') && (text[pos] <= '9'))
|
|
3781
|
+
{
|
|
3782
|
+
iconValue[pos - 1] = text[pos];
|
|
3783
|
+
pos++;
|
|
3784
|
+
}
|
|
3785
|
+
|
|
3786
|
+
if (text[pos] == '#')
|
|
3787
|
+
{
|
|
3788
|
+
*iconId = TextToInteger(iconValue);
|
|
3789
|
+
|
|
3790
|
+
// Move text pointer after icon
|
|
3791
|
+
// WARNING: If only icon provided, it could point to EOL character: '\0'
|
|
3792
|
+
if (*iconId >= 0) text += (pos + 1);
|
|
3793
|
+
}
|
|
3794
|
+
}
|
|
3795
|
+
#endif
|
|
3796
|
+
|
|
3797
|
+
return text;
|
|
3798
|
+
}
|
|
3799
|
+
|
|
3800
|
+
// Gui draw text using default font
|
|
3801
|
+
static void GuiDrawText(const char *text, Rectangle bounds, int alignment, Color tint)
|
|
3802
|
+
{
|
|
3803
|
+
#define TEXT_VALIGN_PIXEL_OFFSET(h) ((int)h%2) // Vertical alignment for pixel perfect
|
|
3804
|
+
|
|
3805
|
+
if ((text != NULL) && (text[0] != '\0'))
|
|
3806
|
+
{
|
|
3807
|
+
int iconId = 0;
|
|
3808
|
+
text = GetTextIcon(text, &iconId); // Check text for icon and move cursor
|
|
3809
|
+
|
|
3810
|
+
// Get text position depending on alignment and iconId
|
|
3811
|
+
//---------------------------------------------------------------------------------
|
|
3812
|
+
#define RICON_TEXT_PADDING 4
|
|
3813
|
+
|
|
3814
|
+
Vector2 position = { bounds.x, bounds.y };
|
|
3815
|
+
|
|
3816
|
+
// NOTE: We get text size after icon has been processed
|
|
3817
|
+
int textWidth = GetTextWidth(text);
|
|
3818
|
+
int textHeight = GuiGetStyle(DEFAULT, TEXT_SIZE);
|
|
3819
|
+
|
|
3820
|
+
// If text requires an icon, add size to measure
|
|
3821
|
+
if (iconId >= 0)
|
|
3822
|
+
{
|
|
3823
|
+
textWidth += RICON_SIZE;
|
|
3824
|
+
|
|
3825
|
+
// WARNING: If only icon provided, text could be pointing to EOF character: '\0'
|
|
3826
|
+
if ((text != NULL) && (text[0] != '\0')) textWidth += RICON_TEXT_PADDING;
|
|
3827
|
+
}
|
|
3828
|
+
|
|
3829
|
+
// Check guiTextAlign global variables
|
|
3830
|
+
switch (alignment)
|
|
3831
|
+
{
|
|
3832
|
+
case GUI_TEXT_ALIGN_LEFT:
|
|
3833
|
+
{
|
|
3834
|
+
position.x = bounds.x;
|
|
3835
|
+
position.y = bounds.y + bounds.height/2 - textHeight/2 + TEXT_VALIGN_PIXEL_OFFSET(bounds.height);
|
|
3836
|
+
} break;
|
|
3837
|
+
case GUI_TEXT_ALIGN_CENTER:
|
|
3838
|
+
{
|
|
3839
|
+
position.x = bounds.x + bounds.width/2 - textWidth/2;
|
|
3840
|
+
position.y = bounds.y + bounds.height/2 - textHeight/2 + TEXT_VALIGN_PIXEL_OFFSET(bounds.height);
|
|
3841
|
+
} break;
|
|
3842
|
+
case GUI_TEXT_ALIGN_RIGHT:
|
|
3843
|
+
{
|
|
3844
|
+
position.x = bounds.x + bounds.width - textWidth;
|
|
3845
|
+
position.y = bounds.y + bounds.height/2 - textHeight/2 + TEXT_VALIGN_PIXEL_OFFSET(bounds.height);
|
|
3846
|
+
} break;
|
|
3847
|
+
default: break;
|
|
3848
|
+
}
|
|
3849
|
+
|
|
3850
|
+
// NOTE: Make sure we get pixel-perfect coordinates,
|
|
3851
|
+
// In case of decimals we got weird text positioning
|
|
3852
|
+
position.x = (float)((int)position.x);
|
|
3853
|
+
position.y = (float)((int)position.y);
|
|
3854
|
+
//---------------------------------------------------------------------------------
|
|
3855
|
+
|
|
3856
|
+
// Draw text (with icon if available)
|
|
3857
|
+
//---------------------------------------------------------------------------------
|
|
3858
|
+
#if !defined(RAYGUI_NO_RICONS)
|
|
3859
|
+
if (iconId >= 0)
|
|
3860
|
+
{
|
|
3861
|
+
// NOTE: We consider icon height, probably different than text size
|
|
3862
|
+
GuiDrawIcon(iconId, (int)position.x, (int)(bounds.y + bounds.height/2 - RICON_SIZE/2 + TEXT_VALIGN_PIXEL_OFFSET(bounds.height)), 1, tint);
|
|
3863
|
+
position.x += (RICON_SIZE + RICON_TEXT_PADDING);
|
|
3864
|
+
}
|
|
3865
|
+
#endif
|
|
3866
|
+
DrawTextEx(guiFont, text, position, (float)GuiGetStyle(DEFAULT, TEXT_SIZE), (float)GuiGetStyle(DEFAULT, TEXT_SPACING), tint);
|
|
3867
|
+
//---------------------------------------------------------------------------------
|
|
3868
|
+
}
|
|
3869
|
+
}
|
|
3870
|
+
|
|
3871
|
+
// Gui draw rectangle using default raygui plain style with borders
|
|
3872
|
+
static void GuiDrawRectangle(Rectangle rec, int borderWidth, Color borderColor, Color color)
|
|
3873
|
+
{
|
|
3874
|
+
if (color.a > 0)
|
|
3875
|
+
{
|
|
3876
|
+
// Draw rectangle filled with color
|
|
3877
|
+
DrawRectangle((int)rec.x, (int)rec.y, (int)rec.width, (int)rec.height, color);
|
|
3878
|
+
}
|
|
3879
|
+
|
|
3880
|
+
if (borderWidth > 0)
|
|
3881
|
+
{
|
|
3882
|
+
// Draw rectangle border lines with color
|
|
3883
|
+
DrawRectangle((int)rec.x, (int)rec.y, (int)rec.width, borderWidth, borderColor);
|
|
3884
|
+
DrawRectangle((int)rec.x, (int)rec.y + borderWidth, borderWidth, (int)rec.height - 2*borderWidth, borderColor);
|
|
3885
|
+
DrawRectangle((int)rec.x + (int)rec.width - borderWidth, (int)rec.y + borderWidth, borderWidth, (int)rec.height - 2*borderWidth, borderColor);
|
|
3886
|
+
DrawRectangle((int)rec.x, (int)rec.y + (int)rec.height - borderWidth, (int)rec.width, borderWidth, borderColor);
|
|
3887
|
+
}
|
|
3888
|
+
}
|
|
3889
|
+
|
|
3890
|
+
// Split controls text into multiple strings
|
|
3891
|
+
// Also check for multiple columns (required by GuiToggleGroup())
|
|
3892
|
+
static const char **GuiTextSplit(const char *text, int *count, int *textRow)
|
|
3893
|
+
{
|
|
3894
|
+
// NOTE: Current implementation returns a copy of the provided string with '\0' (string end delimiter)
|
|
3895
|
+
// inserted between strings defined by "delimiter" parameter. No memory is dynamically allocated,
|
|
3896
|
+
// all used memory is static... it has some limitations:
|
|
3897
|
+
// 1. Maximum number of possible split strings is set by TEXTSPLIT_MAX_TEXT_ELEMENTS
|
|
3898
|
+
// 2. Maximum size of text to split is TEXTSPLIT_MAX_TEXT_LENGTH
|
|
3899
|
+
// NOTE: Those definitions could be externally provided if required
|
|
3900
|
+
|
|
3901
|
+
#if !defined(TEXTSPLIT_MAX_TEXT_LENGTH)
|
|
3902
|
+
#define TEXTSPLIT_MAX_TEXT_LENGTH 1024
|
|
3903
|
+
#endif
|
|
3904
|
+
|
|
3905
|
+
#if !defined(TEXTSPLIT_MAX_TEXT_ELEMENTS)
|
|
3906
|
+
#define TEXTSPLIT_MAX_TEXT_ELEMENTS 128
|
|
3907
|
+
#endif
|
|
3908
|
+
|
|
3909
|
+
static const char *result[TEXTSPLIT_MAX_TEXT_ELEMENTS] = { NULL };
|
|
3910
|
+
static char buffer[TEXTSPLIT_MAX_TEXT_LENGTH] = { 0 };
|
|
3911
|
+
memset(buffer, 0, TEXTSPLIT_MAX_TEXT_LENGTH);
|
|
3912
|
+
|
|
3913
|
+
result[0] = buffer;
|
|
3914
|
+
int counter = 1;
|
|
3915
|
+
|
|
3916
|
+
if (textRow != NULL) textRow[0] = 0;
|
|
3917
|
+
|
|
3918
|
+
// Count how many substrings we have on text and point to every one
|
|
3919
|
+
for (int i = 0; i < TEXTSPLIT_MAX_TEXT_LENGTH; i++)
|
|
3920
|
+
{
|
|
3921
|
+
buffer[i] = text[i];
|
|
3922
|
+
if (buffer[i] == '\0') break;
|
|
3923
|
+
else if ((buffer[i] == ';') || (buffer[i] == '\n'))
|
|
3924
|
+
{
|
|
3925
|
+
result[counter] = buffer + i + 1;
|
|
3926
|
+
|
|
3927
|
+
if (textRow != NULL)
|
|
3928
|
+
{
|
|
3929
|
+
if (buffer[i] == '\n') textRow[counter] = textRow[counter - 1] + 1;
|
|
3930
|
+
else textRow[counter] = textRow[counter - 1];
|
|
3931
|
+
}
|
|
3932
|
+
|
|
3933
|
+
buffer[i] = '\0'; // Set an end of string at this point
|
|
3934
|
+
|
|
3935
|
+
counter++;
|
|
3936
|
+
if (counter == TEXTSPLIT_MAX_TEXT_ELEMENTS) break;
|
|
3937
|
+
}
|
|
3938
|
+
}
|
|
3939
|
+
|
|
3940
|
+
*count = counter;
|
|
3941
|
+
|
|
3942
|
+
return result;
|
|
3943
|
+
}
|
|
3944
|
+
|
|
3945
|
+
// Convert color data from RGB to HSV
|
|
3946
|
+
// NOTE: Color data should be passed normalized
|
|
3947
|
+
static Vector3 ConvertRGBtoHSV(Vector3 rgb)
|
|
3948
|
+
{
|
|
3949
|
+
Vector3 hsv = { 0 };
|
|
3950
|
+
float min = 0.0f;
|
|
3951
|
+
float max = 0.0f;
|
|
3952
|
+
float delta = 0.0f;
|
|
3953
|
+
|
|
3954
|
+
min = (rgb.x < rgb.y)? rgb.x : rgb.y;
|
|
3955
|
+
min = (min < rgb.z)? min : rgb.z;
|
|
3956
|
+
|
|
3957
|
+
max = (rgb.x > rgb.y)? rgb.x : rgb.y;
|
|
3958
|
+
max = (max > rgb.z)? max : rgb.z;
|
|
3959
|
+
|
|
3960
|
+
hsv.z = max; // Value
|
|
3961
|
+
delta = max - min;
|
|
3962
|
+
|
|
3963
|
+
if (delta < 0.00001f)
|
|
3964
|
+
{
|
|
3965
|
+
hsv.y = 0.0f;
|
|
3966
|
+
hsv.x = 0.0f; // Undefined, maybe NAN?
|
|
3967
|
+
return hsv;
|
|
3968
|
+
}
|
|
3969
|
+
|
|
3970
|
+
if (max > 0.0f)
|
|
3971
|
+
{
|
|
3972
|
+
// NOTE: If max is 0, this divide would cause a crash
|
|
3973
|
+
hsv.y = (delta/max); // Saturation
|
|
3974
|
+
}
|
|
3975
|
+
else
|
|
3976
|
+
{
|
|
3977
|
+
// NOTE: If max is 0, then r = g = b = 0, s = 0, h is undefined
|
|
3978
|
+
hsv.y = 0.0f;
|
|
3979
|
+
hsv.x = 0.0f; // Undefined, maybe NAN?
|
|
3980
|
+
return hsv;
|
|
3981
|
+
}
|
|
3982
|
+
|
|
3983
|
+
// NOTE: Comparing float values could not work properly
|
|
3984
|
+
if (rgb.x >= max) hsv.x = (rgb.y - rgb.z)/delta; // Between yellow & magenta
|
|
3985
|
+
else
|
|
3986
|
+
{
|
|
3987
|
+
if (rgb.y >= max) hsv.x = 2.0f + (rgb.z - rgb.x)/delta; // Between cyan & yellow
|
|
3988
|
+
else hsv.x = 4.0f + (rgb.x - rgb.y)/delta; // Between magenta & cyan
|
|
3989
|
+
}
|
|
3990
|
+
|
|
3991
|
+
hsv.x *= 60.0f; // Convert to degrees
|
|
3992
|
+
|
|
3993
|
+
if (hsv.x < 0.0f) hsv.x += 360.0f;
|
|
3994
|
+
|
|
3995
|
+
return hsv;
|
|
3996
|
+
}
|
|
3997
|
+
|
|
3998
|
+
// Convert color data from HSV to RGB
|
|
3999
|
+
// NOTE: Color data should be passed normalized
|
|
4000
|
+
static Vector3 ConvertHSVtoRGB(Vector3 hsv)
|
|
4001
|
+
{
|
|
4002
|
+
Vector3 rgb = { 0 };
|
|
4003
|
+
float hh = 0.0f, p = 0.0f, q = 0.0f, t = 0.0f, ff = 0.0f;
|
|
4004
|
+
long i = 0;
|
|
4005
|
+
|
|
4006
|
+
// NOTE: Comparing float values could not work properly
|
|
4007
|
+
if (hsv.y <= 0.0f)
|
|
4008
|
+
{
|
|
4009
|
+
rgb.x = hsv.z;
|
|
4010
|
+
rgb.y = hsv.z;
|
|
4011
|
+
rgb.z = hsv.z;
|
|
4012
|
+
return rgb;
|
|
4013
|
+
}
|
|
4014
|
+
|
|
4015
|
+
hh = hsv.x;
|
|
4016
|
+
if (hh >= 360.0f) hh = 0.0f;
|
|
4017
|
+
hh /= 60.0f;
|
|
4018
|
+
|
|
4019
|
+
i = (long)hh;
|
|
4020
|
+
ff = hh - i;
|
|
4021
|
+
p = hsv.z*(1.0f - hsv.y);
|
|
4022
|
+
q = hsv.z*(1.0f - (hsv.y*ff));
|
|
4023
|
+
t = hsv.z*(1.0f - (hsv.y*(1.0f - ff)));
|
|
4024
|
+
|
|
4025
|
+
switch (i)
|
|
4026
|
+
{
|
|
4027
|
+
case 0:
|
|
4028
|
+
{
|
|
4029
|
+
rgb.x = hsv.z;
|
|
4030
|
+
rgb.y = t;
|
|
4031
|
+
rgb.z = p;
|
|
4032
|
+
} break;
|
|
4033
|
+
case 1:
|
|
4034
|
+
{
|
|
4035
|
+
rgb.x = q;
|
|
4036
|
+
rgb.y = hsv.z;
|
|
4037
|
+
rgb.z = p;
|
|
4038
|
+
} break;
|
|
4039
|
+
case 2:
|
|
4040
|
+
{
|
|
4041
|
+
rgb.x = p;
|
|
4042
|
+
rgb.y = hsv.z;
|
|
4043
|
+
rgb.z = t;
|
|
4044
|
+
} break;
|
|
4045
|
+
case 3:
|
|
4046
|
+
{
|
|
4047
|
+
rgb.x = p;
|
|
4048
|
+
rgb.y = q;
|
|
4049
|
+
rgb.z = hsv.z;
|
|
4050
|
+
} break;
|
|
4051
|
+
case 4:
|
|
4052
|
+
{
|
|
4053
|
+
rgb.x = t;
|
|
4054
|
+
rgb.y = p;
|
|
4055
|
+
rgb.z = hsv.z;
|
|
4056
|
+
} break;
|
|
4057
|
+
case 5:
|
|
4058
|
+
default:
|
|
4059
|
+
{
|
|
4060
|
+
rgb.x = hsv.z;
|
|
4061
|
+
rgb.y = p;
|
|
4062
|
+
rgb.z = q;
|
|
4063
|
+
} break;
|
|
4064
|
+
}
|
|
4065
|
+
|
|
4066
|
+
return rgb;
|
|
4067
|
+
}
|
|
4068
|
+
|
|
4069
|
+
#if defined(RAYGUI_STANDALONE)
|
|
4070
|
+
// Returns a Color struct from hexadecimal value
|
|
4071
|
+
static Color GetColor(int hexValue)
|
|
4072
|
+
{
|
|
4073
|
+
Color color;
|
|
4074
|
+
|
|
4075
|
+
color.r = (unsigned char)(hexValue >> 24) & 0xFF;
|
|
4076
|
+
color.g = (unsigned char)(hexValue >> 16) & 0xFF;
|
|
4077
|
+
color.b = (unsigned char)(hexValue >> 8) & 0xFF;
|
|
4078
|
+
color.a = (unsigned char)hexValue & 0xFF;
|
|
4079
|
+
|
|
4080
|
+
return color;
|
|
4081
|
+
}
|
|
4082
|
+
|
|
4083
|
+
// Returns hexadecimal value for a Color
|
|
4084
|
+
static int ColorToInt(Color color)
|
|
4085
|
+
{
|
|
4086
|
+
return (((int)color.r << 24) | ((int)color.g << 16) | ((int)color.b << 8) | (int)color.a);
|
|
4087
|
+
}
|
|
4088
|
+
|
|
4089
|
+
// Check if point is inside rectangle
|
|
4090
|
+
static bool CheckCollisionPointRec(Vector2 point, Rectangle rec)
|
|
4091
|
+
{
|
|
4092
|
+
bool collision = false;
|
|
4093
|
+
|
|
4094
|
+
if ((point.x >= rec.x) && (point.x <= (rec.x + rec.width)) &&
|
|
4095
|
+
(point.y >= rec.y) && (point.y <= (rec.y + rec.height))) collision = true;
|
|
4096
|
+
|
|
4097
|
+
return collision;
|
|
4098
|
+
}
|
|
4099
|
+
|
|
4100
|
+
// Color fade-in or fade-out, alpha goes from 0.0f to 1.0f
|
|
4101
|
+
static Color Fade(Color color, float alpha)
|
|
4102
|
+
{
|
|
4103
|
+
if (alpha < 0.0f) alpha = 0.0f;
|
|
4104
|
+
else if (alpha > 1.0f) alpha = 1.0f;
|
|
4105
|
+
|
|
4106
|
+
Color result = { color.r, color.g, color.b, (unsigned char)(255.0f*alpha) };
|
|
4107
|
+
|
|
4108
|
+
return result;
|
|
4109
|
+
}
|
|
4110
|
+
|
|
4111
|
+
// Formatting of text with variables to 'embed'
|
|
4112
|
+
static const char *TextFormat(const char *text, ...)
|
|
4113
|
+
{
|
|
4114
|
+
#define MAX_FORMATTEXT_LENGTH 64
|
|
4115
|
+
|
|
4116
|
+
static char buffer[MAX_FORMATTEXT_LENGTH];
|
|
4117
|
+
|
|
4118
|
+
va_list args;
|
|
4119
|
+
va_start(args, text);
|
|
4120
|
+
vsprintf(buffer, text, args);
|
|
4121
|
+
va_end(args);
|
|
4122
|
+
|
|
4123
|
+
return buffer;
|
|
4124
|
+
}
|
|
4125
|
+
|
|
4126
|
+
// Draw rectangle with vertical gradient fill color
|
|
4127
|
+
// NOTE: This function is only used by GuiColorPicker()
|
|
4128
|
+
static void DrawRectangleGradientV(int posX, int posY, int width, int height, Color color1, Color color2)
|
|
4129
|
+
{
|
|
4130
|
+
Rectangle bounds = { (float)posX, (float)posY, (float)width, (float)height };
|
|
4131
|
+
DrawRectangleGradientEx(bounds, color1, color2, color2, color1);
|
|
4132
|
+
}
|
|
4133
|
+
|
|
4134
|
+
#define TEXTSPLIT_MAX_TEXT_BUFFER_LENGTH 1024 // Size of static buffer: TextSplit()
|
|
4135
|
+
#define TEXTSPLIT_MAX_SUBSTRINGS_COUNT 128 // Size of static pointers array: TextSplit()
|
|
4136
|
+
|
|
4137
|
+
// Split string into multiple strings
|
|
4138
|
+
const char **TextSplit(const char *text, char delimiter, int *count)
|
|
4139
|
+
{
|
|
4140
|
+
// NOTE: Current implementation returns a copy of the provided string with '\0' (string end delimiter)
|
|
4141
|
+
// inserted between strings defined by "delimiter" parameter. No memory is dynamically allocated,
|
|
4142
|
+
// all used memory is static... it has some limitations:
|
|
4143
|
+
// 1. Maximum number of possible split strings is set by TEXTSPLIT_MAX_SUBSTRINGS_COUNT
|
|
4144
|
+
// 2. Maximum size of text to split is TEXTSPLIT_MAX_TEXT_BUFFER_LENGTH
|
|
4145
|
+
|
|
4146
|
+
static const char *result[TEXTSPLIT_MAX_SUBSTRINGS_COUNT] = { NULL };
|
|
4147
|
+
static char buffer[TEXTSPLIT_MAX_TEXT_BUFFER_LENGTH] = { 0 };
|
|
4148
|
+
memset(buffer, 0, TEXTSPLIT_MAX_TEXT_BUFFER_LENGTH);
|
|
4149
|
+
|
|
4150
|
+
result[0] = buffer;
|
|
4151
|
+
int counter = 0;
|
|
4152
|
+
|
|
4153
|
+
if (text != NULL)
|
|
4154
|
+
{
|
|
4155
|
+
counter = 1;
|
|
4156
|
+
|
|
4157
|
+
// Count how many substrings we have on text and point to every one
|
|
4158
|
+
for (int i = 0; i < TEXTSPLIT_MAX_TEXT_BUFFER_LENGTH; i++)
|
|
4159
|
+
{
|
|
4160
|
+
buffer[i] = text[i];
|
|
4161
|
+
if (buffer[i] == '\0') break;
|
|
4162
|
+
else if (buffer[i] == delimiter)
|
|
4163
|
+
{
|
|
4164
|
+
buffer[i] = '\0'; // Set an end of string at this point
|
|
4165
|
+
result[counter] = buffer + i + 1;
|
|
4166
|
+
counter++;
|
|
4167
|
+
|
|
4168
|
+
if (counter == TEXTSPLIT_MAX_SUBSTRINGS_COUNT) break;
|
|
4169
|
+
}
|
|
4170
|
+
}
|
|
4171
|
+
}
|
|
4172
|
+
|
|
4173
|
+
*count = counter;
|
|
4174
|
+
return result;
|
|
4175
|
+
}
|
|
4176
|
+
|
|
4177
|
+
// Get integer value from text
|
|
4178
|
+
// NOTE: This function replaces atoi() [stdlib.h]
|
|
4179
|
+
static int TextToInteger(const char *text)
|
|
4180
|
+
{
|
|
4181
|
+
int value = 0;
|
|
4182
|
+
int sign = 1;
|
|
4183
|
+
|
|
4184
|
+
if ((text[0] == '+') || (text[0] == '-'))
|
|
4185
|
+
{
|
|
4186
|
+
if (text[0] == '-') sign = -1;
|
|
4187
|
+
text++;
|
|
4188
|
+
}
|
|
4189
|
+
|
|
4190
|
+
for (int i = 0; ((text[i] >= '0') && (text[i] <= '9')); ++i) value = value*10 + (int)(text[i] - '0');
|
|
4191
|
+
|
|
4192
|
+
return value*sign;
|
|
4193
|
+
}
|
|
4194
|
+
|
|
4195
|
+
// Encode codepoint into UTF-8 text (char array size returned as parameter)
|
|
4196
|
+
static const char *CodepointToUTF8(int codepoint, int *byteSize)
|
|
4197
|
+
{
|
|
4198
|
+
static char utf8[6] = { 0 };
|
|
4199
|
+
int size = 0;
|
|
4200
|
+
|
|
4201
|
+
if (codepoint <= 0x7f)
|
|
4202
|
+
{
|
|
4203
|
+
utf8[0] = (char)codepoint;
|
|
4204
|
+
size = 1;
|
|
4205
|
+
}
|
|
4206
|
+
else if (codepoint <= 0x7ff)
|
|
4207
|
+
{
|
|
4208
|
+
utf8[0] = (char)(((codepoint >> 6) & 0x1f) | 0xc0);
|
|
4209
|
+
utf8[1] = (char)((codepoint & 0x3f) | 0x80);
|
|
4210
|
+
size = 2;
|
|
4211
|
+
}
|
|
4212
|
+
else if (codepoint <= 0xffff)
|
|
4213
|
+
{
|
|
4214
|
+
utf8[0] = (char)(((codepoint >> 12) & 0x0f) | 0xe0);
|
|
4215
|
+
utf8[1] = (char)(((codepoint >> 6) & 0x3f) | 0x80);
|
|
4216
|
+
utf8[2] = (char)((codepoint & 0x3f) | 0x80);
|
|
4217
|
+
size = 3;
|
|
4218
|
+
}
|
|
4219
|
+
else if (codepoint <= 0x10ffff)
|
|
4220
|
+
{
|
|
4221
|
+
utf8[0] = (char)(((codepoint >> 18) & 0x07) | 0xf0);
|
|
4222
|
+
utf8[1] = (char)(((codepoint >> 12) & 0x3f) | 0x80);
|
|
4223
|
+
utf8[2] = (char)(((codepoint >> 6) & 0x3f) | 0x80);
|
|
4224
|
+
utf8[3] = (char)((codepoint & 0x3f) | 0x80);
|
|
4225
|
+
size = 4;
|
|
4226
|
+
}
|
|
4227
|
+
|
|
4228
|
+
*byteSize = size;
|
|
4229
|
+
|
|
4230
|
+
return utf8;
|
|
4231
|
+
}
|
|
4232
|
+
|
|
4233
|
+
// Get next codepoint in a UTF-8 encoded text, scanning until '\0' is found
|
|
4234
|
+
// When a invalid UTF-8 byte is encountered we exit as soon as possible and a '?'(0x3f) codepoint is returned
|
|
4235
|
+
// Total number of bytes processed are returned as a parameter
|
|
4236
|
+
// NOTE: the standard says U+FFFD should be returned in case of errors
|
|
4237
|
+
// but that character is not supported by the default font in raylib
|
|
4238
|
+
static int GetCodepoint(const char *text, int *bytesProcessed)
|
|
4239
|
+
{
|
|
4240
|
+
/*
|
|
4241
|
+
UTF-8 specs from https://www.ietf.org/rfc/rfc3629.txt
|
|
4242
|
+
|
|
4243
|
+
Char. number range | UTF-8 octet sequence
|
|
4244
|
+
(hexadecimal) | (binary)
|
|
4245
|
+
--------------------+---------------------------------------------
|
|
4246
|
+
0000 0000-0000 007F | 0xxxxxxx
|
|
4247
|
+
0000 0080-0000 07FF | 110xxxxx 10xxxxxx
|
|
4248
|
+
0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx
|
|
4249
|
+
0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
|
|
4250
|
+
*/
|
|
4251
|
+
// NOTE: on decode errors we return as soon as possible
|
|
4252
|
+
|
|
4253
|
+
int code = 0x3f; // Codepoint (defaults to '?')
|
|
4254
|
+
int octet = (unsigned char)(text[0]); // The first UTF8 octet
|
|
4255
|
+
*bytesProcessed = 1;
|
|
4256
|
+
|
|
4257
|
+
if (octet <= 0x7f)
|
|
4258
|
+
{
|
|
4259
|
+
// Only one octet (ASCII range x00-7F)
|
|
4260
|
+
code = text[0];
|
|
4261
|
+
}
|
|
4262
|
+
else if ((octet & 0xe0) == 0xc0)
|
|
4263
|
+
{
|
|
4264
|
+
// Two octets
|
|
4265
|
+
|
|
4266
|
+
// [0]xC2-DF [1]UTF8-tail(x80-BF)
|
|
4267
|
+
unsigned char octet1 = text[1];
|
|
4268
|
+
|
|
4269
|
+
if ((octet1 == '\0') || ((octet1 >> 6) != 2)) { *bytesProcessed = 2; return code; } // Unexpected sequence
|
|
4270
|
+
|
|
4271
|
+
if ((octet >= 0xc2) && (octet <= 0xdf))
|
|
4272
|
+
{
|
|
4273
|
+
code = ((octet & 0x1f) << 6) | (octet1 & 0x3f);
|
|
4274
|
+
*bytesProcessed = 2;
|
|
4275
|
+
}
|
|
4276
|
+
}
|
|
4277
|
+
else if ((octet & 0xf0) == 0xe0)
|
|
4278
|
+
{
|
|
4279
|
+
// Three octets
|
|
4280
|
+
unsigned char octet1 = text[1];
|
|
4281
|
+
unsigned char octet2 = '\0';
|
|
4282
|
+
|
|
4283
|
+
if ((octet1 == '\0') || ((octet1 >> 6) != 2)) { *bytesProcessed = 2; return code; } // Unexpected sequence
|
|
4284
|
+
|
|
4285
|
+
octet2 = text[2];
|
|
4286
|
+
|
|
4287
|
+
if ((octet2 == '\0') || ((octet2 >> 6) != 2)) { *bytesProcessed = 3; return code; } // Unexpected sequence
|
|
4288
|
+
|
|
4289
|
+
// [0]xE0 [1]xA0-BF [2]UTF8-tail(x80-BF)
|
|
4290
|
+
// [0]xE1-EC [1]UTF8-tail [2]UTF8-tail(x80-BF)
|
|
4291
|
+
// [0]xED [1]x80-9F [2]UTF8-tail(x80-BF)
|
|
4292
|
+
// [0]xEE-EF [1]UTF8-tail [2]UTF8-tail(x80-BF)
|
|
4293
|
+
|
|
4294
|
+
if (((octet == 0xe0) && !((octet1 >= 0xa0) && (octet1 <= 0xbf))) ||
|
|
4295
|
+
((octet == 0xed) && !((octet1 >= 0x80) && (octet1 <= 0x9f)))) { *bytesProcessed = 2; return code; }
|
|
4296
|
+
|
|
4297
|
+
if ((octet >= 0xe0) && (0 <= 0xef))
|
|
4298
|
+
{
|
|
4299
|
+
code = ((octet & 0xf) << 12) | ((octet1 & 0x3f) << 6) | (octet2 & 0x3f);
|
|
4300
|
+
*bytesProcessed = 3;
|
|
4301
|
+
}
|
|
4302
|
+
}
|
|
4303
|
+
else if ((octet & 0xf8) == 0xf0)
|
|
4304
|
+
{
|
|
4305
|
+
// Four octets
|
|
4306
|
+
if (octet > 0xf4) return code;
|
|
4307
|
+
|
|
4308
|
+
unsigned char octet1 = text[1];
|
|
4309
|
+
unsigned char octet2 = '\0';
|
|
4310
|
+
unsigned char octet3 = '\0';
|
|
4311
|
+
|
|
4312
|
+
if ((octet1 == '\0') || ((octet1 >> 6) != 2)) { *bytesProcessed = 2; return code; } // Unexpected sequence
|
|
4313
|
+
|
|
4314
|
+
octet2 = text[2];
|
|
4315
|
+
|
|
4316
|
+
if ((octet2 == '\0') || ((octet2 >> 6) != 2)) { *bytesProcessed = 3; return code; } // Unexpected sequence
|
|
4317
|
+
|
|
4318
|
+
octet3 = text[3];
|
|
4319
|
+
|
|
4320
|
+
if ((octet3 == '\0') || ((octet3 >> 6) != 2)) { *bytesProcessed = 4; return code; } // Unexpected sequence
|
|
4321
|
+
|
|
4322
|
+
// [0]xF0 [1]x90-BF [2]UTF8-tail [3]UTF8-tail
|
|
4323
|
+
// [0]xF1-F3 [1]UTF8-tail [2]UTF8-tail [3]UTF8-tail
|
|
4324
|
+
// [0]xF4 [1]x80-8F [2]UTF8-tail [3]UTF8-tail
|
|
4325
|
+
|
|
4326
|
+
if (((octet == 0xf0) && !((octet1 >= 0x90) && (octet1 <= 0xbf))) ||
|
|
4327
|
+
((octet == 0xf4) && !((octet1 >= 0x80) && (octet1 <= 0x8f)))) { *bytesProcessed = 2; return code; } // Unexpected sequence
|
|
4328
|
+
|
|
4329
|
+
if (octet >= 0xf0)
|
|
4330
|
+
{
|
|
4331
|
+
code = ((octet & 0x7) << 18) | ((octet1 & 0x3f) << 12) | ((octet2 & 0x3f) << 6) | (octet3 & 0x3f);
|
|
4332
|
+
*bytesProcessed = 4;
|
|
4333
|
+
}
|
|
4334
|
+
}
|
|
4335
|
+
|
|
4336
|
+
if (code > 0x10ffff) code = 0x3f; // Codepoints after U+10ffff are invalid
|
|
4337
|
+
|
|
4338
|
+
return code;
|
|
4339
|
+
}
|
|
4340
|
+
#endif // RAYGUI_STANDALONE
|
|
4341
|
+
|
|
4342
|
+
#endif // RAYGUI_IMPLEMENTATION
|