the j
This commit is contained in:
parent
5f49ec3d64
commit
2991d95bbb
|
|
@ -2,7 +2,7 @@
|
||||||
include(CMakeDependentOption)
|
include(CMakeDependentOption)
|
||||||
include(EnumOption)
|
include(EnumOption)
|
||||||
|
|
||||||
enum_option(PLATFORM "Desktop;Web;Android;Raspberry Pi;DRM;SDL" "Platform to build for.")
|
enum_option(PLATFORM "Desktop;Web;Android;Raspberry Pi;DRM;SDL;Offscreen;None" "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" "Force a specific OpenGL Version?")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,24 @@ elseif ("${PLATFORM}" MATCHES "SDL")
|
||||||
find_package(SDL2 REQUIRED)
|
find_package(SDL2 REQUIRED)
|
||||||
set(PLATFORM_CPP "PLATFORM_DESKTOP_SDL")
|
set(PLATFORM_CPP "PLATFORM_DESKTOP_SDL")
|
||||||
set(LIBS_PRIVATE SDL2::SDL2)
|
set(LIBS_PRIVATE SDL2::SDL2)
|
||||||
|
elseif ("${PLATFORM}" MATCHES "None")
|
||||||
|
set(PLATFORM_CPP "PLATFORM_NONE")
|
||||||
|
set(CUSTOMIZE_BUILD TRUE)
|
||||||
|
|
||||||
|
set(USE_AUDIO FALSE)
|
||||||
|
find_library(pthread NAMES pthread)
|
||||||
|
find_package(OpenGL)
|
||||||
|
|
||||||
|
set(LIBS_PRIVATE m atomic pthread ${OPENGL_LIBRARIES})
|
||||||
|
elseif ("${PLATFORM}" MATCHES "Offscreen")
|
||||||
|
set(GRAPHICS "GRAPHICS_API_OPENGL_33")
|
||||||
|
set(PLATFORM_CPP "PLATFORM_OFFSCREEN")
|
||||||
|
|
||||||
|
find_library(pthread NAMES pthread)
|
||||||
|
find_package(OpenGL)
|
||||||
|
|
||||||
|
set(LIBS_PRIVATE m atomic pthread ${OPENGL_LIBRARIES})
|
||||||
|
set(LIBS_PRIVATE ${LIBS_PRIVATE} glfw)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (NOT ${OPENGL_VERSION} MATCHES "OFF")
|
if (NOT ${OPENGL_VERSION} MATCHES "OFF")
|
||||||
|
|
|
||||||
|
|
@ -448,7 +448,6 @@ MODELS = \
|
||||||
models/models_mesh_generation \
|
models/models_mesh_generation \
|
||||||
models/models_mesh_picking \
|
models/models_mesh_picking \
|
||||||
models/models_orthographic_projection \
|
models/models_orthographic_projection \
|
||||||
models/models_point_rendering \
|
|
||||||
models/models_rlgl_solar_system \
|
models/models_rlgl_solar_system \
|
||||||
models/models_skybox \
|
models/models_skybox \
|
||||||
models/models_waving_cubes \
|
models/models_waving_cubes \
|
||||||
|
|
@ -478,8 +477,7 @@ SHADERS = \
|
||||||
shaders/shaders_texture_outline \
|
shaders/shaders_texture_outline \
|
||||||
shaders/shaders_texture_tiling \
|
shaders/shaders_texture_tiling \
|
||||||
shaders/shaders_texture_waves \
|
shaders/shaders_texture_waves \
|
||||||
shaders/shaders_write_depth \
|
shaders/shaders_write_depth
|
||||||
shaders/shaders_vertex_displacement
|
|
||||||
|
|
||||||
AUDIO = \
|
AUDIO = \
|
||||||
audio/audio_mixed_processor \
|
audio/audio_mixed_processor \
|
||||||
|
|
|
||||||
|
|
@ -147,12 +147,11 @@ Examples using raylib models functionality, including models loading/generation
|
||||||
| 91 | [models_loading_vox](models/models_loading_vox.c) | <img src="models/models_loading_vox.png" alt="models_loading_vox" width="80"> | ⭐️☆☆☆ | **4.0** | **4.0** | [Johann Nadalutti](https://github.com/procfxgen) |
|
| 91 | [models_loading_vox](models/models_loading_vox.c) | <img src="models/models_loading_vox.png" alt="models_loading_vox" width="80"> | ⭐️☆☆☆ | **4.0** | **4.0** | [Johann Nadalutti](https://github.com/procfxgen) |
|
||||||
| 92 | [models_loading_m3d](models/models_loading_m3d.c) | <img src="models/models_loading_m3d.png" alt="models_loading_m3d" width="80"> | ⭐️☆☆☆ | **4.2** | **4.2** | [bzt](https://bztsrc.gitlab.io/model3d) |
|
| 92 | [models_loading_m3d](models/models_loading_m3d.c) | <img src="models/models_loading_m3d.png" alt="models_loading_m3d" width="80"> | ⭐️☆☆☆ | **4.2** | **4.2** | [bzt](https://bztsrc.gitlab.io/model3d) |
|
||||||
| 93 | [models_orthographic_projection](models/models_orthographic_projection.c) | <img src="models/models_orthographic_projection.png" alt="models_orthographic_projection" width="80"> | ⭐️☆☆☆ | 2.0 | 3.7 | [Max Danielsson](https://github.com/autious) |
|
| 93 | [models_orthographic_projection](models/models_orthographic_projection.c) | <img src="models/models_orthographic_projection.png" alt="models_orthographic_projection" width="80"> | ⭐️☆☆☆ | 2.0 | 3.7 | [Max Danielsson](https://github.com/autious) |
|
||||||
| 94 | [models_point_rendering](models/models_point_rendering.c) | <img src="models/models_point_rendering.png" alt="models_point_rendering" width="80"> | ⭐️⭐️☆☆ | 5.0 | 5.0 | [Reese Gallagher](https://github.com/satchelfrost) |
|
| 94 | [models_rlgl_solar_system](models/models_rlgl_solar_system.c) | <img src="models/models_rlgl_solar_system.png" alt="models_rlgl_solar_system" width="80"> | ⭐️⭐️⭐️⭐️ | 2.5 | **4.0** | [Ray](https://github.com/raysan5) |
|
||||||
| 95 | [models_rlgl_solar_system](models/models_rlgl_solar_system.c) | <img src="models/models_rlgl_solar_system.png" alt="models_rlgl_solar_system" width="80"> | ⭐️⭐️⭐️⭐️ | 2.5 | **4.0** | [Ray](https://github.com/raysan5) |
|
| 95 | [models_yaw_pitch_roll](models/models_yaw_pitch_roll.c) | <img src="models/models_yaw_pitch_roll.png" alt="models_yaw_pitch_roll" width="80"> | ⭐️⭐️☆☆ | 1.8 | **4.0** | [Berni](https://github.com/Berni8k) |
|
||||||
| 96 | [models_yaw_pitch_roll](models/models_yaw_pitch_roll.c) | <img src="models/models_yaw_pitch_roll.png" alt="models_yaw_pitch_roll" width="80"> | ⭐️⭐️☆☆ | 1.8 | **4.0** | [Berni](https://github.com/Berni8k) |
|
| 96 | [models_waving_cubes](models/models_waving_cubes.c) | <img src="models/models_waving_cubes.png" alt="models_waving_cubes" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 3.7 | [codecat](https://github.com/codecat) |
|
||||||
| 97 | [models_waving_cubes](models/models_waving_cubes.c) | <img src="models/models_waving_cubes.png" alt="models_waving_cubes" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 3.7 | [codecat](https://github.com/codecat) |
|
| 97 | [models_heightmap](models/models_heightmap.c) | <img src="models/models_heightmap.png" alt="models_heightmap" width="80"> | ⭐️☆☆☆ | 1.8 | 3.5 | [Ray](https://github.com/raysan5) |
|
||||||
| 98 | [models_heightmap](models/models_heightmap.c) | <img src="models/models_heightmap.png" alt="models_heightmap" width="80"> | ⭐️☆☆☆ | 1.8 | 3.5 | [Ray](https://github.com/raysan5) |
|
| 98 | [models_skybox](models/models_skybox.c) | <img src="models/models_skybox.png" alt="models_skybox" width="80"> | ⭐️⭐️☆☆ | 1.8 | **4.0** | [Ray](https://github.com/raysan5) |
|
||||||
| 99 | [models_skybox](models/models_skybox.c) | <img src="models/models_skybox.png" alt="models_skybox" width="80"> | ⭐️⭐️☆☆ | 1.8 | **4.0** | [Ray](https://github.com/raysan5) |
|
|
||||||
|
|
||||||
### category: shaders
|
### category: shaders
|
||||||
|
|
||||||
|
|
@ -160,25 +159,25 @@ Examples using raylib shaders functionality, including shaders loading, paramete
|
||||||
|
|
||||||
| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|
| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|
||||||
|----|----------|--------|:-------------------:|:------------------:|:------------------:|:----------|
|
|----|----------|--------|:-------------------:|:------------------:|:------------------:|:----------|
|
||||||
| 100 | [shaders_basic_lighting](shaders/shaders_basic_lighting.c) | <img src="shaders/shaders_basic_lighting.png" alt="shaders_basic_lighting" width="80"> | ⭐️⭐️⭐️⭐️ | 3.0 | **4.2** | [Chris Camacho](https://github.com/codifies) |
|
| 99 | [shaders_basic_lighting](shaders/shaders_basic_lighting.c) | <img src="shaders/shaders_basic_lighting.png" alt="shaders_basic_lighting" width="80"> | ⭐️⭐️⭐️⭐️ | 3.0 | **4.2** | [Chris Camacho](https://github.com/codifies) |
|
||||||
| 101 | [shaders_model_shader](shaders/shaders_model_shader.c) | <img src="shaders/shaders_model_shader.png" alt="shaders_model_shader" width="80"> | ⭐️⭐️☆☆ | 1.3 | 3.7 | [Ray](https://github.com/raysan5) |
|
| 100 | [shaders_model_shader](shaders/shaders_model_shader.c) | <img src="shaders/shaders_model_shader.png" alt="shaders_model_shader" width="80"> | ⭐️⭐️☆☆ | 1.3 | 3.7 | [Ray](https://github.com/raysan5) |
|
||||||
| 102 | [shaders_shapes_textures](shaders/shaders_shapes_textures.c) | <img src="shaders/shaders_shapes_textures.png" alt="shaders_shapes_textures" width="80"> | ⭐️⭐️☆☆ | 1.7 | 3.7 | [Ray](https://github.com/raysan5) |
|
| 101 | [shaders_shapes_textures](shaders/shaders_shapes_textures.c) | <img src="shaders/shaders_shapes_textures.png" alt="shaders_shapes_textures" width="80"> | ⭐️⭐️☆☆ | 1.7 | 3.7 | [Ray](https://github.com/raysan5) |
|
||||||
| 103 | [shaders_custom_uniform](shaders/shaders_custom_uniform.c) | <img src="shaders/shaders_custom_uniform.png" alt="shaders_custom_uniform" width="80"> | ⭐️⭐️☆☆ | 1.3 | **4.0** | [Ray](https://github.com/raysan5) |
|
| 102 | [shaders_custom_uniform](shaders/shaders_custom_uniform.c) | <img src="shaders/shaders_custom_uniform.png" alt="shaders_custom_uniform" width="80"> | ⭐️⭐️☆☆ | 1.3 | **4.0** | [Ray](https://github.com/raysan5) |
|
||||||
| 104 | [shaders_postprocessing](shaders/shaders_postprocessing.c) | <img src="shaders/shaders_postprocessing.png" alt="shaders_postprocessing" width="80"> | ⭐️⭐️⭐️☆ | 1.3 | **4.0** | [Ray](https://github.com/raysan5) |
|
| 103 | [shaders_postprocessing](shaders/shaders_postprocessing.c) | <img src="shaders/shaders_postprocessing.png" alt="shaders_postprocessing" width="80"> | ⭐️⭐️⭐️☆ | 1.3 | **4.0** | [Ray](https://github.com/raysan5) |
|
||||||
| 105 | [shaders_palette_switch](shaders/shaders_palette_switch.c) | <img src="shaders/shaders_palette_switch.png" alt="shaders_palette_switch" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 3.7 | [Marco Lizza](https://github.com/MarcoLizza) |
|
| 104 | [shaders_palette_switch](shaders/shaders_palette_switch.c) | <img src="shaders/shaders_palette_switch.png" alt="shaders_palette_switch" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 3.7 | [Marco Lizza](https://github.com/MarcoLizza) |
|
||||||
| 106 | [shaders_raymarching](shaders/shaders_raymarching.c) | <img src="shaders/shaders_raymarching.png" alt="shaders_raymarching" width="80"> | ⭐️⭐️⭐️⭐️ | 2.0 | **4.2** | [Ray](https://github.com/raysan5) |
|
| 105 | [shaders_raymarching](shaders/shaders_raymarching.c) | <img src="shaders/shaders_raymarching.png" alt="shaders_raymarching" width="80"> | ⭐️⭐️⭐️⭐️ | 2.0 | **4.2** | [Ray](https://github.com/raysan5) |
|
||||||
| 107 | [shaders_texture_drawing](shaders/shaders_texture_drawing.c) | <img src="shaders/shaders_texture_drawing.png" alt="shaders_texture_drawing" width="80"> | ⭐️⭐️☆☆ | 2.0 | 3.7 | [Michał Ciesielski](https://github.com/) |
|
| 106 | [shaders_texture_drawing](shaders/shaders_texture_drawing.c) | <img src="shaders/shaders_texture_drawing.png" alt="shaders_texture_drawing" width="80"> | ⭐️⭐️☆☆ | 2.0 | 3.7 | [Michał Ciesielski](https://github.com/) |
|
||||||
| 108 | [shaders_texture_outline](shaders/shaders_texture_outline.c) | <img src="shaders/shaders_texture_outline.png" alt="shaders_texture_outline" width="80"> | ⭐️⭐️⭐️☆ | **4.0** | **4.0** | [Samuel Skiff](https://github.com/GoldenThumbs) |
|
| 107 | [shaders_texture_outline](shaders/shaders_texture_outline.c) | <img src="shaders/shaders_texture_outline.png" alt="shaders_texture_outline" width="80"> | ⭐️⭐️⭐️☆ | **4.0** | **4.0** | [Samuel Skiff](https://github.com/GoldenThumbs) |
|
||||||
| 109 | [shaders_texture_waves](shaders/shaders_texture_waves.c) | <img src="shaders/shaders_texture_waves.png" alt="shaders_texture_waves" width="80"> | ⭐️⭐️☆☆ | 2.5 | 3.7 | [Anata](https://github.com/anatagawa) |
|
| 108 | [shaders_texture_waves](shaders/shaders_texture_waves.c) | <img src="shaders/shaders_texture_waves.png" alt="shaders_texture_waves" width="80"> | ⭐️⭐️☆☆ | 2.5 | 3.7 | [Anata](https://github.com/anatagawa) |
|
||||||
| 110 | [shaders_julia_set](shaders/shaders_julia_set.c) | <img src="shaders/shaders_julia_set.png" alt="shaders_julia_set" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | **4.0** | [eggmund](https://github.com/eggmund) |
|
| 109 | [shaders_julia_set](shaders/shaders_julia_set.c) | <img src="shaders/shaders_julia_set.png" alt="shaders_julia_set" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | **4.0** | [eggmund](https://github.com/eggmund) |
|
||||||
| 111 | [shaders_eratosthenes](shaders/shaders_eratosthenes.c) | <img src="shaders/shaders_eratosthenes.png" alt="shaders_eratosthenes" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | **4.0** | [ProfJski](https://github.com/ProfJski) |
|
| 110 | [shaders_eratosthenes](shaders/shaders_eratosthenes.c) | <img src="shaders/shaders_eratosthenes.png" alt="shaders_eratosthenes" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | **4.0** | [ProfJski](https://github.com/ProfJski) |
|
||||||
| 112 | [shaders_fog](shaders/shaders_fog.c) | <img src="shaders/shaders_fog.png" alt="shaders_fog" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 3.7 | [Chris Camacho](https://github.com/codifies) |
|
| 111 | [shaders_fog](shaders/shaders_fog.c) | <img src="shaders/shaders_fog.png" alt="shaders_fog" width="80"> | ⭐️⭐️⭐️☆ | 2.5 | 3.7 | [Chris Camacho](https://github.com/codifies) |
|
||||||
| 113 | [shaders_simple_mask](shaders/shaders_simple_mask.c) | <img src="shaders/shaders_simple_mask.png" alt="shaders_simple_mask" width="80"> | ⭐️⭐️☆☆ | 2.5 | 3.7 | [Chris Camacho](https://github.com/codifies) |
|
| 112 | [shaders_simple_mask](shaders/shaders_simple_mask.c) | <img src="shaders/shaders_simple_mask.png" alt="shaders_simple_mask" width="80"> | ⭐️⭐️☆☆ | 2.5 | 3.7 | [Chris Camacho](https://github.com/codifies) |
|
||||||
| 114 | [shaders_hot_reloading](shaders/shaders_hot_reloading.c) | <img src="shaders/shaders_hot_reloading.png" alt="shaders_hot_reloading" width="80"> | ⭐️⭐️⭐️☆ | 3.0 | 3.5 | [Ray](https://github.com/raysan5) |
|
| 113 | [shaders_hot_reloading](shaders/shaders_hot_reloading.c) | <img src="shaders/shaders_hot_reloading.png" alt="shaders_hot_reloading" width="80"> | ⭐️⭐️⭐️☆ | 3.0 | 3.5 | [Ray](https://github.com/raysan5) |
|
||||||
| 115 | [shaders_mesh_instancing](shaders/shaders_mesh_instancing.c) | <img src="shaders/shaders_mesh_instancing.png" alt="shaders_mesh_instancing" width="80"> | ⭐️⭐️⭐️⭐️ | 3.7 | **4.2** | [seanpringle](https://github.com/seanpringle) |
|
| 114 | [shaders_mesh_instancing](shaders/shaders_mesh_instancing.c) | <img src="shaders/shaders_mesh_instancing.png" alt="shaders_mesh_instancing" width="80"> | ⭐️⭐️⭐️⭐️ | 3.7 | **4.2** | [seanpringle](https://github.com/seanpringle) |
|
||||||
| 116 | [shaders_multi_sample2d](shaders/shaders_multi_sample2d.c) | <img src="shaders/shaders_multi_sample2d.png" alt="shaders_multi_sample2d" width="80"> | ⭐️⭐️☆☆ | 3.5 | 3.5 | [Ray](https://github.com/raysan5) |
|
| 115 | [shaders_multi_sample2d](shaders/shaders_multi_sample2d.c) | <img src="shaders/shaders_multi_sample2d.png" alt="shaders_multi_sample2d" width="80"> | ⭐️⭐️☆☆ | 3.5 | 3.5 | [Ray](https://github.com/raysan5) |
|
||||||
| 117 | [shaders_spotlight](shaders/shaders_spotlight.c) | <img src="shaders/shaders_spotlight.png" alt="shaders_spotlight" width="80"> | ⭐️⭐️☆☆ | 2.5 | 3.7 | [Chris Camacho](https://github.com/codifies) |
|
| 116 | [shaders_spotlight](shaders/shaders_spotlight.c) | <img src="shaders/shaders_spotlight.png" alt="shaders_spotlight" width="80"> | ⭐️⭐️☆☆ | 2.5 | 3.7 | [Chris Camacho](https://github.com/codifies) |
|
||||||
| 118 | [shaders_deferred_render](shaders/shaders_deferred_render.c) | <img src="shaders/shaders_deferred_render.png" alt="shaders_deferred_render" width="80"> | ⭐️⭐️⭐️⭐️ | 4.5 | 4.5 | [Justin Andreas Lacoste](https://github.com/27justin) |
|
| 117 | [shaders_deferred_render](shaders/shaders_deferred_render.c) | <img src="shaders/shaders_deferred_render.png" alt="shaders_deferred_render" width="80"> | ⭐️⭐️⭐️⭐️ | 4.5 | 4.5 | [Justin Andreas Lacoste](https://github.com/27justin) |
|
||||||
|
|
||||||
### category: audio
|
### category: audio
|
||||||
|
|
||||||
|
|
@ -186,10 +185,10 @@ Examples using raylib audio functionality, including sound/music loading and pla
|
||||||
|
|
||||||
| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|
| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|
||||||
|----|----------|--------|:-------------------:|:------------------:|:------------------:|:----------|
|
|----|----------|--------|:-------------------:|:------------------:|:------------------:|:----------|
|
||||||
| 119 | [audio_module_playing](audio/audio_module_playing.c) | <img src="audio/audio_module_playing.png" alt="audio_module_playing" width="80"> | ⭐️☆☆☆ | 1.5 | 3.5 | [Ray](https://github.com/raysan5) |
|
| 118 | [audio_module_playing](audio/audio_module_playing.c) | <img src="audio/audio_module_playing.png" alt="audio_module_playing" width="80"> | ⭐️☆☆☆ | 1.5 | 3.5 | [Ray](https://github.com/raysan5) |
|
||||||
| 120 | [audio_music_stream](audio/audio_music_stream.c) | <img src="audio/audio_music_stream.png" alt="audio_music_stream" width="80"> | ⭐️☆☆☆ | 1.3 | **4.2** | [Ray](https://github.com/raysan5) |
|
| 119 | [audio_music_stream](audio/audio_music_stream.c) | <img src="audio/audio_music_stream.png" alt="audio_music_stream" width="80"> | ⭐️☆☆☆ | 1.3 | **4.2** | [Ray](https://github.com/raysan5) |
|
||||||
| 121 | [audio_raw_stream](audio/audio_raw_stream.c) | <img src="audio/audio_raw_stream.png" alt="audio_raw_stream" width="80"> | ⭐️⭐️⭐️☆ | 1.6 | **4.2** | [Ray](https://github.com/raysan5) |
|
| 120 | [audio_raw_stream](audio/audio_raw_stream.c) | <img src="audio/audio_raw_stream.png" alt="audio_raw_stream" width="80"> | ⭐️⭐️⭐️☆ | 1.6 | **4.2** | [Ray](https://github.com/raysan5) |
|
||||||
| 122 | [audio_sound_loading](audio/audio_sound_loading.c) | <img src="audio/audio_sound_loading.png" alt="audio_sound_loading" width="80"> | ⭐️☆☆☆ | 1.1 | 3.5 | [Ray](https://github.com/raysan5) |
|
| 121 | [audio_sound_loading](audio/audio_sound_loading.c) | <img src="audio/audio_sound_loading.png" alt="audio_sound_loading" width="80"> | ⭐️☆☆☆ | 1.1 | 3.5 | [Ray](https://github.com/raysan5) |
|
||||||
|
|
||||||
### category: others
|
### category: others
|
||||||
|
|
||||||
|
|
@ -197,11 +196,11 @@ Examples showing raylib misc functionality that does not fit in other categories
|
||||||
|
|
||||||
| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|
| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|
||||||
|----|----------|--------|:-------------------:|:------------------:|:------------------:|:----------|
|
|----|----------|--------|:-------------------:|:------------------:|:------------------:|:----------|
|
||||||
| 123 | [rlgl_standalone](others/rlgl_standalone.c) | <img src="others/rlgl_standalone.png" alt="rlgl_standalone" width="80"> | ⭐️⭐️⭐️⭐️ | 1.6 | **4.0** | [Ray](https://github.com/raysan5) |
|
| 122 | [rlgl_standalone](others/rlgl_standalone.c) | <img src="others/rlgl_standalone.png" alt="rlgl_standalone" width="80"> | ⭐️⭐️⭐️⭐️ | 1.6 | **4.0** | [Ray](https://github.com/raysan5) |
|
||||||
| 124 | [rlgl_compute_shader](others/rlgl_compute_shader.c) | <img src="others/rlgl_compute_shader.png" alt="rlgl_compute_shader" width="80"> | ⭐️⭐️⭐️⭐️ | **4.0** | **4.0** | [Teddy Astie](https://github.com/tsnake41) |
|
| 123 | [rlgl_compute_shader](others/rlgl_compute_shader.c) | <img src="others/rlgl_compute_shader.png" alt="rlgl_compute_shader" width="80"> | ⭐️⭐️⭐️⭐️ | **4.0** | **4.0** | [Teddy Astie](https://github.com/tsnake41) |
|
||||||
| 125 | [easings_testbed](others/easings_testbed.c) | <img src="others/easings_testbed.png" alt="easings_testbed" width="80"> | ⭐️⭐️⭐️☆ | 3.0 | 3.0 | [Juan Miguel López](https://github.com/flashback-fx) |
|
| 124 | [easings_testbed](others/easings_testbed.c) | <img src="others/easings_testbed.png" alt="easings_testbed" width="80"> | ⭐️⭐️⭐️☆ | 3.0 | 3.0 | [Juan Miguel López](https://github.com/flashback-fx) |
|
||||||
| 126 | [raylib_opengl_interop](others/raylib_opengl_interop.c) | <img src="others/raylib_opengl_interop.png" alt="raylib_opengl_interop" width="80"> | ⭐️⭐️⭐️⭐️ | **4.0** | **4.0** | [Stephan Soller](https://github.com/arkanis) |
|
| 125 | [raylib_opengl_interop](others/raylib_opengl_interop.c) | <img src="others/raylib_opengl_interop.png" alt="raylib_opengl_interop" width="80"> | ⭐️⭐️⭐️⭐️ | **4.0** | **4.0** | [Stephan Soller](https://github.com/arkanis) |
|
||||||
| 127 | [embedded_files_loading](others/embedded_files_loading.c) | <img src="others/embedded_files_loading.png" alt="embedded_files_loading" width="80"> | ⭐️⭐️☆☆ | 3.5 | 3.5 | [Kristian Holmgren](https://github.com/defutura) |
|
| 126 | [embedded_files_loading](others/embedded_files_loading.c) | <img src="others/embedded_files_loading.png" alt="embedded_files_loading" width="80"> | ⭐️⭐️☆☆ | 3.5 | 3.5 | [Kristian Holmgren](https://github.com/defutura) |
|
||||||
|
|
||||||
As always contributions are welcome, feel free to send new examples! Here is an [examples template](examples_template.c) to start with!
|
As always contributions are welcome, feel free to send new examples! Here is an [examples template](examples_template.c) to start with!
|
||||||
|
|
||||||
|
|
|
||||||
119
examples/core/core_ascii_rendering.c
Normal file
119
examples/core/core_ascii_rendering.c
Normal file
|
|
@ -0,0 +1,119 @@
|
||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - Ascii rendering
|
||||||
|
*
|
||||||
|
* Example originally created with raylib 5.5, last time updated with raylib 5.5
|
||||||
|
*
|
||||||
|
* Example contributed by Gavin Parker (@IoIxD) 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) 2023 Gavin Parker (@IoIxD)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
#include "rmod.h"
|
||||||
|
|
||||||
|
#include "GLFW/glfw3.h" // Windows/Context and inputs management
|
||||||
|
|
||||||
|
#include <stdio.h> // Required for: printf()
|
||||||
|
#include "rlgl.h"
|
||||||
|
#include "raymath.h"
|
||||||
|
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 450;
|
||||||
|
GLFWwindow *window;
|
||||||
|
|
||||||
|
int CustomInitPlatform(void) {
|
||||||
|
if (!glfwInit())
|
||||||
|
{
|
||||||
|
printf("GLFW3: Can not initialize GLFW\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else printf("GLFW3: GLFW initialized successfully\n");
|
||||||
|
|
||||||
|
glfwWindowHint(GLFW_SAMPLES, 4);
|
||||||
|
glfwWindowHint(GLFW_DEPTH_BITS, 16);
|
||||||
|
|
||||||
|
// WARNING: OpenGL 3.3 Core profile only
|
||||||
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||||
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
|
||||||
|
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
||||||
|
//glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE);
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
glfwWindowHint( GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
window = glfwCreateWindow(screenWidth, screenHeight, "rlgl standalone", NULL, NULL);
|
||||||
|
|
||||||
|
if (!window)
|
||||||
|
{
|
||||||
|
glfwTerminate();
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
else printf("GLFW3: Window created successfully\n");
|
||||||
|
|
||||||
|
//glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
|
||||||
|
glfwSetWindowPos(window, 200, 200);
|
||||||
|
|
||||||
|
glfwMakeContextCurrent(window);
|
||||||
|
glfwSwapInterval(0);
|
||||||
|
|
||||||
|
// Load OpenGL 3.3 supported extensions
|
||||||
|
rlLoadExtensions(glfwGetProcAddress);
|
||||||
|
//--------------------------------------------------------
|
||||||
|
|
||||||
|
// Initialize OpenGL context (states and resources)
|
||||||
|
rlglInit(screenWidth, screenHeight);
|
||||||
|
|
||||||
|
// Initialize viewport and internal projection/modelview matrices
|
||||||
|
rlViewport(0, 0, screenWidth, screenHeight);
|
||||||
|
rlMatrixMode(RL_PROJECTION); // Switch to PROJECTION matrix
|
||||||
|
rlLoadIdentity(); // Reset current matrix (PROJECTION)
|
||||||
|
rlOrtho(0, screenWidth, screenHeight, 0, 0.0f, 1.0f); // Orthographic projection with top-left corner at (0,0)
|
||||||
|
rlMatrixMode(RL_MODELVIEW); // Switch back to MODELVIEW matrix
|
||||||
|
rlLoadIdentity(); // Reset current matrix (MODELVIEW)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CustomClosePlatform(void) {
|
||||||
|
glfwDestroyWindow(window); // Close window
|
||||||
|
glfwTerminate(); // Free GLFW3 resources
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Program main entry point
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
union OverridableFunctionPointer funcs;
|
||||||
|
CustomInitPlatform();
|
||||||
|
|
||||||
|
OverrideInternalFunction("InitPlatform",&funcs);
|
||||||
|
OverrideInternalFunction("ClosePlatform",&funcs);
|
||||||
|
|
||||||
|
RenderTexture2D fb = LoadRenderTexture(80,24);
|
||||||
|
|
||||||
|
InitWindow(1,1,"r");
|
||||||
|
|
||||||
|
Color col;
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
while(!WindowShouldClose()) {
|
||||||
|
BeginDrawing();
|
||||||
|
ClearBackground(WHITE);
|
||||||
|
BeginTextureMode(fb);
|
||||||
|
ClearBackground(RED);
|
||||||
|
EndTextureMode();
|
||||||
|
EndDrawing();
|
||||||
|
|
||||||
|
glfwSwapBuffers(window);
|
||||||
|
glfwPollEvents();
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomClosePlatform();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
@ -47,25 +47,25 @@ int main(void)
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
for (int i = 0, y = 5; i < 4; i++) // MAX_GAMEPADS = 4
|
for (int i = 0, y = 10; i < 4; i++) // MAX_GAMEPADS = 4
|
||||||
{
|
{
|
||||||
if (IsGamepadAvailable(i))
|
if (IsGamepadAvailable(i))
|
||||||
{
|
{
|
||||||
DrawText(TextFormat("Gamepad name: %s", GetGamepadName(i)), 10, y, 10, BLACK);
|
DrawText(TextFormat("Gamepad name: %s", GetGamepadName(i)), 10, y, 20, BLACK);
|
||||||
y += 11;
|
y += 30;
|
||||||
DrawText(TextFormat("\tAxis count: %d", GetGamepadAxisCount(i)), 10, y, 10, BLACK);
|
DrawText(TextFormat("\tAxis count: %d", GetGamepadAxisCount(i)), 10, y, 20, BLACK);
|
||||||
y += 11;
|
y += 30;
|
||||||
|
|
||||||
for (int axis = 0; axis < GetGamepadAxisCount(i); axis++)
|
for (int axis = 0; axis < GetGamepadAxisCount(i); axis++)
|
||||||
{
|
{
|
||||||
DrawText(TextFormat("\tAxis %d = %f", axis, GetGamepadAxisMovement(i, axis)), 10, y, 10, BLACK);
|
DrawText(TextFormat("\tAxis %d = %f", axis, GetGamepadAxisMovement(i, axis)), 10, y, 20, BLACK);
|
||||||
y += 11;
|
y += 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int button = 0; button < 32; button++)
|
for (int button = 0; button < 32; button++)
|
||||||
{
|
{
|
||||||
DrawText(TextFormat("\tButton %d = %d", button, IsGamepadButtonDown(i, button)), 10, y, 10, BLACK);
|
DrawText(TextFormat("\tButton %d = %d", button, IsGamepadButtonDown(i, button)), 10, y, 20, BLACK);
|
||||||
y += 11;
|
y += 30;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ int main(void)
|
||||||
|
|
||||||
DisableCursor(); // Limit cursor to relative movement inside the window
|
DisableCursor(); // Limit cursor to relative movement inside the window
|
||||||
|
|
||||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
SetTargetFPS(90); // Set our game to run at 90 frames-per-second
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ int main(void)
|
||||||
|
|
||||||
EndMode3D();
|
EndMode3D();
|
||||||
|
|
||||||
DrawText("Move player with arrow keys to collide", 220, 40, 20, GRAY);
|
DrawText("Move player with cursors to collide", 220, 40, 20, GRAY);
|
||||||
|
|
||||||
DrawFPS(10, 10);
|
DrawFPS(10, 10);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,6 @@ int main(void)
|
||||||
// De-Initialization
|
// De-Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
UnloadModel(model); // Unload model data
|
UnloadModel(model); // Unload model data
|
||||||
UnloadTexture(texture); // Unload texture data
|
|
||||||
|
|
||||||
CloseWindow(); // Close window and OpenGL context
|
CloseWindow(); // Close window and OpenGL context
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ uniform vec2 resolution;
|
||||||
//
|
//
|
||||||
// More info here: http://www.iquilezles.org/www/articles/distfunctions/distfunctions.htm
|
// More info here: http://www.iquilezles.org/www/articles/distfunctions/distfunctions.htm
|
||||||
|
|
||||||
#define AA 1 // make this 1 if your machine is too slow
|
#define AA 1 // make this 1 is your machine is too slow
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -236,7 +236,7 @@ int main()
|
||||||
float emissiveIntensity = 0.01f;
|
float emissiveIntensity = 0.01f;
|
||||||
SetShaderValue(shader, emissiveIntensityLoc, &emissiveIntensity, SHADER_UNIFORM_FLOAT);
|
SetShaderValue(shader, emissiveIntensityLoc, &emissiveIntensity, SHADER_UNIFORM_FLOAT);
|
||||||
|
|
||||||
DrawModel(car, (Vector3){ 0.0f, 0.0f, 0.0f }, 0.25f, WHITE); // Draw car model
|
DrawModel(car, (Vector3){ 0.0f, 0.0f, 0.0f }, 0.005f, WHITE); // Draw car model
|
||||||
|
|
||||||
// Draw spheres to show the lights positions
|
// Draw spheres to show the lights positions
|
||||||
for (int i = 0; i < MAX_LIGHTS; i++)
|
for (int i = 0; i < MAX_LIGHTS; i++)
|
||||||
|
|
|
||||||
|
|
@ -164,8 +164,6 @@ int main(void)
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
UnloadMesh(mesh); // Unload the mesh
|
UnloadMesh(mesh); // Unload the mesh
|
||||||
UnloadShader(shader); // Unload shader
|
UnloadShader(shader); // Unload shader
|
||||||
UnloadTexture(texture); // Unload texture
|
|
||||||
UnloadTexture(light); // Unload texture
|
|
||||||
|
|
||||||
CloseWindow(); // Close window and OpenGL context
|
CloseWindow(); // Close window and OpenGL context
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,6 @@ int main(void)
|
||||||
// De-Initialization
|
// De-Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
UnloadShader(shader);
|
UnloadShader(shader);
|
||||||
UnloadTexture(texture);
|
|
||||||
|
|
||||||
CloseWindow(); // Close window and OpenGL context
|
CloseWindow(); // Close window and OpenGL context
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -62,7 +62,7 @@ int main(void)
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
// 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);
|
||||||
|
|
|
||||||
|
|
@ -63,11 +63,11 @@ int main(void)
|
||||||
|
|
||||||
// Draw GUI controls
|
// Draw GUI controls
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
GuiSliderBar((Rectangle){ 600, 40, 120, 20}, "StartAngle", TextFormat("%.2f", startAngle), &startAngle, 0, 720);
|
GuiSliderBar((Rectangle){ 600, 40, 120, 20}, "StartAngle", NULL, &startAngle, 0, 720);
|
||||||
GuiSliderBar((Rectangle){ 600, 70, 120, 20}, "EndAngle", TextFormat("%.2f", endAngle), &endAngle, 0, 720);
|
GuiSliderBar((Rectangle){ 600, 70, 120, 20}, "EndAngle", NULL, &endAngle, 0, 720);
|
||||||
|
|
||||||
GuiSliderBar((Rectangle){ 600, 140, 120, 20}, "Radius", TextFormat("%.2f", outerRadius), &outerRadius, 0, 200);
|
GuiSliderBar((Rectangle){ 600, 140, 120, 20}, "Radius", NULL, &outerRadius, 0, 200);
|
||||||
GuiSliderBar((Rectangle){ 600, 170, 120, 20}, "Segments", TextFormat("%.2f", segments), &segments, 0, 100);
|
GuiSliderBar((Rectangle){ 600, 170, 120, 20}, "Segments", NULL, &segments, 0, 100);
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
minSegments = truncf(ceilf((endAngle - startAngle) / 90));
|
minSegments = truncf(ceilf((endAngle - startAngle) / 90));
|
||||||
|
|
|
||||||
|
|
@ -66,11 +66,11 @@ int main(void)
|
||||||
|
|
||||||
// Draw GUI controls
|
// Draw GUI controls
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
GuiSliderBar((Rectangle){ 640, 40, 105, 20 }, "Width", TextFormat("%.2f", width), &width, 0, (float)GetScreenWidth() - 300);
|
GuiSliderBar((Rectangle){ 640, 40, 105, 20 }, "Width", NULL, &width, 0, (float)GetScreenWidth() - 300);
|
||||||
GuiSliderBar((Rectangle){ 640, 70, 105, 20 }, "Height", TextFormat("%.2f", height), &height, 0, (float)GetScreenHeight() - 50);
|
GuiSliderBar((Rectangle){ 640, 70, 105, 20 }, "Height", NULL, &height, 0, (float)GetScreenHeight() - 50);
|
||||||
GuiSliderBar((Rectangle){ 640, 140, 105, 20 }, "Roundness", TextFormat("%.2f", roundness), &roundness, 0.0f, 1.0f);
|
GuiSliderBar((Rectangle){ 640, 140, 105, 20 }, "Roundness", NULL, &roundness, 0.0f, 1.0f);
|
||||||
GuiSliderBar((Rectangle){ 640, 170, 105, 20 }, "Thickness", TextFormat("%.2f", lineThick), &lineThick, 0, 20);
|
GuiSliderBar((Rectangle){ 640, 170, 105, 20 }, "Thickness", NULL, &lineThick, 0, 20);
|
||||||
GuiSliderBar((Rectangle){ 640, 240, 105, 20}, "Segments", TextFormat("%.2f", segments), &segments, 0, 60);
|
GuiSliderBar((Rectangle){ 640, 240, 105, 20}, "Segments", NULL, &segments, 0, 60);
|
||||||
|
|
||||||
GuiCheckBox((Rectangle){ 640, 320, 20, 20 }, "DrawRoundedRect", &drawRoundedRect);
|
GuiCheckBox((Rectangle){ 640, 320, 20, 20 }, "DrawRoundedRect", &drawRoundedRect);
|
||||||
GuiCheckBox((Rectangle){ 640, 350, 20, 20 }, "DrawRoundedLines", &drawRoundedLines);
|
GuiCheckBox((Rectangle){ 640, 350, 20, 20 }, "DrawRoundedLines", &drawRoundedLines);
|
||||||
|
|
|
||||||
|
|
@ -69,13 +69,13 @@ int main(void)
|
||||||
|
|
||||||
// Draw GUI controls
|
// Draw GUI controls
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
GuiSliderBar((Rectangle){ 600, 40, 120, 20 }, "StartAngle", TextFormat("%.2f", startAngle), &startAngle, -450, 450);
|
GuiSliderBar((Rectangle){ 600, 40, 120, 20 }, "StartAngle", NULL, &startAngle, -450, 450);
|
||||||
GuiSliderBar((Rectangle){ 600, 70, 120, 20 }, "EndAngle", TextFormat("%.2f", endAngle), &endAngle, -450, 450);
|
GuiSliderBar((Rectangle){ 600, 70, 120, 20 }, "EndAngle", NULL, &endAngle, -450, 450);
|
||||||
|
|
||||||
GuiSliderBar((Rectangle){ 600, 140, 120, 20 }, "InnerRadius", TextFormat("%.2f", innerRadius), &innerRadius, 0, 100);
|
GuiSliderBar((Rectangle){ 600, 140, 120, 20 }, "InnerRadius", NULL, &innerRadius, 0, 100);
|
||||||
GuiSliderBar((Rectangle){ 600, 170, 120, 20 }, "OuterRadius", TextFormat("%.2f", outerRadius), &outerRadius, 0, 200);
|
GuiSliderBar((Rectangle){ 600, 170, 120, 20 }, "OuterRadius", NULL, &outerRadius, 0, 200);
|
||||||
|
|
||||||
GuiSliderBar((Rectangle){ 600, 240, 120, 20 }, "Segments", TextFormat("%.2f", segments), &segments, 0, 100);
|
GuiSliderBar((Rectangle){ 600, 240, 120, 20 }, "Segments", NULL, &segments, 0, 100);
|
||||||
|
|
||||||
GuiCheckBox((Rectangle){ 600, 320, 20, 20 }, "Draw Ring", &drawRing);
|
GuiCheckBox((Rectangle){ 600, 320, 20, 20 }, "Draw Ring", &drawRing);
|
||||||
GuiCheckBox((Rectangle){ 600, 350, 20, 20 }, "Draw RingLines", &drawRingLines);
|
GuiCheckBox((Rectangle){ 600, 350, 20, 20 }, "Draw RingLines", &drawRingLines);
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ int main(void)
|
||||||
|
|
||||||
int framesCounter = 0;
|
int framesCounter = 0;
|
||||||
|
|
||||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
SetTargetFPS(10); // Set our game to run at 10 frames-per-second
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ int main(void)
|
||||||
DrawText(TextSubtext(message, 0, framesCounter/10), 210, 160, 20, MAROON);
|
DrawText(TextSubtext(message, 0, framesCounter/10), 210, 160, 20, MAROON);
|
||||||
|
|
||||||
DrawText("PRESS [ENTER] to RESTART!", 240, 260, 20, LIGHTGRAY);
|
DrawText("PRESS [ENTER] to RESTART!", 240, 260, 20, LIGHTGRAY);
|
||||||
DrawText("HOLD [SPACE] to SPEED UP!", 239, 300, 20, LIGHTGRAY);
|
DrawText("PRESS [SPACE] to SPEED UP!", 239, 300, 20, LIGHTGRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -43,9 +43,6 @@ int main(void)
|
||||||
const int blendCountMax = 4;
|
const int blendCountMax = 4;
|
||||||
BlendMode blendMode = 0;
|
BlendMode blendMode = 0;
|
||||||
|
|
||||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
|
||||||
//---------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,6 @@ int main(void)
|
||||||
textures[2] = LoadTextureFromImage(imageNeg90);
|
textures[2] = LoadTextureFromImage(imageNeg90);
|
||||||
|
|
||||||
int currentTexture = 0;
|
int currentTexture = 0;
|
||||||
|
|
||||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
|
||||||
//---------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,6 @@ int main(void)
|
||||||
|
|
||||||
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
|
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
|
||||||
Texture2D texture = LoadTexture("resources/raylib_logo.png"); // Texture loading
|
Texture2D texture = LoadTexture("resources/raylib_logo.png"); // Texture loading
|
||||||
|
|
||||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
|
||||||
//---------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
|
|
|
||||||
|
|
@ -63,8 +63,6 @@ int main(void)
|
||||||
|
|
||||||
Texture2D checked = LoadTextureFromImage(checkedIm);
|
Texture2D checked = LoadTextureFromImage(checkedIm);
|
||||||
UnloadImage(checkedIm); // Unload CPU (RAM) image data (pixels)
|
UnloadImage(checkedIm); // Unload CPU (RAM) image data (pixels)
|
||||||
|
|
||||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
|
||||||
//---------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
|
|
|
||||||
|
|
@ -48,8 +48,8 @@ int main(void)
|
||||||
bool active = false;
|
bool active = false;
|
||||||
int framesCounter = 0;
|
int framesCounter = 0;
|
||||||
|
|
||||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
SetTargetFPS(120);
|
||||||
//---------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,6 @@ int main(void)
|
||||||
|
|
||||||
texture = LoadTextureFromImage(image); // Recreate texture from retrieved image data (RAM -> VRAM)
|
texture = LoadTextureFromImage(image); // Recreate texture from retrieved image data (RAM -> VRAM)
|
||||||
UnloadImage(image); // Unload retrieved image data from CPU memory (RAM)
|
UnloadImage(image); // Unload retrieved image data from CPU memory (RAM)
|
||||||
|
|
||||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
|
||||||
//---------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
|
|
|
||||||
20
src/Makefile
20
src/Makefile
|
|
@ -27,6 +27,10 @@
|
||||||
# - Linux DRM subsystem (KMS mode)
|
# - Linux DRM subsystem (KMS mode)
|
||||||
# > PLATFORM_ANDROID:
|
# > PLATFORM_ANDROID:
|
||||||
# - Android (ARM, ARM64)
|
# - Android (ARM, ARM64)
|
||||||
|
# > PLATFORM_OFFSCREEN:
|
||||||
|
# - Offscreen rendering
|
||||||
|
# > PLATFORM_NONE:
|
||||||
|
# - No platform
|
||||||
#
|
#
|
||||||
# Many thanks to Milan Nikolic (@gen2brain) for implementing Android platform pipeline.
|
# Many thanks to Milan Nikolic (@gen2brain) for implementing Android platform pipeline.
|
||||||
# Many thanks to Emanuele Petriglia for his contribution on GNU/Linux pipeline.
|
# Many thanks to Emanuele Petriglia for his contribution on GNU/Linux pipeline.
|
||||||
|
|
@ -127,7 +131,7 @@ HOST_PLATFORM_OS ?= WINDOWS
|
||||||
PLATFORM_OS ?= WINDOWS
|
PLATFORM_OS ?= WINDOWS
|
||||||
|
|
||||||
# Determine PLATFORM_OS when required
|
# Determine PLATFORM_OS when required
|
||||||
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW PLATFORM_DESKTOP_SDL PLATFORM_DESKTOP_RGFW PLATFORM_WEB PLATFORM_ANDROID))
|
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW PLATFORM_DESKTOP_SDL PLATFORM_DESKTOP_RGFW PLATFORM_WEB PLATFORM_ANDROID PLATFORM_NONE PLATFORM_OFFSCREEN))
|
||||||
# No uname.exe on MinGW!, but OS=Windows_NT on Windows!
|
# No uname.exe on MinGW!, but OS=Windows_NT on Windows!
|
||||||
# ifeq ($(UNAME),Msys) -> Windows
|
# ifeq ($(UNAME),Msys) -> Windows
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
|
|
@ -237,6 +241,13 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
|
||||||
#GRAPHICS = GRAPHICS_API_OPENGL_43 # Uncomment to use OpenGL 4.3
|
#GRAPHICS = GRAPHICS_API_OPENGL_43 # Uncomment to use OpenGL 4.3
|
||||||
#GRAPHICS = GRAPHICS_API_OPENGL_ES2 # Uncomment to use OpenGL ES 2.0 (ANGLE)
|
#GRAPHICS = GRAPHICS_API_OPENGL_ES2 # Uncomment to use OpenGL ES 2.0 (ANGLE)
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_NONE PLATFORM_OFFSCREEN))
|
||||||
|
GRAPHICS ?= GRAPHICS_API_OPENGL_33
|
||||||
|
#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_43 # Uncomment to use OpenGL 4.3
|
||||||
|
#GRAPHICS = GRAPHICS_API_OPENGL_ES2 # Uncomment to use OpenGL ES 2.0 (ANGLE)
|
||||||
|
endif
|
||||||
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_SDL)
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_SDL)
|
||||||
# By default use OpenGL 3.3 on desktop platform with SDL backend
|
# By default use OpenGL 3.3 on desktop platform with SDL backend
|
||||||
GRAPHICS ?= GRAPHICS_API_OPENGL_33
|
GRAPHICS ?= GRAPHICS_API_OPENGL_33
|
||||||
|
|
@ -622,6 +633,9 @@ endif
|
||||||
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
|
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
|
||||||
LDLIBS = -llog -landroid -lEGL -lGLESv2 -lOpenSLES -lc -lm
|
LDLIBS = -llog -landroid -lEGL -lGLESv2 -lOpenSLES -lc -lm
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_NONE PLATFORM_OFFSCREEN))
|
||||||
|
LDLIBS = -lGL -lc -lm -lpthread -ldl -lrt
|
||||||
|
endif
|
||||||
|
|
||||||
# Define source code object files required
|
# Define source code object files required
|
||||||
#------------------------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------------------------
|
||||||
|
|
@ -725,7 +739,7 @@ endif
|
||||||
rcore.o : platforms/*.c
|
rcore.o : platforms/*.c
|
||||||
|
|
||||||
# Compile core module
|
# Compile core module
|
||||||
rcore.o : rcore.c raylib.h rlgl.h utils.h raymath.h rcamera.h rgestures.h
|
rcore.o : rcore.c raylib.h rcore.h rlgl.h utils.h raymath.h rcamera.h rgestures.h
|
||||||
$(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS)
|
$(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS)
|
||||||
|
|
||||||
# Compile rglfw module
|
# Compile rglfw module
|
||||||
|
|
@ -814,6 +828,7 @@ ifeq ($(ROOT),root)
|
||||||
cp --update raylib.h $(RAYLIB_H_INSTALL_PATH)/raylib.h
|
cp --update raylib.h $(RAYLIB_H_INSTALL_PATH)/raylib.h
|
||||||
cp --update raymath.h $(RAYLIB_H_INSTALL_PATH)/raymath.h
|
cp --update raymath.h $(RAYLIB_H_INSTALL_PATH)/raymath.h
|
||||||
cp --update rlgl.h $(RAYLIB_H_INSTALL_PATH)/rlgl.h
|
cp --update rlgl.h $(RAYLIB_H_INSTALL_PATH)/rlgl.h
|
||||||
|
cp --update rcore.h $(RAYLIB_H_INSTALL_PATH)/rcore.h
|
||||||
@echo "raylib development files installed/updated!"
|
@echo "raylib development files installed/updated!"
|
||||||
else
|
else
|
||||||
@echo "This function currently works on GNU/Linux systems. Add yours today (^;"
|
@echo "This function currently works on GNU/Linux systems. Add yours today (^;"
|
||||||
|
|
@ -841,6 +856,7 @@ ifeq ($(ROOT),root)
|
||||||
rm --force --interactive --verbose $(RAYLIB_H_INSTALL_PATH)/raylib.h
|
rm --force --interactive --verbose $(RAYLIB_H_INSTALL_PATH)/raylib.h
|
||||||
rm --force --interactive --verbose $(RAYLIB_H_INSTALL_PATH)/raymath.h
|
rm --force --interactive --verbose $(RAYLIB_H_INSTALL_PATH)/raymath.h
|
||||||
rm --force --interactive --verbose $(RAYLIB_H_INSTALL_PATH)/rlgl.h
|
rm --force --interactive --verbose $(RAYLIB_H_INSTALL_PATH)/rlgl.h
|
||||||
|
rm --force --interactive --verbose $(RAYLIB_H_INSTALL_PATH)/rcore.h
|
||||||
@echo "raylib development files removed!"
|
@echo "raylib development files removed!"
|
||||||
else
|
else
|
||||||
@echo "This function currently works on GNU/Linux systems. Add yours today (^;"
|
@echo "This function currently works on GNU/Linux systems. Add yours today (^;"
|
||||||
|
|
|
||||||
|
|
@ -251,6 +251,7 @@ static const KeyboardKey mapKeycode[KEYCODE_MAP_SIZE] = {
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
int InitPlatform(void); // Initialize platform (graphics, inputs and more)
|
int InitPlatform(void); // Initialize platform (graphics, inputs and more)
|
||||||
void ClosePlatform(void); // Close platform
|
void ClosePlatform(void); // Close platform
|
||||||
|
void OverrideInternalFunction(const char * funcName, union OverridableFunctionPointer * func);
|
||||||
|
|
||||||
static void AndroidCommandCallback(struct android_app *app, int32_t cmd); // Process Android activity lifecycle commands
|
static void AndroidCommandCallback(struct android_app *app, int32_t cmd); // Process Android activity lifecycle commands
|
||||||
static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event); // Process Android inputs
|
static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event); // Process Android inputs
|
||||||
|
|
@ -1336,4 +1337,9 @@ static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Override an internal platform function with your own (PLATFORM_OFFSCREEN and PLATFORM_NONE only)
|
||||||
|
void OverrideInternalFunction(const char * funcName, union OverridableFunctionPointer * func); {
|
||||||
|
TraceLog(LOG_WARNING, "OverrideInternalFunction called on unsupported platform");
|
||||||
|
};
|
||||||
|
|
||||||
// EOF
|
// EOF
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,7 @@ static PlatformData platform = { 0 }; // Platform specific data
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
int InitPlatform(void); // Initialize platform (graphics, inputs and more)
|
int InitPlatform(void); // Initialize platform (graphics, inputs and more)
|
||||||
void ClosePlatform(void); // Close platform
|
void ClosePlatform(void); // Close platform
|
||||||
|
void OverrideInternalFunction(const char * funcName, union OverridableFunctionPointer * func);
|
||||||
|
|
||||||
// Error callback event
|
// Error callback event
|
||||||
static void ErrorCallback(int error, const char *description); // GLFW3 Error Callback, runs on GLFW3 error
|
static void ErrorCallback(int error, const char *description); // GLFW3 Error Callback, runs on GLFW3 error
|
||||||
|
|
@ -1898,4 +1899,9 @@ static void JoystickCallback(int jid, int event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Override an internal platform function with your own (PLATFORM_OFFSCREEN and PLATFORM_NONE only)
|
||||||
|
void OverrideInternalFunction(const char * funcName, union OverridableFunctionPointer * func); {
|
||||||
|
TraceLog(LOG_WARNING, "OverrideInternalFunction called on unsupported platform");
|
||||||
|
};
|
||||||
|
|
||||||
// EOF
|
// EOF
|
||||||
|
|
|
||||||
|
|
@ -220,6 +220,7 @@ static const unsigned short keyMappingRGFW[] = {
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
int InitPlatform(void); // Initialize platform (graphics, inputs and more)
|
int InitPlatform(void); // Initialize platform (graphics, inputs and more)
|
||||||
bool InitGraphicsDevice(void); // Initialize graphics device
|
bool InitGraphicsDevice(void); // Initialize graphics device
|
||||||
|
void OverrideInternalFunction(const char * funcName, union OverridableFunctionPointer * func);
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Module Functions Declaration
|
// Module Functions Declaration
|
||||||
|
|
@ -1353,3 +1354,9 @@ static KeyboardKey ConvertScancodeToKey(u32 keycode)
|
||||||
|
|
||||||
return keyMappingRGFW[keycode];
|
return keyMappingRGFW[keycode];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Override an internal platform function with your own (PLATFORM_OFFSCREEN and PLATFORM_NONE only)
|
||||||
|
void OverrideInternalFunction(const char * funcName, union OverridableFunctionPointer * func); {
|
||||||
|
TraceLog(LOG_WARNING, "OverrideInternalFunction called on unsupported platform");
|
||||||
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -225,6 +225,7 @@ static const int CursorsLUT[] = {
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
int InitPlatform(void); // Initialize platform (graphics, inputs and more)
|
int InitPlatform(void); // Initialize platform (graphics, inputs and more)
|
||||||
void ClosePlatform(void); // Close platform
|
void ClosePlatform(void); // Close platform
|
||||||
|
void OverrideInternalFunction(const char * funcName, union OverridableFunctionPointer * func);
|
||||||
|
|
||||||
static KeyboardKey ConvertScancodeToKey(SDL_Scancode sdlScancode); // Help convert SDL scancodes to raylib key
|
static KeyboardKey ConvertScancodeToKey(SDL_Scancode sdlScancode); // Help convert SDL scancodes to raylib key
|
||||||
|
|
||||||
|
|
@ -1617,4 +1618,11 @@ static KeyboardKey ConvertScancodeToKey(SDL_Scancode sdlScancode)
|
||||||
|
|
||||||
return KEY_NULL; // No equivalent key in Raylib
|
return KEY_NULL; // No equivalent key in Raylib
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Override an internal platform function with your own (PLATFORM_OFFSCREEN and PLATFORM_NONE only)
|
||||||
|
void OverrideInternalFunction(const char * funcName, union OverridableFunctionPointer * func); {
|
||||||
|
TraceLog(LOG_WARNING, "OverrideInternalFunction called on unsupported platform");
|
||||||
|
};
|
||||||
|
|
||||||
// EOF
|
// EOF
|
||||||
|
|
|
||||||
|
|
@ -219,6 +219,7 @@ static const short linuxToRaylibMap[KEYMAP_SIZE] = {
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
int InitPlatform(void); // Initialize platform (graphics, inputs and more)
|
int InitPlatform(void); // Initialize platform (graphics, inputs and more)
|
||||||
void ClosePlatform(void); // Close platform
|
void ClosePlatform(void); // Close platform
|
||||||
|
void OverrideInternalFunction(const char * funcName, union OverridableFunctionPointer * func);
|
||||||
|
|
||||||
#if defined(SUPPORT_SSH_KEYBOARD_RPI)
|
#if defined(SUPPORT_SSH_KEYBOARD_RPI)
|
||||||
static void InitKeyboard(void); // Initialize raw keyboard system
|
static void InitKeyboard(void); // Initialize raw keyboard system
|
||||||
|
|
@ -1938,4 +1939,9 @@ static int FindNearestConnectorMode(const drmModeConnector *connector, uint widt
|
||||||
return nearestIndex;
|
return nearestIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Override an internal platform function with your own (PLATFORM_OFFSCREEN and PLATFORM_NONE only)
|
||||||
|
void OverrideInternalFunction(const char * funcName, union OverridableFunctionPointer * func); {
|
||||||
|
TraceLog(LOG_WARNING, "OverrideInternalFunction called on unsupported platform");
|
||||||
|
};
|
||||||
|
|
||||||
// EOF
|
// EOF
|
||||||
|
|
|
||||||
422
src/platforms/rcore_none.c
Normal file
422
src/platforms/rcore_none.c
Normal file
|
|
@ -0,0 +1,422 @@
|
||||||
|
#include "rcore_none.h"
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Global Variables Definition
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
extern CoreData CORE; // Global CORE state context
|
||||||
|
|
||||||
|
|
||||||
|
static PlatformData platform = { 0 }; // Platform specific data
|
||||||
|
|
||||||
|
#define GEN_CALLBACK_BODY(fn_ret, ret_value, fn_name, named_args, args) \
|
||||||
|
fn_ret fn_name(LIST named_args) { \
|
||||||
|
if(internal##fn_name##Callback == NULL) {\
|
||||||
|
FUNCTION_MISSING_WARNING(fn_name) \
|
||||||
|
return ret_value; \
|
||||||
|
} else {\
|
||||||
|
return (*internal##fn_name##Callback)(LIST args); \
|
||||||
|
}\
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate a callback that returns a void.
|
||||||
|
#define GEN_CALLBACK_BODY_VOID(fn_name, named_args, args) \
|
||||||
|
void fn_name(LIST named_args) { \
|
||||||
|
if(internal##fn_name##Callback == NULL) {\
|
||||||
|
FUNCTION_MISSING_WARNING(fn_name) \
|
||||||
|
} else {\
|
||||||
|
(*internal##fn_name##Callback)(LIST args); \
|
||||||
|
}\
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate any of the if/else statements in OverrideInternalFunction.
|
||||||
|
#define GEN_CASE(fn_name) \
|
||||||
|
if (strcmp(funcName, #fn_name) == 0) { \
|
||||||
|
internal##fn_name##Callback = &(func-> fn_name); \
|
||||||
|
return; \
|
||||||
|
}
|
||||||
|
|
||||||
|
// For the functions that have default behavior on PLATFORM_OFFSCREEN, check if the function exists
|
||||||
|
// first.
|
||||||
|
#define CHECK_AND_CALL(fn_name, args) \
|
||||||
|
if(internal##fn_name##Callback != NULL) {\
|
||||||
|
return (*internal##fn_name##Callback)(LIST args); \
|
||||||
|
}
|
||||||
|
|
||||||
|
// For the functions that have default behavior on PLATFORM_OFFSCREEN, check if the function exists
|
||||||
|
// first (void version).
|
||||||
|
#define CHECK_AND_CALL_VOID(fn_name, args) \
|
||||||
|
if(internal##fn_name##Callback != NULL) {\
|
||||||
|
(*internal##fn_name##Callback)(LIST args); \
|
||||||
|
}
|
||||||
|
|
||||||
|
GEN_CALLBACK_BODY_VOID(ClosePlatform, (void), ())
|
||||||
|
GEN_CALLBACK_BODY_VOID(ToggleFullscreen, (void), ())
|
||||||
|
GEN_CALLBACK_BODY_VOID(ToggleBorderlessWindowed, (void), ())
|
||||||
|
GEN_CALLBACK_BODY_VOID(MaximizeWindow, (void), ())
|
||||||
|
GEN_CALLBACK_BODY_VOID(MinimizeWindow, (void), ())
|
||||||
|
GEN_CALLBACK_BODY_VOID(RestoreWindow, (void), ())
|
||||||
|
GEN_CALLBACK_BODY_VOID(SetWindowIcon, (Image image), (image))
|
||||||
|
GEN_CALLBACK_BODY_VOID(SetWindowIcons, (Image *images, int count), (images, count))
|
||||||
|
GEN_CALLBACK_BODY_VOID(SetWindowTitle, (const char *title), (title))
|
||||||
|
GEN_CALLBACK_BODY_VOID(SetWindowPosition, (int x, int y), (x,y))
|
||||||
|
GEN_CALLBACK_BODY_VOID(SetWindowMonitor, (int monitor), (monitor))
|
||||||
|
GEN_CALLBACK_BODY_VOID(SetWindowOpacity, (float opacity), (opacity))
|
||||||
|
GEN_CALLBACK_BODY_VOID(SetWindowFocused, (void), ())
|
||||||
|
GEN_CALLBACK_BODY_VOID(EnableCursor, (void), ())
|
||||||
|
GEN_CALLBACK_BODY_VOID(DisableCursor, (void), ())
|
||||||
|
GEN_CALLBACK_BODY_VOID(SwapScreenBuffer, (void), ())
|
||||||
|
GEN_CALLBACK_BODY_VOID(SetGamepadVibration, (int gamepad, float leftMotor, float rightMotor), (gamepad,leftMotor,rightMotor))
|
||||||
|
GEN_CALLBACK_BODY_VOID(SetMousePosition, (int x, int y), (x,y))
|
||||||
|
GEN_CALLBACK_BODY_VOID(SetMouseCursor, (int cursor), (cursor))
|
||||||
|
GEN_CALLBACK_BODY_VOID(PollInputEvents, (void), ())
|
||||||
|
GEN_CALLBACK_BODY_VOID(SetClipboardText, (const char *text), (text))
|
||||||
|
GEN_CALLBACK_BODY(int, 0, SetGamepadMappings, (const char *mappings), (mappings))
|
||||||
|
GEN_CALLBACK_BODY(void *, NULL, GetWindowHandle, (void), ())
|
||||||
|
GEN_CALLBACK_BODY(Vector2, Vector2Zero(), GetMonitorPosition, (int monitor), (monitor))
|
||||||
|
GEN_CALLBACK_BODY(int, 0, GetMonitorWidth, (int monitor), (monitor))
|
||||||
|
GEN_CALLBACK_BODY(int, 0, GetMonitorHeight, (int monitor), (monitor))
|
||||||
|
GEN_CALLBACK_BODY(int, 0, GetMonitorPhysicalWidth, (int monitor), (monitor))
|
||||||
|
GEN_CALLBACK_BODY(int, 0, GetMonitorPhysicalHeight, (int monitor), (monitor))
|
||||||
|
GEN_CALLBACK_BODY(int, 0, GetMonitorRefreshRate, (int monitor), (monitor))
|
||||||
|
GEN_CALLBACK_BODY(const char*, "", GetMonitorName, (int monitor), (monitor))
|
||||||
|
GEN_CALLBACK_BODY(Vector2, Vector2Zero(), GetWindowPosition, (void), ())
|
||||||
|
GEN_CALLBACK_BODY(Vector2, Vector2Zero(), GetWindowScaleDPI, (void), ())
|
||||||
|
GEN_CALLBACK_BODY(const char *, "", GetClipboardText, (void), ())
|
||||||
|
GEN_CALLBACK_BODY(const char *, "", GetKeyName, (int key), (key))
|
||||||
|
GEN_CALLBACK_BODY(double, 0.0, GetTime, (void), ())
|
||||||
|
GEN_CALLBACK_BODY_VOID(OpenURL, (const char *url), (url))
|
||||||
|
|
||||||
|
// Override an internal platform function with your own (PLATFORM_OFFSCREEN and PLATFORM_NONE only).
|
||||||
|
// Note that there is no responsibility here for the Raylib maintainers to keep a stable API for core functions
|
||||||
|
void OverrideInternalFunction(const char * funcName, union OverridableFunctionPointer * func) {
|
||||||
|
GEN_CASE(InitPlatform)
|
||||||
|
GEN_CASE(ClosePlatform)
|
||||||
|
GEN_CASE(ToggleFullscreen)
|
||||||
|
GEN_CASE(ToggleBorderlessWindowed)
|
||||||
|
GEN_CASE(MaximizeWindow)
|
||||||
|
GEN_CASE(MinimizeWindow)
|
||||||
|
GEN_CASE(RestoreWindow)
|
||||||
|
GEN_CASE(SetWindowIcon)
|
||||||
|
GEN_CASE(SetWindowIcons)
|
||||||
|
GEN_CASE(SetWindowTitle)
|
||||||
|
GEN_CASE(SetWindowPosition)
|
||||||
|
GEN_CASE(SetWindowMonitor)
|
||||||
|
GEN_CASE(SetWindowOpacity)
|
||||||
|
GEN_CASE(SetWindowFocused)
|
||||||
|
GEN_CASE(EnableCursor)
|
||||||
|
GEN_CASE(DisableCursor)
|
||||||
|
GEN_CASE(SwapScreenBuffer)
|
||||||
|
GEN_CASE(SetGamepadVibration)
|
||||||
|
GEN_CASE(SetMousePosition)
|
||||||
|
GEN_CASE(SetMouseCursor)
|
||||||
|
GEN_CASE(PollInputEvents)
|
||||||
|
GEN_CASE(SetClipboardText)
|
||||||
|
GEN_CASE(SetGamepadMappings)
|
||||||
|
GEN_CASE(GetWindowHandle)
|
||||||
|
GEN_CASE(GetMonitorPosition)
|
||||||
|
GEN_CASE(GetMonitorWidth)
|
||||||
|
GEN_CASE(GetMonitorHeight)
|
||||||
|
GEN_CASE(GetMonitorPhysicalWidth)
|
||||||
|
GEN_CASE(GetMonitorPhysicalHeight)
|
||||||
|
GEN_CASE(GetMonitorRefreshRate)
|
||||||
|
GEN_CASE(GetMonitorName)
|
||||||
|
GEN_CASE(GetWindowPosition)
|
||||||
|
GEN_CASE(GetWindowScaleDPI)
|
||||||
|
GEN_CASE(GetClipboardText)
|
||||||
|
GEN_CASE(GetKeyName)
|
||||||
|
GEN_CASE(GetTime)
|
||||||
|
|
||||||
|
TraceLog(LOG_ERROR, "Unknown function name \"%s\", did not bind.",funcName);
|
||||||
|
};
|
||||||
|
|
||||||
|
CoreData * GetCore() {
|
||||||
|
return &CORE;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef PLATFORM_OFFSCREEN
|
||||||
|
//
|
||||||
|
int InitPlatform(void) {
|
||||||
|
CHECK_AND_CALL(InitPlatform, ());
|
||||||
|
CORE.Window.ready = true;
|
||||||
|
TRACELOG(LOG_WARNING, "InitPlatform was called but not overriden by the user");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if application should close
|
||||||
|
// NOTE: By default, if KEY_ESCAPE pressed or window close icon clicked
|
||||||
|
|
||||||
|
bool WindowShouldClose(void)
|
||||||
|
{
|
||||||
|
CHECK_AND_CALL(WindowShouldClose, ());
|
||||||
|
if (CORE.Window.ready) return CORE.Window.shouldClose;
|
||||||
|
else return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set window configuration state using flags
|
||||||
|
void SetWindowState(unsigned int flags)
|
||||||
|
{
|
||||||
|
CHECK_AND_CALL_VOID(SetWindowState, (flags));
|
||||||
|
// Check previous state and requested state to apply required changes
|
||||||
|
// NOTE: In most cases the functions already change the flags internally
|
||||||
|
|
||||||
|
// State change: FLAG_VSYNC_HINT
|
||||||
|
if (((CORE.Window.flags & FLAG_VSYNC_HINT) != (flags & FLAG_VSYNC_HINT)) && ((flags & FLAG_VSYNC_HINT) > 0))
|
||||||
|
{
|
||||||
|
CORE.Window.flags |= FLAG_VSYNC_HINT;
|
||||||
|
}
|
||||||
|
|
||||||
|
// State change: FLAG_BORDERLESS_WINDOWED_MODE
|
||||||
|
// NOTE: This must be handled before FLAG_FULLSCREEN_MODE because ToggleBorderlessWindowed() needs to get some fullscreen values if fullscreen is running
|
||||||
|
if (((CORE.Window.flags & FLAG_BORDERLESS_WINDOWED_MODE) != (flags & FLAG_BORDERLESS_WINDOWED_MODE)) && ((flags & FLAG_BORDERLESS_WINDOWED_MODE) > 0))
|
||||||
|
{
|
||||||
|
ToggleBorderlessWindowed(); // NOTE: Window state flag updated inside function
|
||||||
|
}
|
||||||
|
|
||||||
|
// State change: FLAG_FULLSCREEN_MODE
|
||||||
|
if ((CORE.Window.flags & FLAG_FULLSCREEN_MODE) != (flags & FLAG_FULLSCREEN_MODE))
|
||||||
|
{
|
||||||
|
ToggleFullscreen(); // NOTE: Window state flag updated inside function
|
||||||
|
}
|
||||||
|
|
||||||
|
// State change: FLAG_WINDOW_RESIZABLE
|
||||||
|
if (((CORE.Window.flags & FLAG_WINDOW_RESIZABLE) != (flags & FLAG_WINDOW_RESIZABLE)) && ((flags & FLAG_WINDOW_RESIZABLE) > 0))
|
||||||
|
{
|
||||||
|
CORE.Window.flags |= FLAG_WINDOW_RESIZABLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// State change: FLAG_WINDOW_UNDECORATED
|
||||||
|
if (((CORE.Window.flags & FLAG_WINDOW_UNDECORATED) != (flags & FLAG_WINDOW_UNDECORATED)) && (flags & FLAG_WINDOW_UNDECORATED))
|
||||||
|
{
|
||||||
|
CORE.Window.flags |= FLAG_WINDOW_UNDECORATED;
|
||||||
|
}
|
||||||
|
|
||||||
|
// State change: FLAG_WINDOW_HIDDEN
|
||||||
|
if (((CORE.Window.flags & FLAG_WINDOW_HIDDEN) != (flags & FLAG_WINDOW_HIDDEN)) && ((flags & FLAG_WINDOW_HIDDEN) > 0))
|
||||||
|
{
|
||||||
|
CORE.Window.flags |= FLAG_WINDOW_HIDDEN;
|
||||||
|
}
|
||||||
|
|
||||||
|
// State change: FLAG_WINDOW_MINIMIZED
|
||||||
|
if (((CORE.Window.flags & FLAG_WINDOW_MINIMIZED) != (flags & FLAG_WINDOW_MINIMIZED)) && ((flags & FLAG_WINDOW_MINIMIZED) > 0))
|
||||||
|
{
|
||||||
|
//MinimizeWindow(); // NOTE: Window state flag updated inside function
|
||||||
|
}
|
||||||
|
|
||||||
|
// State change: FLAG_WINDOW_MAXIMIZED
|
||||||
|
if (((CORE.Window.flags & FLAG_WINDOW_MAXIMIZED) != (flags & FLAG_WINDOW_MAXIMIZED)) && ((flags & FLAG_WINDOW_MAXIMIZED) > 0))
|
||||||
|
{
|
||||||
|
//MaximizeWindow(); // NOTE: Window state flag updated inside function
|
||||||
|
}
|
||||||
|
|
||||||
|
// State change: FLAG_WINDOW_UNFOCUSED
|
||||||
|
if (((CORE.Window.flags & FLAG_WINDOW_UNFOCUSED) != (flags & FLAG_WINDOW_UNFOCUSED)) && ((flags & FLAG_WINDOW_UNFOCUSED) > 0))
|
||||||
|
{
|
||||||
|
CORE.Window.flags |= FLAG_WINDOW_UNFOCUSED;
|
||||||
|
}
|
||||||
|
|
||||||
|
// State change: FLAG_WINDOW_TOPMOST
|
||||||
|
if (((CORE.Window.flags & FLAG_WINDOW_TOPMOST) != (flags & FLAG_WINDOW_TOPMOST)) && ((flags & FLAG_WINDOW_TOPMOST) > 0))
|
||||||
|
{
|
||||||
|
CORE.Window.flags |= FLAG_WINDOW_TOPMOST;
|
||||||
|
}
|
||||||
|
|
||||||
|
// State change: FLAG_WINDOW_ALWAYS_RUN
|
||||||
|
if (((CORE.Window.flags & FLAG_WINDOW_ALWAYS_RUN) != (flags & FLAG_WINDOW_ALWAYS_RUN)) && ((flags & FLAG_WINDOW_ALWAYS_RUN) > 0))
|
||||||
|
{
|
||||||
|
CORE.Window.flags |= FLAG_WINDOW_ALWAYS_RUN;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The following states can not be changed after window creation
|
||||||
|
|
||||||
|
// State change: FLAG_WINDOW_TRANSPARENT
|
||||||
|
if (((CORE.Window.flags & FLAG_WINDOW_TRANSPARENT) != (flags & FLAG_WINDOW_TRANSPARENT)) && ((flags & FLAG_WINDOW_TRANSPARENT) > 0))
|
||||||
|
{
|
||||||
|
TRACELOG(LOG_WARNING, "WINDOW: Framebuffer transparency can only be configured before window initialization");
|
||||||
|
}
|
||||||
|
|
||||||
|
// State change: FLAG_WINDOW_HIGHDPI
|
||||||
|
if (((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) != (flags & FLAG_WINDOW_HIGHDPI)) && ((flags & FLAG_WINDOW_HIGHDPI) > 0))
|
||||||
|
{
|
||||||
|
TRACELOG(LOG_WARNING, "WINDOW: High DPI can only be configured before window initialization");
|
||||||
|
}
|
||||||
|
|
||||||
|
// State change: FLAG_WINDOW_MOUSE_PASSTHROUGH
|
||||||
|
if (((CORE.Window.flags & FLAG_WINDOW_MOUSE_PASSTHROUGH) != (flags & FLAG_WINDOW_MOUSE_PASSTHROUGH)) && ((flags & FLAG_WINDOW_MOUSE_PASSTHROUGH) > 0))
|
||||||
|
{
|
||||||
|
CORE.Window.flags |= FLAG_WINDOW_MOUSE_PASSTHROUGH;
|
||||||
|
}
|
||||||
|
|
||||||
|
// State change: FLAG_MSAA_4X_HINT
|
||||||
|
if (((CORE.Window.flags & FLAG_MSAA_4X_HINT) != (flags & FLAG_MSAA_4X_HINT)) && ((flags & FLAG_MSAA_4X_HINT) > 0))
|
||||||
|
{
|
||||||
|
TRACELOG(LOG_WARNING, "WINDOW: MSAA can only be configured before window initialization");
|
||||||
|
}
|
||||||
|
|
||||||
|
// State change: FLAG_INTERLACED_HINT
|
||||||
|
if (((CORE.Window.flags & FLAG_INTERLACED_HINT) != (flags & FLAG_INTERLACED_HINT)) && ((flags & FLAG_INTERLACED_HINT) > 0))
|
||||||
|
{
|
||||||
|
TRACELOG(LOG_WARNING, "RPI: Interlaced mode can only be configured before window initialization");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear window configuration state flags
|
||||||
|
void ClearWindowState(unsigned int flags)
|
||||||
|
{
|
||||||
|
CHECK_AND_CALL_VOID(ClearWindowState, (flags));
|
||||||
|
// Check previous state and requested state to apply required changes
|
||||||
|
// NOTE: In most cases the functions already change the flags internally
|
||||||
|
|
||||||
|
// State change: FLAG_VSYNC_HINT
|
||||||
|
if (((CORE.Window.flags & FLAG_VSYNC_HINT) > 0) && ((flags & FLAG_VSYNC_HINT) > 0))
|
||||||
|
{
|
||||||
|
CORE.Window.flags &= ~FLAG_VSYNC_HINT;
|
||||||
|
}
|
||||||
|
|
||||||
|
// State change: FLAG_BORDERLESS_WINDOWED_MODE
|
||||||
|
// NOTE: This must be handled before FLAG_FULLSCREEN_MODE because ToggleBorderlessWindowed() needs to get some fullscreen values if fullscreen is running
|
||||||
|
if (((CORE.Window.flags & FLAG_BORDERLESS_WINDOWED_MODE) > 0) && ((flags & FLAG_BORDERLESS_WINDOWED_MODE) > 0))
|
||||||
|
{
|
||||||
|
ToggleBorderlessWindowed(); // NOTE: Window state flag updated inside function
|
||||||
|
}
|
||||||
|
|
||||||
|
// State change: FLAG_FULLSCREEN_MODE
|
||||||
|
if (((CORE.Window.flags & FLAG_FULLSCREEN_MODE) > 0) && ((flags & FLAG_FULLSCREEN_MODE) > 0))
|
||||||
|
{
|
||||||
|
ToggleFullscreen(); // NOTE: Window state flag updated inside function
|
||||||
|
}
|
||||||
|
|
||||||
|
// State change: FLAG_WINDOW_RESIZABLE
|
||||||
|
if (((CORE.Window.flags & FLAG_WINDOW_RESIZABLE) > 0) && ((flags & FLAG_WINDOW_RESIZABLE) > 0))
|
||||||
|
{
|
||||||
|
CORE.Window.flags &= ~FLAG_WINDOW_RESIZABLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// State change: FLAG_WINDOW_HIDDEN
|
||||||
|
if (((CORE.Window.flags & FLAG_WINDOW_HIDDEN) > 0) && ((flags & FLAG_WINDOW_HIDDEN) > 0))
|
||||||
|
{
|
||||||
|
CORE.Window.flags &= ~FLAG_WINDOW_HIDDEN;
|
||||||
|
}
|
||||||
|
|
||||||
|
// State change: FLAG_WINDOW_MINIMIZED
|
||||||
|
if (((CORE.Window.flags & FLAG_WINDOW_MINIMIZED) > 0) && ((flags & FLAG_WINDOW_MINIMIZED) > 0))
|
||||||
|
{
|
||||||
|
RestoreWindow(); // NOTE: Window state flag updated inside function
|
||||||
|
}
|
||||||
|
|
||||||
|
// State change: FLAG_WINDOW_MAXIMIZED
|
||||||
|
if (((CORE.Window.flags & FLAG_WINDOW_MAXIMIZED) > 0) && ((flags & FLAG_WINDOW_MAXIMIZED) > 0))
|
||||||
|
{
|
||||||
|
RestoreWindow(); // NOTE: Window state flag updated inside function
|
||||||
|
}
|
||||||
|
|
||||||
|
// State change: FLAG_WINDOW_UNDECORATED
|
||||||
|
if (((CORE.Window.flags & FLAG_WINDOW_UNDECORATED) > 0) && ((flags & FLAG_WINDOW_UNDECORATED) > 0))
|
||||||
|
{
|
||||||
|
CORE.Window.flags &= ~FLAG_WINDOW_UNDECORATED;
|
||||||
|
}
|
||||||
|
|
||||||
|
// State change: FLAG_WINDOW_UNFOCUSED
|
||||||
|
if (((CORE.Window.flags & FLAG_WINDOW_UNFOCUSED) > 0) && ((flags & FLAG_WINDOW_UNFOCUSED) > 0))
|
||||||
|
{
|
||||||
|
CORE.Window.flags &= ~FLAG_WINDOW_UNFOCUSED;
|
||||||
|
}
|
||||||
|
|
||||||
|
// State change: FLAG_WINDOW_TOPMOST
|
||||||
|
if (((CORE.Window.flags & FLAG_WINDOW_TOPMOST) > 0) && ((flags & FLAG_WINDOW_TOPMOST) > 0))
|
||||||
|
{
|
||||||
|
CORE.Window.flags &= ~FLAG_WINDOW_TOPMOST;
|
||||||
|
}
|
||||||
|
|
||||||
|
// State change: FLAG_WINDOW_ALWAYS_RUN
|
||||||
|
if (((CORE.Window.flags & FLAG_WINDOW_ALWAYS_RUN) > 0) && ((flags & FLAG_WINDOW_ALWAYS_RUN) > 0))
|
||||||
|
{
|
||||||
|
CORE.Window.flags &= ~FLAG_WINDOW_ALWAYS_RUN;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The following states can not be changed after window creation
|
||||||
|
|
||||||
|
// State change: FLAG_WINDOW_TRANSPARENT
|
||||||
|
if (((CORE.Window.flags & FLAG_WINDOW_TRANSPARENT) > 0) && ((flags & FLAG_WINDOW_TRANSPARENT) > 0))
|
||||||
|
{
|
||||||
|
TRACELOG(LOG_WARNING, "WINDOW: Framebuffer transparency can only be configured before window initialization");
|
||||||
|
}
|
||||||
|
|
||||||
|
// State change: FLAG_WINDOW_HIGHDPI
|
||||||
|
if (((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0) && ((flags & FLAG_WINDOW_HIGHDPI) > 0))
|
||||||
|
{
|
||||||
|
TRACELOG(LOG_WARNING, "WINDOW: High DPI can only be configured before window initialization");
|
||||||
|
}
|
||||||
|
|
||||||
|
// State change: FLAG_WINDOW_MOUSE_PASSTHROUGH
|
||||||
|
if (((CORE.Window.flags & FLAG_WINDOW_MOUSE_PASSTHROUGH) > 0) && ((flags & FLAG_WINDOW_MOUSE_PASSTHROUGH) > 0))
|
||||||
|
{
|
||||||
|
CORE.Window.flags &= ~FLAG_WINDOW_MOUSE_PASSTHROUGH;
|
||||||
|
}
|
||||||
|
|
||||||
|
// State change: FLAG_MSAA_4X_HINT
|
||||||
|
if (((CORE.Window.flags & FLAG_MSAA_4X_HINT) > 0) && ((flags & FLAG_MSAA_4X_HINT) > 0))
|
||||||
|
{
|
||||||
|
TRACELOG(LOG_WARNING, "WINDOW: MSAA can only be configured before window initialization");
|
||||||
|
}
|
||||||
|
|
||||||
|
// State change: FLAG_INTERLACED_HINT
|
||||||
|
if (((CORE.Window.flags & FLAG_INTERLACED_HINT) > 0) && ((flags & FLAG_INTERLACED_HINT) > 0))
|
||||||
|
{
|
||||||
|
TRACELOG(LOG_WARNING, "RPI: Interlaced mode can only be configured before window initialization");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set window minimum dimensions (FLAG_WINDOW_RESIZABLE)
|
||||||
|
void SetWindowMinSize(int width, int height)
|
||||||
|
{
|
||||||
|
CHECK_AND_CALL_VOID(SetWindowMinSize, (width, height));
|
||||||
|
CORE.Window.screenMin.width = width;
|
||||||
|
CORE.Window.screenMin.height = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set window maximum dimensions (FLAG_WINDOW_RESIZABLE)
|
||||||
|
void SetWindowMaxSize(int width, int height)
|
||||||
|
{
|
||||||
|
CHECK_AND_CALL_VOID(SetWindowMaxSize, (width, height));
|
||||||
|
CORE.Window.screenMax.width = width;
|
||||||
|
CORE.Window.screenMax.height = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set window dimensions
|
||||||
|
void SetWindowSize(int width, int height)
|
||||||
|
{
|
||||||
|
CHECK_AND_CALL_VOID(SetWindowSize, (width, height));
|
||||||
|
CORE.Window.screen.width = width;
|
||||||
|
CORE.Window.screen.height = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get number of monitors
|
||||||
|
int GetMonitorCount(void)
|
||||||
|
{
|
||||||
|
CHECK_AND_CALL(GetMonitorCount, ());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get number of monitors
|
||||||
|
int GetCurrentMonitor(void)
|
||||||
|
{
|
||||||
|
CHECK_AND_CALL(GetCurrentMonitor, ());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show mouse cursor
|
||||||
|
void ShowCursor(void)
|
||||||
|
{
|
||||||
|
CHECK_AND_CALL_VOID(ShowCursor, ());
|
||||||
|
CORE.Input.Mouse.cursorHidden = false;
|
||||||
|
}
|
||||||
|
// Hides mouse cursor
|
||||||
|
void HideCursor(void)
|
||||||
|
{
|
||||||
|
CHECK_AND_CALL_VOID(HideCursor, ());
|
||||||
|
CORE.Input.Mouse.cursorHidden = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
188
src/platforms/rcore_none.h
Normal file
188
src/platforms/rcore_none.h
Normal file
|
|
@ -0,0 +1,188 @@
|
||||||
|
/**********************************************************************************************
|
||||||
|
*
|
||||||
|
* rcore_none - Functions to manage window, graphics device and inputs
|
||||||
|
*
|
||||||
|
* PLATFORM: NONE
|
||||||
|
*
|
||||||
|
* LIMITATIONS:
|
||||||
|
* - Limitation 01
|
||||||
|
* - Limitation 02
|
||||||
|
*
|
||||||
|
* POSSIBLE IMPROVEMENTS:
|
||||||
|
* - For OverrideInternalFunction, we should maybe consider hashing the input string
|
||||||
|
* so that we can use a switch case? But to be fair this also isn't a function you should be running on loop.
|
||||||
|
* - We could introduce a config flag to disable the if/else check if a function is set, letting the user
|
||||||
|
* improve the performance at the cost of segfaults if a function pointer isn't set.
|
||||||
|
*
|
||||||
|
* ADDITIONAL NOTES:
|
||||||
|
* - You still need a platform that has OpenGL, or a port of it, to use this.
|
||||||
|
* - There is no responsibility for the maintainers of Raylib to keep a stable API here.
|
||||||
|
*
|
||||||
|
* LICENSE: zlib/libpng
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013-2024 Ramon Santamaria (@raysan5) and contributors
|
||||||
|
*
|
||||||
|
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||||
|
* will the authors be held liable for any damages arising from the use of this software.
|
||||||
|
*
|
||||||
|
* Permission is granted to anyone to use this software for any purpose, including commercial
|
||||||
|
* applications, and to alter it and redistribute it freely, subject to the following restrictions:
|
||||||
|
*
|
||||||
|
* 1. The origin of this software must not be misrepresented; you must not claim that you
|
||||||
|
* wrote the original software. If you use this software in a product, an acknowledgment
|
||||||
|
* in the product documentation would be appreciated but is not required.
|
||||||
|
*
|
||||||
|
* 2. Altered source versions must be plainly marked as such, and must not be misrepresented
|
||||||
|
* as being the original software.
|
||||||
|
*
|
||||||
|
* 3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*
|
||||||
|
**********************************************************************************************/
|
||||||
|
|
||||||
|
#ifndef RCORE_NONE_H
|
||||||
|
#define RCORE_NONE_H
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Types and Structures Definition
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
typedef struct {
|
||||||
|
} PlatformData;
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Macros Declaration
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// NOTE(IOI_XD):
|
||||||
|
// Yes, macros suck. However, there is a right way to use them, I believe I have taken said precautions, and I believe it is worth it here because
|
||||||
|
// it would make updating this file much easier.
|
||||||
|
// That said, these are functions that will not have to be modified past when this is merged, except to rename/add them.
|
||||||
|
|
||||||
|
// Macro that lets us put two vararg sections in one macro
|
||||||
|
#define LIST(...) __VA_ARGS__
|
||||||
|
|
||||||
|
// The code for warning the user that a function hasn't been overriden. On PLATFORM_NONE, this isn't emitted.
|
||||||
|
#ifndef PLATFORM_OFFSCREEN
|
||||||
|
#define FUNCTION_MISSING_WARNING(fn_name) TRACELOG(LOG_WARNING, #fn_name " was called but not overriden by the user");
|
||||||
|
#else
|
||||||
|
#define FUNCTION_MISSING_WARNING(fn_name)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Generate a callback
|
||||||
|
#define GEN_CALLBACK_HEAD(fn_ret, ret_value, fn_name, named_args, args) \
|
||||||
|
typedef fn_ret (*fn_name##Callback)(LIST named_args); \
|
||||||
|
static fn_name##Callback * internal##fn_name##Callback = NULL; \
|
||||||
|
fn_ret fn_name(LIST named_args);
|
||||||
|
|
||||||
|
// Generate a callback that returns a void.
|
||||||
|
#define GEN_CALLBACK_HEAD_VOID(fn_name, named_args, args) \
|
||||||
|
typedef void (*fn_name##Callback)(LIST named_args); \
|
||||||
|
static fn_name##Callback * internal##fn_name##Callback = NULL; \
|
||||||
|
void fn_name(LIST named_args);
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Module Functions Declaration
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// NOTE: Functions declaration is provided by raylib.h
|
||||||
|
|
||||||
|
// We start with any functions that unambigiously must be overriden.
|
||||||
|
GEN_CALLBACK_HEAD_VOID(ClosePlatform, (void), ())
|
||||||
|
GEN_CALLBACK_HEAD_VOID(ToggleFullscreen, (void), ())
|
||||||
|
GEN_CALLBACK_HEAD_VOID(ToggleBorderlessWindowed, (void), ())
|
||||||
|
GEN_CALLBACK_HEAD_VOID(MaximizeWindow, (void), ())
|
||||||
|
GEN_CALLBACK_HEAD_VOID(MinimizeWindow, (void), ())
|
||||||
|
GEN_CALLBACK_HEAD_VOID(RestoreWindow, (void), ())
|
||||||
|
GEN_CALLBACK_HEAD_VOID(SetWindowIcon, (Image image), (image))
|
||||||
|
GEN_CALLBACK_HEAD_VOID(SetWindowIcons, (Image *images, int count), (images, count))
|
||||||
|
GEN_CALLBACK_HEAD_VOID(SetWindowTitle, (const char *title), (title))
|
||||||
|
GEN_CALLBACK_HEAD_VOID(SetWindowPosition, (int x, int y), (x,y))
|
||||||
|
GEN_CALLBACK_HEAD_VOID(SetWindowMonitor, (int monitor), (monitor))
|
||||||
|
GEN_CALLBACK_HEAD_VOID(SetWindowOpacity, (float opacity), (opacity))
|
||||||
|
GEN_CALLBACK_HEAD_VOID(SetWindowFocused, (void), ())
|
||||||
|
GEN_CALLBACK_HEAD_VOID(EnableCursor, (void), ())
|
||||||
|
GEN_CALLBACK_HEAD_VOID(DisableCursor, (void), ())
|
||||||
|
GEN_CALLBACK_HEAD_VOID(SwapScreenBuffer, (void), ())
|
||||||
|
GEN_CALLBACK_HEAD_VOID(SetGamepadVibration, (int gamepad, float leftMotor, float rightMotor), (gamepad,leftMotor,rightMotor))
|
||||||
|
GEN_CALLBACK_HEAD_VOID(SetMousePosition, (int x, int y), (x,y))
|
||||||
|
GEN_CALLBACK_HEAD_VOID(SetMouseCursor, (int cursor), (cursor))
|
||||||
|
GEN_CALLBACK_HEAD_VOID(PollInputEvents, (void), ())
|
||||||
|
GEN_CALLBACK_HEAD_VOID(SetClipboardText, (const char *text), (text))
|
||||||
|
GEN_CALLBACK_HEAD(int, 0, SetGamepadMappings, (const char *mappings), (mappings))
|
||||||
|
GEN_CALLBACK_HEAD(void *, NULL, GetWindowHandle, (void), ())
|
||||||
|
GEN_CALLBACK_HEAD(Vector2, Vector2Zero(), GetMonitorPosition, (int monitor), (monitor))
|
||||||
|
GEN_CALLBACK_HEAD(int, 0, GetMonitorWidth, (int monitor), (monitor))
|
||||||
|
GEN_CALLBACK_HEAD(int, 0, GetMonitorHeight, (int monitor), (monitor))
|
||||||
|
GEN_CALLBACK_HEAD(int, 0, GetMonitorPhysicalWidth, (int monitor), (monitor))
|
||||||
|
GEN_CALLBACK_HEAD(int, 0, GetMonitorPhysicalHeight, (int monitor), (monitor))
|
||||||
|
GEN_CALLBACK_HEAD(int, 0, GetMonitorRefreshRate, (int monitor), (monitor))
|
||||||
|
GEN_CALLBACK_HEAD(const char*, "", GetMonitorName, (int monitor), (monitor))
|
||||||
|
GEN_CALLBACK_HEAD(Vector2, Vector2Zero(), GetWindowPosition, (void), ())
|
||||||
|
GEN_CALLBACK_HEAD(Vector2, Vector2Zero(), GetWindowScaleDPI, (void), ())
|
||||||
|
GEN_CALLBACK_HEAD(const char *, "", GetClipboardText, (void), ())
|
||||||
|
GEN_CALLBACK_HEAD(const char *, "", GetKeyName, (int key), (key))
|
||||||
|
GEN_CALLBACK_HEAD(double, 0.0, GetTime, (void), ())
|
||||||
|
GEN_CALLBACK_HEAD_VOID(OpenURL, (const char *url), (url))
|
||||||
|
|
||||||
|
// We then move on to functions that can be overriden, but on the offscreen platform, should have things set by default.
|
||||||
|
GEN_CALLBACK_HEAD(int, 0, InitPlatform, (void), ())
|
||||||
|
GEN_CALLBACK_HEAD(bool, true, WindowShouldClose, (void), ())
|
||||||
|
GEN_CALLBACK_HEAD(int, 0, GetMonitorCount, (void), ())
|
||||||
|
GEN_CALLBACK_HEAD(int, 0, GetCurrentMonitor, (void), ())
|
||||||
|
GEN_CALLBACK_HEAD_VOID(ShowCursor, (void), ())
|
||||||
|
GEN_CALLBACK_HEAD_VOID(HideCursor, (void), ())
|
||||||
|
GEN_CALLBACK_HEAD_VOID(SetWindowState, (unsigned int flags), (flags))
|
||||||
|
GEN_CALLBACK_HEAD_VOID(ClearWindowState, (unsigned int flags), (flags))
|
||||||
|
GEN_CALLBACK_HEAD_VOID(SetWindowMinSize, (int width, int height), (width,height))
|
||||||
|
GEN_CALLBACK_HEAD_VOID(SetWindowMaxSize, (int width, int height), (width,height))
|
||||||
|
GEN_CALLBACK_HEAD_VOID(SetWindowSize, (int width, int height), (width,height))
|
||||||
|
|
||||||
|
// Generate any of the fields for the OverridableFunctionPointer union.
|
||||||
|
#define GEN_FIELD(fn_name) fn_name##Callback fn_name;
|
||||||
|
|
||||||
|
// The avaliable functions you can pass to OverrideInternalFunction.
|
||||||
|
// The fields are only accessible when compiling with PLATFORM_NONE or PLATFORM_OFFSCREEN
|
||||||
|
union OverridableFunctionPointer {
|
||||||
|
GEN_FIELD(InitPlatform)
|
||||||
|
GEN_FIELD(ClosePlatform)
|
||||||
|
GEN_FIELD(ToggleFullscreen)
|
||||||
|
GEN_FIELD(ToggleBorderlessWindowed)
|
||||||
|
GEN_FIELD(MaximizeWindow)
|
||||||
|
GEN_FIELD(MinimizeWindow)
|
||||||
|
GEN_FIELD(RestoreWindow)
|
||||||
|
GEN_FIELD(SetWindowIcon)
|
||||||
|
GEN_FIELD(SetWindowIcons)
|
||||||
|
GEN_FIELD(SetWindowTitle)
|
||||||
|
GEN_FIELD(SetWindowPosition)
|
||||||
|
GEN_FIELD(SetWindowMonitor)
|
||||||
|
GEN_FIELD(SetWindowOpacity)
|
||||||
|
GEN_FIELD(SetWindowFocused)
|
||||||
|
GEN_FIELD(EnableCursor)
|
||||||
|
GEN_FIELD(DisableCursor)
|
||||||
|
GEN_FIELD(SwapScreenBuffer)
|
||||||
|
GEN_FIELD(SetGamepadVibration)
|
||||||
|
GEN_FIELD(SetMousePosition)
|
||||||
|
GEN_FIELD(SetMouseCursor)
|
||||||
|
GEN_FIELD(PollInputEvents)
|
||||||
|
GEN_FIELD(SetClipboardText)
|
||||||
|
GEN_FIELD(SetGamepadMappings)
|
||||||
|
GEN_FIELD(GetWindowHandle)
|
||||||
|
GEN_FIELD(GetMonitorPosition)
|
||||||
|
GEN_FIELD(GetMonitorWidth)
|
||||||
|
GEN_FIELD(GetMonitorHeight)
|
||||||
|
GEN_FIELD(GetMonitorPhysicalWidth)
|
||||||
|
GEN_FIELD(GetMonitorPhysicalHeight)
|
||||||
|
GEN_FIELD(GetMonitorRefreshRate)
|
||||||
|
GEN_FIELD(GetMonitorName)
|
||||||
|
GEN_FIELD(GetWindowPosition)
|
||||||
|
GEN_FIELD(GetWindowScaleDPI)
|
||||||
|
GEN_FIELD(GetClipboardText)
|
||||||
|
GEN_FIELD(GetKeyName)
|
||||||
|
GEN_FIELD(GetTime)
|
||||||
|
};
|
||||||
|
|
||||||
|
void OverrideInternalFunction(const char * funcName, union OverridableFunctionPointer * func);
|
||||||
|
//CoreData * GetCore(); // Get and set variables of Raylib's core struct
|
||||||
|
|
||||||
|
// EOF
|
||||||
|
#endif
|
||||||
|
|
@ -73,6 +73,7 @@ static PlatformData platform = { 0 }; // Platform specific data
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
int InitPlatform(void); // Initialize platform (graphics, inputs and more)
|
int InitPlatform(void); // Initialize platform (graphics, inputs and more)
|
||||||
bool InitGraphicsDevice(void); // Initialize graphics device
|
bool InitGraphicsDevice(void); // Initialize graphics device
|
||||||
|
void OverrideInternalFunction(const char * funcName, union OverridableFunctionPointer * func);
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Module Functions Declaration
|
// Module Functions Declaration
|
||||||
|
|
@ -595,4 +596,9 @@ void ClosePlatform(void)
|
||||||
// TODO: De-initialize graphics, inputs and more
|
// TODO: De-initialize graphics, inputs and more
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Override an internal platform function with your own (PLATFORM_OFFSCREEN and PLATFORM_NONE only)
|
||||||
|
void OverrideInternalFunction(const char * funcName, union OverridableFunctionPointer * func); {
|
||||||
|
TraceLog(LOG_WARNING, "OverrideInternalFunction called on unsupported platform");
|
||||||
|
};
|
||||||
|
|
||||||
// EOF
|
// EOF
|
||||||
|
|
|
||||||
|
|
@ -107,6 +107,7 @@ Vector2 lockedMousePos = { 0 };
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
int InitPlatform(void); // Initialize platform (graphics, inputs and more)
|
int InitPlatform(void); // Initialize platform (graphics, inputs and more)
|
||||||
void ClosePlatform(void); // Close platform
|
void ClosePlatform(void); // Close platform
|
||||||
|
void OverrideInternalFunction(const char * funcName, union OverridableFunctionPointer * func);
|
||||||
|
|
||||||
// Error callback event
|
// Error callback event
|
||||||
static void ErrorCallback(int error, const char *description); // GLFW3 Error Callback, runs on GLFW3 error
|
static void ErrorCallback(int error, const char *description); // GLFW3 Error Callback, runs on GLFW3 error
|
||||||
|
|
@ -1729,4 +1730,9 @@ static EM_BOOL EmscriptenTouchCallback(int eventType, const EmscriptenTouchEvent
|
||||||
return 1; // The event was consumed by the callback handler
|
return 1; // The event was consumed by the callback handler
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Override an internal platform function with your own (PLATFORM_OFFSCREEN and PLATFORM_NONE only)
|
||||||
|
void OverrideInternalFunction(const char * funcName, union OverridableFunctionPointer * func); {
|
||||||
|
TraceLog(LOG_WARNING, "OverrideInternalFunction called on unsupported platform");
|
||||||
|
};
|
||||||
|
|
||||||
// EOF
|
// EOF
|
||||||
|
|
|
||||||
|
|
@ -515,6 +515,10 @@ const char *TextFormat(const char *text, ...); // Formatting of tex
|
||||||
#include "platforms/rcore_drm.c"
|
#include "platforms/rcore_drm.c"
|
||||||
#elif defined(PLATFORM_ANDROID)
|
#elif defined(PLATFORM_ANDROID)
|
||||||
#include "platforms/rcore_android.c"
|
#include "platforms/rcore_android.c"
|
||||||
|
#elif defined(PLATFORM_NONE)
|
||||||
|
#include "platforms/rcore_none.c"
|
||||||
|
#elif defined(PLATFORM_OFFSCREEN)
|
||||||
|
#include "platforms/rcore_none.c"
|
||||||
#else
|
#else
|
||||||
// TODO: Include your custom platform backend!
|
// TODO: Include your custom platform backend!
|
||||||
// i.e software rendering backend or console backend!
|
// i.e software rendering backend or console backend!
|
||||||
|
|
|
||||||
11
src/rmod.h
Normal file
11
src/rmod.h
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
#ifndef RMOD_H
|
||||||
|
#define RMOD_H
|
||||||
|
|
||||||
|
#ifdef PLATFORM_NONE
|
||||||
|
#include "platforms/rcore_none.h"
|
||||||
|
#endif
|
||||||
|
#ifdef PLATFORM_OFFSCREEN
|
||||||
|
#include "platforms/rcore_none.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // RMOD_H
|
||||||
Loading…
Reference in New Issue
Block a user