Merge branch 'master' into flag-macros
|
|
@ -8,7 +8,7 @@ if(EMSCRIPTEN)
|
||||||
endif()
|
endif()
|
||||||
enum_option(PLATFORM "Desktop;Web;Android;Raspberry Pi;DRM;SDL" "Platform to build for.")
|
enum_option(PLATFORM "Desktop;Web;Android;Raspberry Pi;DRM;SDL" "Platform to build for.")
|
||||||
|
|
||||||
enum_option(OPENGL_VERSION "OFF;4.3;3.3;2.1;1.1;ES 2.0;ES 3.0" "Force a specific OpenGL Version?")
|
enum_option(OPENGL_VERSION "OFF;4.3;3.3;2.1;1.1;ES 2.0;ES 3.0;Software" "Force a specific OpenGL Version?")
|
||||||
|
|
||||||
# Configuration options
|
# Configuration options
|
||||||
option(BUILD_EXAMPLES "Build the examples." ${PROJECT_IS_TOP_LEVEL})
|
option(BUILD_EXAMPLES "Build the examples." ${PROJECT_IS_TOP_LEVEL})
|
||||||
|
|
|
||||||
|
|
@ -158,6 +158,8 @@ if (NOT ${OPENGL_VERSION} MATCHES "OFF")
|
||||||
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
|
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
|
||||||
elseif (${OPENGL_VERSION} MATCHES "ES 3.0")
|
elseif (${OPENGL_VERSION} MATCHES "ES 3.0")
|
||||||
set(GRAPHICS "GRAPHICS_API_OPENGL_ES3")
|
set(GRAPHICS "GRAPHICS_API_OPENGL_ES3")
|
||||||
|
elseif (${OPENGL_VERSION} MATCHES "Software")
|
||||||
|
set(GRAPHICS "GRAPHICS_API_OPENGL_11_SOFTWARE")
|
||||||
endif ()
|
endif ()
|
||||||
if (NOT "${SUGGESTED_GRAPHICS}" STREQUAL "" AND NOT "${SUGGESTED_GRAPHICS}" STREQUAL "${GRAPHICS}")
|
if (NOT "${SUGGESTED_GRAPHICS}" STREQUAL "" AND NOT "${SUGGESTED_GRAPHICS}" STREQUAL "${GRAPHICS}")
|
||||||
message(WARNING "You are overriding the suggested GRAPHICS=${SUGGESTED_GRAPHICS} with ${GRAPHICS}! This may fail.")
|
message(WARNING "You are overriding the suggested GRAPHICS=${SUGGESTED_GRAPHICS} with ${GRAPHICS}! This may fail.")
|
||||||
|
|
|
||||||
|
|
@ -105,6 +105,10 @@ elseif ("${PLATFORM}" STREQUAL "DRM")
|
||||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.c)
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.c)
|
||||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/raylib_opengl_interop.c)
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/raylib_opengl_interop.c)
|
||||||
|
|
||||||
|
elseif ("${OPENGL_VERSION}" STREQUAL "Software")
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.c)
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/raylib_opengl_interop.c)
|
||||||
|
|
||||||
elseif (NOT SUPPORT_GESTURES_SYSTEM)
|
elseif (NOT SUPPORT_GESTURES_SYSTEM)
|
||||||
# Items requiring gestures system
|
# Items requiring gestures system
|
||||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/textures/textures_mouse_painting.c)
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/textures/textures_mouse_painting.c)
|
||||||
|
|
|
||||||
|
|
@ -516,6 +516,7 @@ CORE = \
|
||||||
core/core_custom_logging \
|
core/core_custom_logging \
|
||||||
core/core_drop_files \
|
core/core_drop_files \
|
||||||
core/core_high_dpi \
|
core/core_high_dpi \
|
||||||
|
core/core_input_actions \
|
||||||
core/core_input_gamepad \
|
core/core_input_gamepad \
|
||||||
core/core_input_gestures \
|
core/core_input_gestures \
|
||||||
core/core_input_gestures_testbed \
|
core/core_input_gestures_testbed \
|
||||||
|
|
@ -540,6 +541,7 @@ CORE = \
|
||||||
SHAPES = \
|
SHAPES = \
|
||||||
shapes/shapes_basic_shapes \
|
shapes/shapes_basic_shapes \
|
||||||
shapes/shapes_bouncing_ball \
|
shapes/shapes_bouncing_ball \
|
||||||
|
shapes/shapes_bullet_hell \
|
||||||
shapes/shapes_circle_sector_drawing \
|
shapes/shapes_circle_sector_drawing \
|
||||||
shapes/shapes_collision_area \
|
shapes/shapes_collision_area \
|
||||||
shapes/shapes_colors_palette \
|
shapes/shapes_colors_palette \
|
||||||
|
|
@ -557,7 +559,8 @@ SHAPES = \
|
||||||
shapes/shapes_ring_drawing \
|
shapes/shapes_ring_drawing \
|
||||||
shapes/shapes_rounded_rectangle_drawing \
|
shapes/shapes_rounded_rectangle_drawing \
|
||||||
shapes/shapes_splines_drawing \
|
shapes/shapes_splines_drawing \
|
||||||
shapes/shapes_top_down_lights
|
shapes/shapes_top_down_lights \
|
||||||
|
shapes/shapes_dashed_line
|
||||||
|
|
||||||
TEXTURES = \
|
TEXTURES = \
|
||||||
textures/textures_background_scrolling \
|
textures/textures_background_scrolling \
|
||||||
|
|
@ -606,12 +609,14 @@ TEXT = \
|
||||||
MODELS = \
|
MODELS = \
|
||||||
models/models_animation_gpu_skinning \
|
models/models_animation_gpu_skinning \
|
||||||
models/models_animation_playing \
|
models/models_animation_playing \
|
||||||
|
models/models_basic_voxel \
|
||||||
models/models_billboard_rendering \
|
models/models_billboard_rendering \
|
||||||
models/models_bone_socket \
|
models/models_bone_socket \
|
||||||
models/models_box_collisions \
|
models/models_box_collisions \
|
||||||
models/models_cubicmap_rendering \
|
models/models_cubicmap_rendering \
|
||||||
models/models_first_person_maze \
|
models/models_first_person_maze \
|
||||||
models/models_geometric_shapes \
|
models/models_geometric_shapes \
|
||||||
|
models/models_geometry_textures_cube \
|
||||||
models/models_heightmap_rendering \
|
models/models_heightmap_rendering \
|
||||||
models/models_loading \
|
models/models_loading \
|
||||||
models/models_loading_gltf \
|
models/models_loading_gltf \
|
||||||
|
|
|
||||||
|
|
@ -516,6 +516,7 @@ CORE = \
|
||||||
core/core_custom_logging \
|
core/core_custom_logging \
|
||||||
core/core_drop_files \
|
core/core_drop_files \
|
||||||
core/core_high_dpi \
|
core/core_high_dpi \
|
||||||
|
core/core_input_actions \
|
||||||
core/core_input_gamepad \
|
core/core_input_gamepad \
|
||||||
core/core_input_gestures \
|
core/core_input_gestures \
|
||||||
core/core_input_gestures_testbed \
|
core/core_input_gestures_testbed \
|
||||||
|
|
@ -540,6 +541,7 @@ CORE = \
|
||||||
SHAPES = \
|
SHAPES = \
|
||||||
shapes/shapes_basic_shapes \
|
shapes/shapes_basic_shapes \
|
||||||
shapes/shapes_bouncing_ball \
|
shapes/shapes_bouncing_ball \
|
||||||
|
shapes/shapes_bullet_hell \
|
||||||
shapes/shapes_circle_sector_drawing \
|
shapes/shapes_circle_sector_drawing \
|
||||||
shapes/shapes_collision_area \
|
shapes/shapes_collision_area \
|
||||||
shapes/shapes_colors_palette \
|
shapes/shapes_colors_palette \
|
||||||
|
|
@ -557,7 +559,8 @@ SHAPES = \
|
||||||
shapes/shapes_ring_drawing \
|
shapes/shapes_ring_drawing \
|
||||||
shapes/shapes_rounded_rectangle_drawing \
|
shapes/shapes_rounded_rectangle_drawing \
|
||||||
shapes/shapes_splines_drawing \
|
shapes/shapes_splines_drawing \
|
||||||
shapes/shapes_top_down_lights
|
shapes/shapes_top_down_lights \
|
||||||
|
shapes/shapes_dashed_line
|
||||||
|
|
||||||
TEXTURES = \
|
TEXTURES = \
|
||||||
textures/textures_background_scrolling \
|
textures/textures_background_scrolling \
|
||||||
|
|
@ -606,12 +609,14 @@ TEXT = \
|
||||||
MODELS = \
|
MODELS = \
|
||||||
models/models_animation_gpu_skinning \
|
models/models_animation_gpu_skinning \
|
||||||
models/models_animation_playing \
|
models/models_animation_playing \
|
||||||
|
models/models_basic_voxel \
|
||||||
models/models_billboard_rendering \
|
models/models_billboard_rendering \
|
||||||
models/models_bone_socket \
|
models/models_bone_socket \
|
||||||
models/models_box_collisions \
|
models/models_box_collisions \
|
||||||
models/models_cubicmap_rendering \
|
models/models_cubicmap_rendering \
|
||||||
models/models_first_person_maze \
|
models/models_first_person_maze \
|
||||||
models/models_geometric_shapes \
|
models/models_geometric_shapes \
|
||||||
|
models/models_geometry_textures_cube \
|
||||||
models/models_heightmap_rendering \
|
models/models_heightmap_rendering \
|
||||||
models/models_loading \
|
models/models_loading \
|
||||||
models/models_loading_gltf \
|
models/models_loading_gltf \
|
||||||
|
|
@ -732,6 +737,9 @@ core/core_drop_files: core/core_drop_files.c
|
||||||
core/core_high_dpi: core/core_high_dpi.c
|
core/core_high_dpi: core/core_high_dpi.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
core/core_input_actions: core/core_input_actions.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
core/core_input_gamepad: core/core_input_gamepad.c
|
core/core_input_gamepad: core/core_input_gamepad.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
--preload-file core/resources/ps3.png@resources/ps3.png \
|
--preload-file core/resources/ps3.png@resources/ps3.png \
|
||||||
|
|
@ -802,6 +810,9 @@ shapes/shapes_basic_shapes: shapes/shapes_basic_shapes.c
|
||||||
shapes/shapes_bouncing_ball: shapes/shapes_bouncing_ball.c
|
shapes/shapes_bouncing_ball: shapes/shapes_bouncing_ball.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
shapes/shapes_bullet_hell: shapes/shapes_bullet_hell.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
shapes/shapes_circle_sector_drawing: shapes/shapes_circle_sector_drawing.c
|
shapes/shapes_circle_sector_drawing: shapes/shapes_circle_sector_drawing.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
|
@ -1045,6 +1056,9 @@ models/models_animation_playing: models/models_animation_playing.c
|
||||||
--preload-file models/resources/models/iqm/guytex.png@resources/models/iqm/guytex.png \
|
--preload-file models/resources/models/iqm/guytex.png@resources/models/iqm/guytex.png \
|
||||||
--preload-file models/resources/models/iqm/guyanim.iqm@resources/models/iqm/guyanim.iqm
|
--preload-file models/resources/models/iqm/guyanim.iqm@resources/models/iqm/guyanim.iqm
|
||||||
|
|
||||||
|
models/models_basic_voxel: models/models_basic_voxel.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
models/models_billboard_rendering: models/models_billboard_rendering.c
|
models/models_billboard_rendering: models/models_billboard_rendering.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
--preload-file models/resources/billboard.png@resources/billboard.png
|
--preload-file models/resources/billboard.png@resources/billboard.png
|
||||||
|
|
@ -1072,6 +1086,10 @@ models/models_first_person_maze: models/models_first_person_maze.c
|
||||||
models/models_geometric_shapes: models/models_geometric_shapes.c
|
models/models_geometric_shapes: models/models_geometric_shapes.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
models/models_geometry_textures_cube: models/models_geometry_textures_cube.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
|
--preload-file models/resources/cubicmap_atlas.png@resources/cubicmap_atlas.png
|
||||||
|
|
||||||
models/models_heightmap_rendering: models/models_heightmap_rendering.c
|
models/models_heightmap_rendering: models/models_heightmap_rendering.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||||
--preload-file models/resources/heightmap.png@resources/heightmap.png
|
--preload-file models/resources/heightmap.png@resources/heightmap.png
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,9 @@ You may find it easier to use than other toolchains, especially when it comes to
|
||||||
- `zig build [module]` to compile all examples for a module (e.g. `zig build core`)
|
- `zig build [module]` to compile all examples for a module (e.g. `zig build core`)
|
||||||
- `zig build [example]` to compile _and run_ a particular example (e.g. `zig build core_basic_window`)
|
- `zig build [example]` to compile _and run_ a particular example (e.g. `zig build core_basic_window`)
|
||||||
|
|
||||||
## EXAMPLES COLLECTION [TOTAL: 163]
|
## EXAMPLES COLLECTION [TOTAL: 166]
|
||||||
|
|
||||||
### category: core [37]
|
### category: core [38]
|
||||||
|
|
||||||
Examples using raylib[core](../src/rcore.c) platform functionality like window creation, inputs, drawing modes and system functionality.
|
Examples using raylib[core](../src/rcore.c) platform functionality like window creation, inputs, drawing modes and system functionality.
|
||||||
|
|
||||||
|
|
@ -62,8 +62,9 @@ Examples using raylib[core](../src/rcore.c) platform functionality like window c
|
||||||
| [core_high_dpi](core/core_high_dpi.c) | <img src="core/core_high_dpi.png" alt="core_high_dpi" width="80"> | ⭐⭐☆☆ | 5.0 | 5.5 | [Jonathan Marler](https://github.com/marler8997) |
|
| [core_high_dpi](core/core_high_dpi.c) | <img src="core/core_high_dpi.png" alt="core_high_dpi" width="80"> | ⭐⭐☆☆ | 5.0 | 5.5 | [Jonathan Marler](https://github.com/marler8997) |
|
||||||
| [core_render_texture](core/core_render_texture.c) | <img src="core/core_render_texture.png" alt="core_render_texture" width="80"> | ⭐☆☆☆ | 5.6-dev | 5.6-dev | [Ramon Santamaria](https://github.com/raysan5) |
|
| [core_render_texture](core/core_render_texture.c) | <img src="core/core_render_texture.png" alt="core_render_texture" width="80"> | ⭐☆☆☆ | 5.6-dev | 5.6-dev | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [core_undo_redo](core/core_undo_redo.c) | <img src="core/core_undo_redo.png" alt="core_undo_redo" width="80"> | ⭐⭐⭐☆ | 5.5 | 5.6 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [core_undo_redo](core/core_undo_redo.c) | <img src="core/core_undo_redo.png" alt="core_undo_redo" width="80"> | ⭐⭐⭐☆ | 5.5 | 5.6 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
|
| [core_input_actions](core/core_input_actions.c) | <img src="core/core_input_actions.png" alt="core_input_actions" width="80"> | ⭐⭐☆☆ | 5.5 | 5.6 | [Jett](https://github.com/JettMonstersGoBoom) |
|
||||||
|
|
||||||
### category: shapes [20]
|
### category: shapes [21]
|
||||||
|
|
||||||
Examples using raylib shapes drawing functionality, provided by raylib [shapes](../src/rshapes.c) module.
|
Examples using raylib shapes drawing functionality, provided by raylib [shapes](../src/rshapes.c) module.
|
||||||
|
|
||||||
|
|
@ -71,6 +72,7 @@ Examples using raylib shapes drawing functionality, provided by raylib [shapes](
|
||||||
|-----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
|
|-----------|--------|:-------------------:|:------------------:|:-----------------------:|:----------------------|
|
||||||
| [shapes_basic_shapes](shapes/shapes_basic_shapes.c) | <img src="shapes/shapes_basic_shapes.png" alt="shapes_basic_shapes" width="80"> | ⭐☆☆☆ | 1.0 | 4.2 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [shapes_basic_shapes](shapes/shapes_basic_shapes.c) | <img src="shapes/shapes_basic_shapes.png" alt="shapes_basic_shapes" width="80"> | ⭐☆☆☆ | 1.0 | 4.2 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [shapes_bouncing_ball](shapes/shapes_bouncing_ball.c) | <img src="shapes/shapes_bouncing_ball.png" alt="shapes_bouncing_ball" width="80"> | ⭐☆☆☆ | 2.5 | 2.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [shapes_bouncing_ball](shapes/shapes_bouncing_ball.c) | <img src="shapes/shapes_bouncing_ball.png" alt="shapes_bouncing_ball" width="80"> | ⭐☆☆☆ | 2.5 | 2.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
|
| [shapes_bullet_hell](shapes/shapes_bullet_hell.c) | <img src="shapes/shapes_bullet_hell.png" alt="shapes_bullet_hell" width="80"> | ⭐☆☆☆ | 5.6 | 5.6 | [Zero](https://github.com/zerohorsepower) |
|
||||||
| [shapes_colors_palette](shapes/shapes_colors_palette.c) | <img src="shapes/shapes_colors_palette.png" alt="shapes_colors_palette" width="80"> | ⭐⭐☆☆ | 1.0 | 2.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [shapes_colors_palette](shapes/shapes_colors_palette.c) | <img src="shapes/shapes_colors_palette.png" alt="shapes_colors_palette" width="80"> | ⭐⭐☆☆ | 1.0 | 2.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [shapes_logo_raylib](shapes/shapes_logo_raylib.c) | <img src="shapes/shapes_logo_raylib.png" alt="shapes_logo_raylib" width="80"> | ⭐☆☆☆ | 1.0 | 1.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [shapes_logo_raylib](shapes/shapes_logo_raylib.c) | <img src="shapes/shapes_logo_raylib.png" alt="shapes_logo_raylib" width="80"> | ⭐☆☆☆ | 1.0 | 1.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [shapes_logo_raylib_anim](shapes/shapes_logo_raylib_anim.c) | <img src="shapes/shapes_logo_raylib_anim.png" alt="shapes_logo_raylib_anim" width="80"> | ⭐⭐☆☆ | 2.5 | 4.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [shapes_logo_raylib_anim](shapes/shapes_logo_raylib_anim.c) | <img src="shapes/shapes_logo_raylib_anim.png" alt="shapes_logo_raylib_anim" width="80"> | ⭐⭐☆☆ | 2.5 | 4.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
|
|
@ -89,6 +91,7 @@ Examples using raylib shapes drawing functionality, provided by raylib [shapes](
|
||||||
| [shapes_splines_drawing](shapes/shapes_splines_drawing.c) | <img src="shapes/shapes_splines_drawing.png" alt="shapes_splines_drawing" width="80"> | ⭐⭐⭐☆ | 5.0 | 5.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [shapes_splines_drawing](shapes/shapes_splines_drawing.c) | <img src="shapes/shapes_splines_drawing.png" alt="shapes_splines_drawing" width="80"> | ⭐⭐⭐☆ | 5.0 | 5.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [shapes_digital_clock](shapes/shapes_digital_clock.c) | <img src="shapes/shapes_digital_clock.png" alt="shapes_digital_clock" width="80"> | ⭐⭐⭐⭐️ | 5.5 | 5.6 | [Hamza RAHAL](https://github.com/hmz-rhl) |
|
| [shapes_digital_clock](shapes/shapes_digital_clock.c) | <img src="shapes/shapes_digital_clock.png" alt="shapes_digital_clock" width="80"> | ⭐⭐⭐⭐️ | 5.5 | 5.6 | [Hamza RAHAL](https://github.com/hmz-rhl) |
|
||||||
| [shapes_double_pendulum](shapes/shapes_double_pendulum.c) | <img src="shapes/shapes_double_pendulum.png" alt="shapes_double_pendulum" width="80"> | ⭐⭐☆☆ | 5.5 | 5.5 | [JoeCheong](https://github.com/Joecheong2006) |
|
| [shapes_double_pendulum](shapes/shapes_double_pendulum.c) | <img src="shapes/shapes_double_pendulum.png" alt="shapes_double_pendulum" width="80"> | ⭐⭐☆☆ | 5.5 | 5.5 | [JoeCheong](https://github.com/Joecheong2006) |
|
||||||
|
| [shapes_dashed_line](shapes/shapes_dashed_line.c) | <img src="shapes/shapes_dashed_line.png" alt="shapes_dashed_line" width="80"> | ⭐☆☆☆ | 5.5 | 5.5 | [Luís Almeida](https://github.com/luis605) |
|
||||||
|
|
||||||
### category: textures [26]
|
### category: textures [26]
|
||||||
|
|
||||||
|
|
@ -144,7 +147,7 @@ Examples using raylib text functionality, including sprite fonts loading/generat
|
||||||
| [text_codepoints_loading](text/text_codepoints_loading.c) | <img src="text/text_codepoints_loading.png" alt="text_codepoints_loading" width="80"> | ⭐⭐⭐☆ | 4.2 | 4.2 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [text_codepoints_loading](text/text_codepoints_loading.c) | <img src="text/text_codepoints_loading.png" alt="text_codepoints_loading" width="80"> | ⭐⭐⭐☆ | 4.2 | 4.2 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [text_inline_styling](text/text_inline_styling.c) | <img src="text/text_inline_styling.png" alt="text_inline_styling" width="80"> | ⭐⭐⭐☆ | 5.6-dev | 5.6-dev | [Wagner Barongello](https://github.com/SultansOfCode) |
|
| [text_inline_styling](text/text_inline_styling.c) | <img src="text/text_inline_styling.png" alt="text_inline_styling" width="80"> | ⭐⭐⭐☆ | 5.6-dev | 5.6-dev | [Wagner Barongello](https://github.com/SultansOfCode) |
|
||||||
|
|
||||||
### category: models [23]
|
### category: models [25]
|
||||||
|
|
||||||
Examples using raylib models functionality, including models loading/generation and drawing, provided by raylib [models](../src/rmodels.c) module.
|
Examples using raylib models functionality, including models loading/generation and drawing, provided by raylib [models](../src/rmodels.c) module.
|
||||||
|
|
||||||
|
|
@ -173,6 +176,8 @@ Examples using raylib models functionality, including models loading/generation
|
||||||
| [models_animation_gpu_skinning](models/models_animation_gpu_skinning.c) | <img src="models/models_animation_gpu_skinning.png" alt="models_animation_gpu_skinning" width="80"> | ⭐⭐⭐☆ | 4.5 | 4.5 | [Daniel Holden](https://github.com/orangeduck) |
|
| [models_animation_gpu_skinning](models/models_animation_gpu_skinning.c) | <img src="models/models_animation_gpu_skinning.png" alt="models_animation_gpu_skinning" width="80"> | ⭐⭐⭐☆ | 4.5 | 4.5 | [Daniel Holden](https://github.com/orangeduck) |
|
||||||
| [models_bone_socket](models/models_bone_socket.c) | <img src="models/models_bone_socket.png" alt="models_bone_socket" width="80"> | ⭐⭐⭐⭐️ | 4.5 | 4.5 | [iP](https://github.com/ipzaur) |
|
| [models_bone_socket](models/models_bone_socket.c) | <img src="models/models_bone_socket.png" alt="models_bone_socket" width="80"> | ⭐⭐⭐⭐️ | 4.5 | 4.5 | [iP](https://github.com/ipzaur) |
|
||||||
| [models_tesseract_view](models/models_tesseract_view.c) | <img src="models/models_tesseract_view.png" alt="models_tesseract_view" width="80"> | ⭐⭐☆☆ | 5.6-dev | 5.6-dev | [Timothy van der Valk](https://github.com/arceryz) |
|
| [models_tesseract_view](models/models_tesseract_view.c) | <img src="models/models_tesseract_view.png" alt="models_tesseract_view" width="80"> | ⭐⭐☆☆ | 5.6-dev | 5.6-dev | [Timothy van der Valk](https://github.com/arceryz) |
|
||||||
|
| [models_basic_voxel](models/models_basic_voxel.c) | <img src="models/models_basic_voxel.png" alt="models_basic_voxel" width="80"> | ⭐⭐☆☆ | 5.5 | 5.5 | [Tim Little](https://github.com/timlittle) |
|
||||||
|
| [models_geometry_textures_cube](models/models_geometry_textures_cube.c) | <img src="models/models_geometry_textures_cube.png" alt="models_geometry_textures_cube" width="80"> | ⭐☆☆☆ | 5.6-dev | 5.6-dev | [Jopestpe](https://github.com/jopestpe) |
|
||||||
|
|
||||||
### category: shaders [29]
|
### category: shaders [29]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ int main(void)
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
UpdateCamera(&camera, CAMERA_FREE);
|
UpdateCamera(&camera, CAMERA_FREE);
|
||||||
|
|
||||||
if (IsKeyPressed('Z')) camera.target = (Vector3){ 0.0f, 0.0f, 0.0f };
|
if (IsKeyPressed(KEY_Z)) camera.target = (Vector3){ 0.0f, 0.0f, 0.0f };
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
|
|
|
||||||
112
examples/core/core_delta_time.c
Normal file
|
|
@ -0,0 +1,112 @@
|
||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - delta time
|
||||||
|
*
|
||||||
|
* Example complexity rating: [★☆☆☆] 1/4
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 5.5
|
||||||
|
*
|
||||||
|
* Example contributed by Robin (@RobinsAviary) and reviewed by Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
* BSD-like license that allows static linking with closed source software
|
||||||
|
*
|
||||||
|
* Copyright (c) 2025-2025 Robin (@RobinsAviary)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - delta time");
|
||||||
|
|
||||||
|
int currentFps = 60;
|
||||||
|
|
||||||
|
// Store the position for the both of the circles
|
||||||
|
Vector2 deltaCircle = { 0, (float)screenHeight/3.0f };
|
||||||
|
Vector2 frameCircle = { 0, (float)screenHeight*(2.0f/3.0f) };
|
||||||
|
|
||||||
|
// The speed applied to both circles
|
||||||
|
const float speed = 10.0f;
|
||||||
|
const float circleRadius = 32.0f;
|
||||||
|
|
||||||
|
SetTargetFPS(currentFps);
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Adjust the FPS target based on the mouse wheel
|
||||||
|
float mouseWheel = GetMouseWheelMove();
|
||||||
|
if (mouseWheel != 0)
|
||||||
|
{
|
||||||
|
currentFps += (int)mouseWheel;
|
||||||
|
if (currentFps < 0) currentFps = 0;
|
||||||
|
SetTargetFPS(currentFps);
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetFrameTime() returns the time it took to draw the last frame, in seconds (usually called delta time)
|
||||||
|
// Uses the delta time to make the circle look like it's moving at a "consistent" speed regardless of FPS
|
||||||
|
|
||||||
|
// Multiply by 6.0 (an arbitrary value) in order to make the speed
|
||||||
|
// visually closer to the other circle (at 60 fps), for comparison
|
||||||
|
deltaCircle.x += GetFrameTime()*6.0f*speed;
|
||||||
|
// This circle can move faster or slower visually depending on the FPS
|
||||||
|
frameCircle.x += 0.1f*speed;
|
||||||
|
|
||||||
|
// If either circle is off the screen, reset it back to the start
|
||||||
|
if (deltaCircle.x > screenWidth) deltaCircle.x = 0;
|
||||||
|
if (frameCircle.x > screenWidth) frameCircle.x = 0;
|
||||||
|
|
||||||
|
// Reset both circles positions
|
||||||
|
if (IsKeyPressed(KEY_R))
|
||||||
|
{
|
||||||
|
deltaCircle.x = 0;
|
||||||
|
frameCircle.x = 0;
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
// Draw both circles to the screen
|
||||||
|
DrawCircleV(deltaCircle, circleRadius, RED);
|
||||||
|
DrawCircleV(frameCircle, circleRadius, BLUE);
|
||||||
|
|
||||||
|
// Draw the help text
|
||||||
|
// Determine what help text to show depending on the current FPS target
|
||||||
|
const char *fpsText = 0;
|
||||||
|
if (currentFps <= 0) fpsText = TextFormat("FPS: unlimited (%i)", GetFPS());
|
||||||
|
else fpsText = TextFormat("FPS: %i (target: %i)", GetFPS(), currentFps);
|
||||||
|
DrawText(fpsText, 10, 10, 20, DARKGRAY);
|
||||||
|
DrawText(TextFormat("Frame time: %02.02f ms", GetFrameTime()), 10, 30, 20, DARKGRAY);
|
||||||
|
DrawText("Use the scroll wheel to change the fps limit, r to reset", 10, 50, 20, DARKGRAY);
|
||||||
|
|
||||||
|
// Draw the text above the circles
|
||||||
|
DrawText("FUNC: x += GetFrameTime()*speed", 10, 90, 20, RED);
|
||||||
|
DrawText("FUNC: x += speed", 10, 240, 20, BLUE);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
BIN
examples/core/core_delta_time.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
197
examples/core/core_input_actions.c
Normal file
|
|
@ -0,0 +1,197 @@
|
||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - input actions
|
||||||
|
*
|
||||||
|
* Example complexity rating: [★★☆☆] 2/4
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 5.5, last time updated with raylib 5.6
|
||||||
|
*
|
||||||
|
* Example contributed by Jett (@JettMonstersGoBoom) and reviewed by Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
* BSD-like license that allows static linking with closed source software
|
||||||
|
*
|
||||||
|
* Copyright (c) 2025 Jett (@JettMonstersGoBoom)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
// Simple example for decoding input as actions, allowing remapping of input to different keys or gamepad buttons
|
||||||
|
// For example instead of using `IsKeyDown(KEY_LEFT)`, you can use `IsActionDown(ACTION_LEFT)`
|
||||||
|
// which can be reassigned to e.g. KEY_A and also assigned to a gamepad button. the action will trigger with either gamepad or keys
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Types and Structures Definition
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
typedef enum ActionType {
|
||||||
|
NO_ACTION = 0,
|
||||||
|
ACTION_UP,
|
||||||
|
ACTION_DOWN,
|
||||||
|
ACTION_LEFT,
|
||||||
|
ACTION_RIGHT,
|
||||||
|
ACTION_FIRE,
|
||||||
|
MAX_ACTION
|
||||||
|
} ActionType;
|
||||||
|
|
||||||
|
// Key and button inputs
|
||||||
|
typedef struct ActionInput {
|
||||||
|
int key;
|
||||||
|
int button;
|
||||||
|
} ActionInput;
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Global Variables Definition
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
static int gamepadIndex = 0; // Gamepad default index
|
||||||
|
static ActionInput actionInputs[MAX_ACTION] = { 0 };
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Module Functions Declaration
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
static bool IsActionPressed(int action); // Check action key/button pressed
|
||||||
|
static bool IsActionReleased(int action); // Check action key/button released
|
||||||
|
static bool IsActionDown(int action); // Check action key/button down
|
||||||
|
|
||||||
|
static void SetActionsDefault(void); // Set the "default" keyset
|
||||||
|
static void SetActionsCursor(void); // Set the "alternate" keyset
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - input actions");
|
||||||
|
|
||||||
|
// Set default actions
|
||||||
|
char actionSet = 0;
|
||||||
|
SetActionsDefault();
|
||||||
|
|
||||||
|
Vector2 position = (Vector2){ 400.0f, 200.0f };
|
||||||
|
Vector2 size = (Vector2){ 40.0f, 40.0f };
|
||||||
|
|
||||||
|
SetTargetFPS(60);
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
gamepadIndex = 0; // set this to gamepad being checked
|
||||||
|
if (IsActionDown(ACTION_UP)) position.y -= 2;
|
||||||
|
if (IsActionDown(ACTION_DOWN)) position.y += 2;
|
||||||
|
if (IsActionDown(ACTION_LEFT)) position.x -= 2;
|
||||||
|
if (IsActionDown(ACTION_RIGHT)) position.x += 2;
|
||||||
|
if (IsActionPressed(ACTION_FIRE))
|
||||||
|
{
|
||||||
|
position.x = (screenWidth-size.x)/2;
|
||||||
|
position.y = (screenHeight-size.y)/2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Switch control scheme by pressing TAB
|
||||||
|
if (IsKeyPressed(KEY_TAB))
|
||||||
|
{
|
||||||
|
actionSet = !actionSet;
|
||||||
|
if (actionSet == 0) SetActionsDefault();
|
||||||
|
else SetActionsCursor();
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(GRAY);
|
||||||
|
|
||||||
|
DrawRectangleV(position, size, RED);
|
||||||
|
|
||||||
|
DrawText((actionSet == 0)? "Current input set: WASD (default)" : "Current input set: Cursor", 10, 10, 20, WHITE);
|
||||||
|
DrawText("Use TAB key to toggles Actions keyset", 10, 50, 20, GREEN);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Module Functions Definition
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Check action key/button pressed
|
||||||
|
// NOTE: Combines key pressed and gamepad button pressed in one action
|
||||||
|
static bool IsActionPressed(int action)
|
||||||
|
{
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
if (action < MAX_ACTION) result = (IsKeyPressed(actionInputs[action].key) || IsGamepadButtonPressed(gamepadIndex, actionInputs[action].button));
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check action key/button released
|
||||||
|
// NOTE: Combines key released and gamepad button released in one action
|
||||||
|
static bool IsActionReleased(int action)
|
||||||
|
{
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
if (action < MAX_ACTION) result = (IsKeyReleased(actionInputs[action].key) || IsGamepadButtonReleased(gamepadIndex, actionInputs[action].button));
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check action key/button down
|
||||||
|
// NOTE: Combines key down and gamepad button down in one action
|
||||||
|
static bool IsActionDown(int action)
|
||||||
|
{
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
if (action < MAX_ACTION) result = (IsKeyDown(actionInputs[action].key) || IsGamepadButtonDown(gamepadIndex, actionInputs[action].button));
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the "default" keyset
|
||||||
|
// NOTE: Here WASD and gamepad buttons on the left side for movement
|
||||||
|
static void SetActionsDefault(void)
|
||||||
|
{
|
||||||
|
actionInputs[ACTION_UP].key = KEY_W;
|
||||||
|
actionInputs[ACTION_DOWN].key = KEY_S;
|
||||||
|
actionInputs[ACTION_LEFT].key = KEY_A;
|
||||||
|
actionInputs[ACTION_RIGHT].key = KEY_D;
|
||||||
|
actionInputs[ACTION_FIRE].key = KEY_SPACE;
|
||||||
|
|
||||||
|
actionInputs[ACTION_UP].button = GAMEPAD_BUTTON_LEFT_FACE_UP;
|
||||||
|
actionInputs[ACTION_DOWN].button = GAMEPAD_BUTTON_LEFT_FACE_DOWN;
|
||||||
|
actionInputs[ACTION_LEFT].button = GAMEPAD_BUTTON_LEFT_FACE_LEFT;
|
||||||
|
actionInputs[ACTION_RIGHT].button = GAMEPAD_BUTTON_LEFT_FACE_RIGHT;
|
||||||
|
actionInputs[ACTION_FIRE].button = GAMEPAD_BUTTON_RIGHT_FACE_DOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the "alternate" keyset
|
||||||
|
// NOTE: Here cursor keys and gamepad buttons on the right side for movement
|
||||||
|
static void SetActionsCursor(void)
|
||||||
|
{
|
||||||
|
actionInputs[ACTION_UP].key = KEY_UP;
|
||||||
|
actionInputs[ACTION_DOWN].key = KEY_DOWN;
|
||||||
|
actionInputs[ACTION_LEFT].key = KEY_LEFT;
|
||||||
|
actionInputs[ACTION_RIGHT].key = KEY_RIGHT;
|
||||||
|
actionInputs[ACTION_FIRE].key = KEY_SPACE;
|
||||||
|
|
||||||
|
actionInputs[ACTION_UP].button = GAMEPAD_BUTTON_RIGHT_FACE_UP;
|
||||||
|
actionInputs[ACTION_DOWN].button = GAMEPAD_BUTTON_RIGHT_FACE_DOWN;
|
||||||
|
actionInputs[ACTION_LEFT].button = GAMEPAD_BUTTON_RIGHT_FACE_LEFT;
|
||||||
|
actionInputs[ACTION_RIGHT].button = GAMEPAD_BUTTON_RIGHT_FACE_RIGHT;
|
||||||
|
actionInputs[ACTION_FIRE].button = GAMEPAD_BUTTON_LEFT_FACE_DOWN;
|
||||||
|
}
|
||||||
BIN
examples/core/core_input_actions.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
|
|
@ -72,7 +72,7 @@ int main(void)
|
||||||
DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, DARKGRAY);
|
DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, DARKGRAY);
|
||||||
DrawText("Press 'H' to toggle cursor visibility", 10, 30, 20, DARKGRAY);
|
DrawText("Press 'H' to toggle cursor visibility", 10, 30, 20, DARKGRAY);
|
||||||
|
|
||||||
if (!IsCursorHidden()) DrawText("CURSOR HIDDEN", 20, 60, 20, RED);
|
if (IsCursorHidden()) DrawText("CURSOR HIDDEN", 20, 60, 20, RED);
|
||||||
else DrawText("CURSOR VISIBLE", 20, 60, 20, LIME);
|
else DrawText("CURSOR VISIBLE", 20, 60, 20, LIME);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
|
|
|
||||||
170
examples/core/core_monitor_change.c
Normal file
|
|
@ -0,0 +1,170 @@
|
||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - monitor change
|
||||||
|
*
|
||||||
|
* Example complexity rating: [★☆☆☆] 1/4
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 5.5, last time updated with raylib 5.6
|
||||||
|
*
|
||||||
|
* Example contributed by Maicon Santana (@maiconpintoabreu) and reviewed by Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
* BSD-like license that allows static linking with closed source software
|
||||||
|
*
|
||||||
|
* Copyright (c) 2025-2025 Maicon Santana (@maiconpintoabreu)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#define MAX_MONITORS 10
|
||||||
|
|
||||||
|
// Monitor Details
|
||||||
|
typedef struct Monitor {
|
||||||
|
Vector2 position;
|
||||||
|
char *name;
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
int physicalWidth;
|
||||||
|
int physicalHeight;
|
||||||
|
int refreshRate;
|
||||||
|
} Monitor;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 450;
|
||||||
|
|
||||||
|
Monitor monitors[MAX_MONITORS] = { 0 };
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - monitor change");
|
||||||
|
|
||||||
|
int currentMonitorIndex = GetCurrentMonitor();
|
||||||
|
int monitorCount = 0;
|
||||||
|
|
||||||
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Variables to find the max x and Y to calculate the scale
|
||||||
|
int maxWidth = 1;
|
||||||
|
int maxHeight = 1;
|
||||||
|
|
||||||
|
// Monitor offset is to fix when monitor position x is negative
|
||||||
|
int monitorOffsetX = 0;
|
||||||
|
|
||||||
|
// Rebuild monitors array every frame
|
||||||
|
monitorCount = GetMonitorCount();
|
||||||
|
for (int i = 0; i < monitorCount; i++)
|
||||||
|
{
|
||||||
|
monitors[i] = (Monitor){
|
||||||
|
GetMonitorPosition(i),
|
||||||
|
GetMonitorName(i),
|
||||||
|
GetMonitorWidth(i),
|
||||||
|
GetMonitorHeight(i),
|
||||||
|
GetMonitorPhysicalWidth(i),
|
||||||
|
GetMonitorPhysicalHeight(i),
|
||||||
|
GetMonitorRefreshRate(i)
|
||||||
|
};
|
||||||
|
if (monitors[i].position.x < monitorOffsetX) monitorOffsetX = monitors[i].position.x*-1;
|
||||||
|
|
||||||
|
const int width = monitors[i].position.x + monitors[i].width;
|
||||||
|
const int height = monitors[i].position.y + monitors[i].height;
|
||||||
|
|
||||||
|
if (maxWidth < width) maxWidth = width;
|
||||||
|
if (maxHeight < height) maxHeight = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsKeyPressed(KEY_ENTER) && monitorCount > 1)
|
||||||
|
{
|
||||||
|
currentMonitorIndex += 1;
|
||||||
|
|
||||||
|
// Set index to 0 if the last one
|
||||||
|
if(currentMonitorIndex == monitorCount) currentMonitorIndex = 0;
|
||||||
|
|
||||||
|
SetWindowMonitor(currentMonitorIndex); // Move window to currentMonitorIndex
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Get currentMonitorIndex if manually moved
|
||||||
|
currentMonitorIndex = GetCurrentMonitor();
|
||||||
|
}
|
||||||
|
const Monitor currentMonitor = monitors[currentMonitorIndex];
|
||||||
|
|
||||||
|
float monitorScale = 0.6;
|
||||||
|
|
||||||
|
if(maxHeight > maxWidth + monitorOffsetX) monitorScale *= ((float)screenHeight/(float)maxHeight);
|
||||||
|
else monitorScale *= ((float)screenWidth/(float)(maxWidth + monitorOffsetX));
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
DrawText("Press [Enter] to move window to next monitor available", 20, 20, 20, DARKGRAY);
|
||||||
|
|
||||||
|
DrawRectangleLines(20, 60, screenWidth - 40, screenHeight - 100, DARKGRAY);
|
||||||
|
|
||||||
|
// Draw Monitor Rectangles with information inside
|
||||||
|
for (int i = 0; i < monitorCount; i++)
|
||||||
|
{
|
||||||
|
// Calculate retangle position and size using monitorScale
|
||||||
|
const Rectangle rec = (Rectangle){
|
||||||
|
(monitors[i].position.x + monitorOffsetX) * monitorScale + 140,
|
||||||
|
monitors[i].position.y * monitorScale + 80,
|
||||||
|
monitors[i].width * monitorScale,
|
||||||
|
monitors[i].height * monitorScale
|
||||||
|
};
|
||||||
|
|
||||||
|
// Draw monitor name and information inside the rectangle
|
||||||
|
DrawText(TextFormat("[%i] %s", i, monitors[i].name), rec.x + 10, rec.y + (int)(100*monitorScale), (int)(120*monitorScale), BLUE);
|
||||||
|
DrawText(
|
||||||
|
TextFormat("Resolution: [%ipx x %ipx]\nRefreshRate: [%ihz]\nPhysical Size: [%imm x %imm]\nPosition: %3.0f x %3.0f",
|
||||||
|
monitors[i].width,
|
||||||
|
monitors[i].height,
|
||||||
|
monitors[i].refreshRate,
|
||||||
|
monitors[i].physicalWidth,
|
||||||
|
monitors[i].physicalHeight,
|
||||||
|
monitors[i].position.x,
|
||||||
|
monitors[i].position.y
|
||||||
|
), rec.x + 10, rec.y + (int)(200*monitorScale), (int)(120*monitorScale), DARKGRAY);
|
||||||
|
|
||||||
|
// Highlight current monitor
|
||||||
|
if (i == currentMonitorIndex)
|
||||||
|
{
|
||||||
|
DrawRectangleLinesEx(rec, 5, RED);
|
||||||
|
Vector2 windowPosition = (Vector2){ (GetWindowPosition().x + monitorOffsetX)*monitorScale + 140, GetWindowPosition().y*monitorScale + 80 };
|
||||||
|
|
||||||
|
// Draw window position based on monitors
|
||||||
|
DrawRectangleV(windowPosition, (Vector2){screenWidth * monitorScale, screenHeight * monitorScale}, Fade(GREEN, 0.5));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DrawRectangleLinesEx(rec, 5, GRAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
BIN
examples/core/core_monitor_change.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
|
|
@ -44,8 +44,10 @@ core;core_automation_events;★★★☆;5.0;5.0;2023;2025;"Ramon Santamaria";@r
|
||||||
core;core_high_dpi;★★☆☆;5.0;5.5;2025;2025;"Jonathan Marler";@marler8997
|
core;core_high_dpi;★★☆☆;5.0;5.5;2025;2025;"Jonathan Marler";@marler8997
|
||||||
core;core_render_texture;★☆☆☆;5.6-dev;5.6-dev;2025;2025;"Ramon Santamaria";@raysan5
|
core;core_render_texture;★☆☆☆;5.6-dev;5.6-dev;2025;2025;"Ramon Santamaria";@raysan5
|
||||||
core;core_undo_redo;★★★☆;5.5;5.6;2025;2025;"Ramon Santamaria";@raysan5
|
core;core_undo_redo;★★★☆;5.5;5.6;2025;2025;"Ramon Santamaria";@raysan5
|
||||||
|
core;core_input_actions;★★☆☆;5.5;5.6;2025;2025;"Jett";@JettMonstersGoBoom
|
||||||
shapes;shapes_basic_shapes;★☆☆☆;1.0;4.2;2014;2025;"Ramon Santamaria";@raysan5
|
shapes;shapes_basic_shapes;★☆☆☆;1.0;4.2;2014;2025;"Ramon Santamaria";@raysan5
|
||||||
shapes;shapes_bouncing_ball;★☆☆☆;2.5;2.5;2013;2025;"Ramon Santamaria";@raysan5
|
shapes;shapes_bouncing_ball;★☆☆☆;2.5;2.5;2013;2025;"Ramon Santamaria";@raysan5
|
||||||
|
shapes;shapes_bullet_hell;★☆☆☆;5.6;5.6;2025;2025;"Zero";@zerohorsepower
|
||||||
shapes;shapes_colors_palette;★★☆☆;1.0;2.5;2014;2025;"Ramon Santamaria";@raysan5
|
shapes;shapes_colors_palette;★★☆☆;1.0;2.5;2014;2025;"Ramon Santamaria";@raysan5
|
||||||
shapes;shapes_logo_raylib;★☆☆☆;1.0;1.0;2014;2025;"Ramon Santamaria";@raysan5
|
shapes;shapes_logo_raylib;★☆☆☆;1.0;1.0;2014;2025;"Ramon Santamaria";@raysan5
|
||||||
shapes;shapes_logo_raylib_anim;★★☆☆;2.5;4.0;2014;2025;"Ramon Santamaria";@raysan5
|
shapes;shapes_logo_raylib_anim;★★☆☆;2.5;4.0;2014;2025;"Ramon Santamaria";@raysan5
|
||||||
|
|
@ -64,6 +66,7 @@ shapes;shapes_rectangle_advanced;★★★★;5.5;5.5;2024;2025;"Everton Jr.";@e
|
||||||
shapes;shapes_splines_drawing;★★★☆;5.0;5.0;2023;2025;"Ramon Santamaria";@raysan5
|
shapes;shapes_splines_drawing;★★★☆;5.0;5.0;2023;2025;"Ramon Santamaria";@raysan5
|
||||||
shapes;shapes_digital_clock;★★★★;5.5;5.6;2025;2025;"Hamza RAHAL";@hmz-rhl
|
shapes;shapes_digital_clock;★★★★;5.5;5.6;2025;2025;"Hamza RAHAL";@hmz-rhl
|
||||||
shapes;shapes_double_pendulum;★★☆☆;5.5;5.5;2025;2025;"JoeCheong";@Joecheong2006
|
shapes;shapes_double_pendulum;★★☆☆;5.5;5.5;2025;2025;"JoeCheong";@Joecheong2006
|
||||||
|
shapes;shapes_dashed_line;★☆☆☆;5.5;5.5;2025;2025;"Luís Almeida";@luis605
|
||||||
textures;textures_logo_raylib;★☆☆☆;1.0;1.0;2014;2025;"Ramon Santamaria";@raysan5
|
textures;textures_logo_raylib;★☆☆☆;1.0;1.0;2014;2025;"Ramon Santamaria";@raysan5
|
||||||
textures;textures_srcrec_dstrec;★★★☆;1.3;1.3;2015;2025;"Ramon Santamaria";@raysan5
|
textures;textures_srcrec_dstrec;★★★☆;1.3;1.3;2015;2025;"Ramon Santamaria";@raysan5
|
||||||
textures;textures_image_drawing;★★☆☆;1.4;1.4;2016;2025;"Ramon Santamaria";@raysan5
|
textures;textures_image_drawing;★★☆☆;1.4;1.4;2016;2025;"Ramon Santamaria";@raysan5
|
||||||
|
|
@ -127,6 +130,8 @@ models;models_textured_cube;★★☆☆;4.5;4.5;2022;2025;"Ramon Santamaria";@r
|
||||||
models;models_animation_gpu_skinning;★★★☆;4.5;4.5;2024;2025;"Daniel Holden";@orangeduck
|
models;models_animation_gpu_skinning;★★★☆;4.5;4.5;2024;2025;"Daniel Holden";@orangeduck
|
||||||
models;models_bone_socket;★★★★;4.5;4.5;2024;2025;"iP";@ipzaur
|
models;models_bone_socket;★★★★;4.5;4.5;2024;2025;"iP";@ipzaur
|
||||||
models;models_tesseract_view;★★☆☆;5.6-dev;5.6-dev;2024;2025;"Timothy van der Valk";@arceryz
|
models;models_tesseract_view;★★☆☆;5.6-dev;5.6-dev;2024;2025;"Timothy van der Valk";@arceryz
|
||||||
|
models;models_basic_voxel;★★☆☆;5.5;5.5;2025;2025;"Tim Little";@timlittle
|
||||||
|
models;models_geometry_textures_cube;★☆☆☆;5.6-dev;5.6-dev;2025;2025;"Jopestpe";@jopestpe
|
||||||
shaders;shaders_basic_lighting;★★★★;3.0;4.2;2019;2025;"Chris Camacho";@chriscamacho
|
shaders;shaders_basic_lighting;★★★★;3.0;4.2;2019;2025;"Chris Camacho";@chriscamacho
|
||||||
shaders;shaders_model_shader;★★☆☆;1.3;3.7;2014;2025;"Ramon Santamaria";@raysan5
|
shaders;shaders_model_shader;★★☆☆;1.3;3.7;2014;2025;"Ramon Santamaria";@raysan5
|
||||||
shaders;shaders_shapes_textures;★★☆☆;1.7;3.7;2015;2025;"Ramon Santamaria";@raysan5
|
shaders;shaders_shapes_textures;★★☆☆;1.7;3.7;2015;2025;"Ramon Santamaria";@raysan5
|
||||||
|
|
|
||||||
152
examples/models/models_basic_voxel.c
Normal file
|
|
@ -0,0 +1,152 @@
|
||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [models] example - basic voxel
|
||||||
|
*
|
||||||
|
* Example complexity rating: [★★☆☆] 2/4
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 5.5, last time updated with raylib 5.5
|
||||||
|
*
|
||||||
|
* Example contributed by Tim Little (@timlittle) and reviewed by Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
* BSD-like license that allows static linking with closed source software
|
||||||
|
*
|
||||||
|
* Copyright (c) 2025 Tim Little (@timlittle)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
#include "raymath.h"
|
||||||
|
|
||||||
|
#define WORLD_SIZE 8 // Size of our voxel world (8x8x8 cubes)
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [models] example - basic voxel");
|
||||||
|
|
||||||
|
DisableCursor(); // Lock mouse to window center
|
||||||
|
|
||||||
|
// Define the camera to look into our 3d world (first person)
|
||||||
|
Camera3D camera = { 0 };
|
||||||
|
camera.position = (Vector3){ -2.0f, 0.0f, -2.0f }; // Camera position at ground level
|
||||||
|
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
|
||||||
|
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector
|
||||||
|
camera.fovy = 45.0f; // Camera field-of-view Y
|
||||||
|
camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
|
||||||
|
|
||||||
|
// Create a cube model
|
||||||
|
Mesh cubeMesh = GenMeshCube(1.0f, 1.0f, 1.0f); // Create a unit cube mesh
|
||||||
|
Model cubeModel = LoadModelFromMesh(cubeMesh); // Convert mesh to a model
|
||||||
|
cubeModel.materials[0].maps[MATERIAL_MAP_DIFFUSE].color = BEIGE;
|
||||||
|
|
||||||
|
// Initialize voxel world - fill with voxels
|
||||||
|
bool voxels[WORLD_SIZE][WORLD_SIZE][WORLD_SIZE] = { false };
|
||||||
|
for (int x = 0; x < WORLD_SIZE; x++)
|
||||||
|
{
|
||||||
|
for (int y = 0; y < WORLD_SIZE; y++)
|
||||||
|
{
|
||||||
|
for (int z = 0; z < WORLD_SIZE; z++)
|
||||||
|
{
|
||||||
|
voxels[x][y][z] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SetTargetFPS(60);
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
UpdateCamera(&camera, CAMERA_FIRST_PERSON);
|
||||||
|
|
||||||
|
// Handle voxel removal with mouse click
|
||||||
|
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
|
||||||
|
{
|
||||||
|
// Cast a ray from the screen center (where crosshair would be)
|
||||||
|
Vector2 screenCenter = { screenWidth/2.0f, screenHeight/2.0f };
|
||||||
|
Ray ray = GetMouseRay(screenCenter, camera);
|
||||||
|
|
||||||
|
// Check ray collision with all voxels
|
||||||
|
bool voxelRemoved = false;
|
||||||
|
for (int x = 0; (x < WORLD_SIZE) && !voxelRemoved; x++)
|
||||||
|
{
|
||||||
|
for (int y = 0; (y < WORLD_SIZE) && !voxelRemoved; y++)
|
||||||
|
{
|
||||||
|
for (int z = 0; (z < WORLD_SIZE) && !voxelRemoved; z++)
|
||||||
|
{
|
||||||
|
if (!voxels[x][y][z]) continue; // Skip empty voxels
|
||||||
|
|
||||||
|
// Build a bounding box for this voxel
|
||||||
|
Vector3 position = { x, y, z };
|
||||||
|
BoundingBox box = {
|
||||||
|
(Vector3){ position.x - 0.5f, position.y - 0.5f, position.z - 0.5f },
|
||||||
|
(Vector3){ position.x + 0.5f, position.y + 0.5f, position.z + 0.5f }
|
||||||
|
};
|
||||||
|
|
||||||
|
// Check ray-box collision
|
||||||
|
RayCollision collision = GetRayCollisionBox(ray, box);
|
||||||
|
if (collision.hit)
|
||||||
|
{
|
||||||
|
voxels[x][y][z] = false; // Remove this voxel
|
||||||
|
voxelRemoved = true; // Exit all loops
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
BeginMode3D(camera);
|
||||||
|
|
||||||
|
DrawGrid(10, 1.0f);
|
||||||
|
|
||||||
|
// Draw all voxels
|
||||||
|
for (int x = 0; x < WORLD_SIZE; x++)
|
||||||
|
{
|
||||||
|
for (int y = 0; y < WORLD_SIZE; y++)
|
||||||
|
{
|
||||||
|
for (int z = 0; z < WORLD_SIZE; z++)
|
||||||
|
{
|
||||||
|
if (!voxels[x][y][z]) continue;
|
||||||
|
|
||||||
|
Vector3 position = { x, y, z };
|
||||||
|
DrawModel(cubeModel, position, 1.0f, BEIGE);
|
||||||
|
DrawCubeWires(position, 1.0f, 1.0f, 1.0f, BLACK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
EndMode3D();
|
||||||
|
|
||||||
|
DrawText("Left-click a voxel to remove it!", 10, 10, 20, DARKGRAY);
|
||||||
|
DrawText("WASD to move, mouse to look around", 10, 35, 10, GRAY);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
UnloadModel(cubeModel);
|
||||||
|
CloseWindow();
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
BIN
examples/models/models_basic_voxel.png
Normal file
|
After Width: | Height: | Size: 341 KiB |
88
examples/models/models_geometry_textures_cube.c
Normal file
|
|
@ -0,0 +1,88 @@
|
||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [models] example - geometry textures cube
|
||||||
|
*
|
||||||
|
* Example complexity rating: [★☆☆☆] 1/4
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 5.6-dev, last time updated with raylib 5.6-dev
|
||||||
|
*
|
||||||
|
* Example contributed by Jopestpe (@jopestpe)
|
||||||
|
*
|
||||||
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
* BSD-like license that allows static linking with closed source software
|
||||||
|
*
|
||||||
|
* Copyright (c) 2025-2025 Jopestpe (@jopestpe)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [models] example - geometry textures cube");
|
||||||
|
|
||||||
|
// Define the camera to look into our 3d world
|
||||||
|
Camera camera = { 0 };
|
||||||
|
camera.position = (Vector3){ 0.0f, 0.0f, 4.0f };
|
||||||
|
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f };
|
||||||
|
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f };
|
||||||
|
camera.fovy = 45.0f;
|
||||||
|
camera.projection = CAMERA_PERSPECTIVE;
|
||||||
|
|
||||||
|
// Load image to create texture for the cube
|
||||||
|
Model model = LoadModelFromMesh(GenMeshCube(1.0f, 1.0f, 1.0f));
|
||||||
|
Image img = LoadImage("resources/cubicmap_atlas.png");
|
||||||
|
Image crop = ImageFromImage(img, (Rectangle){0, img.height/2, img.width/2, img.height/2});
|
||||||
|
Texture2D texture = LoadTextureFromImage(crop);
|
||||||
|
UnloadImage(img);
|
||||||
|
UnloadImage(crop);
|
||||||
|
|
||||||
|
model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture;
|
||||||
|
|
||||||
|
float rotation = 0.0f;
|
||||||
|
|
||||||
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
rotation += 1.0f;
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
BeginMode3D(camera);
|
||||||
|
|
||||||
|
DrawModelEx(model, (Vector3){0,0,0}, (Vector3){0.5f,1,0}, rotation, (Vector3){1,1,1}, WHITE);
|
||||||
|
|
||||||
|
EndMode3D();
|
||||||
|
|
||||||
|
DrawFPS(10, 10);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
UnloadTexture(texture); // Unload texture
|
||||||
|
UnloadModel(model); // Unload model
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
BIN
examples/models/models_geometry_textures_cube.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
80
examples/shaders/resources/shaders/glsl100/ascii.fs
Normal file
|
|
@ -0,0 +1,80 @@
|
||||||
|
#version 100
|
||||||
|
|
||||||
|
precision mediump float;
|
||||||
|
|
||||||
|
// Input from the vertex shader
|
||||||
|
varying vec2 fragTexCoord;
|
||||||
|
|
||||||
|
// Output color for the screen
|
||||||
|
varying vec4 finalColor;
|
||||||
|
|
||||||
|
uniform sampler2D texture0;
|
||||||
|
uniform vec2 resolution;
|
||||||
|
|
||||||
|
// Fontsize less then 9 may be not complete
|
||||||
|
uniform float fontSize;
|
||||||
|
|
||||||
|
float GreyScale(in vec3 col)
|
||||||
|
{
|
||||||
|
return dot(col, vec3(0.2126, 0.7152, 0.0722));
|
||||||
|
}
|
||||||
|
|
||||||
|
float GetCharacter(float n, vec2 p)
|
||||||
|
{
|
||||||
|
p = floor(p*vec2(-4.0, 4.0) + 2.5);
|
||||||
|
|
||||||
|
// Check if the calculated coordinate is inside the 5x5 grid (from 0.0 to 4.0)
|
||||||
|
if (clamp(p.x, 0.0, 4.0) == p.x && clamp(p.y, 0.0, 4.0) == p.y)
|
||||||
|
{
|
||||||
|
float a = floor(p.x + 0.5) + 5.0*floor(p.y + 0.5);
|
||||||
|
|
||||||
|
// This checked if the 'a'-th bit of 'n' was set
|
||||||
|
float shiftedN = floor(n/pow(2.0, a));
|
||||||
|
|
||||||
|
if (mod(shiftedN, 2.0) == 1.0)
|
||||||
|
{
|
||||||
|
return 1.0; // The bit is on
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0.0; // The bit is off, or we are outside the grid
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Main shader logic
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec2 charPixelSize = vec2(fontSize, fontSize);
|
||||||
|
vec2 uvCellSize = charPixelSize/resolution;
|
||||||
|
|
||||||
|
// The cell size is based on the fontSize set by application
|
||||||
|
vec2 cellUV = floor(fragTexCoord/uvCellSize)*uvCellSize;
|
||||||
|
|
||||||
|
vec3 cellColor = texture2D(texture0, cellUV).rgb;
|
||||||
|
|
||||||
|
// Gray is used to define what character will be selected to draw
|
||||||
|
float gray = GreyScale(cellColor);
|
||||||
|
|
||||||
|
float n = 4096.0;
|
||||||
|
|
||||||
|
// Character set from https://www.shadertoy.com/view/lssGDj
|
||||||
|
// Create new bitmaps https://thrill-project.com/archiv/coding/bitmap/
|
||||||
|
if (gray > 0.2) n = 65600.0; // :
|
||||||
|
if (gray > 0.3) n = 18725316.0; // v
|
||||||
|
if (gray > 0.4) n = 15255086.0; // o
|
||||||
|
if (gray > 0.5) n = 13121101.0; // &
|
||||||
|
if (gray > 0.6) n = 15252014.0; // 8
|
||||||
|
if (gray > 0.7) n = 13195790.0; // @
|
||||||
|
if (gray > 0.8) n = 11512810.0; // #
|
||||||
|
|
||||||
|
vec2 localUV = (fragTexCoord - cellUV)/uvCellSize; // Range [0.0, 1.0]
|
||||||
|
|
||||||
|
vec2 p = localUV*2.0 - 1.0; // Range [-1.0, 1.0]
|
||||||
|
|
||||||
|
// cellColor and charShape will define the color of the char
|
||||||
|
vec3 color = cellColor*GetCharacter(n, p);
|
||||||
|
|
||||||
|
gl_FragColor = vec4(color, 1.0);
|
||||||
|
}
|
||||||
78
examples/shaders/resources/shaders/glsl120/ascii.fs
Normal file
|
|
@ -0,0 +1,78 @@
|
||||||
|
#version 120
|
||||||
|
|
||||||
|
// Input from the vertex shader
|
||||||
|
varying vec2 fragTexCoord;
|
||||||
|
|
||||||
|
// Output color for the screen
|
||||||
|
varying vec4 finalColor;
|
||||||
|
|
||||||
|
uniform sampler2D texture0;
|
||||||
|
uniform vec2 resolution;
|
||||||
|
|
||||||
|
// Fontsize less then 9 may be not complete
|
||||||
|
uniform float fontSize;
|
||||||
|
|
||||||
|
float GreyScale(in vec3 col)
|
||||||
|
{
|
||||||
|
return dot(col, vec3(0.2126, 0.7152, 0.0722));
|
||||||
|
}
|
||||||
|
|
||||||
|
float GetCharacter(float n, vec2 p)
|
||||||
|
{
|
||||||
|
p = floor(p*vec2(-4.0, 4.0) + 2.5);
|
||||||
|
|
||||||
|
// Check if the calculated coordinate is inside the 5x5 grid (from 0.0 to 4.0)
|
||||||
|
if (clamp(p.x, 0.0, 4.0) == p.x && clamp(p.y, 0.0, 4.0) == p.y)
|
||||||
|
{
|
||||||
|
float a = floor(p.x + 0.5) + 5.0*floor(p.y + 0.5);
|
||||||
|
|
||||||
|
// This checked if the 'a'-th bit of 'n' was set
|
||||||
|
float shiftedN = floor(n/pow(2.0, a));
|
||||||
|
|
||||||
|
if (mod(shiftedN, 2.0) == 1.0)
|
||||||
|
{
|
||||||
|
return 1.0; // The bit is on
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0.0; // The bit is off, or we are outside the grid
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Main shader logic
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec2 charPixelSize = vec2(fontSize, fontSize);
|
||||||
|
vec2 uvCellSize = charPixelSize / resolution;
|
||||||
|
|
||||||
|
// The cell size is based on the fontSize set by application
|
||||||
|
vec2 cellUV = floor(fragTexCoord / uvCellSize)*uvCellSize;
|
||||||
|
|
||||||
|
vec3 cellColor = texture2D(texture0, cellUV).rgb;
|
||||||
|
|
||||||
|
// Gray is used to define what character will be selected to draw
|
||||||
|
float gray = GreyScale(cellColor);
|
||||||
|
|
||||||
|
float n = 4096.0;
|
||||||
|
|
||||||
|
// Character set from https://www.shadertoy.com/view/lssGDj
|
||||||
|
// Create new bitmaps https://thrill-project.com/archiv/coding/bitmap/
|
||||||
|
if (gray > 0.2) n = 65600.0; // :
|
||||||
|
if (gray > 0.3) n = 18725316.0; // v
|
||||||
|
if (gray > 0.4) n = 15255086.0; // o
|
||||||
|
if (gray > 0.5) n = 13121101.0; // &
|
||||||
|
if (gray > 0.6) n = 15252014.0; // 8
|
||||||
|
if (gray > 0.7) n = 13195790.0; // @
|
||||||
|
if (gray > 0.8) n = 11512810.0; // #
|
||||||
|
|
||||||
|
vec2 localUV = (fragTexCoord - cellUV)/uvCellSize; // Range [0.0, 1.0]
|
||||||
|
|
||||||
|
vec2 p = localUV*2.0 - 1.0; // Range [-1.0, 1.0]
|
||||||
|
|
||||||
|
// cellColor and charShape will define the color of the char
|
||||||
|
vec3 color = cellColor*GetCharacter(n, p);
|
||||||
|
|
||||||
|
gl_FragColor = vec4(color, 1.0);
|
||||||
|
}
|
||||||
73
examples/shaders/resources/shaders/glsl330/ascii.fs
Normal file
|
|
@ -0,0 +1,73 @@
|
||||||
|
#version 330
|
||||||
|
|
||||||
|
// Input from the vertex shader
|
||||||
|
in vec2 fragTexCoord;
|
||||||
|
|
||||||
|
// Output color for the screen
|
||||||
|
out vec4 finalColor;
|
||||||
|
|
||||||
|
uniform sampler2D texture0;
|
||||||
|
uniform vec2 resolution;
|
||||||
|
|
||||||
|
// Fontsize less then 9 may be not complete
|
||||||
|
uniform float fontSize;
|
||||||
|
|
||||||
|
float GreyScale(in vec3 col)
|
||||||
|
{
|
||||||
|
return dot(col, vec3(0.2126, 0.7152, 0.0722));
|
||||||
|
}
|
||||||
|
|
||||||
|
float GetCharacter(int n, vec2 p)
|
||||||
|
{
|
||||||
|
p = floor(p*vec2(-4.0, 4.0) + 2.5);
|
||||||
|
|
||||||
|
// Check if the coordinate is inside the 5x5 grid (0 to 4)
|
||||||
|
if (clamp(p.x, 0.0, 4.0) == p.x && clamp(p.y, 0.0, 4.0) == p.y)
|
||||||
|
{
|
||||||
|
int a = int(round(p.x) + 5.0*round(p.y));
|
||||||
|
if (((n >> a) & 1) == 1)
|
||||||
|
{
|
||||||
|
return 1.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0.0; // The bit is off, or we are outside the grid
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Main shader logic
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec2 charPixelSize = vec2(fontSize, fontSize);
|
||||||
|
vec2 uvCellSize = charPixelSize/resolution;
|
||||||
|
|
||||||
|
// The cell size is based on the fontSize set by application
|
||||||
|
vec2 cellUV = floor(fragTexCoord/uvCellSize)*uvCellSize;
|
||||||
|
|
||||||
|
vec3 cellColor = texture(texture0, cellUV).rgb;
|
||||||
|
|
||||||
|
// Gray is used to define what character will be selected to draw
|
||||||
|
float gray = GreyScale(cellColor);
|
||||||
|
|
||||||
|
int n = 4096;
|
||||||
|
|
||||||
|
// Character set from https://www.shadertoy.com/view/lssGDj
|
||||||
|
// Create new bitmaps https://thrill-project.com/archiv/coding/bitmap/
|
||||||
|
if (gray > 0.2) n = 65600; // :
|
||||||
|
if (gray > 0.3) n = 18725316; // v
|
||||||
|
if (gray > 0.4) n = 15255086; // o
|
||||||
|
if (gray > 0.5) n = 13121101; // &
|
||||||
|
if (gray > 0.6) n = 15252014; // 8
|
||||||
|
if (gray > 0.7) n = 13195790; // @
|
||||||
|
if (gray > 0.8) n = 11512810; // #
|
||||||
|
|
||||||
|
vec2 localUV = (fragTexCoord - cellUV)/uvCellSize; // Range [0.0, 1.0]
|
||||||
|
|
||||||
|
vec2 p = localUV*2.0 - 1.0; // Range [-1.0, 1.0]
|
||||||
|
|
||||||
|
vec3 color = cellColor*GetCharacter(n, p);
|
||||||
|
|
||||||
|
finalColor = vec4(color, 1.0);
|
||||||
|
}
|
||||||
121
examples/shaders/shaders_ascii_rendering.c
Normal file
|
|
@ -0,0 +1,121 @@
|
||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [shaders] example - ascii rendering
|
||||||
|
*
|
||||||
|
* Example complexity rating: [★★☆☆] 2/4
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 5.5, last time updated with raylib 5.6
|
||||||
|
*
|
||||||
|
* Example contributed by Maicon Santana (@maiconpintoabreu) and reviewed by Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
* BSD-like license that allows static linking with closed source software
|
||||||
|
*
|
||||||
|
* Copyright (c) 2025-2025 Maicon Santana (@maiconpintoabreu)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#if defined(PLATFORM_DESKTOP)
|
||||||
|
#define GLSL_VERSION 330
|
||||||
|
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||||
|
#define GLSL_VERSION 100
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [shaders] example - ascii rendering");
|
||||||
|
|
||||||
|
// Texture to test static drawing
|
||||||
|
Texture2D fudesumi = LoadTexture("resources/fudesumi.png");
|
||||||
|
// Texture to test moving drawing
|
||||||
|
Texture2D raysan = LoadTexture("resources/raysan.png");
|
||||||
|
|
||||||
|
// Load shader to be used on postprocessing
|
||||||
|
Shader shader = LoadShader(0, TextFormat("resources/shaders/glsl%i/ascii.fs", GLSL_VERSION));
|
||||||
|
|
||||||
|
// These locations are used to send data to the GPU
|
||||||
|
int resolutionLoc = GetShaderLocation(shader, "resolution");
|
||||||
|
int fontSizeLoc = GetShaderLocation(shader, "fontSize");
|
||||||
|
|
||||||
|
// Set the character size for the ASCII effect
|
||||||
|
// Fontsize should be 9 or more
|
||||||
|
float fontSize = 9.0f;
|
||||||
|
|
||||||
|
// Send the updated values to the shader
|
||||||
|
float resolution[2] = { (float)screenWidth, (float)screenHeight };
|
||||||
|
SetShaderValue(shader, resolutionLoc, resolution, SHADER_UNIFORM_VEC2);
|
||||||
|
|
||||||
|
Vector2 circlePos = (Vector2){40.0f, (float)screenHeight*0.5f};
|
||||||
|
float circleSpeed = 1.0f;
|
||||||
|
|
||||||
|
// RenderTexture to apply the postprocessing later
|
||||||
|
RenderTexture2D target = LoadRenderTexture(screenWidth, screenHeight);
|
||||||
|
|
||||||
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
circlePos.x += circleSpeed;
|
||||||
|
if ((circlePos.x > 200.0f) || (circlePos.x < 40.0f)) circleSpeed *= -1; // Revert speed
|
||||||
|
|
||||||
|
if (IsKeyPressed(KEY_LEFT) && (fontSize > 9.0)) fontSize -= 1; // Reduce fontSize
|
||||||
|
if (IsKeyPressed(KEY_RIGHT) && (fontSize < 15.0)) fontSize += 1; // Increase fontSize
|
||||||
|
|
||||||
|
// Set fontsize for the shader
|
||||||
|
SetShaderValue(shader, fontSizeLoc, &fontSize, SHADER_UNIFORM_FLOAT);
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginTextureMode(target);
|
||||||
|
ClearBackground(WHITE);
|
||||||
|
|
||||||
|
// Draw scene in our render texture
|
||||||
|
DrawTexture(fudesumi, 500, -30, WHITE);
|
||||||
|
DrawTextureV(raysan, circlePos, WHITE);
|
||||||
|
EndTextureMode();
|
||||||
|
|
||||||
|
BeginDrawing();
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
BeginShaderMode(shader);
|
||||||
|
// Draw the scene texture (that we rendered earlier) to the screen
|
||||||
|
// The shader will process every pixel of this texture
|
||||||
|
DrawTextureRec(target.texture,
|
||||||
|
(Rectangle){ 0, 0, (float)target.texture.width, (float)-target.texture.height },
|
||||||
|
(Vector2){ 0, 0 }, WHITE);
|
||||||
|
EndShaderMode();
|
||||||
|
|
||||||
|
DrawRectangle(0, 0, screenWidth, 40, BLACK);
|
||||||
|
DrawText(TextFormat("Ascii effect - FontSize:%2.0f - [Left] -1 [Right] +1 ", fontSize), 120, 10, 20, LIGHTGRAY);
|
||||||
|
DrawFPS(10, 10);
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
UnloadRenderTexture(target); // Unload render texture
|
||||||
|
|
||||||
|
UnloadShader(shader); // Unload shader
|
||||||
|
UnloadTexture(fudesumi); // Unload texture
|
||||||
|
UnloadTexture(raysan); // Unload texture
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
BIN
examples/shaders/shaders_ascii_rendering.png
Normal file
|
After Width: | Height: | Size: 42 KiB |
|
|
@ -4,7 +4,9 @@
|
||||||
*
|
*
|
||||||
* Example complexity rating: [★☆☆☆] 1/4
|
* Example complexity rating: [★☆☆☆] 1/4
|
||||||
*
|
*
|
||||||
* Example originally created with raylib 2.5, last time updated with raylib 2.5
|
* Example originally created with raylib 2.5, last time updated with raylib 5.6
|
||||||
|
*
|
||||||
|
* Example contributed by Jopestpe (@jopestpe)
|
||||||
*
|
*
|
||||||
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
* BSD-like license that allows static linking with closed source software
|
* BSD-like license that allows static linking with closed source software
|
||||||
|
|
@ -31,7 +33,9 @@ int main(void)
|
||||||
Vector2 ballPosition = { GetScreenWidth()/2.0f, GetScreenHeight()/2.0f };
|
Vector2 ballPosition = { GetScreenWidth()/2.0f, GetScreenHeight()/2.0f };
|
||||||
Vector2 ballSpeed = { 5.0f, 4.0f };
|
Vector2 ballSpeed = { 5.0f, 4.0f };
|
||||||
int ballRadius = 20;
|
int ballRadius = 20;
|
||||||
|
float gravity = 0.2f;
|
||||||
|
|
||||||
|
bool useGravity = true;
|
||||||
bool pause = 0;
|
bool pause = 0;
|
||||||
int framesCounter = 0;
|
int framesCounter = 0;
|
||||||
|
|
||||||
|
|
@ -43,6 +47,7 @@ int main(void)
|
||||||
{
|
{
|
||||||
// Update
|
// Update
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
|
if (IsKeyPressed(KEY_G)) useGravity = !useGravity;
|
||||||
if (IsKeyPressed(KEY_SPACE)) pause = !pause;
|
if (IsKeyPressed(KEY_SPACE)) pause = !pause;
|
||||||
|
|
||||||
if (!pause)
|
if (!pause)
|
||||||
|
|
@ -50,9 +55,11 @@ int main(void)
|
||||||
ballPosition.x += ballSpeed.x;
|
ballPosition.x += ballSpeed.x;
|
||||||
ballPosition.y += ballSpeed.y;
|
ballPosition.y += ballSpeed.y;
|
||||||
|
|
||||||
|
if (useGravity) ballSpeed.y += gravity;
|
||||||
|
|
||||||
// Check walls collision for bouncing
|
// Check walls collision for bouncing
|
||||||
if ((ballPosition.x >= (GetScreenWidth() - ballRadius)) || (ballPosition.x <= ballRadius)) ballSpeed.x *= -1.0f;
|
if ((ballPosition.x >= (GetScreenWidth() - ballRadius)) || (ballPosition.x <= ballRadius)) ballSpeed.x *= -1.0f;
|
||||||
if ((ballPosition.y >= (GetScreenHeight() - ballRadius)) || (ballPosition.y <= ballRadius)) ballSpeed.y *= -1.0f;
|
if ((ballPosition.y >= (GetScreenHeight() - ballRadius)) || (ballPosition.y <= ballRadius)) ballSpeed.y *= -0.95f;
|
||||||
}
|
}
|
||||||
else framesCounter++;
|
else framesCounter++;
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
|
|
@ -66,6 +73,9 @@ int main(void)
|
||||||
DrawCircleV(ballPosition, (float)ballRadius, MAROON);
|
DrawCircleV(ballPosition, (float)ballRadius, MAROON);
|
||||||
DrawText("PRESS SPACE to PAUSE BALL MOVEMENT", 10, GetScreenHeight() - 25, 20, LIGHTGRAY);
|
DrawText("PRESS SPACE to PAUSE BALL MOVEMENT", 10, GetScreenHeight() - 25, 20, LIGHTGRAY);
|
||||||
|
|
||||||
|
if (useGravity) DrawText("GRAVITY: ON (Press G to disable)", 10, GetScreenHeight() - 50, 20, DARKGREEN);
|
||||||
|
else DrawText("GRAVITY: OFF (Press G to enable)", 10, GetScreenHeight() - 50, 20, RED);
|
||||||
|
|
||||||
// On pause, we draw a blinking message
|
// On pause, we draw a blinking message
|
||||||
if (pause && ((framesCounter/30)%2)) DrawText("PAUSED", 350, 200, 30, GRAY);
|
if (pause && ((framesCounter/30)%2)) DrawText("PAUSED", 350, 200, 30, GRAY);
|
||||||
|
|
||||||
|
|
|
||||||
248
examples/shapes/shapes_bullet_hell.c
Normal file
|
|
@ -0,0 +1,248 @@
|
||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [shapes] example - bullet hell
|
||||||
|
*
|
||||||
|
* Example complexity rating: [★☆☆☆] 1/4
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 5.6, last time updated with raylib 5.6
|
||||||
|
*
|
||||||
|
* Example contributed by Zero (@zerohorsepower) and reviewed by Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
* BSD-like license that allows static linking with closed source software
|
||||||
|
*
|
||||||
|
* Copyright (c) 2025-2025 Zero (@zerohorsepower)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#include <stdlib.h> // Required for: calloc(), free()
|
||||||
|
#include <math.h> // Required for: cosf(), sinf()
|
||||||
|
|
||||||
|
#define MAX_BULLETS 500000 // Max bullets to be processed
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Types and Structures Definition
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
typedef struct Bullet {
|
||||||
|
Vector2 position; // Bullet position on screen
|
||||||
|
Vector2 acceleration; // Amount of pixels to be incremented to position every frame
|
||||||
|
bool disabled; // Skip processing and draw case out of screen
|
||||||
|
Color color; // Bullet color
|
||||||
|
} Bullet;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - bullet hell");
|
||||||
|
|
||||||
|
// Bullets definition
|
||||||
|
Bullet *bullets = (Bullet *)RL_CALLOC(MAX_BULLETS, sizeof(Bullet)); // Bullets array
|
||||||
|
int bulletCount = 0;
|
||||||
|
int bulletDisabledCount = 0; // Used to calculate how many bullets are on screen
|
||||||
|
int bulletRadius = 10;
|
||||||
|
float bulletSpeed = 3.0f;
|
||||||
|
int bulletRows = 6;
|
||||||
|
Color bulletColor[2] = { RED, BLUE };
|
||||||
|
|
||||||
|
// Spawner variables
|
||||||
|
float baseDirection = 0;
|
||||||
|
int angleIncrement = 5; // After spawn all bullet rows, increment this value on the baseDirection for next the frame
|
||||||
|
float spawnCooldown = 2;
|
||||||
|
float spawnCooldownTimer = spawnCooldown;
|
||||||
|
|
||||||
|
// Magic circle
|
||||||
|
float magicCircleRotation = 0;
|
||||||
|
|
||||||
|
// Used on performance drawing
|
||||||
|
RenderTexture bulletTexture = LoadRenderTexture(24, 24);
|
||||||
|
|
||||||
|
// Draw circle to bullet texture, then draw bullet using DrawTexture()
|
||||||
|
// NOTE: This is done to improve the performance, since DrawCircle() is very slow
|
||||||
|
BeginTextureMode(bulletTexture);
|
||||||
|
DrawCircle(12, 12, bulletRadius, WHITE);
|
||||||
|
DrawCircleLines(12, 12, bulletRadius, BLACK);
|
||||||
|
EndTextureMode();
|
||||||
|
|
||||||
|
bool drawInPerformanceMode = true; // Switch between DrawCircle() and DrawTexture()
|
||||||
|
|
||||||
|
SetTargetFPS(60);
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Reset the bullet index
|
||||||
|
// New bullets will replace the old ones that are already disabled due to out-of-screen
|
||||||
|
if (bulletCount >= MAX_BULLETS)
|
||||||
|
{
|
||||||
|
bulletCount = 0;
|
||||||
|
bulletDisabledCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
spawnCooldownTimer--;
|
||||||
|
if (spawnCooldownTimer < 0)
|
||||||
|
{
|
||||||
|
spawnCooldownTimer = spawnCooldown;
|
||||||
|
|
||||||
|
// Spawn bullets
|
||||||
|
float degreesPerRow = 360.0f/bulletRows;
|
||||||
|
for (int row = 0; row < bulletRows; row++)
|
||||||
|
{
|
||||||
|
if (bulletCount < MAX_BULLETS)
|
||||||
|
{
|
||||||
|
bullets[bulletCount].position = (Vector2){(float) screenWidth/2, (float) screenHeight/2};
|
||||||
|
bullets[bulletCount].disabled = false;
|
||||||
|
bullets[bulletCount].color = bulletColor[row%2];
|
||||||
|
|
||||||
|
float bulletDirection = baseDirection + (degreesPerRow*row);
|
||||||
|
|
||||||
|
// Bullet speed * bullet direction, this will determine how much pixels will be incremented/decremented
|
||||||
|
// from the bullet position every frame. Since the bullets doesn't change its direction and speed,
|
||||||
|
// only need to calculate it at the spawning time
|
||||||
|
// 0 degrees = right, 90 degrees = down, 180 degrees = left and 270 degrees = up, basically clockwise
|
||||||
|
// Case you want it to be anti-clockwise, add "* -1" at the y acceleration
|
||||||
|
bullets[bulletCount].acceleration = (Vector2){
|
||||||
|
bulletSpeed*cosf(bulletDirection*DEG2RAD),
|
||||||
|
bulletSpeed*sinf(bulletDirection*DEG2RAD)
|
||||||
|
};
|
||||||
|
|
||||||
|
bulletCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
baseDirection += angleIncrement;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update bullets position based on its acceleration
|
||||||
|
for (int i = 0; i < bulletCount; i++)
|
||||||
|
{
|
||||||
|
// Only update bullet if inside the screen
|
||||||
|
if (!bullets[i].disabled)
|
||||||
|
{
|
||||||
|
bullets[i].position.x += bullets[i].acceleration.x;
|
||||||
|
bullets[i].position.y += bullets[i].acceleration.y;
|
||||||
|
|
||||||
|
// Disable bullet if out of screen
|
||||||
|
if ((bullets[i].position.x < -bulletRadius*2) ||
|
||||||
|
(bullets[i].position.x > screenWidth + bulletRadius*2) ||
|
||||||
|
(bullets[i].position.y < -bulletRadius*2) ||
|
||||||
|
(bullets[i].position.y > screenHeight + bulletRadius*2))
|
||||||
|
{
|
||||||
|
bullets[i].disabled = true;
|
||||||
|
bulletDisabledCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Input logic
|
||||||
|
if ((IsKeyPressed(KEY_RIGHT) || IsKeyPressed(KEY_D)) && (bulletRows < 359)) bulletRows++;
|
||||||
|
if ((IsKeyPressed(KEY_LEFT) || IsKeyPressed(KEY_A)) && (bulletRows > 1)) bulletRows--;
|
||||||
|
if (IsKeyPressed(KEY_UP) || IsKeyPressed(KEY_W)) bulletSpeed += 0.25f;
|
||||||
|
if ((IsKeyPressed(KEY_DOWN) || IsKeyPressed(KEY_S)) && (bulletSpeed > 0.50f)) bulletSpeed -= 0.25f;
|
||||||
|
if (IsKeyPressed(KEY_Z) && (spawnCooldown > 1)) spawnCooldown--;
|
||||||
|
if (IsKeyPressed(KEY_X)) spawnCooldown++;
|
||||||
|
if (IsKeyPressed(KEY_ENTER)) drawInPerformanceMode = !drawInPerformanceMode;
|
||||||
|
|
||||||
|
if (IsKeyDown(KEY_SPACE))
|
||||||
|
{
|
||||||
|
angleIncrement += 1;
|
||||||
|
angleIncrement %= 360;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsKeyPressed(KEY_C))
|
||||||
|
{
|
||||||
|
bulletCount = 0;
|
||||||
|
bulletDisabledCount = 0;
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
// Draw magic circle
|
||||||
|
magicCircleRotation++;
|
||||||
|
DrawRectanglePro((Rectangle){ (float)screenWidth/2, (float)screenHeight/2, 120, 120 },
|
||||||
|
(Vector2){ 60.0f, 60.0f }, magicCircleRotation, PURPLE);
|
||||||
|
DrawRectanglePro((Rectangle){ (float)screenWidth/2, (float)screenHeight/2, 120, 120 },
|
||||||
|
(Vector2){ 60.0f, 60.0f }, magicCircleRotation + 45, PURPLE);
|
||||||
|
DrawCircleLines(screenWidth/2, screenHeight/2, 70, BLACK);
|
||||||
|
DrawCircleLines(screenWidth/2, screenHeight/2, 50, BLACK);
|
||||||
|
DrawCircleLines(screenWidth/2, screenHeight/2, 30, BLACK);
|
||||||
|
|
||||||
|
// Draw bullets
|
||||||
|
if (drawInPerformanceMode)
|
||||||
|
{
|
||||||
|
// Draw bullets using pre-rendered texture containing circle
|
||||||
|
for (int i = 0; i < bulletCount; i++)
|
||||||
|
{
|
||||||
|
// Do not draw disabled bullets (out of screen)
|
||||||
|
if (!bullets[i].disabled)
|
||||||
|
{
|
||||||
|
DrawTexture(bulletTexture.texture,
|
||||||
|
bullets[i].position.x - bulletTexture.texture.width*0.5f,
|
||||||
|
bullets[i].position.y - bulletTexture.texture.height*0.5f,
|
||||||
|
bullets[i].color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Draw bullets using DrawCircle(), less performant
|
||||||
|
for (int i = 0; i < bulletCount; i++)
|
||||||
|
{
|
||||||
|
// Do not draw disabled bullets (out of screen)
|
||||||
|
if (!bullets[i].disabled)
|
||||||
|
{
|
||||||
|
DrawCircleV(bullets[i].position, bulletRadius, bullets[i].color);
|
||||||
|
DrawCircleLinesV(bullets[i].position, bulletRadius, BLACK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw UI
|
||||||
|
DrawRectangle(10, 10, 280, 150, (Color){0,0, 0, 200 });
|
||||||
|
DrawText("Controls:", 20, 20, 10, LIGHTGRAY);
|
||||||
|
DrawText("- Right/Left or A/D: Change rows number", 40, 40, 10, LIGHTGRAY);
|
||||||
|
DrawText("- Up/Down or W/S: Change bullet speed", 40, 60, 10, LIGHTGRAY);
|
||||||
|
DrawText("- Z or X: Change spawn cooldown", 40, 80, 10, LIGHTGRAY);
|
||||||
|
DrawText("- Space (Hold): Change the angle increment", 40, 100, 10, LIGHTGRAY);
|
||||||
|
DrawText("- Enter: Switch draw method (Performance)", 40, 120, 10, LIGHTGRAY);
|
||||||
|
DrawText("- C: Clear bullets", 40, 140, 10, LIGHTGRAY);
|
||||||
|
|
||||||
|
DrawRectangle(610, 10, 170, 30, (Color){0,0, 0, 200 });
|
||||||
|
if (drawInPerformanceMode) DrawText("Draw method: DrawTexture(*)", 620, 20, 10, GREEN);
|
||||||
|
else DrawText("Draw method: DrawCircle(*)", 620, 20, 10, RED);
|
||||||
|
|
||||||
|
DrawRectangle(135, 410, 530, 30, (Color){0,0, 0, 200 });
|
||||||
|
DrawText(TextFormat("[ FPS: %d, Bullets: %d, Rows: %d, Bullet speed: %.2f, Angle increment per frame: %d, Cooldown: %.0f ]",
|
||||||
|
GetFPS(), bulletCount - bulletDisabledCount, bulletRows, bulletSpeed, angleIncrement, spawnCooldown),
|
||||||
|
155, 420, 10, GREEN);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
UnloadRenderTexture(bulletTexture); // Unload bullet texture
|
||||||
|
|
||||||
|
RL_FREE(bullets); // Free bullets array data
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
BIN
examples/shapes/shapes_bullet_hell.png
Normal file
|
After Width: | Height: | Size: 38 KiB |
|
|
@ -15,8 +15,6 @@
|
||||||
|
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
|
||||||
#include <stdlib.h> // Required for: abs()
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Program main entry point
|
// Program main entry point
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
103
examples/shapes/shapes_dashed_line.c
Normal file
|
|
@ -0,0 +1,103 @@
|
||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [shapes] example - dashed line drawing
|
||||||
|
*
|
||||||
|
* Example complexity rating: [★☆☆☆] 1/4
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 2.5, last time updated with raylib 2.5
|
||||||
|
*
|
||||||
|
* Example contributed by Luís Almeida (@luis605)
|
||||||
|
*
|
||||||
|
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||||
|
* BSD-like license that allows static linking with closed source software
|
||||||
|
*
|
||||||
|
* Copyright (c) 2025 Luís Almeida (@luis605)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
#define RAYGUI_IMPLEMENTATION
|
||||||
|
#include "raygui.h" // Required for GUI controls
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - interactive dashed line");
|
||||||
|
|
||||||
|
// Line Properties
|
||||||
|
Vector2 lineStartPosition = { 20.0f, 50.0f };
|
||||||
|
Vector2 lineEndPosition = { 780.0f, 400.0f };
|
||||||
|
float dashLength = 25.0f;
|
||||||
|
float blankLength = 15.0f;
|
||||||
|
|
||||||
|
// Color selection
|
||||||
|
Color lineColors[] = { RED, ORANGE, GOLD, GREEN, BLUE, VIOLET, PINK, BLACK };
|
||||||
|
int colorIndex = 0;
|
||||||
|
|
||||||
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
lineEndPosition = GetMousePosition(); // Line endpoint follows the mouse
|
||||||
|
|
||||||
|
// --- Keyboard Controls ---
|
||||||
|
|
||||||
|
// Change Dash Length (UP/DOWN arrows)
|
||||||
|
if (IsKeyDown(KEY_UP)) dashLength += 1.0f;
|
||||||
|
if (IsKeyDown(KEY_DOWN) && dashLength > 1.0f) dashLength -= 1.0f;
|
||||||
|
|
||||||
|
// Change Space Length (LEFT/RIGHT arrows)
|
||||||
|
if (IsKeyDown(KEY_RIGHT)) blankLength += 1.0f;
|
||||||
|
if (IsKeyDown(KEY_LEFT) && blankLength > 1.0f) blankLength -= 1.0f;
|
||||||
|
|
||||||
|
// Cycle through colors ('C' key)
|
||||||
|
if (IsKeyPressed(KEY_C))
|
||||||
|
{
|
||||||
|
colorIndex = (colorIndex + 1) % (sizeof(lineColors)/sizeof(Color));
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
// Draw the dashed line with the current properties
|
||||||
|
DrawLineDashed(lineStartPosition, lineEndPosition, dashLength, blankLength, lineColors[colorIndex]);
|
||||||
|
|
||||||
|
// Draw UI and Instructions
|
||||||
|
DrawRectangle(5, 5, 265, 95, Fade(SKYBLUE, 0.5f));
|
||||||
|
DrawRectangleLines(5, 5, 265, 95, BLUE);
|
||||||
|
|
||||||
|
DrawText("CONTROLS:", 15, 15, 10, BLACK);
|
||||||
|
DrawText("UP/DOWN: Change Dash Length", 15, 35, 10, BLACK);
|
||||||
|
DrawText("LEFT/RIGHT: Change Space Length", 15, 55, 10, BLACK);
|
||||||
|
DrawText("C: Cycle Color", 15, 75, 10, BLACK);
|
||||||
|
|
||||||
|
DrawText(TextFormat("Dash: %.0f | Space: %.0f", dashLength, blankLength), 15, 115, 10, DARKGRAY);
|
||||||
|
|
||||||
|
DrawFPS(screenWidth - 80, 10);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
BIN
examples/shapes/shapes_dashed_line.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
569
projects/VS2022/examples/core_input_actions.vcxproj
Normal file
|
|
@ -0,0 +1,569 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug.DLL|ARM64">
|
||||||
|
<Configuration>Debug.DLL</Configuration>
|
||||||
|
<Platform>ARM64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug.DLL|Win32">
|
||||||
|
<Configuration>Debug.DLL</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug.DLL|x64">
|
||||||
|
<Configuration>Debug.DLL</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|ARM64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>ARM64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release.DLL|ARM64">
|
||||||
|
<Configuration>Release.DLL</Configuration>
|
||||||
|
<Platform>ARM64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release.DLL|Win32">
|
||||||
|
<Configuration>Release.DLL</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release.DLL|x64">
|
||||||
|
<Configuration>Release.DLL</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|ARM64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>ARM64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{718FCBD0-591D-448C-B7D5-9F1CA8544E7B}</ProjectGuid>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<RootNamespace>core_input_actions</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
|
<ProjectName>core_input_actions</ProjectName>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|ARM64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|ARM64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="Shared">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|Win32'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|ARM64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|Win32'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|ARM64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|Win32'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|x64'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|ARM64'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|Win32'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|x64'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|ARM64'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|Win32'">
|
||||||
|
<LocalDebuggerWorkingDirectory>$(SolutionDir)..\..\examples\core</LocalDebuggerWorkingDirectory>
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|x64'">
|
||||||
|
<LocalDebuggerWorkingDirectory>$(SolutionDir)..\..\examples\core</LocalDebuggerWorkingDirectory>
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|ARM64'">
|
||||||
|
<LocalDebuggerWorkingDirectory>$(SolutionDir)..\..\examples\core</LocalDebuggerWorkingDirectory>
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<LocalDebuggerWorkingDirectory>$(SolutionDir)..\..\examples\core</LocalDebuggerWorkingDirectory>
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<LocalDebuggerWorkingDirectory>$(SolutionDir)..\..\examples\core</LocalDebuggerWorkingDirectory>
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|Win32'">
|
||||||
|
<LocalDebuggerWorkingDirectory>$(SolutionDir)..\..\examples\core</LocalDebuggerWorkingDirectory>
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<LocalDebuggerWorkingDirectory>$(SolutionDir)..\..\examples\core</LocalDebuggerWorkingDirectory>
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
|
||||||
|
<LocalDebuggerWorkingDirectory>$(SolutionDir)..\..\examples\core</LocalDebuggerWorkingDirectory>
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<LocalDebuggerWorkingDirectory>$(SolutionDir)..\..\examples\core</LocalDebuggerWorkingDirectory>
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
|
||||||
|
<LocalDebuggerWorkingDirectory>$(SolutionDir)..\..\examples\core</LocalDebuggerWorkingDirectory>
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|x64'">
|
||||||
|
<LocalDebuggerWorkingDirectory>$(SolutionDir)..\..\examples\core</LocalDebuggerWorkingDirectory>
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|ARM64'">
|
||||||
|
<LocalDebuggerWorkingDirectory>$(SolutionDir)..\..\examples\core</LocalDebuggerWorkingDirectory>
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<AdditionalOptions>/FS %(AdditionalOptions)</AdditionalOptions>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>raylib.lib;opengl32.lib;kernel32.lib;user32.lib;shcore.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<AdditionalOptions>/FS %(AdditionalOptions)</AdditionalOptions>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
<PostBuildEvent>
|
||||||
|
<Command>xcopy /y /d "$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\raylib.dll" "$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)"</Command>
|
||||||
|
<Message>Copy Debug DLL to output directory</Message>
|
||||||
|
</PostBuildEvent>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
<PostBuildEvent>
|
||||||
|
<Command>xcopy /y /d "$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\raylib.dll" "$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)"</Command>
|
||||||
|
<Message>Copy Debug DLL to output directory</Message>
|
||||||
|
</PostBuildEvent>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|ARM64'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
<PostBuildEvent>
|
||||||
|
<Command>xcopy /y /d "$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\raylib.dll" "$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)"</Command>
|
||||||
|
<Message>Copy Debug DLL to output directory</Message>
|
||||||
|
</PostBuildEvent>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
<RemoveUnreferencedCodeData>true</RemoveUnreferencedCodeData>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalDependencies>raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\</AdditionalLibraryDirectories>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
<RemoveUnreferencedCodeData>true</RemoveUnreferencedCodeData>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalDependencies>raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\</AdditionalLibraryDirectories>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
<RemoveUnreferencedCodeData>true</RemoveUnreferencedCodeData>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalDependencies>raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\</AdditionalLibraryDirectories>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
<RemoveUnreferencedCodeData>true</RemoveUnreferencedCodeData>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalDependencies>raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\</AdditionalLibraryDirectories>
|
||||||
|
</Link>
|
||||||
|
<PostBuildEvent>
|
||||||
|
<Command>xcopy /y /d "$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\raylib.dll" "$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)"</Command>
|
||||||
|
</PostBuildEvent>
|
||||||
|
<PostBuildEvent>
|
||||||
|
<Message>Copy Release DLL to output directory</Message>
|
||||||
|
</PostBuildEvent>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
<RemoveUnreferencedCodeData>true</RemoveUnreferencedCodeData>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalDependencies>raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\</AdditionalLibraryDirectories>
|
||||||
|
</Link>
|
||||||
|
<PostBuildEvent>
|
||||||
|
<Command>xcopy /y /d "$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\raylib.dll" "$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)"</Command>
|
||||||
|
</PostBuildEvent>
|
||||||
|
<PostBuildEvent>
|
||||||
|
<Message>Copy Release DLL to output directory</Message>
|
||||||
|
</PostBuildEvent>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release.DLL|ARM64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
<RemoveUnreferencedCodeData>true</RemoveUnreferencedCodeData>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalDependencies>raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<AdditionalLibraryDirectories>$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\</AdditionalLibraryDirectories>
|
||||||
|
</Link>
|
||||||
|
<PostBuildEvent>
|
||||||
|
<Command>xcopy /y /d "$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\raylib.dll" "$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)"</Command>
|
||||||
|
</PostBuildEvent>
|
||||||
|
<PostBuildEvent>
|
||||||
|
<Message>Copy Release DLL to output directory</Message>
|
||||||
|
</PostBuildEvent>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\..\..\examples\core\core_input_actions.c" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="..\..\..\examples\examples.rc" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\raylib\raylib.vcxproj">
|
||||||
|
<Project>{e89d61ac-55de-4482-afd4-df7242ebc859}</Project>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
||||||
|
|
@ -345,6 +345,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "text_inline_styling", "exam
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "core_undo_redo", "examples\core_undo_redo.vcxproj", "{3B27F358-2679-4F38-B297-17B536F580BB}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "core_undo_redo", "examples\core_undo_redo.vcxproj", "{3B27F358-2679-4F38-B297-17B536F580BB}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "core_input_actions", "examples\core_input_actions.vcxproj", "{718FCBD0-591D-448C-B7D5-9F1CA8544E7B}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug.DLL|ARM64 = Debug.DLL|ARM64
|
Debug.DLL|ARM64 = Debug.DLL|ARM64
|
||||||
|
|
@ -4247,6 +4249,30 @@ Global
|
||||||
{3B27F358-2679-4F38-B297-17B536F580BB}.Release|x64.Build.0 = Release|x64
|
{3B27F358-2679-4F38-B297-17B536F580BB}.Release|x64.Build.0 = Release|x64
|
||||||
{3B27F358-2679-4F38-B297-17B536F580BB}.Release|x86.ActiveCfg = Release|Win32
|
{3B27F358-2679-4F38-B297-17B536F580BB}.Release|x86.ActiveCfg = Release|Win32
|
||||||
{3B27F358-2679-4F38-B297-17B536F580BB}.Release|x86.Build.0 = Release|Win32
|
{3B27F358-2679-4F38-B297-17B536F580BB}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{718FCBD0-591D-448C-B7D5-9F1CA8544E7B}.Debug.DLL|ARM64.ActiveCfg = Debug.DLL|ARM64
|
||||||
|
{718FCBD0-591D-448C-B7D5-9F1CA8544E7B}.Debug.DLL|ARM64.Build.0 = Debug.DLL|ARM64
|
||||||
|
{718FCBD0-591D-448C-B7D5-9F1CA8544E7B}.Debug.DLL|x64.ActiveCfg = Debug.DLL|x64
|
||||||
|
{718FCBD0-591D-448C-B7D5-9F1CA8544E7B}.Debug.DLL|x64.Build.0 = Debug.DLL|x64
|
||||||
|
{718FCBD0-591D-448C-B7D5-9F1CA8544E7B}.Debug.DLL|x86.ActiveCfg = Debug.DLL|Win32
|
||||||
|
{718FCBD0-591D-448C-B7D5-9F1CA8544E7B}.Debug.DLL|x86.Build.0 = Debug.DLL|Win32
|
||||||
|
{718FCBD0-591D-448C-B7D5-9F1CA8544E7B}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||||
|
{718FCBD0-591D-448C-B7D5-9F1CA8544E7B}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||||
|
{718FCBD0-591D-448C-B7D5-9F1CA8544E7B}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{718FCBD0-591D-448C-B7D5-9F1CA8544E7B}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{718FCBD0-591D-448C-B7D5-9F1CA8544E7B}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{718FCBD0-591D-448C-B7D5-9F1CA8544E7B}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{718FCBD0-591D-448C-B7D5-9F1CA8544E7B}.Release.DLL|ARM64.ActiveCfg = Release.DLL|ARM64
|
||||||
|
{718FCBD0-591D-448C-B7D5-9F1CA8544E7B}.Release.DLL|ARM64.Build.0 = Release.DLL|ARM64
|
||||||
|
{718FCBD0-591D-448C-B7D5-9F1CA8544E7B}.Release.DLL|x64.ActiveCfg = Release.DLL|x64
|
||||||
|
{718FCBD0-591D-448C-B7D5-9F1CA8544E7B}.Release.DLL|x64.Build.0 = Release.DLL|x64
|
||||||
|
{718FCBD0-591D-448C-B7D5-9F1CA8544E7B}.Release.DLL|x86.ActiveCfg = Release.DLL|Win32
|
||||||
|
{718FCBD0-591D-448C-B7D5-9F1CA8544E7B}.Release.DLL|x86.Build.0 = Release.DLL|Win32
|
||||||
|
{718FCBD0-591D-448C-B7D5-9F1CA8544E7B}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||||
|
{718FCBD0-591D-448C-B7D5-9F1CA8544E7B}.Release|ARM64.Build.0 = Release|ARM64
|
||||||
|
{718FCBD0-591D-448C-B7D5-9F1CA8544E7B}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{718FCBD0-591D-448C-B7D5-9F1CA8544E7B}.Release|x64.Build.0 = Release|x64
|
||||||
|
{718FCBD0-591D-448C-B7D5-9F1CA8544E7B}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{718FCBD0-591D-448C-B7D5-9F1CA8544E7B}.Release|x86.Build.0 = Release|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
@ -4421,6 +4447,7 @@ Global
|
||||||
{49C67F03-1A56-4F96-B278-39B66EC93678} = {6C82BAAE-BDDF-457D-8FA8-7E2490B07035}
|
{49C67F03-1A56-4F96-B278-39B66EC93678} = {6C82BAAE-BDDF-457D-8FA8-7E2490B07035}
|
||||||
{D496308F-3C3C-40B3-A3ED-EA327D244B3E} = {8D3C83B7-F1E0-4C2E-9E34-EE5F6AB2502A}
|
{D496308F-3C3C-40B3-A3ED-EA327D244B3E} = {8D3C83B7-F1E0-4C2E-9E34-EE5F6AB2502A}
|
||||||
{3B27F358-2679-4F38-B297-17B536F580BB} = {6C82BAAE-BDDF-457D-8FA8-7E2490B07035}
|
{3B27F358-2679-4F38-B297-17B536F580BB} = {6C82BAAE-BDDF-457D-8FA8-7E2490B07035}
|
||||||
|
{718FCBD0-591D-448C-B7D5-9F1CA8544E7B} = {6C82BAAE-BDDF-457D-8FA8-7E2490B07035}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {E926C768-6307-4423-A1EC-57E95B1FAB29}
|
SolutionGuid = {E926C768-6307-4423-A1EC-57E95B1FAB29}
|
||||||
|
|
|
||||||
|
|
@ -235,6 +235,7 @@ endif
|
||||||
# NOTE: By default use OpenGL 3.3 on desktop platforms
|
# NOTE: By default use OpenGL 3.3 on desktop platforms
|
||||||
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
|
||||||
GRAPHICS ?= GRAPHICS_API_OPENGL_33
|
GRAPHICS ?= GRAPHICS_API_OPENGL_33
|
||||||
|
#GRAPHICS = GRAPHICS_API_OPENGL_11_SOFTWARE # Uncomment to use software rendering
|
||||||
#GRAPHICS = GRAPHICS_API_OPENGL_11 # Uncomment to use OpenGL 1.1
|
#GRAPHICS = GRAPHICS_API_OPENGL_11 # Uncomment to use OpenGL 1.1
|
||||||
#GRAPHICS = GRAPHICS_API_OPENGL_21 # Uncomment to use OpenGL 2.1
|
#GRAPHICS = GRAPHICS_API_OPENGL_21 # Uncomment to use OpenGL 2.1
|
||||||
#GRAPHICS = GRAPHICS_API_OPENGL_43 # Uncomment to use OpenGL 4.3
|
#GRAPHICS = GRAPHICS_API_OPENGL_43 # Uncomment to use OpenGL 4.3
|
||||||
|
|
@ -245,6 +246,7 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_SDL)
|
||||||
endif
|
endif
|
||||||
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_RGFW)
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_RGFW)
|
||||||
GRAPHICS ?= GRAPHICS_API_OPENGL_33
|
GRAPHICS ?= GRAPHICS_API_OPENGL_33
|
||||||
|
#GRAPHICS = GRAPHICS_API_OPENGL_11_SOFTWARE # Uncomment to use software rendering
|
||||||
#GRAPHICS = GRAPHICS_API_OPENGL_11 # Uncomment to use OpenGL 1.1
|
#GRAPHICS = GRAPHICS_API_OPENGL_11 # Uncomment to use OpenGL 1.1
|
||||||
#GRAPHICS = GRAPHICS_API_OPENGL_21 # Uncomment to use OpenGL 2.1
|
#GRAPHICS = GRAPHICS_API_OPENGL_21 # Uncomment to use OpenGL 2.1
|
||||||
#GRAPHICS = GRAPHICS_API_OPENGL_43 # Uncomment to use OpenGL 4.3
|
#GRAPHICS = GRAPHICS_API_OPENGL_43 # Uncomment to use OpenGL 4.3
|
||||||
|
|
|
||||||
4938
src/external/rlsw.h
vendored
Normal file
|
|
@ -63,10 +63,11 @@
|
||||||
#include "SDL.h"
|
#include "SDL.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(GRAPHICS_API_OPENGL_ES2)
|
#if !defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||||
|
#if defined(GRAPHICS_API_OPENGL_ES2)
|
||||||
// It seems it does not need to be included to work
|
// It seems it does not need to be included to work
|
||||||
//#include "SDL_opengles2.h"
|
//#include "SDL_opengles2.h"
|
||||||
#else
|
#else
|
||||||
// SDL OpenGL functionality (if required, instead of internal renderer)
|
// SDL OpenGL functionality (if required, instead of internal renderer)
|
||||||
#ifdef USING_SDL3_PROJECT
|
#ifdef USING_SDL3_PROJECT
|
||||||
#include "SDL3/SDL_opengl.h"
|
#include "SDL3/SDL_opengl.h"
|
||||||
|
|
@ -75,6 +76,7 @@
|
||||||
#else
|
#else
|
||||||
#include "SDL_opengl.h"
|
#include "SDL_opengl.h"
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
@ -1220,7 +1222,14 @@ void DisableCursor(void)
|
||||||
// Swap back buffer with front buffer (screen drawing)
|
// Swap back buffer with front buffer (screen drawing)
|
||||||
void SwapScreenBuffer(void)
|
void SwapScreenBuffer(void)
|
||||||
{
|
{
|
||||||
|
#if defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||||
|
// NOTE: We use a preprocessor condition here because `rlCopyFramebuffer` is only declared for software rendering
|
||||||
|
SDL_Surface *surface = SDL_GetWindowSurface(platform.window);
|
||||||
|
rlCopyFramebuffer(0, 0, CORE.Window.render.width, CORE.Window.render.height, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8, surface->pixels);
|
||||||
|
SDL_UpdateWindowSurface(platform.window);
|
||||||
|
#else
|
||||||
SDL_GL_SwapWindow(platform.window);
|
SDL_GL_SwapWindow(platform.window);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
@ -1568,6 +1577,7 @@ void PollInputEvents(void)
|
||||||
if (CORE.Input.Keyboard.charPressedQueueCount < MAX_CHAR_PRESSED_QUEUE)
|
if (CORE.Input.Keyboard.charPressedQueueCount < MAX_CHAR_PRESSED_QUEUE)
|
||||||
{
|
{
|
||||||
// Add character (codepoint) to the queue
|
// Add character (codepoint) to the queue
|
||||||
|
|
||||||
#if defined(USING_VERSION_SDL3)
|
#if defined(USING_VERSION_SDL3)
|
||||||
size_t textLen = strlen(event.text.text);
|
size_t textLen = strlen(event.text.text);
|
||||||
unsigned int codepoint = (unsigned int)SDL_StepUTF8(&event.text.text, &textLen);
|
unsigned int codepoint = (unsigned int)SDL_StepUTF8(&event.text.text, &textLen);
|
||||||
|
|
@ -1575,6 +1585,7 @@ void PollInputEvents(void)
|
||||||
int codepointSize = 0;
|
int codepointSize = 0;
|
||||||
int codepoint = GetCodepointNextSDL(event.text.text, &codepointSize);
|
int codepoint = GetCodepointNextSDL(event.text.text, &codepointSize);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CORE.Input.Keyboard.charPressedQueue[CORE.Input.Keyboard.charPressedQueueCount] = codepoint;
|
CORE.Input.Keyboard.charPressedQueue[CORE.Input.Keyboard.charPressedQueueCount] = codepoint;
|
||||||
CORE.Input.Keyboard.charPressedQueueCount++;
|
CORE.Input.Keyboard.charPressedQueueCount++;
|
||||||
}
|
}
|
||||||
|
|
@ -1878,7 +1889,6 @@ int InitPlatform(void)
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
FLAG_SET(flags, SDL_WINDOW_SHOWN);
|
FLAG_SET(flags, SDL_WINDOW_SHOWN);
|
||||||
FLAG_SET(flags, SDL_WINDOW_OPENGL);
|
|
||||||
FLAG_SET(flags, SDL_WINDOW_INPUT_FOCUS);
|
FLAG_SET(flags, SDL_WINDOW_INPUT_FOCUS);
|
||||||
FLAG_SET(flags, SDL_WINDOW_MOUSE_FOCUS);
|
FLAG_SET(flags, SDL_WINDOW_MOUSE_FOCUS);
|
||||||
FLAG_SET(flags, SDL_WINDOW_MOUSE_CAPTURE); // Window has mouse captured
|
FLAG_SET(flags, SDL_WINDOW_MOUSE_CAPTURE); // Window has mouse captured
|
||||||
|
|
@ -1909,6 +1919,11 @@ int InitPlatform(void)
|
||||||
|
|
||||||
// NOTE: Some OpenGL context attributes must be set before window creation
|
// NOTE: Some OpenGL context attributes must be set before window creation
|
||||||
|
|
||||||
|
if (rlGetVersion() != RL_OPENGL_11_SOFTWARE)
|
||||||
|
{
|
||||||
|
// Add the flag telling the window to use an OpenGL context
|
||||||
|
flags |= SDL_WINDOW_OPENGL;
|
||||||
|
|
||||||
// Check selection OpenGL version
|
// Check selection OpenGL version
|
||||||
if (rlGetVersion() == RL_OPENGL_21)
|
if (rlGetVersion() == RL_OPENGL_21)
|
||||||
{
|
{
|
||||||
|
|
@ -1926,9 +1941,9 @@ int InitPlatform(void)
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4);
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4);
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
|
||||||
#if defined(RLGL_ENABLE_OPENGL_DEBUG_CONTEXT)
|
#if defined(RLGL_ENABLE_OPENGL_DEBUG_CONTEXT)
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG); // Enable OpenGL Debug Context
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG); // Enable OpenGL Debug Context
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (rlGetVersion() == RL_OPENGL_ES_20) // Request OpenGL ES 2.0 context
|
else if (rlGetVersion() == RL_OPENGL_ES_20) // Request OpenGL ES 2.0 context
|
||||||
{
|
{
|
||||||
|
|
@ -1948,6 +1963,7 @@ int InitPlatform(void)
|
||||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
|
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
|
||||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);
|
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Init window
|
// Init window
|
||||||
#if defined(USING_VERSION_SDL3)
|
#if defined(USING_VERSION_SDL3)
|
||||||
|
|
@ -1957,10 +1973,12 @@ int InitPlatform(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Init OpenGL context
|
// Init OpenGL context
|
||||||
|
if (rlGetVersion() != RL_OPENGL_11_SOFTWARE)
|
||||||
|
{
|
||||||
platform.glContext = SDL_GL_CreateContext(platform.window);
|
platform.glContext = SDL_GL_CreateContext(platform.window);
|
||||||
|
}
|
||||||
|
|
||||||
// Check window and glContext have been initialized successfully
|
if ((platform.window != NULL) && ((rlGetVersion() == RL_OPENGL_11_SOFTWARE) || (platform.glContext != NULL)))
|
||||||
if ((platform.window != NULL) && (platform.glContext != NULL))
|
|
||||||
{
|
{
|
||||||
CORE.Window.ready = true;
|
CORE.Window.ready = true;
|
||||||
|
|
||||||
|
|
@ -1981,8 +1999,14 @@ int InitPlatform(void)
|
||||||
TRACELOG(LOG_INFO, " > Render size: %i x %i", CORE.Window.render.width, CORE.Window.render.height);
|
TRACELOG(LOG_INFO, " > Render size: %i x %i", CORE.Window.render.width, CORE.Window.render.height);
|
||||||
TRACELOG(LOG_INFO, " > Viewport offsets: %i, %i", CORE.Window.renderOffset.x, CORE.Window.renderOffset.y);
|
TRACELOG(LOG_INFO, " > Viewport offsets: %i, %i", CORE.Window.renderOffset.x, CORE.Window.renderOffset.y);
|
||||||
|
|
||||||
if (FLAG_CHECK(CORE.Window.flags, FLAG_VSYNC_HINT) > 0) SDL_GL_SetSwapInterval(1);
|
if (platform.glContext != NULL)
|
||||||
else SDL_GL_SetSwapInterval(0);
|
{
|
||||||
|
SDL_GL_SetSwapInterval((FLAG_CHECK(CORE.Window.flags, FLAG_VSYNC_HINT) > 0)? 1 : 0);
|
||||||
|
|
||||||
|
// Load OpenGL extensions
|
||||||
|
// NOTE: GL procedures address loader is required to load extensions
|
||||||
|
rlLoadExtensions(SDL_GL_GetProcAddress);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -1990,9 +2014,6 @@ int InitPlatform(void)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load OpenGL extensions
|
|
||||||
// NOTE: GL procedures address loader is required to load extensions
|
|
||||||
rlLoadExtensions(SDL_GL_GetProcAddress);
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Initialize input events system
|
// Initialize input events system
|
||||||
|
|
@ -2064,7 +2085,7 @@ int InitPlatform(void)
|
||||||
void ClosePlatform(void)
|
void ClosePlatform(void)
|
||||||
{
|
{
|
||||||
SDL_FreeCursor(platform.cursor); // Free cursor
|
SDL_FreeCursor(platform.cursor); // Free cursor
|
||||||
SDL_GL_DeleteContext(platform.glContext); // Deinitialize OpenGL context
|
if (platform.glContext != NULL) SDL_GL_DeleteContext(platform.glContext); // Deinitialize OpenGL context
|
||||||
SDL_DestroyWindow(platform.window);
|
SDL_DestroyWindow(platform.window);
|
||||||
SDL_Quit(); // Deinitialize SDL internal global state
|
SDL_Quit(); // Deinitialize SDL internal global state
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,12 +65,17 @@
|
||||||
// so the enum KEY_F12 from raylib is used
|
// so the enum KEY_F12 from raylib is used
|
||||||
#undef KEY_F12
|
#undef KEY_F12
|
||||||
|
|
||||||
#include <gbm.h> // Generic Buffer Management (native platform for EGL on DRM)
|
|
||||||
#include <xf86drm.h> // Direct Rendering Manager user-level library interface
|
#include <xf86drm.h> // Direct Rendering Manager user-level library interface
|
||||||
#include <xf86drmMode.h> // Direct Rendering Manager mode setting (KMS) interface
|
#include <xf86drmMode.h> // Direct Rendering Manager mode setting (KMS) interface
|
||||||
|
|
||||||
#include "EGL/egl.h" // Native platform windowing system interface
|
#if !defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||||
#include "EGL/eglext.h" // EGL extensions
|
#include <gbm.h> // Generic Buffer Management (native platform for EGL on DRM)
|
||||||
|
#include "EGL/egl.h" // Native platform windowing system interface
|
||||||
|
#include "EGL/eglext.h" // EGL extensions
|
||||||
|
#else
|
||||||
|
#include <sys/mman.h> // For mmap when copying to the dumb buffer
|
||||||
|
#include <errno.h> // For the conversion of certain error messages
|
||||||
|
#endif
|
||||||
|
|
||||||
// NOTE: DRM cache enables triple buffered DRM caching
|
// NOTE: DRM cache enables triple buffered DRM caching
|
||||||
#if defined(SUPPORT_DRM_CACHE)
|
#if defined(SUPPORT_DRM_CACHE)
|
||||||
|
|
@ -103,15 +108,19 @@ typedef struct {
|
||||||
drmModeConnector *connector; // Direct Rendering Manager (DRM) mode connector
|
drmModeConnector *connector; // Direct Rendering Manager (DRM) mode connector
|
||||||
drmModeCrtc *crtc; // CRT Controller
|
drmModeCrtc *crtc; // CRT Controller
|
||||||
int modeIndex; // Index of the used mode of connector->modes
|
int modeIndex; // Index of the used mode of connector->modes
|
||||||
|
uint32_t prevFB; // Previous DRM framebufer (during frame swapping)
|
||||||
|
|
||||||
|
#if !defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||||
struct gbm_device *gbmDevice; // GBM device
|
struct gbm_device *gbmDevice; // GBM device
|
||||||
struct gbm_surface *gbmSurface; // GBM surface
|
struct gbm_surface *gbmSurface; // GBM surface
|
||||||
struct gbm_bo *prevBO; // Previous GBM buffer object (during frame swapping)
|
struct gbm_bo *prevBO; // Previous GBM buffer object (during frame swapping)
|
||||||
uint32_t prevFB; // Previous GBM framebufer (during frame swapping)
|
|
||||||
|
|
||||||
EGLDisplay device; // Native display device (physical screen connection)
|
EGLDisplay device; // Native display device (physical screen connection)
|
||||||
EGLSurface surface; // Surface to draw on, framebuffers (connected to context)
|
EGLSurface surface; // Surface to draw on, framebuffers (connected to context)
|
||||||
EGLContext context; // Graphic context, mode in which drawing can be done
|
EGLContext context; // Graphic context, mode in which drawing can be done
|
||||||
EGLConfig config; // Graphic config
|
EGLConfig config; // Graphic config
|
||||||
|
#else
|
||||||
|
uint32_t prevDumbHandle; // Handle to the previous dumb buffer (during frame swapping)
|
||||||
|
#endif
|
||||||
|
|
||||||
// Keyboard data
|
// Keyboard data
|
||||||
int defaultKeyboardMode; // Default keyboard mode
|
int defaultKeyboardMode; // Default keyboard mode
|
||||||
|
|
@ -780,6 +789,8 @@ void SwapScreenBuffer()
|
||||||
// Swap back buffer with front buffer (screen drawing)
|
// Swap back buffer with front buffer (screen drawing)
|
||||||
void SwapScreenBuffer(void)
|
void SwapScreenBuffer(void)
|
||||||
{
|
{
|
||||||
|
#if !defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||||
|
// Hardware rendering buffer swap with EGL
|
||||||
eglSwapBuffers(platform.device, platform.surface);
|
eglSwapBuffers(platform.device, platform.surface);
|
||||||
|
|
||||||
if (!platform.gbmSurface || (-1 == platform.fd) || !platform.connector || !platform.crtc) TRACELOG(LOG_ERROR, "DISPLAY: DRM initialization failed to swap");
|
if (!platform.gbmSurface || (-1 == platform.fd) || !platform.connector || !platform.crtc) TRACELOG(LOG_ERROR, "DISPLAY: DRM initialization failed to swap");
|
||||||
|
|
@ -805,6 +816,196 @@ void SwapScreenBuffer(void)
|
||||||
if (platform.prevBO) gbm_surface_release_buffer(platform.gbmSurface, platform.prevBO);
|
if (platform.prevBO) gbm_surface_release_buffer(platform.gbmSurface, platform.prevBO);
|
||||||
|
|
||||||
platform.prevBO = bo;
|
platform.prevBO = bo;
|
||||||
|
#else
|
||||||
|
// Software rendering buffer swap
|
||||||
|
if ((platform.fd == -1) || !platform.connector || (platform.modeIndex < 0))
|
||||||
|
{
|
||||||
|
TRACELOG(LOG_ERROR, "DISPLAY: DRM initialization failed to swap");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the software rendered color buffer
|
||||||
|
int bufferWidth = 0, bufferHeight = 0;
|
||||||
|
void *colorBuffer = swGetColorBuffer(&bufferWidth, &bufferHeight);
|
||||||
|
if (!colorBuffer)
|
||||||
|
{
|
||||||
|
TRACELOG(LOG_ERROR, "DISPLAY: Failed to get software color buffer");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Retrieving the dimensions of the display mode used
|
||||||
|
drmModeModeInfo *mode = &platform.connector->modes[platform.modeIndex];
|
||||||
|
uint32_t width = mode->hdisplay;
|
||||||
|
uint32_t height = mode->vdisplay;
|
||||||
|
|
||||||
|
// Dumb buffers use a fixed format based on bpp
|
||||||
|
#if SW_COLOR_BUFFER_BITS == 24
|
||||||
|
const uint32_t bpp = 32; // 32 bits per pixel (XRGB8888 format)
|
||||||
|
const uint32_t depth = 24; // Color depth, here only 24 bits, alpha is not used
|
||||||
|
#else
|
||||||
|
// REVIEW: Not sure how it will be interpreted (RGB or RGBA?)
|
||||||
|
const uint32_t bpp = SW_COLOR_BUFFER_BITS;
|
||||||
|
const uint32_t depth = SW_COLOR_BUFFER_BITS;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Create a dumb buffer for software rendering
|
||||||
|
struct drm_mode_create_dumb creq = { 0 };
|
||||||
|
creq.width = width;
|
||||||
|
creq.height = height;
|
||||||
|
creq.bpp = bpp;
|
||||||
|
|
||||||
|
int result = drmIoctl(platform.fd, DRM_IOCTL_MODE_CREATE_DUMB, &creq);
|
||||||
|
if (result < 0)
|
||||||
|
{
|
||||||
|
TRACELOG(LOG_ERROR, "DISPLAY: Failed to create dumb buffer: %s", strerror(errno));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create framebuffer with the correct format
|
||||||
|
uint32_t fb = 0;
|
||||||
|
result = drmModeAddFB(platform.fd, width, height, depth, bpp, creq.pitch, creq.handle, &fb);
|
||||||
|
if (result != 0)
|
||||||
|
{
|
||||||
|
TRACELOG(LOG_ERROR, "DISPLAY: drmModeAddFB() failed with result: %d (%s)", result, strerror(errno));
|
||||||
|
struct drm_mode_destroy_dumb dreq = { 0 };
|
||||||
|
dreq.handle = creq.handle;
|
||||||
|
drmIoctl(platform.fd, DRM_IOCTL_MODE_DESTROY_DUMB, &dreq);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Map the dumb buffer to copy our software rendered buffer
|
||||||
|
struct drm_mode_map_dumb mreq = { 0 };
|
||||||
|
mreq.handle = creq.handle;
|
||||||
|
result = drmIoctl(platform.fd, DRM_IOCTL_MODE_MAP_DUMB, &mreq);
|
||||||
|
if (result != 0)
|
||||||
|
{
|
||||||
|
TRACELOG(LOG_ERROR, "DISPLAY: Failed to map dumb buffer: %s", strerror(errno));
|
||||||
|
drmModeRmFB(platform.fd, fb);
|
||||||
|
struct drm_mode_destroy_dumb dreq = { 0 };
|
||||||
|
dreq.handle = creq.handle;
|
||||||
|
drmIoctl(platform.fd, DRM_IOCTL_MODE_DESTROY_DUMB, &dreq);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Map the buffer into userspace
|
||||||
|
void *dumbBuffer = mmap(0, creq.size, PROT_READ | PROT_WRITE, MAP_SHARED, platform.fd, mreq.offset);
|
||||||
|
if (dumbBuffer == MAP_FAILED)
|
||||||
|
{
|
||||||
|
TRACELOG(LOG_ERROR, "DISPLAY: Failed to mmap dumb buffer: %s", strerror(errno));
|
||||||
|
drmModeRmFB(platform.fd, fb);
|
||||||
|
struct drm_mode_destroy_dumb dreq = { 0 };
|
||||||
|
dreq.handle = creq.handle;
|
||||||
|
drmIoctl(platform.fd, DRM_IOCTL_MODE_DESTROY_DUMB, &dreq);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy the software rendered buffer to the dumb buffer with scaling if needed
|
||||||
|
if (bufferWidth == width && bufferHeight == height)
|
||||||
|
{
|
||||||
|
// Direct copy if sizes match
|
||||||
|
swCopyFramebuffer(0, 0, bufferWidth, bufferHeight, SW_RGBA, SW_UNSIGNED_BYTE, dumbBuffer);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Scale the software buffer to match the display mode
|
||||||
|
swBlitFramebuffer(0, 0, width, height, 0, 0, bufferWidth, bufferHeight, SW_RGBA, SW_UNSIGNED_BYTE, dumbBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unmap the buffer
|
||||||
|
munmap(dumbBuffer, creq.size);
|
||||||
|
|
||||||
|
// Find a CRTC compatible with the connector
|
||||||
|
uint32_t crtcId = 0;
|
||||||
|
if (platform.crtc) crtcId = platform.crtc->crtc_id;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Find a CRTC that's compatible with this connector
|
||||||
|
drmModeRes *res = drmModeGetResources(platform.fd);
|
||||||
|
if (!res)
|
||||||
|
{
|
||||||
|
TRACELOG(LOG_ERROR, "DISPLAY: Failed to get DRM resources");
|
||||||
|
drmModeRmFB(platform.fd, fb);
|
||||||
|
struct drm_mode_destroy_dumb dreq = {0};
|
||||||
|
dreq.handle = creq.handle;
|
||||||
|
drmIoctl(platform.fd, DRM_IOCTL_MODE_DESTROY_DUMB, &dreq);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check which CRTCs are compatible with this connector
|
||||||
|
drmModeEncoder *encoder = NULL;
|
||||||
|
if (platform.connector->encoder_id) encoder = drmModeGetEncoder(platform.fd, platform.connector->encoder_id);
|
||||||
|
|
||||||
|
if (encoder && encoder->crtc_id)
|
||||||
|
{
|
||||||
|
crtcId = encoder->crtc_id;
|
||||||
|
platform.crtc = drmModeGetCrtc(platform.fd, crtcId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Find a free CRTC
|
||||||
|
for (int i = 0; i < res->count_crtcs; i++)
|
||||||
|
{
|
||||||
|
drmModeCrtc *crtc = drmModeGetCrtc(platform.fd, res->crtcs[i]);
|
||||||
|
if (crtc && !crtc->buffer_id) // CRTC is free
|
||||||
|
{
|
||||||
|
crtcId = res->crtcs[i];
|
||||||
|
if (platform.crtc) drmModeFreeCrtc(platform.crtc);
|
||||||
|
platform.crtc = crtc;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (crtc) drmModeFreeCrtc(crtc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (encoder) drmModeFreeEncoder(encoder);
|
||||||
|
drmModeFreeResources(res);
|
||||||
|
|
||||||
|
if (!crtcId)
|
||||||
|
{
|
||||||
|
TRACELOG(LOG_ERROR, "DISPLAY: No compatible CRTC found");
|
||||||
|
drmModeRmFB(platform.fd, fb);
|
||||||
|
struct drm_mode_destroy_dumb dreq = {0};
|
||||||
|
dreq.handle = creq.handle;
|
||||||
|
drmIoctl(platform.fd, DRM_IOCTL_MODE_DESTROY_DUMB, &dreq);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set CRTC with better error handling
|
||||||
|
result = drmModeSetCrtc(platform.fd, crtcId, fb, 0, 0, &platform.connector->connector_id, 1, mode);
|
||||||
|
if (result != 0)
|
||||||
|
{
|
||||||
|
TRACELOG(LOG_ERROR, "DISPLAY: drmModeSetCrtc() failed with result: %d (%s)", result, strerror(errno));
|
||||||
|
TRACELOG(LOG_ERROR, "DISPLAY: CRTC ID: %u, FB ID: %u, Connector ID: %u", crtcId, fb, platform.connector->connector_id);
|
||||||
|
TRACELOG(LOG_ERROR, "DISPLAY: Mode: %dx%d@%d", mode->hdisplay, mode->vdisplay, mode->vrefresh);
|
||||||
|
|
||||||
|
drmModeRmFB(platform.fd, fb);
|
||||||
|
struct drm_mode_destroy_dumb dreq = {0};
|
||||||
|
dreq.handle = creq.handle;
|
||||||
|
drmIoctl(platform.fd, DRM_IOCTL_MODE_DESTROY_DUMB, &dreq);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clean up previous framebuffer
|
||||||
|
if (platform.prevFB)
|
||||||
|
{
|
||||||
|
result = drmModeRmFB(platform.fd, platform.prevFB);
|
||||||
|
if (result != 0) TRACELOG(LOG_WARNING, "DISPLAY: drmModeRmFB() failed with result: %d", result);
|
||||||
|
}
|
||||||
|
|
||||||
|
platform.prevFB = fb;
|
||||||
|
|
||||||
|
// Clean up previous dumb buffer
|
||||||
|
if (platform.prevDumbHandle)
|
||||||
|
{
|
||||||
|
struct drm_mode_destroy_dumb dreq = {0};
|
||||||
|
dreq.handle = platform.prevDumbHandle;
|
||||||
|
drmIoctl(platform.fd, DRM_IOCTL_MODE_DESTROY_DUMB, &dreq);
|
||||||
|
}
|
||||||
|
|
||||||
|
platform.prevDumbHandle = creq.handle;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif // SUPPORT_DRM_CACHE
|
#endif // SUPPORT_DRM_CACHE
|
||||||
|
|
||||||
|
|
@ -950,10 +1151,15 @@ int InitPlatform(void)
|
||||||
platform.connector = NULL;
|
platform.connector = NULL;
|
||||||
platform.modeIndex = -1;
|
platform.modeIndex = -1;
|
||||||
platform.crtc = NULL;
|
platform.crtc = NULL;
|
||||||
|
platform.prevFB = 0;
|
||||||
|
|
||||||
|
#if !defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||||
platform.gbmDevice = NULL;
|
platform.gbmDevice = NULL;
|
||||||
platform.gbmSurface = NULL;
|
platform.gbmSurface = NULL;
|
||||||
platform.prevBO = NULL;
|
platform.prevBO = NULL;
|
||||||
platform.prevFB = 0;
|
#else
|
||||||
|
platform.prevDumbHandle = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Initialize graphic device: display/window and graphic context
|
// Initialize graphic device: display/window and graphic context
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
@ -970,6 +1176,7 @@ int InitPlatform(void)
|
||||||
|
|
||||||
if ((platform.fd == -1) || (drmModeGetResources(platform.fd) == NULL))
|
if ((platform.fd == -1) || (drmModeGetResources(platform.fd) == NULL))
|
||||||
{
|
{
|
||||||
|
if (platform.fd != -1) close(platform.fd);
|
||||||
TRACELOG(LOG_WARNING, "DISPLAY: Failed to open platform-gpu-card, trying card1");
|
TRACELOG(LOG_WARNING, "DISPLAY: Failed to open platform-gpu-card, trying card1");
|
||||||
platform.fd = open("/dev/dri/card1", O_RDWR); // Other Embedded
|
platform.fd = open("/dev/dri/card1", O_RDWR); // Other Embedded
|
||||||
if (platform.fd != -1) TRACELOG(LOG_INFO, "DISPLAY: card1 opened successfully");
|
if (platform.fd != -1) TRACELOG(LOG_INFO, "DISPLAY: card1 opened successfully");
|
||||||
|
|
@ -977,10 +1184,19 @@ int InitPlatform(void)
|
||||||
|
|
||||||
if ((platform.fd == -1) || (drmModeGetResources(platform.fd) == NULL))
|
if ((platform.fd == -1) || (drmModeGetResources(platform.fd) == NULL))
|
||||||
{
|
{
|
||||||
|
if (platform.fd != -1) close(platform.fd);
|
||||||
TRACELOG(LOG_WARNING, "DISPLAY: Failed to open graphic card1, trying card0");
|
TRACELOG(LOG_WARNING, "DISPLAY: Failed to open graphic card1, trying card0");
|
||||||
platform.fd = open("/dev/dri/card0", O_RDWR); // VideoCore IV (Raspberry Pi 1-3)
|
platform.fd = open("/dev/dri/card0", O_RDWR); // VideoCore IV (Raspberry Pi 1-3)
|
||||||
if (platform.fd != -1) TRACELOG(LOG_INFO, "DISPLAY: card0 opened successfully");
|
if (platform.fd != -1) TRACELOG(LOG_INFO, "DISPLAY: card0 opened successfully");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((platform.fd == -1) || (drmModeGetResources(platform.fd) == NULL))
|
||||||
|
{
|
||||||
|
if (platform.fd != -1) close(platform.fd);
|
||||||
|
TRACELOG(LOG_WARNING, "DISPLAY: Failed to open graphic card0, trying card2");
|
||||||
|
platform.fd = open("/dev/dri/card2", O_RDWR);
|
||||||
|
if (platform.fd != -1) TRACELOG(LOG_INFO, "DISPLAY: card2 opened successfully");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (platform.fd == -1)
|
if (platform.fd == -1)
|
||||||
|
|
@ -993,29 +1209,55 @@ int InitPlatform(void)
|
||||||
if (!res)
|
if (!res)
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "DISPLAY: Failed get DRM resources");
|
TRACELOG(LOG_WARNING, "DISPLAY: Failed get DRM resources");
|
||||||
|
close(platform.fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACELOG(LOG_TRACE, "DISPLAY: Connectors found: %i", res->count_connectors);
|
TRACELOG(LOG_TRACE, "DISPLAY: Connectors found: %i", res->count_connectors);
|
||||||
|
|
||||||
|
// Connector detection
|
||||||
for (size_t i = 0; i < res->count_connectors; i++)
|
for (size_t i = 0; i < res->count_connectors; i++)
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_TRACE, "DISPLAY: Connector index %i", i);
|
TRACELOG(LOG_TRACE, "DISPLAY: Connector index %i", i);
|
||||||
|
|
||||||
drmModeConnector *con = drmModeGetConnector(platform.fd, res->connectors[i]);
|
drmModeConnector *con = drmModeGetConnector(platform.fd, res->connectors[i]);
|
||||||
TRACELOG(LOG_TRACE, "DISPLAY: Connector modes detected: %i", con->count_modes);
|
if (!con)
|
||||||
|
{
|
||||||
|
TRACELOG(LOG_WARNING, "DISPLAY: Failed to get connector %i", i);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
TRACELOG(LOG_TRACE, "DISPLAY: Connector %i modes detected: %i", i, con->count_modes);
|
||||||
|
TRACELOG(LOG_TRACE, "DISPLAY: Connector %i status: %s", i,
|
||||||
|
(con->connection == DRM_MODE_CONNECTED) ? "CONNECTED" :
|
||||||
|
(con->connection == DRM_MODE_DISCONNECTED) ? "DISCONNECTED" :
|
||||||
|
(con->connection == DRM_MODE_UNKNOWNCONNECTION) ? "UNKNOWN" : "OTHER");
|
||||||
|
|
||||||
// In certain cases the status of the conneciton is reported as UKNOWN, but it is still connected
|
// In certain cases the status of the conneciton is reported as UKNOWN, but it is still connected
|
||||||
// This might be a hardware or software limitation like on Raspberry Pi Zero with composite output
|
// This might be a hardware or software limitation like on Raspberry Pi Zero with composite output
|
||||||
if (((con->connection == DRM_MODE_CONNECTED) || (con->connection == DRM_MODE_UNKNOWNCONNECTION)) && (con->encoder_id))
|
// WARNING: Accept CONNECTED, UNKNOWN and even those without encoder_id connectors for software mode
|
||||||
|
if (((con->connection == DRM_MODE_CONNECTED) || (con->connection == DRM_MODE_UNKNOWNCONNECTION)) && (con->count_modes > 0))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_TRACE, "DISPLAY: DRM mode connected");
|
#if !defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||||
|
// For hardware rendering, we need an encoder_id
|
||||||
|
if (con->encoder_id)
|
||||||
|
{
|
||||||
|
TRACELOG(LOG_TRACE, "DISPLAY: DRM connector %i connected with encoder", i);
|
||||||
platform.connector = con;
|
platform.connector = con;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else TRACELOG(LOG_TRACE, "DISPLAY: DRM connector %i connected but no encoder", i);
|
||||||
|
#else
|
||||||
|
// For software rendering, we can accept even without encoder_id
|
||||||
|
TRACELOG(LOG_TRACE, "DISPLAY: DRM connector %i suitable for software rendering", i);
|
||||||
|
platform.connector = con;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!platform.connector)
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_TRACE, "DISPLAY: DRM mode NOT connected (deleting)");
|
TRACELOG(LOG_TRACE, "DISPLAY: DRM connector %i NOT suitable (deleting)", i);
|
||||||
drmModeFreeConnector(con);
|
drmModeFreeConnector(con);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1024,14 +1266,18 @@ int InitPlatform(void)
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "DISPLAY: No suitable DRM connector found");
|
TRACELOG(LOG_WARNING, "DISPLAY: No suitable DRM connector found");
|
||||||
drmModeFreeResources(res);
|
drmModeFreeResources(res);
|
||||||
|
close(platform.fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||||
drmModeEncoder *enc = drmModeGetEncoder(platform.fd, platform.connector->encoder_id);
|
drmModeEncoder *enc = drmModeGetEncoder(platform.fd, platform.connector->encoder_id);
|
||||||
if (!enc)
|
if (!enc)
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "DISPLAY: Failed to get DRM mode encoder");
|
TRACELOG(LOG_WARNING, "DISPLAY: Failed to get DRM mode encoder");
|
||||||
|
drmModeFreeConnector(platform.connector);
|
||||||
drmModeFreeResources(res);
|
drmModeFreeResources(res);
|
||||||
|
close(platform.fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1040,7 +1286,9 @@ int InitPlatform(void)
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "DISPLAY: Failed to get DRM mode crtc");
|
TRACELOG(LOG_WARNING, "DISPLAY: Failed to get DRM mode crtc");
|
||||||
drmModeFreeEncoder(enc);
|
drmModeFreeEncoder(enc);
|
||||||
|
drmModeFreeConnector(platform.connector);
|
||||||
drmModeFreeResources(res);
|
drmModeFreeResources(res);
|
||||||
|
close(platform.fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1055,7 +1303,9 @@ int InitPlatform(void)
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "DISPLAY: No matching DRM connector mode found");
|
TRACELOG(LOG_WARNING, "DISPLAY: No matching DRM connector mode found");
|
||||||
drmModeFreeEncoder(enc);
|
drmModeFreeEncoder(enc);
|
||||||
|
drmModeFreeConnector(platform.connector);
|
||||||
drmModeFreeResources(res);
|
drmModeFreeResources(res);
|
||||||
|
close(platform.fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1064,7 +1314,7 @@ int InitPlatform(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool allowInterlaced = FLAG_CHECK(CORE.Window.flags. FLAG_INTERLACED_HINT);
|
const bool allowInterlaced = FLAG_CHECK(CORE.Window.flags. FLAG_INTERLACED_HINT);
|
||||||
const int fps = (CORE.Time.target > 0)? (1.0/CORE.Time.target) : 60;
|
const int fps = (CORE.Time.target > 0) ? (1.0/CORE.Time.target) : 60;
|
||||||
|
|
||||||
// Try to find an exact matching mode
|
// Try to find an exact matching mode
|
||||||
platform.modeIndex = FindExactConnectorMode(platform.connector, CORE.Window.screen.width, CORE.Window.screen.height, fps, allowInterlaced);
|
platform.modeIndex = FindExactConnectorMode(platform.connector, CORE.Window.screen.width, CORE.Window.screen.height, fps, allowInterlaced);
|
||||||
|
|
@ -1083,7 +1333,9 @@ int InitPlatform(void)
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "DISPLAY: Failed to find a suitable DRM connector mode");
|
TRACELOG(LOG_WARNING, "DISPLAY: Failed to find a suitable DRM connector mode");
|
||||||
drmModeFreeEncoder(enc);
|
drmModeFreeEncoder(enc);
|
||||||
|
drmModeFreeConnector(platform.connector);
|
||||||
drmModeFreeResources(res);
|
drmModeFreeResources(res);
|
||||||
|
close(platform.fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1095,16 +1347,42 @@ int InitPlatform(void)
|
||||||
FLAG_CHECK(platform.connector->modes[platform.modeIndex].flags, DRM_MODE_FLAG_INTERLACE)? 'i' : 'p',
|
FLAG_CHECK(platform.connector->modes[platform.modeIndex].flags, DRM_MODE_FLAG_INTERLACE)? 'i' : 'p',
|
||||||
platform.connector->modes[platform.modeIndex].vrefresh);
|
platform.connector->modes[platform.modeIndex].vrefresh);
|
||||||
|
|
||||||
|
drmModeFreeEncoder(enc);
|
||||||
|
enc = NULL;
|
||||||
|
#else
|
||||||
|
// For software rendering, the first available mode can be used
|
||||||
|
if (platform.connector->count_modes > 0)
|
||||||
|
{
|
||||||
|
platform.modeIndex = 0;
|
||||||
|
CORE.Window.display.width = platform.connector->modes[0].hdisplay;
|
||||||
|
CORE.Window.display.height = platform.connector->modes[0].vdisplay;
|
||||||
|
|
||||||
|
TRACELOG(LOG_INFO, "DISPLAY: Selected DRM connector mode %s (%ux%u%c@%u) for software rendering",
|
||||||
|
platform.connector->modes[0].name,
|
||||||
|
platform.connector->modes[0].hdisplay,
|
||||||
|
platform.connector->modes[0].vdisplay,
|
||||||
|
(platform.connector->modes[0].flags & DRM_MODE_FLAG_INTERLACE) ? 'i' : 'p',
|
||||||
|
platform.connector->modes[0].vrefresh);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TRACELOG(LOG_WARNING, "DISPLAY: No modes available for connector");
|
||||||
|
drmModeFreeConnector(platform.connector);
|
||||||
|
drmModeFreeResources(res);
|
||||||
|
close(platform.fd);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Use the width and height of the surface for render
|
// Use the width and height of the surface for render
|
||||||
CORE.Window.render.width = CORE.Window.screen.width;
|
CORE.Window.render.width = CORE.Window.screen.width;
|
||||||
CORE.Window.render.height = CORE.Window.screen.height;
|
CORE.Window.render.height = CORE.Window.screen.height;
|
||||||
|
|
||||||
drmModeFreeEncoder(enc);
|
|
||||||
enc = NULL;
|
|
||||||
|
|
||||||
drmModeFreeResources(res);
|
drmModeFreeResources(res);
|
||||||
res = NULL;
|
res = NULL;
|
||||||
|
|
||||||
|
#if !defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||||
|
// Hardware rendering initialization with EGL
|
||||||
platform.gbmDevice = gbm_create_device(platform.fd);
|
platform.gbmDevice = gbm_create_device(platform.fd);
|
||||||
if (!platform.gbmDevice)
|
if (!platform.gbmDevice)
|
||||||
{
|
{
|
||||||
|
|
@ -1273,6 +1551,32 @@ int InitPlatform(void)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Load OpenGL extensions
|
||||||
|
// NOTE: GL procedures address loader is required to load extensions
|
||||||
|
rlLoadExtensions(eglGetProcAddress);
|
||||||
|
#else
|
||||||
|
// At this point we need to manage render size vs screen size
|
||||||
|
// NOTE: This function use and modify global module variables:
|
||||||
|
// -> CORE.Window.screen.width/CORE.Window.screen.height
|
||||||
|
// -> CORE.Window.render.width/CORE.Window.render.height
|
||||||
|
// -> CORE.Window.screenScale
|
||||||
|
SetupFramebuffer(CORE.Window.display.width, CORE.Window.display.height);
|
||||||
|
|
||||||
|
// Setup window ready state for software rendering
|
||||||
|
CORE.Window.ready = true;
|
||||||
|
|
||||||
|
CORE.Window.render.width = CORE.Window.screen.width;
|
||||||
|
CORE.Window.render.height = CORE.Window.screen.height;
|
||||||
|
CORE.Window.currentFbo.width = CORE.Window.render.width;
|
||||||
|
CORE.Window.currentFbo.height = CORE.Window.render.height;
|
||||||
|
|
||||||
|
TRACELOG(LOG_INFO, "DISPLAY: Device initialized successfully (Software Rendering)");
|
||||||
|
TRACELOG(LOG_INFO, " > Display size: %i x %i", CORE.Window.display.width, CORE.Window.display.height);
|
||||||
|
TRACELOG(LOG_INFO, " > Screen size: %i x %i", CORE.Window.screen.width, CORE.Window.screen.height);
|
||||||
|
TRACELOG(LOG_INFO, " > Render size: %i x %i", CORE.Window.render.width, CORE.Window.render.height);
|
||||||
|
TRACELOG(LOG_INFO, " > Viewport offsets: %i, %i", CORE.Window.renderOffset.x, CORE.Window.renderOffset.y);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (FLAG_CHECK(CORE.Window.flags, FLAG_WINDOW_MINIMIZED) > 0) MinimizeWindow();
|
if (FLAG_CHECK(CORE.Window.flags, FLAG_WINDOW_MINIMIZED) > 0) MinimizeWindow();
|
||||||
|
|
||||||
// If graphic device is no properly initialized, we end program
|
// If graphic device is no properly initialized, we end program
|
||||||
|
|
@ -1285,12 +1589,8 @@ int InitPlatform(void)
|
||||||
FLAG_SET(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED); // true
|
FLAG_SET(CORE.Window.flags, FLAG_WINDOW_MAXIMIZED); // true
|
||||||
FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_UNFOCUSED); // false
|
FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_UNFOCUSED); // false
|
||||||
|
|
||||||
// Load OpenGL extensions
|
|
||||||
// NOTE: GL procedures address loader is required to load extensions
|
|
||||||
rlLoadExtensions(eglGetProcAddress);
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
// Initialize timing system
|
||||||
// Initialize timming system
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// NOTE: timming system must be initialized before the input events system
|
// NOTE: timming system must be initialized before the input events system
|
||||||
InitTimer();
|
InitTimer();
|
||||||
|
|
@ -1336,6 +1636,7 @@ void ClosePlatform(void)
|
||||||
platform.prevFB = 0;
|
platform.prevFB = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||||
if (platform.prevBO)
|
if (platform.prevBO)
|
||||||
{
|
{
|
||||||
gbm_surface_release_buffer(platform.gbmSurface, platform.prevBO);
|
gbm_surface_release_buffer(platform.gbmSurface, platform.prevBO);
|
||||||
|
|
@ -1353,6 +1654,7 @@ void ClosePlatform(void)
|
||||||
gbm_device_destroy(platform.gbmDevice);
|
gbm_device_destroy(platform.gbmDevice);
|
||||||
platform.gbmDevice = NULL;
|
platform.gbmDevice = NULL;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (platform.crtc)
|
if (platform.crtc)
|
||||||
{
|
{
|
||||||
|
|
@ -1374,6 +1676,7 @@ void ClosePlatform(void)
|
||||||
platform.fd = -1;
|
platform.fd = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||||
// Close surface, context and display
|
// Close surface, context and display
|
||||||
if (platform.device != EGL_NO_DISPLAY)
|
if (platform.device != EGL_NO_DISPLAY)
|
||||||
{
|
{
|
||||||
|
|
@ -1392,6 +1695,7 @@ void ClosePlatform(void)
|
||||||
eglTerminate(platform.device);
|
eglTerminate(platform.device);
|
||||||
platform.device = EGL_NO_DISPLAY;
|
platform.device = EGL_NO_DISPLAY;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
CORE.Window.shouldClose = true; // Added to force threads to exit when the close window is called
|
CORE.Window.shouldClose = true; // Added to force threads to exit when the close window is called
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1258,6 +1258,7 @@ RLAPI Rectangle GetShapesTextureRectangle(void); // Get texture source re
|
||||||
RLAPI void DrawPixel(int posX, int posY, Color color); // Draw a pixel using geometry [Can be slow, use with care]
|
RLAPI void DrawPixel(int posX, int posY, Color color); // Draw a pixel using geometry [Can be slow, use with care]
|
||||||
RLAPI void DrawPixelV(Vector2 position, Color color); // Draw a pixel using geometry (Vector version) [Can be slow, use with care]
|
RLAPI void DrawPixelV(Vector2 position, Color color); // Draw a pixel using geometry (Vector version) [Can be slow, use with care]
|
||||||
RLAPI void DrawLine(int startPosX, int startPosY, int endPosX, int endPosY, Color color); // Draw a line
|
RLAPI void DrawLine(int startPosX, int startPosY, int endPosX, int endPosY, Color color); // Draw a line
|
||||||
|
RLAPI void DrawLineDashed(Vector2 startPos, Vector2 endPos, int dashSize, int whiteSpaceSize, Color color); // Draw a dashed line
|
||||||
RLAPI void DrawLineV(Vector2 startPos, Vector2 endPos, Color color); // Draw a line (using gl lines)
|
RLAPI void DrawLineV(Vector2 startPos, Vector2 endPos, Color color); // Draw a line (using gl lines)
|
||||||
RLAPI void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw a line (using triangles/quads)
|
RLAPI void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw a line (using triangles/quads)
|
||||||
RLAPI void DrawLineStrip(const Vector2 *points, int pointCount, Color color); // Draw lines sequence (using gl lines)
|
RLAPI void DrawLineStrip(const Vector2 *points, int pointCount, Color color); // Draw lines sequence (using gl lines)
|
||||||
|
|
|
||||||
88
src/rlgl.h
|
|
@ -149,7 +149,8 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Security check in case no GRAPHICS_API_OPENGL_* defined
|
// Security check in case no GRAPHICS_API_OPENGL_* defined
|
||||||
#if !defined(GRAPHICS_API_OPENGL_11) && \
|
#if !defined(GRAPHICS_API_OPENGL_11_SOFTWARE) && \
|
||||||
|
!defined(GRAPHICS_API_OPENGL_11) && \
|
||||||
!defined(GRAPHICS_API_OPENGL_21) && \
|
!defined(GRAPHICS_API_OPENGL_21) && \
|
||||||
!defined(GRAPHICS_API_OPENGL_33) && \
|
!defined(GRAPHICS_API_OPENGL_33) && \
|
||||||
!defined(GRAPHICS_API_OPENGL_43) && \
|
!defined(GRAPHICS_API_OPENGL_43) && \
|
||||||
|
|
@ -159,7 +160,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Security check in case multiple GRAPHICS_API_OPENGL_* defined
|
// Security check in case multiple GRAPHICS_API_OPENGL_* defined
|
||||||
#if defined(GRAPHICS_API_OPENGL_11)
|
#if defined(GRAPHICS_API_OPENGL_11) || defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||||
#if defined(GRAPHICS_API_OPENGL_21)
|
#if defined(GRAPHICS_API_OPENGL_21)
|
||||||
#undef GRAPHICS_API_OPENGL_21
|
#undef GRAPHICS_API_OPENGL_21
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -174,6 +175,11 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Software implementation uses OpenGL 1.1 functionality
|
||||||
|
#if defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||||
|
#define GRAPHICS_API_OPENGL_11
|
||||||
|
#endif
|
||||||
|
|
||||||
// OpenGL 2.1 uses most of OpenGL 3.3 Core functionality
|
// OpenGL 2.1 uses most of OpenGL 3.3 Core functionality
|
||||||
// WARNING: Specific parts are checked with #if defines
|
// WARNING: Specific parts are checked with #if defines
|
||||||
#if defined(GRAPHICS_API_OPENGL_21)
|
#if defined(GRAPHICS_API_OPENGL_21)
|
||||||
|
|
@ -427,7 +433,8 @@ typedef struct rlRenderBatch {
|
||||||
|
|
||||||
// OpenGL version
|
// OpenGL version
|
||||||
typedef enum {
|
typedef enum {
|
||||||
RL_OPENGL_11 = 1, // OpenGL 1.1
|
RL_OPENGL_11_SOFTWARE = 0, // Software rendering
|
||||||
|
RL_OPENGL_11, // OpenGL 1.1
|
||||||
RL_OPENGL_21, // OpenGL 2.1 (GLSL 120)
|
RL_OPENGL_21, // OpenGL 2.1 (GLSL 120)
|
||||||
RL_OPENGL_33, // OpenGL 3.3 (GLSL 330)
|
RL_OPENGL_33, // OpenGL 3.3 (GLSL 330)
|
||||||
RL_OPENGL_43, // OpenGL 4.3 (using GLSL 330)
|
RL_OPENGL_43, // OpenGL 4.3 (using GLSL 330)
|
||||||
|
|
@ -644,10 +651,8 @@ RLAPI void rlEnableVertexBufferElement(unsigned int id); // Enable vertex buffer
|
||||||
RLAPI void rlDisableVertexBufferElement(void); // Disable vertex buffer element (VBO element)
|
RLAPI void rlDisableVertexBufferElement(void); // Disable vertex buffer element (VBO element)
|
||||||
RLAPI void rlEnableVertexAttribute(unsigned int index); // Enable vertex attribute index
|
RLAPI void rlEnableVertexAttribute(unsigned int index); // Enable vertex attribute index
|
||||||
RLAPI void rlDisableVertexAttribute(unsigned int index); // Disable vertex attribute index
|
RLAPI void rlDisableVertexAttribute(unsigned int index); // Disable vertex attribute index
|
||||||
#if defined(GRAPHICS_API_OPENGL_11)
|
|
||||||
RLAPI void rlEnableStatePointer(int vertexAttribType, void *buffer); // Enable attribute state pointer
|
RLAPI void rlEnableStatePointer(int vertexAttribType, void *buffer); // Enable attribute state pointer
|
||||||
RLAPI void rlDisableStatePointer(int vertexAttribType); // Disable attribute state pointer
|
RLAPI void rlDisableStatePointer(int vertexAttribType); // Disable attribute state pointer
|
||||||
#endif
|
|
||||||
|
|
||||||
// Textures state
|
// Textures state
|
||||||
RLAPI void rlActiveTextureSlot(int slot); // Select and active a texture slot
|
RLAPI void rlActiveTextureSlot(int slot); // Select and active a texture slot
|
||||||
|
|
@ -686,6 +691,8 @@ RLAPI void rlDisableScissorTest(void); // Disable scissor test
|
||||||
RLAPI void rlScissor(int x, int y, int width, int height); // Scissor test
|
RLAPI void rlScissor(int x, int y, int width, int height); // Scissor test
|
||||||
RLAPI void rlEnablePointMode(void); // Enable point mode
|
RLAPI void rlEnablePointMode(void); // Enable point mode
|
||||||
RLAPI void rlDisablePointMode(void); // Disable point mode
|
RLAPI void rlDisablePointMode(void); // Disable point mode
|
||||||
|
RLAPI void rlSetPointSize(float size); // Set the point drawing size
|
||||||
|
RLAPI float rlGetPointSize(void); // Get the point drawing size
|
||||||
RLAPI void rlEnableWireMode(void); // Enable wire mode
|
RLAPI void rlEnableWireMode(void); // Enable wire mode
|
||||||
RLAPI void rlDisableWireMode(void); // Disable wire mode
|
RLAPI void rlDisableWireMode(void); // Disable wire mode
|
||||||
RLAPI void rlSetLineWidth(float width); // Set the line drawing width
|
RLAPI void rlSetLineWidth(float width); // Set the line drawing width
|
||||||
|
|
@ -768,6 +775,10 @@ RLAPI unsigned int rlLoadFramebuffer(void); // Loa
|
||||||
RLAPI void rlFramebufferAttach(unsigned int fboId, unsigned int texId, int attachType, int texType, int mipLevel); // Attach texture/renderbuffer to a framebuffer
|
RLAPI void rlFramebufferAttach(unsigned int fboId, unsigned int texId, int attachType, int texType, int mipLevel); // Attach texture/renderbuffer to a framebuffer
|
||||||
RLAPI bool rlFramebufferComplete(unsigned int id); // Verify framebuffer is complete
|
RLAPI bool rlFramebufferComplete(unsigned int id); // Verify framebuffer is complete
|
||||||
RLAPI void rlUnloadFramebuffer(unsigned int id); // Delete framebuffer from GPU
|
RLAPI void rlUnloadFramebuffer(unsigned int id); // Delete framebuffer from GPU
|
||||||
|
#if defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||||
|
RLAPI void rlCopyFramebuffer(int x, int y, int width, int height, int format, void *pixels); // Copy framebuffer pixel data to internal buffer
|
||||||
|
RLAPI void rlResizeFramebuffer(int width, int height); // Resize internal framebuffer
|
||||||
|
#endif
|
||||||
|
|
||||||
// Shaders management
|
// Shaders management
|
||||||
RLAPI unsigned int rlLoadShaderCode(const char *vsCode, const char *fsCode); // Load shader from code strings
|
RLAPI unsigned int rlLoadShaderCode(const char *vsCode, const char *fsCode); // Load shader from code strings
|
||||||
|
|
@ -834,6 +845,13 @@ RLAPI void rlLoadDrawQuad(void); // Load and draw a quad
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(GRAPHICS_API_OPENGL_11)
|
#if defined(GRAPHICS_API_OPENGL_11)
|
||||||
|
#if defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||||
|
#define RLSW_IMPLEMENTATION
|
||||||
|
#define SW_MALLOC(sz) RL_MALLOC(sz)
|
||||||
|
#define SW_REALLOC(ptr, newSz) RL_REALLOC(ptr, newSz)
|
||||||
|
#define SW_FREE(ptr) RL_FREE(ptr)
|
||||||
|
#include "external/rlsw.h" // OpenGL 1.1 software implementation
|
||||||
|
#else
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
#include <OpenGL/gl.h> // OpenGL 1.1 library for OSX
|
#include <OpenGL/gl.h> // OpenGL 1.1 library for OSX
|
||||||
#include <OpenGL/glext.h> // OpenGL extensions library
|
#include <OpenGL/glext.h> // OpenGL extensions library
|
||||||
|
|
@ -853,6 +871,7 @@ RLAPI void rlLoadDrawQuad(void); // Load and draw a quad
|
||||||
|
|
||||||
#include <GL/gl.h> // OpenGL 1.1 library
|
#include <GL/gl.h> // OpenGL 1.1 library
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(GRAPHICS_API_OPENGL_33)
|
#if defined(GRAPHICS_API_OPENGL_33)
|
||||||
|
|
@ -2016,6 +2035,25 @@ float rlGetLineWidth(void)
|
||||||
return width;
|
return width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set the point drawing size
|
||||||
|
void rlSetPointSize(float size)
|
||||||
|
{
|
||||||
|
#if defined(GRAPHICS_API_OPENGL_11)
|
||||||
|
glPointSize(size);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the point drawing size
|
||||||
|
float rlGetPointSize(void)
|
||||||
|
{
|
||||||
|
float size = 1;
|
||||||
|
#if defined(GRAPHICS_API_OPENGL_11)
|
||||||
|
glGetFloatv(GL_POINT_SIZE, &size);
|
||||||
|
#endif
|
||||||
|
return size;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Enable line aliasing
|
// Enable line aliasing
|
||||||
void rlEnableSmoothLines(void)
|
void rlEnableSmoothLines(void)
|
||||||
{
|
{
|
||||||
|
|
@ -2318,6 +2356,15 @@ void rlglInit(int width, int height)
|
||||||
glShadeModel(GL_SMOOTH); // Smooth shading between vertex (vertex colors interpolation)
|
glShadeModel(GL_SMOOTH); // Smooth shading between vertex (vertex colors interpolation)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||||
|
int result = swInit(width, height); // Initialize software renderer backend
|
||||||
|
if (result == 0)
|
||||||
|
{
|
||||||
|
TRACELOG(RL_LOG_ERROR, "RLSW: Software renderer initialization failed!");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||||
// Store screen size into global variables
|
// Store screen size into global variables
|
||||||
RLGL.State.framebufferWidth = width;
|
RLGL.State.framebufferWidth = width;
|
||||||
|
|
@ -2344,6 +2391,10 @@ void rlglClose(void)
|
||||||
glDeleteTextures(1, &RLGL.State.defaultTextureId); // Unload default texture
|
glDeleteTextures(1, &RLGL.State.defaultTextureId); // Unload default texture
|
||||||
TRACELOG(RL_LOG_INFO, "TEXTURE: [ID %i] Default texture unloaded successfully", RLGL.State.defaultTextureId);
|
TRACELOG(RL_LOG_INFO, "TEXTURE: [ID %i] Default texture unloaded successfully", RLGL.State.defaultTextureId);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||||
|
swClose(); // Unload sofware renderer resources
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load OpenGL extensions
|
// Load OpenGL extensions
|
||||||
|
|
@ -2653,7 +2704,10 @@ void *rlGetProcAddress(const char *procName)
|
||||||
int rlGetVersion(void)
|
int rlGetVersion(void)
|
||||||
{
|
{
|
||||||
int glVersion = 0;
|
int glVersion = 0;
|
||||||
#if defined(GRAPHICS_API_OPENGL_11)
|
|
||||||
|
#if defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||||
|
glVersion = RL_OPENGL_11_SOFTWARE;
|
||||||
|
#elif defined(GRAPHICS_API_OPENGL_11)
|
||||||
glVersion = RL_OPENGL_11;
|
glVersion = RL_OPENGL_11;
|
||||||
#endif
|
#endif
|
||||||
#if defined(GRAPHICS_API_OPENGL_21)
|
#if defined(GRAPHICS_API_OPENGL_21)
|
||||||
|
|
@ -3694,6 +3748,22 @@ void *rlReadTexturePixels(unsigned int id, int width, int height, int format)
|
||||||
return pixels;
|
return pixels;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||||
|
// Copy framebuffer pixel data to internal buffer
|
||||||
|
void rlCopyFramebuffer(int x, int y, int width, int height, int format, void* pixels)
|
||||||
|
{
|
||||||
|
unsigned int glInternalFormat, glFormat, glType;
|
||||||
|
rlGetGlTextureFormats(format, &glInternalFormat, &glFormat, &glType); // Get OpenGL texture format
|
||||||
|
swCopyFramebuffer(x, y, width, height, glFormat, glType, pixels);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Resize internal framebuffer
|
||||||
|
void rlResizeFramebuffer(int width, int height)
|
||||||
|
{
|
||||||
|
swResizeFramebuffer(width, height);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Read screen pixel data (color buffer)
|
// Read screen pixel data (color buffer)
|
||||||
unsigned char *rlReadScreenPixels(int width, int height)
|
unsigned char *rlReadScreenPixels(int width, int height)
|
||||||
{
|
{
|
||||||
|
|
@ -4003,10 +4073,10 @@ void rlDrawVertexArrayElementsInstanced(int offset, int count, const void *buffe
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(GRAPHICS_API_OPENGL_11)
|
|
||||||
// Enable vertex state pointer
|
// Enable vertex state pointer
|
||||||
void rlEnableStatePointer(int vertexAttribType, void *buffer)
|
void rlEnableStatePointer(int vertexAttribType, void *buffer)
|
||||||
{
|
{
|
||||||
|
#if defined(GRAPHICS_API_OPENGL_11)
|
||||||
if (buffer != NULL) glEnableClientState(vertexAttribType);
|
if (buffer != NULL) glEnableClientState(vertexAttribType);
|
||||||
switch (vertexAttribType)
|
switch (vertexAttribType)
|
||||||
{
|
{
|
||||||
|
|
@ -4017,14 +4087,16 @@ void rlEnableStatePointer(int vertexAttribType, void *buffer)
|
||||||
//case GL_INDEX_ARRAY: if (buffer != NULL) glIndexPointer(GL_SHORT, 0, buffer); break; // Indexed colors
|
//case GL_INDEX_ARRAY: if (buffer != NULL) glIndexPointer(GL_SHORT, 0, buffer); break; // Indexed colors
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable vertex state pointer
|
// Disable vertex state pointer
|
||||||
void rlDisableStatePointer(int vertexAttribType)
|
void rlDisableStatePointer(int vertexAttribType)
|
||||||
{
|
{
|
||||||
|
#if defined(GRAPHICS_API_OPENGL_11)
|
||||||
glDisableClientState(vertexAttribType);
|
glDisableClientState(vertexAttribType);
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// Load vertex array object (VAO)
|
// Load vertex array object (VAO)
|
||||||
unsigned int rlLoadVertexArray(void)
|
unsigned int rlLoadVertexArray(void)
|
||||||
|
|
|
||||||
|
|
@ -1293,10 +1293,19 @@ void UploadMesh(Mesh *mesh, bool dynamic)
|
||||||
rlEnableVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION);
|
rlEnableVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION);
|
||||||
|
|
||||||
// Enable vertex attributes: texcoords (shader-location = 1)
|
// Enable vertex attributes: texcoords (shader-location = 1)
|
||||||
|
|
||||||
|
if (mesh->texcoords != NULL)
|
||||||
|
{
|
||||||
mesh->vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD] = rlLoadVertexBuffer(mesh->texcoords, mesh->vertexCount*2*sizeof(float), dynamic);
|
mesh->vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD] = rlLoadVertexBuffer(mesh->texcoords, mesh->vertexCount*2*sizeof(float), dynamic);
|
||||||
rlSetVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD, 2, RL_FLOAT, 0, 0, 0);
|
rlSetVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD, 2, RL_FLOAT, 0, 0, 0);
|
||||||
rlEnableVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD);
|
rlEnableVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
float value[2] = { 0.0f, 0.0f };
|
||||||
|
rlSetVertexAttributeDefault(RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD, value, SHADER_ATTRIB_VEC2, 2);
|
||||||
|
rlDisableVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD);
|
||||||
|
}
|
||||||
// WARNING: When setting default vertex attribute values, the values for each generic vertex attribute
|
// WARNING: When setting default vertex attribute values, the values for each generic vertex attribute
|
||||||
// is part of current state, and it is maintained even if a different program object is used
|
// is part of current state, and it is maintained even if a different program object is used
|
||||||
|
|
||||||
|
|
@ -1420,7 +1429,7 @@ void UpdateMeshBuffer(Mesh mesh, int index, const void *data, int dataSize, int
|
||||||
// Draw a 3d mesh with material and transform
|
// Draw a 3d mesh with material and transform
|
||||||
void DrawMesh(Mesh mesh, Material material, Matrix transform)
|
void DrawMesh(Mesh mesh, Material material, Matrix transform)
|
||||||
{
|
{
|
||||||
#if defined(GRAPHICS_API_OPENGL_11)
|
#if defined(GRAPHICS_API_OPENGL_11) || defined(GRAPHICS_API_OPENGL_11_SOFTWARE)
|
||||||
#define GL_VERTEX_ARRAY 0x8074
|
#define GL_VERTEX_ARRAY 0x8074
|
||||||
#define GL_NORMAL_ARRAY 0x8075
|
#define GL_NORMAL_ARRAY 0x8075
|
||||||
#define GL_COLOR_ARRAY 0x8076
|
#define GL_COLOR_ARRAY 0x8076
|
||||||
|
|
@ -1431,12 +1440,12 @@ void DrawMesh(Mesh mesh, Material material, Matrix transform)
|
||||||
if (mesh.animVertices) rlEnableStatePointer(GL_VERTEX_ARRAY, mesh.animVertices);
|
if (mesh.animVertices) rlEnableStatePointer(GL_VERTEX_ARRAY, mesh.animVertices);
|
||||||
else rlEnableStatePointer(GL_VERTEX_ARRAY, mesh.vertices);
|
else rlEnableStatePointer(GL_VERTEX_ARRAY, mesh.vertices);
|
||||||
|
|
||||||
rlEnableStatePointer(GL_TEXTURE_COORD_ARRAY, mesh.texcoords);
|
if (mesh.texcoords) rlEnableStatePointer(GL_TEXTURE_COORD_ARRAY, mesh.texcoords);
|
||||||
|
|
||||||
if (mesh.animNormals) rlEnableStatePointer(GL_NORMAL_ARRAY, mesh.animNormals);
|
if (mesh.animNormals) rlEnableStatePointer(GL_NORMAL_ARRAY, mesh.animNormals);
|
||||||
else rlEnableStatePointer(GL_NORMAL_ARRAY, mesh.normals);
|
else if (mesh.normals) rlEnableStatePointer(GL_NORMAL_ARRAY, mesh.normals);
|
||||||
|
|
||||||
rlEnableStatePointer(GL_COLOR_ARRAY, mesh.colors);
|
if (mesh.colors) rlEnableStatePointer(GL_COLOR_ARRAY, mesh.colors);
|
||||||
|
|
||||||
rlPushMatrix();
|
rlPushMatrix();
|
||||||
rlMultMatrixf(MatrixToFloat(transform));
|
rlMultMatrixf(MatrixToFloat(transform));
|
||||||
|
|
@ -3836,6 +3845,7 @@ void DrawModelWiresEx(Model model, Vector3 position, Vector3 rotationAxis, float
|
||||||
|
|
||||||
// Draw a model points
|
// Draw a model points
|
||||||
// WARNING: OpenGL ES 2.0 does not support point mode drawing
|
// WARNING: OpenGL ES 2.0 does not support point mode drawing
|
||||||
|
// TODO: gate these properly for non es 2.0 versions only
|
||||||
void DrawModelPoints(Model model, Vector3 position, float scale, Color tint)
|
void DrawModelPoints(Model model, Vector3 position, float scale, Color tint)
|
||||||
{
|
{
|
||||||
rlEnablePointMode();
|
rlEnablePointMode();
|
||||||
|
|
@ -4420,7 +4430,11 @@ static Model LoadOBJ(const char *fileName)
|
||||||
model.meshes[i].vertices = (float *)MemAlloc(sizeof(float)*vertexCount*3);
|
model.meshes[i].vertices = (float *)MemAlloc(sizeof(float)*vertexCount*3);
|
||||||
model.meshes[i].normals = (float *)MemAlloc(sizeof(float)*vertexCount*3);
|
model.meshes[i].normals = (float *)MemAlloc(sizeof(float)*vertexCount*3);
|
||||||
model.meshes[i].texcoords = (float *)MemAlloc(sizeof(float)*vertexCount*2);
|
model.meshes[i].texcoords = (float *)MemAlloc(sizeof(float)*vertexCount*2);
|
||||||
|
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||||
model.meshes[i].colors = (unsigned char *)MemAlloc(sizeof(unsigned char)*vertexCount*4);
|
model.meshes[i].colors = (unsigned char *)MemAlloc(sizeof(unsigned char)*vertexCount*4);
|
||||||
|
#else
|
||||||
|
model.meshes[i].colors = NULL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
MemFree(localMeshVertexCounts);
|
MemFree(localMeshVertexCounts);
|
||||||
|
|
@ -4474,8 +4488,18 @@ static Model LoadOBJ(const char *fileName)
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++) model.meshes[meshIndex].vertices[localMeshVertexCount*3 + i] = objAttributes.vertices[vertIndex*3 + i];
|
for (int i = 0; i < 3; i++) model.meshes[meshIndex].vertices[localMeshVertexCount*3 + i] = objAttributes.vertices[vertIndex*3 + i];
|
||||||
|
|
||||||
|
if ((objAttributes.texcoords != NULL) && (texcordIndex != TINYOBJ_INVALID_INDEX) && (texcordIndex >= 0))
|
||||||
|
{
|
||||||
for (int i = 0; i < 2; i++) model.meshes[meshIndex].texcoords[localMeshVertexCount*2 + i] = objAttributes.texcoords[texcordIndex*2 + i];
|
for (int i = 0; i < 2; i++) model.meshes[meshIndex].texcoords[localMeshVertexCount*2 + i] = objAttributes.texcoords[texcordIndex*2 + i];
|
||||||
if (objAttributes.normals != NULL && normalIndex != TINYOBJ_INVALID_INDEX && normalIndex >= 0)
|
model.meshes[meshIndex].texcoords[localMeshVertexCount*2 + 1] = 1.0f - model.meshes[meshIndex].texcoords[localMeshVertexCount*2 + 1];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
model.meshes[meshIndex].texcoords[localMeshVertexCount*2 + 0] = 0.0f;
|
||||||
|
model.meshes[meshIndex].texcoords[localMeshVertexCount*2 + 1] = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((objAttributes.normals != NULL) && (normalIndex != TINYOBJ_INVALID_INDEX) && (normalIndex >= 0))
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 3; i++) model.meshes[meshIndex].normals[localMeshVertexCount*3 + i] = objAttributes.normals[normalIndex*3 + i];
|
for (int i = 0; i < 3; i++) model.meshes[meshIndex].normals[localMeshVertexCount*3 + i] = objAttributes.normals[normalIndex*3 + i];
|
||||||
}
|
}
|
||||||
|
|
@ -4485,11 +4509,9 @@ static Model LoadOBJ(const char *fileName)
|
||||||
model.meshes[meshIndex].normals[localMeshVertexCount*3 + 1] = 1.0f;
|
model.meshes[meshIndex].normals[localMeshVertexCount*3 + 1] = 1.0f;
|
||||||
model.meshes[meshIndex].normals[localMeshVertexCount*3 + 2] = 0.0f;
|
model.meshes[meshIndex].normals[localMeshVertexCount*3 + 2] = 0.0f;
|
||||||
}
|
}
|
||||||
|
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||||
model.meshes[meshIndex].texcoords[localMeshVertexCount*2 + 1] = 1.0f - model.meshes[meshIndex].texcoords[localMeshVertexCount*2 + 1];
|
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++) model.meshes[meshIndex].colors[localMeshVertexCount*4 + i] = 255;
|
for (int i = 0; i < 4; i++) model.meshes[meshIndex].colors[localMeshVertexCount*4 + i] = 255;
|
||||||
|
#endif
|
||||||
faceVertIndex++;
|
faceVertIndex++;
|
||||||
localMeshVertexCount++;
|
localMeshVertexCount++;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -182,6 +182,55 @@ void DrawLine(int startPosX, int startPosY, int endPosX, int endPosY, Color colo
|
||||||
rlEnd();
|
rlEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DrawLineDashed(Vector2 startPos, Vector2 endPos, int dashSize, int whiteSpaceSize, Color color)
|
||||||
|
{
|
||||||
|
// Calculate the vector and length of the line
|
||||||
|
float dx = endPos.x - startPos.x;
|
||||||
|
float dy = endPos.y - startPos.y;
|
||||||
|
float lineLength = sqrtf(dx*dx + dy*dy);
|
||||||
|
|
||||||
|
// If the line is too short for dashing or dash size is invalid, draw a solid thick line
|
||||||
|
if (lineLength < (dashSize + whiteSpaceSize) || dashSize <= 0)
|
||||||
|
{
|
||||||
|
DrawLineV(startPos, endPos, color);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate the normalized direction vector of the line
|
||||||
|
float invLineLength = 1 / lineLength;
|
||||||
|
float dirX = dx * invLineLength;
|
||||||
|
float dirY = dy * invLineLength;
|
||||||
|
|
||||||
|
Vector2 currentPos = startPos;
|
||||||
|
float distanceTraveled = 0;
|
||||||
|
|
||||||
|
rlBegin(RL_LINES);
|
||||||
|
rlColor4ub(color.r, color.g, color.b, color.a);
|
||||||
|
|
||||||
|
while (distanceTraveled < lineLength)
|
||||||
|
{
|
||||||
|
// Calculate the end of the current dash
|
||||||
|
float dashEndDist = distanceTraveled + dashSize;
|
||||||
|
if (dashEndDist > lineLength)
|
||||||
|
{
|
||||||
|
dashEndDist = lineLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector2 dashEndPos = { startPos.x + dashEndDist * dirX, startPos.y + dashEndDist * dirY };
|
||||||
|
|
||||||
|
// Draw the dash segment
|
||||||
|
rlVertex2f(currentPos.x, currentPos.y);
|
||||||
|
rlVertex2f(dashEndPos.x, dashEndPos.y);
|
||||||
|
|
||||||
|
// Update the distance traveled and move the current position for the next dash
|
||||||
|
distanceTraveled = dashEndDist + whiteSpaceSize;
|
||||||
|
currentPos.x = startPos.x + distanceTraveled * dirX;
|
||||||
|
currentPos.y = startPos.y + distanceTraveled * dirY;
|
||||||
|
}
|
||||||
|
|
||||||
|
rlEnd();
|
||||||
|
}
|
||||||
|
|
||||||
// Draw a line (using gl lines)
|
// Draw a line (using gl lines)
|
||||||
void DrawLineV(Vector2 startPos, Vector2 endPos, Color color)
|
void DrawLineV(Vector2 startPos, Vector2 endPos, Color color)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
10
src/rtext.c
|
|
@ -1452,7 +1452,7 @@ Rectangle GetGlyphAtlasRec(Font font, int codepoint)
|
||||||
char **LoadTextLines(const char *text, int *count)
|
char **LoadTextLines(const char *text, int *count)
|
||||||
{
|
{
|
||||||
int lineCount = 1;
|
int lineCount = 1;
|
||||||
int textSize = strlen(text);
|
int textSize = (int)strlen(text);
|
||||||
|
|
||||||
// Text pass to get required line count
|
// Text pass to get required line count
|
||||||
for (int i = 0; i < textSize; i++)
|
for (int i = 0; i < textSize; i++)
|
||||||
|
|
@ -1679,7 +1679,7 @@ char *GetTextBetween(const char *text, const char *begin, const char *end)
|
||||||
|
|
||||||
if (beginIndex > -1)
|
if (beginIndex > -1)
|
||||||
{
|
{
|
||||||
int beginLen = strlen(begin);
|
int beginLen = (int)strlen(begin);
|
||||||
int endIndex = TextFindIndex(text + beginIndex + beginLen, end);
|
int endIndex = TextFindIndex(text + beginIndex + beginLen, end);
|
||||||
|
|
||||||
if (endIndex > -1)
|
if (endIndex > -1)
|
||||||
|
|
@ -1758,15 +1758,15 @@ char *TextReplaceBetween(const char *text, const char *begin, const char *end, c
|
||||||
|
|
||||||
if (beginIndex > -1)
|
if (beginIndex > -1)
|
||||||
{
|
{
|
||||||
int beginLen = strlen(begin);
|
int beginLen = (int)strlen(begin);
|
||||||
int endIndex = TextFindIndex(text + beginIndex + beginLen, end);
|
int endIndex = TextFindIndex(text + beginIndex + beginLen, end);
|
||||||
|
|
||||||
if (endIndex > -1)
|
if (endIndex > -1)
|
||||||
{
|
{
|
||||||
endIndex += (beginIndex + beginLen);
|
endIndex += (beginIndex + beginLen);
|
||||||
|
|
||||||
int textLen = strlen(text);
|
int textLen = (int)strlen(text);
|
||||||
int replaceLen = (replacement == NULL)? 0 : strlen(replacement);
|
int replaceLen = (replacement == NULL)? 0 : (int)strlen(replacement);
|
||||||
int toreplaceLen = endIndex - beginIndex - beginLen;
|
int toreplaceLen = endIndex - beginIndex - beginLen;
|
||||||
result = (char *)RL_CALLOC(textLen + replaceLen - toreplaceLen + 1, sizeof(char));
|
result = (char *)RL_CALLOC(textLen + replaceLen - toreplaceLen + 1, sizeof(char));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -811,8 +811,8 @@ Image GenImageColor(int width, int height, Color color)
|
||||||
.data = pixels,
|
.data = pixels,
|
||||||
.width = width,
|
.width = width,
|
||||||
.height = height,
|
.height = height,
|
||||||
.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8,
|
.mipmaps = 1,
|
||||||
.mipmaps = 1
|
.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8
|
||||||
};
|
};
|
||||||
|
|
||||||
return image;
|
return image;
|
||||||
|
|
@ -863,8 +863,8 @@ Image GenImageGradientLinear(int width, int height, int direction, Color start,
|
||||||
.data = pixels,
|
.data = pixels,
|
||||||
.width = width,
|
.width = width,
|
||||||
.height = height,
|
.height = height,
|
||||||
.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8,
|
.mipmaps = 1,
|
||||||
.mipmaps = 1
|
.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8
|
||||||
};
|
};
|
||||||
|
|
||||||
return image;
|
return image;
|
||||||
|
|
@ -900,8 +900,8 @@ Image GenImageGradientRadial(int width, int height, float density, Color inner,
|
||||||
.data = pixels,
|
.data = pixels,
|
||||||
.width = width,
|
.width = width,
|
||||||
.height = height,
|
.height = height,
|
||||||
.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8,
|
.mipmaps = 1,
|
||||||
.mipmaps = 1
|
.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8
|
||||||
};
|
};
|
||||||
|
|
||||||
return image;
|
return image;
|
||||||
|
|
@ -949,8 +949,8 @@ Image GenImageGradientSquare(int width, int height, float density, Color inner,
|
||||||
.data = pixels,
|
.data = pixels,
|
||||||
.width = width,
|
.width = width,
|
||||||
.height = height,
|
.height = height,
|
||||||
.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8,
|
.mipmaps = 1,
|
||||||
.mipmaps = 1
|
.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8
|
||||||
};
|
};
|
||||||
|
|
||||||
return image;
|
return image;
|
||||||
|
|
@ -974,8 +974,8 @@ Image GenImageChecked(int width, int height, int checksX, int checksY, Color col
|
||||||
.data = pixels,
|
.data = pixels,
|
||||||
.width = width,
|
.width = width,
|
||||||
.height = height,
|
.height = height,
|
||||||
.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8,
|
.mipmaps = 1,
|
||||||
.mipmaps = 1
|
.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8
|
||||||
};
|
};
|
||||||
|
|
||||||
return image;
|
return image;
|
||||||
|
|
@ -997,8 +997,8 @@ Image GenImageWhiteNoise(int width, int height, float factor)
|
||||||
.data = pixels,
|
.data = pixels,
|
||||||
.width = width,
|
.width = width,
|
||||||
.height = height,
|
.height = height,
|
||||||
.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8,
|
.mipmaps = 1,
|
||||||
.mipmaps = 1
|
.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8
|
||||||
};
|
};
|
||||||
|
|
||||||
return image;
|
return image;
|
||||||
|
|
@ -1048,8 +1048,8 @@ Image GenImagePerlinNoise(int width, int height, int offsetX, int offsetY, float
|
||||||
.data = pixels,
|
.data = pixels,
|
||||||
.width = width,
|
.width = width,
|
||||||
.height = height,
|
.height = height,
|
||||||
.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8,
|
.mipmaps = 1,
|
||||||
.mipmaps = 1
|
.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8
|
||||||
};
|
};
|
||||||
|
|
||||||
return image;
|
return image;
|
||||||
|
|
@ -1113,8 +1113,8 @@ Image GenImageCellular(int width, int height, int tileSize)
|
||||||
.data = pixels,
|
.data = pixels,
|
||||||
.width = width,
|
.width = width,
|
||||||
.height = height,
|
.height = height,
|
||||||
.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8,
|
.mipmaps = 1,
|
||||||
.mipmaps = 1
|
.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8
|
||||||
};
|
};
|
||||||
|
|
||||||
return image;
|
return image;
|
||||||
|
|
|
||||||
|
|
@ -5508,6 +5508,33 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "DrawLineDashed",
|
||||||
|
"description": "Draw a dashed line",
|
||||||
|
"returnType": "void",
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Vector2",
|
||||||
|
"name": "startPos"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Vector2",
|
||||||
|
"name": "endPos"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "int",
|
||||||
|
"name": "dashSize"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "int",
|
||||||
|
"name": "whiteSpaceSize"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Color",
|
||||||
|
"name": "color"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "DrawLineV",
|
"name": "DrawLineV",
|
||||||
"description": "Draw a line (using gl lines)",
|
"description": "Draw a line (using gl lines)",
|
||||||
|
|
|
||||||
|
|
@ -4758,6 +4758,18 @@ return {
|
||||||
{type = "Color", name = "color"}
|
{type = "Color", name = "color"}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name = "DrawLineDashed",
|
||||||
|
description = "Draw a dashed line",
|
||||||
|
returnType = "void",
|
||||||
|
params = {
|
||||||
|
{type = "Vector2", name = "startPos"},
|
||||||
|
{type = "Vector2", name = "endPos"},
|
||||||
|
{type = "int", name = "dashSize"},
|
||||||
|
{type = "int", name = "whiteSpaceSize"},
|
||||||
|
{type = "Color", name = "color"}
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name = "DrawLineV",
|
name = "DrawLineV",
|
||||||
description = "Draw a line (using gl lines)",
|
description = "Draw a line (using gl lines)",
|
||||||
|
|
|
||||||
|
|
@ -679,7 +679,7 @@
|
||||||
<Param type="unsigned int" name="frames" desc="" />
|
<Param type="unsigned int" name="frames" desc="" />
|
||||||
</Callback>
|
</Callback>
|
||||||
</Callbacks>
|
</Callbacks>
|
||||||
<Functions count="595">
|
<Functions count="596">
|
||||||
<Function name="InitWindow" retType="void" paramCount="3" desc="Initialize window and OpenGL context">
|
<Function name="InitWindow" retType="void" paramCount="3" desc="Initialize window and OpenGL context">
|
||||||
<Param type="int" name="width" desc="" />
|
<Param type="int" name="width" desc="" />
|
||||||
<Param type="int" name="height" desc="" />
|
<Param type="int" name="height" desc="" />
|
||||||
|
|
@ -1359,6 +1359,13 @@
|
||||||
<Param type="int" name="endPosY" desc="" />
|
<Param type="int" name="endPosY" desc="" />
|
||||||
<Param type="Color" name="color" desc="" />
|
<Param type="Color" name="color" desc="" />
|
||||||
</Function>
|
</Function>
|
||||||
|
<Function name="DrawLineDashed" retType="void" paramCount="5" desc="Draw a dashed line">
|
||||||
|
<Param type="Vector2" name="startPos" desc="" />
|
||||||
|
<Param type="Vector2" name="endPos" desc="" />
|
||||||
|
<Param type="int" name="dashSize" desc="" />
|
||||||
|
<Param type="int" name="whiteSpaceSize" desc="" />
|
||||||
|
<Param type="Color" name="color" desc="" />
|
||||||
|
</Function>
|
||||||
<Function name="DrawLineV" retType="void" paramCount="3" desc="Draw a line (using gl lines)">
|
<Function name="DrawLineV" retType="void" paramCount="3" desc="Draw a line (using gl lines)">
|
||||||
<Param type="Vector2" name="startPos" desc="" />
|
<Param type="Vector2" name="startPos" desc="" />
|
||||||
<Param type="Vector2" name="endPos" desc="" />
|
<Param type="Vector2" name="endPos" desc="" />
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ PROJECT_BUILD_PATH ?= .
|
||||||
PROJECT_SOURCE_FILES ?= rexm.c
|
PROJECT_SOURCE_FILES ?= rexm.c
|
||||||
|
|
||||||
# raylib library variables
|
# raylib library variables
|
||||||
RAYLIB_SRC_PATH ?= ..\..\src
|
RAYLIB_SRC_PATH ?= ../../src
|
||||||
RAYLIB_INCLUDE_PATH ?= $(RAYLIB_SRC_PATH)
|
RAYLIB_INCLUDE_PATH ?= $(RAYLIB_SRC_PATH)
|
||||||
RAYLIB_LIB_PATH ?= $(RAYLIB_SRC_PATH)
|
RAYLIB_LIB_PATH ?= $(RAYLIB_SRC_PATH)
|
||||||
|
|
||||||
|
|
@ -363,4 +363,3 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
del *.o *.html *.js
|
del *.o *.html *.js
|
||||||
endif
|
endif
|
||||||
@echo Cleaning done
|
@echo Cleaning done
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,7 @@ Example elements validated:
|
||||||
| core_high_dpi | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
|
| core_high_dpi | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
|
||||||
| core_render_texture | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
|
| core_render_texture | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
|
||||||
| core_undo_redo | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
|
| core_undo_redo | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
|
||||||
|
| core_input_actions | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
|
||||||
| shapes_basic_shapes | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
|
| shapes_basic_shapes | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
|
||||||
| shapes_bouncing_ball | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
|
| shapes_bouncing_ball | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
|
||||||
| shapes_colors_palette | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
|
| shapes_colors_palette | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
|
||||||
|
|
|
||||||
|
|
@ -205,12 +205,22 @@ int main(int argc, char *argv[])
|
||||||
exCollectionFilePath = getenv("REXM_EXAMPLES_COLLECTION_FILE_PATH");
|
exCollectionFilePath = getenv("REXM_EXAMPLES_COLLECTION_FILE_PATH");
|
||||||
exVSProjectSolutionFile = getenv("REXM_EXAMPLES_VS2022_SLN_FILE");
|
exVSProjectSolutionFile = getenv("REXM_EXAMPLES_VS2022_SLN_FILE");
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
if (!exBasePath) exBasePath = "C:/GitHub/raylib/examples";
|
if (!exBasePath) exBasePath = "C:/GitHub/raylib/examples";
|
||||||
if (!exWebPath) exWebPath = "C:/GitHub/raylib.com/examples";
|
if (!exWebPath) exWebPath = "C:/GitHub/raylib.com/examples";
|
||||||
if (!exTemplateFilePath) exTemplateFilePath = "C:/GitHub/raylib/examples/examples_template.c";
|
if (!exTemplateFilePath) exTemplateFilePath = "C:/GitHub/raylib/examples/examples_template.c";
|
||||||
if (!exTemplateScreenshot) exTemplateScreenshot = "C:/GitHub/raylib/examples/examples_template.png";
|
if (!exTemplateScreenshot) exTemplateScreenshot = "C:/GitHub/raylib/examples/examples_template.png";
|
||||||
if (!exCollectionFilePath) exCollectionFilePath = "C:/GitHub/raylib/examples/examples_list.txt";
|
if (!exCollectionFilePath) exCollectionFilePath = "C:/GitHub/raylib/examples/examples_list.txt";
|
||||||
if (!exVSProjectSolutionFile) exVSProjectSolutionFile = "C:/GitHub/raylib/projects/VS2022/raylib.sln";
|
if (!exVSProjectSolutionFile) exVSProjectSolutionFile = "C:/GitHub/raylib/projects/VS2022/raylib.sln";
|
||||||
|
#else
|
||||||
|
// Cross-platform relative fallbacks (run from tools/rexm directory)
|
||||||
|
if (!exBasePath) exBasePath = "../../examples";
|
||||||
|
if (!exWebPath) exWebPath = "../../raylib.com/examples";
|
||||||
|
if (!exTemplateFilePath) exTemplateFilePath = "../../examples/examples_template.c";
|
||||||
|
if (!exTemplateScreenshot) exTemplateScreenshot = "../../examples/examples_template.png";
|
||||||
|
if (!exCollectionFilePath) exCollectionFilePath = "../../examples/examples_list.txt";
|
||||||
|
if (!exVSProjectSolutionFile) exVSProjectSolutionFile = "../../projects/VS2022/raylib.sln";
|
||||||
|
#endif
|
||||||
|
|
||||||
char inFileName[1024] = { 0 }; // Example input filename (to be added)
|
char inFileName[1024] = { 0 }; // Example input filename (to be added)
|
||||||
|
|
||||||
|
|
@ -1660,11 +1670,22 @@ static int UpdateRequiredFiles(void)
|
||||||
// NOTE: Entries format: exampleEntry('⭐️☆☆☆' , 'core' , 'basic_window'),
|
// NOTE: Entries format: exampleEntry('⭐️☆☆☆' , 'core' , 'basic_window'),
|
||||||
//------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------
|
||||||
char *jsText = LoadFileText(TextFormat("%s/../common/examples.js", exWebPath));
|
char *jsText = LoadFileText(TextFormat("%s/../common/examples.js", exWebPath));
|
||||||
char *jsTextUpdated = (char *)RL_CALLOC(REXM_MAX_BUFFER_SIZE, 1); // Updated examples.js copy, 2MB
|
if (!jsText)
|
||||||
|
{
|
||||||
|
LOG("INFO: examples.js not found, skipping web examples list update\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
int jsListStartIndex = TextFindIndex(jsText, "//EXAMPLE_DATA_LIST_START");
|
int jsListStartIndex = TextFindIndex(jsText, "//EXAMPLE_DATA_LIST_START");
|
||||||
int jsListEndIndex = TextFindIndex(jsText, "//EXAMPLE_DATA_LIST_END");
|
int jsListEndIndex = TextFindIndex(jsText, "//EXAMPLE_DATA_LIST_END");
|
||||||
|
if ((jsListStartIndex < 0) || (jsListEndIndex < 0))
|
||||||
|
{
|
||||||
|
LOG("WARNING: examples.js markers not found, skipping update\n");
|
||||||
|
UnloadFileText(jsText);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char *jsTextUpdated = (char *)RL_CALLOC(REXM_MAX_BUFFER_SIZE, 1); // Updated examples.js copy, 2MB
|
||||||
int jsIndex = 0;
|
int jsIndex = 0;
|
||||||
memcpy(jsTextUpdated, jsText, jsListStartIndex);
|
memcpy(jsTextUpdated, jsText, jsListStartIndex);
|
||||||
jsIndex = sprintf(jsTextUpdated + jsListStartIndex, "//EXAMPLE_DATA_LIST_START\n");
|
jsIndex = sprintf(jsTextUpdated + jsListStartIndex, "//EXAMPLE_DATA_LIST_START\n");
|
||||||
|
|
@ -1708,6 +1729,8 @@ static int UpdateRequiredFiles(void)
|
||||||
SaveFileText(TextFormat("%s/../common/examples.js", exWebPath), jsTextUpdated);
|
SaveFileText(TextFormat("%s/../common/examples.js", exWebPath), jsTextUpdated);
|
||||||
UnloadFileText(jsText);
|
UnloadFileText(jsText);
|
||||||
RL_FREE(jsTextUpdated);
|
RL_FREE(jsTextUpdated);
|
||||||
|
}
|
||||||
|
}
|
||||||
//------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
@ -2331,7 +2354,7 @@ static const char *GenerateUUIDv4(void)
|
||||||
// Update source code header and comments metadata
|
// Update source code header and comments metadata
|
||||||
static void UpdateSourceMetadata(const char *exSrcPath, const rlExampleInfo *info)
|
static void UpdateSourceMetadata(const char *exSrcPath, const rlExampleInfo *info)
|
||||||
{
|
{
|
||||||
if (FileExists(exSrcPath) && IsFileExtension(exSrcPath, ".c"))
|
if (FileExists(exSrcPath) && IsFileExtension(exSrcPath, ".c") && (!TextIsEqual(info->category, "others")))
|
||||||
{
|
{
|
||||||
// WARNING: Cache a copy of exSrcPath to avoid modifications by TextFormat()
|
// WARNING: Cache a copy of exSrcPath to avoid modifications by TextFormat()
|
||||||
char exSourcePath[512] = { 0 };
|
char exSourcePath[512] = { 0 };
|
||||||
|
|
|
||||||