Merge branch 'master' into add-pie-chart-example
This commit is contained in:
commit
780ddc6118
83 changed files with 7077 additions and 2494 deletions
4
.github/workflows/analyze_codeql.yml
vendored
4
.github/workflows/analyze_codeql.yml
vendored
|
|
@ -71,7 +71,7 @@ jobs:
|
||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v2
|
uses: github/codeql-action/init@v3
|
||||||
with:
|
with:
|
||||||
languages: ${{ matrix.language }}
|
languages: ${{ matrix.language }}
|
||||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||||
|
|
@ -90,7 +90,7 @@ jobs:
|
||||||
cmake --build . --config $BUILD_TYPE
|
cmake --build . --config $BUILD_TYPE
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v2
|
uses: github/codeql-action/analyze@v3
|
||||||
with:
|
with:
|
||||||
category: "/language:${{matrix.language}}"
|
category: "/language:${{matrix.language}}"
|
||||||
upload: false
|
upload: false
|
||||||
|
|
|
||||||
4
.github/workflows/parse_api.yml
vendored
4
.github/workflows/parse_api.yml
vendored
|
|
@ -32,6 +32,6 @@ jobs:
|
||||||
set -x
|
set -x
|
||||||
git config user.name "github-actions[bot]"
|
git config user.name "github-actions[bot]"
|
||||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||||
git add tools/parser
|
git add tools/rlparser
|
||||||
git commit -m "Update raylib_api.* by CI"
|
git commit -m "rlparser: update raylib_api.* by CI"
|
||||||
git push
|
git push
|
||||||
|
|
|
||||||
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -55,6 +55,8 @@ packages/
|
||||||
*.so
|
*.so
|
||||||
*.so.*
|
*.so.*
|
||||||
*.dll
|
*.dll
|
||||||
|
*.h.pch
|
||||||
|
./*.obj
|
||||||
|
|
||||||
# Emscripten
|
# Emscripten
|
||||||
emsdk
|
emsdk
|
||||||
|
|
@ -81,6 +83,7 @@ DerivedData/
|
||||||
|
|
||||||
# VSCode project
|
# VSCode project
|
||||||
.vscode
|
.vscode
|
||||||
|
.clangd
|
||||||
|
|
||||||
# Jetbrains project
|
# Jetbrains project
|
||||||
.idea/
|
.idea/
|
||||||
|
|
|
||||||
|
|
@ -386,6 +386,8 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
|
||||||
setDesktopPlatform(raylib, options.platform);
|
setDesktopPlatform(raylib, options.platform);
|
||||||
},
|
},
|
||||||
.emscripten => {
|
.emscripten => {
|
||||||
|
const activate_emsdk_step = emsdk.zemscripten.activateEmsdkStep(b);
|
||||||
|
raylib.step.dependOn(activate_emsdk_step);
|
||||||
raylib.root_module.addCMacro("PLATFORM_WEB", "");
|
raylib.root_module.addCMacro("PLATFORM_WEB", "");
|
||||||
if (options.opengl_version == .auto) {
|
if (options.opengl_version == .auto) {
|
||||||
raylib.root_module.addCMacro("GRAPHICS_API_OPENGL_ES3", "");
|
raylib.root_module.addCMacro("GRAPHICS_API_OPENGL_ES3", "");
|
||||||
|
|
|
||||||
|
|
@ -554,16 +554,19 @@ SHAPES = \
|
||||||
shapes/shapes_easings_box \
|
shapes/shapes_easings_box \
|
||||||
shapes/shapes_easings_rectangles \
|
shapes/shapes_easings_rectangles \
|
||||||
shapes/shapes_following_eyes \
|
shapes/shapes_following_eyes \
|
||||||
|
shapes/shapes_kaleidoscope \
|
||||||
shapes/shapes_lines_bezier \
|
shapes/shapes_lines_bezier \
|
||||||
shapes/shapes_logo_raylib \
|
shapes/shapes_logo_raylib \
|
||||||
shapes/shapes_logo_raylib_anim \
|
shapes/shapes_logo_raylib_anim \
|
||||||
shapes/shapes_pie_chart \
|
shapes/shapes_pie_chart \
|
||||||
shapes/shapes_rectangle_advanced \
|
shapes/shapes_rectangle_advanced \
|
||||||
shapes/shapes_rectangle_scaling \
|
shapes/shapes_rectangle_scaling \
|
||||||
|
shapes/shapes_recursive_tree \
|
||||||
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_triangle_strip \
|
||||||
shapes/shapes_vector_angle
|
shapes/shapes_vector_angle
|
||||||
|
|
||||||
TEXTURES = \
|
TEXTURES = \
|
||||||
|
|
|
||||||
|
|
@ -554,16 +554,19 @@ SHAPES = \
|
||||||
shapes/shapes_easings_box \
|
shapes/shapes_easings_box \
|
||||||
shapes/shapes_easings_rectangles \
|
shapes/shapes_easings_rectangles \
|
||||||
shapes/shapes_following_eyes \
|
shapes/shapes_following_eyes \
|
||||||
|
shapes/shapes_kaleidoscope \
|
||||||
shapes/shapes_lines_bezier \
|
shapes/shapes_lines_bezier \
|
||||||
shapes/shapes_logo_raylib \
|
shapes/shapes_logo_raylib \
|
||||||
shapes/shapes_logo_raylib_anim \
|
shapes/shapes_logo_raylib_anim \
|
||||||
shapes/shapes_pie_chart \
|
shapes/shapes_pie_chart \
|
||||||
shapes/shapes_rectangle_advanced \
|
shapes/shapes_rectangle_advanced \
|
||||||
shapes/shapes_rectangle_scaling \
|
shapes/shapes_rectangle_scaling \
|
||||||
|
shapes/shapes_recursive_tree \
|
||||||
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_triangle_strip \
|
||||||
shapes/shapes_vector_angle
|
shapes/shapes_vector_angle
|
||||||
|
|
||||||
TEXTURES = \
|
TEXTURES = \
|
||||||
|
|
@ -854,6 +857,9 @@ shapes/shapes_easings_rectangles: shapes/shapes_easings_rectangles.c
|
||||||
shapes/shapes_following_eyes: shapes/shapes_following_eyes.c
|
shapes/shapes_following_eyes: shapes/shapes_following_eyes.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
shapes/shapes_kaleidoscope: shapes/shapes_kaleidoscope.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
shapes/shapes_lines_bezier: shapes/shapes_lines_bezier.c
|
shapes/shapes_lines_bezier: shapes/shapes_lines_bezier.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
|
@ -872,6 +878,9 @@ shapes/shapes_rectangle_advanced: shapes/shapes_rectangle_advanced.c
|
||||||
shapes/shapes_rectangle_scaling: shapes/shapes_rectangle_scaling.c
|
shapes/shapes_rectangle_scaling: shapes/shapes_rectangle_scaling.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
shapes/shapes_recursive_tree: shapes/shapes_recursive_tree.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
shapes/shapes_ring_drawing: shapes/shapes_ring_drawing.c
|
shapes/shapes_ring_drawing: shapes/shapes_ring_drawing.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
|
@ -884,6 +893,9 @@ shapes/shapes_splines_drawing: shapes/shapes_splines_drawing.c
|
||||||
shapes/shapes_top_down_lights: shapes/shapes_top_down_lights.c
|
shapes/shapes_top_down_lights: shapes/shapes_top_down_lights.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
shapes/shapes_triangle_strip: shapes/shapes_triangle_strip.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
shapes/shapes_vector_angle: shapes/shapes_vector_angle.c
|
shapes/shapes_vector_angle: shapes/shapes_vector_angle.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ 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: 173]
|
## EXAMPLES COLLECTION [TOTAL: 175]
|
||||||
|
|
||||||
### category: core [40]
|
### category: core [40]
|
||||||
|
|
||||||
|
|
@ -66,7 +66,7 @@ Examples using raylib[core](../src/rcore.c) platform functionality like window c
|
||||||
| [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) |
|
| [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 [24]
|
### category: shapes [26]
|
||||||
|
|
||||||
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.
|
||||||
|
|
||||||
|
|
@ -85,6 +85,7 @@ Examples using raylib shapes drawing functionality, provided by raylib [shapes](
|
||||||
| [shapes_easings_ball](shapes/shapes_easings_ball.c) | <img src="shapes/shapes_easings_ball.png" alt="shapes_easings_ball" width="80"> | ⭐⭐☆☆ | 2.5 | 2.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [shapes_easings_ball](shapes/shapes_easings_ball.c) | <img src="shapes/shapes_easings_ball.png" alt="shapes_easings_ball" width="80"> | ⭐⭐☆☆ | 2.5 | 2.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [shapes_easings_box](shapes/shapes_easings_box.c) | <img src="shapes/shapes_easings_box.png" alt="shapes_easings_box" width="80"> | ⭐⭐☆☆ | 2.5 | 2.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [shapes_easings_box](shapes/shapes_easings_box.c) | <img src="shapes/shapes_easings_box.png" alt="shapes_easings_box" width="80"> | ⭐⭐☆☆ | 2.5 | 2.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [shapes_easings_rectangles](shapes/shapes_easings_rectangles.c) | <img src="shapes/shapes_easings_rectangles.png" alt="shapes_easings_rectangles" width="80"> | ⭐⭐⭐☆ | 2.0 | 2.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [shapes_easings_rectangles](shapes/shapes_easings_rectangles.c) | <img src="shapes/shapes_easings_rectangles.png" alt="shapes_easings_rectangles" width="80"> | ⭐⭐⭐☆ | 2.0 | 2.5 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
|
| [shapes_recursive_tree](shapes/shapes_recursive_tree.c) | <img src="shapes/shapes_recursive_tree.png" alt="shapes_recursive_tree" width="80"> | ⭐⭐⭐☆ | 5.6-dev | 5.6-dev | [Jopestpe](https://github.com/jopestpe) |
|
||||||
| [shapes_ring_drawing](shapes/shapes_ring_drawing.c) | <img src="shapes/shapes_ring_drawing.png" alt="shapes_ring_drawing" width="80"> | ⭐⭐⭐☆ | 2.5 | 2.5 | [Vlad Adrian](https://github.com/demizdor) |
|
| [shapes_ring_drawing](shapes/shapes_ring_drawing.c) | <img src="shapes/shapes_ring_drawing.png" alt="shapes_ring_drawing" width="80"> | ⭐⭐⭐☆ | 2.5 | 2.5 | [Vlad Adrian](https://github.com/demizdor) |
|
||||||
| [shapes_circle_sector_drawing](shapes/shapes_circle_sector_drawing.c) | <img src="shapes/shapes_circle_sector_drawing.png" alt="shapes_circle_sector_drawing" width="80"> | ⭐⭐⭐☆ | 2.5 | 2.5 | [Vlad Adrian](https://github.com/demizdor) |
|
| [shapes_circle_sector_drawing](shapes/shapes_circle_sector_drawing.c) | <img src="shapes/shapes_circle_sector_drawing.png" alt="shapes_circle_sector_drawing" width="80"> | ⭐⭐⭐☆ | 2.5 | 2.5 | [Vlad Adrian](https://github.com/demizdor) |
|
||||||
| [shapes_rounded_rectangle_drawing](shapes/shapes_rounded_rectangle_drawing.c) | <img src="shapes/shapes_rounded_rectangle_drawing.png" alt="shapes_rounded_rectangle_drawing" width="80"> | ⭐⭐⭐☆ | 2.5 | 2.5 | [Vlad Adrian](https://github.com/demizdor) |
|
| [shapes_rounded_rectangle_drawing](shapes/shapes_rounded_rectangle_drawing.c) | <img src="shapes/shapes_rounded_rectangle_drawing.png" alt="shapes_rounded_rectangle_drawing" width="80"> | ⭐⭐⭐☆ | 2.5 | 2.5 | [Vlad Adrian](https://github.com/demizdor) |
|
||||||
|
|
@ -94,8 +95,9 @@ Examples using raylib shapes drawing functionality, provided by raylib [shapes](
|
||||||
| [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) |
|
| [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) |
|
||||||
|
| [shapes_triangle_strip](shapes/shapes_triangle_strip.c) | <img src="shapes/shapes_triangle_strip.png" alt="shapes_triangle_strip" width="80"> | ⭐⭐☆☆ | 5.6-dev | 5.6-dev | [Jopestpe](https://github.com/jopestpe) |
|
||||||
| [shapes_vector_angle](shapes/shapes_vector_angle.c) | <img src="shapes/shapes_vector_angle.png" alt="shapes_vector_angle" width="80"> | ⭐⭐☆☆ | 1.0 | 5.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
| [shapes_vector_angle](shapes/shapes_vector_angle.c) | <img src="shapes/shapes_vector_angle.png" alt="shapes_vector_angle" width="80"> | ⭐⭐☆☆ | 1.0 | 5.0 | [Ramon Santamaria](https://github.com/raysan5) |
|
||||||
| [shapes_pie_chart](shapes/shapes_pie_chart.c) | <img src="shapes/shapes_pie_chart.png" alt="shapes_pie_chart" width="80"> | ⭐☆☆☆ | 5.5 | 5.6 | [Gideon Serfontein](https://github.com/GideonSerf) |
|
| [shapes_kaleidoscope](shapes/shapes_kaleidoscope.c) | <img src="shapes/shapes_kaleidoscope.png" alt="shapes_kaleidoscope" width="80"> | ⭐⭐☆☆ | 5.5 | 5.6 | [Hugo ARNAL](https://github.com/hugoarnal) |
|
||||||
|
|
||||||
### category: textures [26]
|
### category: textures [26]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ int main(void)
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
UpdateCamera(&camera, CAMERA_FREE);
|
UpdateCamera(&camera, CAMERA_FREE);
|
||||||
|
|
||||||
float th = GetTime();
|
float th = (float)GetTime();
|
||||||
|
|
||||||
Vector3 spherePos = {
|
Vector3 spherePos = {
|
||||||
.x = 5.0f*cosf(th),
|
.x = 5.0f*cosf(th),
|
||||||
|
|
|
||||||
|
|
@ -198,8 +198,8 @@ void UpdateBody(Body *body, float rot, char side, char forward, bool jumpPressed
|
||||||
//PlaySound(fxJump);
|
//PlaySound(fxJump);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3 front = (Vector3){ sin(rot), 0.f, cos(rot) };
|
Vector3 front = (Vector3){ sinf(rot), 0.f, cosf(rot) };
|
||||||
Vector3 right = (Vector3){ cos(-rot), 0.f, sin(-rot) };
|
Vector3 right = (Vector3){ cosf(-rot), 0.f, sinf(-rot) };
|
||||||
|
|
||||||
Vector3 desiredDir = (Vector3){ input.x*right.x + input.y*front.x, 0.0f, input.x*right.z + input.y*front.z, };
|
Vector3 desiredDir = (Vector3){ input.x*right.x + input.y*front.x, 0.0f, input.x*right.z + input.y*front.z, };
|
||||||
body->dir = Vector3Lerp(body->dir, desiredDir, CONTROL*delta);
|
body->dir = Vector3Lerp(body->dir, desiredDir, CONTROL*delta);
|
||||||
|
|
@ -267,8 +267,8 @@ static void UpdateCameraFPS(Camera *camera)
|
||||||
|
|
||||||
// Head animation
|
// Head animation
|
||||||
// Rotate up direction around forward axis
|
// Rotate up direction around forward axis
|
||||||
float headSin = sin(headTimer*PI);
|
float headSin = sinf(headTimer*PI);
|
||||||
float headCos = cos(headTimer*PI);
|
float headCos = cosf(headTimer*PI);
|
||||||
const float stepRotation = 0.01f;
|
const float stepRotation = 0.01f;
|
||||||
camera->up = Vector3RotateByAxisAngle(up, pitch, headSin*stepRotation + lean.x);
|
camera->up = Vector3RotateByAxisAngle(up, pitch, headSin*stepRotation + lean.x);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -177,33 +177,33 @@ int main(void)
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
// Draw common elements
|
// Draw common elements
|
||||||
DrawText("*", messagePosition.x + 5, messagePosition.y + 5, 10, BLACK);
|
DrawText("*", (int)messagePosition.x + 5, (int)messagePosition.y + 5, 10, BLACK);
|
||||||
DrawText("Example optimized for Web/HTML5\non Smartphones with Touch Screen.", messagePosition.x + 15, messagePosition.y + 5, 10, BLACK);
|
DrawText("Example optimized for Web/HTML5\non Smartphones with Touch Screen.", (int)messagePosition.x + 15, (int)messagePosition.y + 5, 10, BLACK);
|
||||||
DrawText("*", messagePosition.x + 5, messagePosition.y + 35, 10, BLACK);
|
DrawText("*", (int)messagePosition.x + 5, (int)messagePosition.y + 35, 10, BLACK);
|
||||||
DrawText("While running on Desktop Web Browsers,\ninspect and turn on Touch Emulation.", messagePosition.x + 15, messagePosition.y + 35, 10, BLACK);
|
DrawText("While running on Desktop Web Browsers,\ninspect and turn on Touch Emulation.", (int)messagePosition.x + 15, (int)messagePosition.y + 35, 10, BLACK);
|
||||||
|
|
||||||
// Draw last gesture
|
// Draw last gesture
|
||||||
DrawText("Last gesture", lastGesturePosition.x + 33, lastGesturePosition.y - 47, 20, BLACK);
|
DrawText("Last gesture", (int)lastGesturePosition.x + 33, (int)lastGesturePosition.y - 47, 20, BLACK);
|
||||||
DrawText("Swipe Tap Pinch Touch", lastGesturePosition.x + 17, lastGesturePosition.y - 18, 10, BLACK);
|
DrawText("Swipe Tap Pinch Touch", (int)lastGesturePosition.x + 17, (int)lastGesturePosition.y - 18, 10, BLACK);
|
||||||
DrawRectangle(lastGesturePosition.x + 20, lastGesturePosition.y, 20, 20, lastGesture == GESTURE_SWIPE_UP ? RED : LIGHTGRAY);
|
DrawRectangle((int)lastGesturePosition.x + 20, (int)lastGesturePosition.y, 20, 20, lastGesture == GESTURE_SWIPE_UP ? RED : LIGHTGRAY);
|
||||||
DrawRectangle(lastGesturePosition.x, lastGesturePosition.y + 20, 20, 20, lastGesture == GESTURE_SWIPE_LEFT ? RED : LIGHTGRAY);
|
DrawRectangle((int)lastGesturePosition.x, (int)lastGesturePosition.y + 20, 20, 20, lastGesture == GESTURE_SWIPE_LEFT ? RED : LIGHTGRAY);
|
||||||
DrawRectangle(lastGesturePosition.x + 40, lastGesturePosition.y + 20, 20, 20, lastGesture == GESTURE_SWIPE_RIGHT ? RED : LIGHTGRAY);
|
DrawRectangle((int)lastGesturePosition.x + 40, (int)lastGesturePosition.y + 20, 20, 20, lastGesture == GESTURE_SWIPE_RIGHT ? RED : LIGHTGRAY);
|
||||||
DrawRectangle(lastGesturePosition.x + 20, lastGesturePosition.y + 40, 20, 20, lastGesture == GESTURE_SWIPE_DOWN ? RED : LIGHTGRAY);
|
DrawRectangle((int)lastGesturePosition.x + 20, (int)lastGesturePosition.y + 40, 20, 20, lastGesture == GESTURE_SWIPE_DOWN ? RED : LIGHTGRAY);
|
||||||
DrawCircle(lastGesturePosition.x + 80, lastGesturePosition.y + 16, 10, lastGesture == GESTURE_TAP ? BLUE : LIGHTGRAY);
|
DrawCircle((int)lastGesturePosition.x + 80, (int)lastGesturePosition.y + 16, 10, lastGesture == GESTURE_TAP ? BLUE : LIGHTGRAY);
|
||||||
DrawRing( (Vector2){lastGesturePosition.x + 103, lastGesturePosition.y + 16}, 6.0f, 11.0f, 0.0f, 360.0f, 0, lastGesture == GESTURE_DRAG ? LIME : LIGHTGRAY);
|
DrawRing( (Vector2){lastGesturePosition.x + 103, lastGesturePosition.y + 16}, 6.0f, 11.0f, 0.0f, 360.0f, 0, lastGesture == GESTURE_DRAG ? LIME : LIGHTGRAY);
|
||||||
DrawCircle(lastGesturePosition.x + 80, lastGesturePosition.y + 43, 10, lastGesture == GESTURE_DOUBLETAP ? SKYBLUE : LIGHTGRAY);
|
DrawCircle((int)lastGesturePosition.x + 80, (int)lastGesturePosition.y + 43, 10, lastGesture == GESTURE_DOUBLETAP ? SKYBLUE : LIGHTGRAY);
|
||||||
DrawCircle(lastGesturePosition.x + 103, lastGesturePosition.y + 43, 10, lastGesture == GESTURE_DOUBLETAP ? SKYBLUE : LIGHTGRAY);
|
DrawCircle((int)lastGesturePosition.x + 103, (int)lastGesturePosition.y + 43, 10, lastGesture == GESTURE_DOUBLETAP ? SKYBLUE : LIGHTGRAY);
|
||||||
DrawTriangle((Vector2){ lastGesturePosition.x + 122, lastGesturePosition.y + 16 }, (Vector2){ lastGesturePosition.x + 137, lastGesturePosition.y + 26 }, (Vector2){lastGesturePosition.x + 137, lastGesturePosition.y + 6 }, lastGesture == GESTURE_PINCH_OUT? ORANGE : LIGHTGRAY);
|
DrawTriangle((Vector2){ lastGesturePosition.x + 122, lastGesturePosition.y + 16 }, (Vector2){ lastGesturePosition.x + 137, lastGesturePosition.y + 26 }, (Vector2){lastGesturePosition.x + 137, lastGesturePosition.y + 6 }, lastGesture == GESTURE_PINCH_OUT? ORANGE : LIGHTGRAY);
|
||||||
DrawTriangle((Vector2){ lastGesturePosition.x + 147, lastGesturePosition.y + 6 }, (Vector2){ lastGesturePosition.x + 147, lastGesturePosition.y + 26 }, (Vector2){ lastGesturePosition.x + 162, lastGesturePosition.y + 16 }, lastGesture == GESTURE_PINCH_OUT? ORANGE : LIGHTGRAY);
|
DrawTriangle((Vector2){ lastGesturePosition.x + 147, lastGesturePosition.y + 6 }, (Vector2){ lastGesturePosition.x + 147, lastGesturePosition.y + 26 }, (Vector2){ lastGesturePosition.x + 162, lastGesturePosition.y + 16 }, lastGesture == GESTURE_PINCH_OUT? ORANGE : LIGHTGRAY);
|
||||||
DrawTriangle((Vector2){ lastGesturePosition.x + 125, lastGesturePosition.y + 33 }, (Vector2){ lastGesturePosition.x + 125, lastGesturePosition.y + 53 }, (Vector2){ lastGesturePosition.x + 140, lastGesturePosition.y + 43 }, lastGesture == GESTURE_PINCH_IN? VIOLET : LIGHTGRAY);
|
DrawTriangle((Vector2){ lastGesturePosition.x + 125, lastGesturePosition.y + 33 }, (Vector2){ lastGesturePosition.x + 125, lastGesturePosition.y + 53 }, (Vector2){ lastGesturePosition.x + 140, lastGesturePosition.y + 43 }, lastGesture == GESTURE_PINCH_IN? VIOLET : LIGHTGRAY);
|
||||||
DrawTriangle((Vector2){ lastGesturePosition.x + 144, lastGesturePosition.y + 43 }, (Vector2){ lastGesturePosition.x + 159, lastGesturePosition.y + 53 }, (Vector2){ lastGesturePosition.x + 159, lastGesturePosition.y + 33 }, lastGesture == GESTURE_PINCH_IN? VIOLET : LIGHTGRAY);
|
DrawTriangle((Vector2){ lastGesturePosition.x + 144, lastGesturePosition.y + 43 }, (Vector2){ lastGesturePosition.x + 159, lastGesturePosition.y + 53 }, (Vector2){ lastGesturePosition.x + 159, lastGesturePosition.y + 33 }, lastGesture == GESTURE_PINCH_IN? VIOLET : LIGHTGRAY);
|
||||||
for (i = 0; i < 4; i++) DrawCircle(lastGesturePosition.x + 180, lastGesturePosition.y + 7 + i*15, 5, touchCount <= i? LIGHTGRAY : gestureColor);
|
for (i = 0; i < 4; i++) DrawCircle((int)lastGesturePosition.x + 180, (int)lastGesturePosition.y + 7 + i*15, 5, touchCount <= i? LIGHTGRAY : gestureColor);
|
||||||
|
|
||||||
// Draw gesture log
|
// Draw gesture log
|
||||||
DrawText("Log", gestureLogPosition.x, gestureLogPosition.y, 20, BLACK);
|
DrawText("Log", (int)gestureLogPosition.x, (int)gestureLogPosition.y, 20, BLACK);
|
||||||
|
|
||||||
// Loop in both directions to print the gesture log array in the inverted order (and looping around if the index started somewhere in the middle)
|
// Loop in both directions to print the gesture log array in the inverted order (and looping around if the index started somewhere in the middle)
|
||||||
for (i = 0, ii = gestureLogIndex; i < GESTURE_LOG_SIZE; i++, ii = (ii + 1) % GESTURE_LOG_SIZE) DrawText(gestureLog[ii], gestureLogPosition.x, gestureLogPosition.y + 410 - i*20, 20, (i == 0 ? gestureColor : LIGHTGRAY));
|
for (i = 0, ii = gestureLogIndex; i < GESTURE_LOG_SIZE; i++, ii = (ii + 1) % GESTURE_LOG_SIZE) DrawText(gestureLog[ii], (int)gestureLogPosition.x, (int)gestureLogPosition.y + 410 - i*20, 20, (i == 0 ? gestureColor : LIGHTGRAY));
|
||||||
Color logButton1Color, logButton2Color;
|
Color logButton1Color, logButton2Color;
|
||||||
switch (logMode)
|
switch (logMode)
|
||||||
{
|
{
|
||||||
|
|
@ -213,31 +213,31 @@ int main(void)
|
||||||
default: logButton1Color=GRAY; logButton2Color=GRAY; break;
|
default: logButton1Color=GRAY; logButton2Color=GRAY; break;
|
||||||
}
|
}
|
||||||
DrawRectangleRec(logButton1, logButton1Color);
|
DrawRectangleRec(logButton1, logButton1Color);
|
||||||
DrawText("Hide", logButton1.x + 7, logButton1.y + 3, 10, WHITE);
|
DrawText("Hide", (int)logButton1.x + 7, (int)logButton1.y + 3, 10, WHITE);
|
||||||
DrawText("Repeat", logButton1.x + 7, logButton1.y + 13, 10, WHITE);
|
DrawText("Repeat", (int)logButton1.x + 7, (int)logButton1.y + 13, 10, WHITE);
|
||||||
DrawRectangleRec(logButton2, logButton2Color);
|
DrawRectangleRec(logButton2, logButton2Color);
|
||||||
DrawText("Hide", logButton1.x + 62, logButton1.y + 3, 10, WHITE);
|
DrawText("Hide", (int)logButton1.x + 62, (int)logButton1.y + 3, 10, WHITE);
|
||||||
DrawText("Hold", logButton1.x + 62, logButton1.y + 13, 10, WHITE);
|
DrawText("Hold", (int)logButton1.x + 62, (int)logButton1.y + 13, 10, WHITE);
|
||||||
|
|
||||||
// Draw protractor
|
// Draw protractor
|
||||||
DrawText("Angle", protractorPosition.x + 55, protractorPosition.y + 76, 10, BLACK);
|
DrawText("Angle", (int)protractorPosition.x + 55, (int)protractorPosition.y + 76, 10, BLACK);
|
||||||
const char *angleString = TextFormat("%f", currentAngleDegrees);
|
const char *angleString = TextFormat("%f", currentAngleDegrees);
|
||||||
const int angleStringDot = TextFindIndex(angleString, ".");
|
const int angleStringDot = TextFindIndex(angleString, ".");
|
||||||
const char *angleStringTrim = TextSubtext(angleString, 0, angleStringDot + 3);
|
const char *angleStringTrim = TextSubtext(angleString, 0, angleStringDot + 3);
|
||||||
DrawText( angleStringTrim, protractorPosition.x + 55, protractorPosition.y + 92, 20, gestureColor);
|
DrawText( angleStringTrim, (int)protractorPosition.x + 55, (int)protractorPosition.y + 92, 20, gestureColor);
|
||||||
DrawCircle(protractorPosition.x, protractorPosition.y, 80.0f, WHITE);
|
DrawCircleV(protractorPosition, 80.0f, WHITE);
|
||||||
DrawLineEx((Vector2){ protractorPosition.x - 90, protractorPosition.y }, (Vector2){ protractorPosition.x + 90, protractorPosition.y }, 3.0f, LIGHTGRAY);
|
DrawLineEx((Vector2){ protractorPosition.x - 90, protractorPosition.y }, (Vector2){ protractorPosition.x + 90, protractorPosition.y }, 3.0f, LIGHTGRAY);
|
||||||
DrawLineEx((Vector2){ protractorPosition.x, protractorPosition.y - 90 }, (Vector2){ protractorPosition.x, protractorPosition.y + 90 }, 3.0f, LIGHTGRAY);
|
DrawLineEx((Vector2){ protractorPosition.x, protractorPosition.y - 90 }, (Vector2){ protractorPosition.x, protractorPosition.y + 90 }, 3.0f, LIGHTGRAY);
|
||||||
DrawLineEx((Vector2){ protractorPosition.x - 80, protractorPosition.y - 45 }, (Vector2){ protractorPosition.x + 80, protractorPosition.y + 45 }, 3.0f, GREEN);
|
DrawLineEx((Vector2){ protractorPosition.x - 80, protractorPosition.y - 45 }, (Vector2){ protractorPosition.x + 80, protractorPosition.y + 45 }, 3.0f, GREEN);
|
||||||
DrawLineEx((Vector2){ protractorPosition.x - 80, protractorPosition.y + 45 }, (Vector2){ protractorPosition.x + 80, protractorPosition.y - 45 }, 3.0f, GREEN);
|
DrawLineEx((Vector2){ protractorPosition.x - 80, protractorPosition.y + 45 }, (Vector2){ protractorPosition.x + 80, protractorPosition.y - 45 }, 3.0f, GREEN);
|
||||||
DrawText("0", protractorPosition.x + 96, protractorPosition.y - 9, 20, BLACK);
|
DrawText("0", (int)protractorPosition.x + 96, (int)protractorPosition.y - 9, 20, BLACK);
|
||||||
DrawText("30", protractorPosition.x + 74, protractorPosition.y - 68, 20, BLACK);
|
DrawText("30", (int)protractorPosition.x + 74, (int)protractorPosition.y - 68, 20, BLACK);
|
||||||
DrawText("90", protractorPosition.x - 11, protractorPosition.y - 110, 20, BLACK);
|
DrawText("90", (int)protractorPosition.x - 11, (int)protractorPosition.y - 110, 20, BLACK);
|
||||||
DrawText("150", protractorPosition.x - 100, protractorPosition.y - 68, 20, BLACK);
|
DrawText("150", (int)protractorPosition.x - 100, (int)protractorPosition.y - 68, 20, BLACK);
|
||||||
DrawText("180", protractorPosition.x - 124, protractorPosition.y - 9, 20, BLACK);
|
DrawText("180", (int)protractorPosition.x - 124, (int)protractorPosition.y - 9, 20, BLACK);
|
||||||
DrawText("210", protractorPosition.x - 100, protractorPosition.y + 50, 20, BLACK);
|
DrawText("210", (int)protractorPosition.x - 100, (int)protractorPosition.y + 50, 20, BLACK);
|
||||||
DrawText("270", protractorPosition.x - 18, protractorPosition.y + 92, 20, BLACK);
|
DrawText("270", (int)protractorPosition.x - 18, (int)protractorPosition.y + 92, 20, BLACK);
|
||||||
DrawText("330", protractorPosition.x + 72, protractorPosition.y + 50, 20, BLACK);
|
DrawText("330", (int)protractorPosition.x + 72, (int)protractorPosition.y + 50, 20, BLACK);
|
||||||
if (currentAngleDegrees != 0.0f) DrawLineEx(protractorPosition, finalVector, 3.0f, gestureColor);
|
if (currentAngleDegrees != 0.0f) DrawLineEx(protractorPosition, finalVector, 3.0f, gestureColor);
|
||||||
|
|
||||||
// Draw touch and mouse pointer points
|
// Draw touch and mouse pointer points
|
||||||
|
|
@ -251,7 +251,7 @@ int main(void)
|
||||||
DrawCircleV(touchPosition[i], 5.0f, gestureColor);
|
DrawCircleV(touchPosition[i], 5.0f, gestureColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (touchCount == 2) DrawLineEx(touchPosition[0], touchPosition[1], ((currentGesture == 512)? 8 : 12), gestureColor);
|
if (touchCount == 2) DrawLineEx(touchPosition[0], touchPosition[1], ((currentGesture == 512)? 8.0f : 12.0f), gestureColor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
// Monitor Details
|
// Monitor Details
|
||||||
typedef struct Monitor {
|
typedef struct Monitor {
|
||||||
Vector2 position;
|
Vector2 position;
|
||||||
char *name;
|
const char *name;
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
int physicalWidth;
|
int physicalWidth;
|
||||||
|
|
@ -76,10 +76,10 @@ int main(void)
|
||||||
GetMonitorPhysicalHeight(i),
|
GetMonitorPhysicalHeight(i),
|
||||||
GetMonitorRefreshRate(i)
|
GetMonitorRefreshRate(i)
|
||||||
};
|
};
|
||||||
if (monitors[i].position.x < monitorOffsetX) monitorOffsetX = monitors[i].position.x*-1;
|
if (monitors[i].position.x < monitorOffsetX) monitorOffsetX = (int)monitors[i].position.x*-1;
|
||||||
|
|
||||||
const int width = monitors[i].position.x + monitors[i].width;
|
const int width = (int)monitors[i].position.x + monitors[i].width;
|
||||||
const int height = monitors[i].position.y + monitors[i].height;
|
const int height = (int)monitors[i].position.y + monitors[i].height;
|
||||||
|
|
||||||
if (maxWidth < width) maxWidth = width;
|
if (maxWidth < width) maxWidth = width;
|
||||||
if (maxHeight < height) maxHeight = height;
|
if (maxHeight < height) maxHeight = height;
|
||||||
|
|
@ -99,9 +99,8 @@ int main(void)
|
||||||
// Get currentMonitorIndex if manually moved
|
// Get currentMonitorIndex if manually moved
|
||||||
currentMonitorIndex = GetCurrentMonitor();
|
currentMonitorIndex = GetCurrentMonitor();
|
||||||
}
|
}
|
||||||
const Monitor currentMonitor = monitors[currentMonitorIndex];
|
|
||||||
|
|
||||||
float monitorScale = 0.6;
|
float monitorScale = 0.6f;
|
||||||
|
|
||||||
if(maxHeight > maxWidth + monitorOffsetX) monitorScale *= ((float)screenHeight/(float)maxHeight);
|
if(maxHeight > maxWidth + monitorOffsetX) monitorScale *= ((float)screenHeight/(float)maxHeight);
|
||||||
else monitorScale *= ((float)screenWidth/(float)(maxWidth + monitorOffsetX));
|
else monitorScale *= ((float)screenWidth/(float)(maxWidth + monitorOffsetX));
|
||||||
|
|
@ -128,7 +127,7 @@ int main(void)
|
||||||
};
|
};
|
||||||
|
|
||||||
// Draw monitor name and information inside the rectangle
|
// 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("[%i] %s", i, monitors[i].name), (int)rec.x + 10, (int)rec.y + (int)(100*monitorScale), (int)(120*monitorScale), BLUE);
|
||||||
DrawText(
|
DrawText(
|
||||||
TextFormat("Resolution: [%ipx x %ipx]\nRefreshRate: [%ihz]\nPhysical Size: [%imm x %imm]\nPosition: %3.0f x %3.0f",
|
TextFormat("Resolution: [%ipx x %ipx]\nRefreshRate: [%ihz]\nPhysical Size: [%imm x %imm]\nPosition: %3.0f x %3.0f",
|
||||||
monitors[i].width,
|
monitors[i].width,
|
||||||
|
|
@ -138,7 +137,7 @@ int main(void)
|
||||||
monitors[i].physicalHeight,
|
monitors[i].physicalHeight,
|
||||||
monitors[i].position.x,
|
monitors[i].position.x,
|
||||||
monitors[i].position.y
|
monitors[i].position.y
|
||||||
), rec.x + 10, rec.y + (int)(200*monitorScale), (int)(120*monitorScale), DARKGRAY);
|
), (int)rec.x + 10, (int)rec.y + (int)(200*monitorScale), (int)(120*monitorScale), DARKGRAY);
|
||||||
|
|
||||||
// Highlight current monitor
|
// Highlight current monitor
|
||||||
if (i == currentMonitorIndex)
|
if (i == currentMonitorIndex)
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,7 @@ int main(void)
|
||||||
|
|
||||||
ClearBackground(SKYBLUE);
|
ClearBackground(SKYBLUE);
|
||||||
|
|
||||||
|
DrawRectangle(0, 0, 20, 20, RED);
|
||||||
DrawCircleV(ballPosition, (float)ballRadius, MAROON);
|
DrawCircleV(ballPosition, (float)ballRadius, MAROON);
|
||||||
|
|
||||||
EndTextureMode();
|
EndTextureMode();
|
||||||
|
|
@ -75,11 +76,12 @@ int main(void)
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
// Draw our render texture with rotation applied
|
// Draw our render texture with rotation applied
|
||||||
// NOTE: We set the origin of the texture to the center of the render texture
|
// NOTE 1: We set the origin of the texture to the center of the render texture
|
||||||
|
// NOTE 2: We flip vertically the texture setting negative source rectangle height
|
||||||
DrawTexturePro(target.texture,
|
DrawTexturePro(target.texture,
|
||||||
(Rectangle){ 0, 0, target.texture.width, -target.texture.height },
|
(Rectangle){ 0, 0, (float)target.texture.width, (float)-target.texture.height },
|
||||||
(Rectangle){ screenWidth/2, screenHeight/2, target.texture.width, -target.texture.height },
|
(Rectangle){ screenWidth/2.0f, screenHeight/2.0f, (float)target.texture.width, (float)target.texture.height },
|
||||||
(Vector2){ target.texture.width/2, target.texture.height/2 }, rotation, WHITE);
|
(Vector2){ target.texture.width/2.0f, target.texture.height/2.0f }, rotation, WHITE);
|
||||||
|
|
||||||
DrawText("DRAWING BOUNCING BALL INSIDE RENDER TEXTURE!", 10, screenHeight - 40, 20, BLACK);
|
DrawText("DRAWING BOUNCING BALL INSIDE RENDER TEXTURE!", 10, screenHeight - 40, 20, BLACK);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -187,42 +187,42 @@ int main(void)
|
||||||
if (lastUndoIndex > firstUndoIndex)
|
if (lastUndoIndex > firstUndoIndex)
|
||||||
{
|
{
|
||||||
for (int i = firstUndoIndex; i < currentUndoIndex; i++)
|
for (int i = firstUndoIndex; i < currentUndoIndex; i++)
|
||||||
DrawRectangle(gridPosition.x + states[i].cell.x*GRID_CELL_SIZE, gridPosition.y + states[i].cell.y*GRID_CELL_SIZE,
|
DrawRectangleRec((Rectangle){gridPosition.x + states[i].cell.x * GRID_CELL_SIZE, gridPosition.y + states[i].cell.y * GRID_CELL_SIZE,
|
||||||
GRID_CELL_SIZE, GRID_CELL_SIZE, LIGHTGRAY);
|
GRID_CELL_SIZE, GRID_CELL_SIZE }, LIGHTGRAY);
|
||||||
}
|
}
|
||||||
else if (firstUndoIndex > lastUndoIndex)
|
else if (firstUndoIndex > lastUndoIndex)
|
||||||
{
|
{
|
||||||
if ((currentUndoIndex < MAX_UNDO_STATES) && (currentUndoIndex > lastUndoIndex))
|
if ((currentUndoIndex < MAX_UNDO_STATES) && (currentUndoIndex > lastUndoIndex))
|
||||||
{
|
{
|
||||||
for (int i = firstUndoIndex; i < currentUndoIndex; i++)
|
for (int i = firstUndoIndex; i < currentUndoIndex; i++)
|
||||||
DrawRectangle(gridPosition.x + states[i].cell.x*GRID_CELL_SIZE, gridPosition.y + states[i].cell.y*GRID_CELL_SIZE,
|
DrawRectangleRec((Rectangle) { gridPosition.x + states[i].cell.x * GRID_CELL_SIZE, gridPosition.y + states[i].cell.y * GRID_CELL_SIZE,
|
||||||
GRID_CELL_SIZE, GRID_CELL_SIZE, LIGHTGRAY);
|
GRID_CELL_SIZE, GRID_CELL_SIZE }, LIGHTGRAY);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (int i = firstUndoIndex; i < MAX_UNDO_STATES; i++)
|
for (int i = firstUndoIndex; i < MAX_UNDO_STATES; i++)
|
||||||
DrawRectangle(gridPosition.x + states[i].cell.x*GRID_CELL_SIZE, gridPosition.y + states[i].cell.y*GRID_CELL_SIZE,
|
DrawRectangle((int)gridPosition.x + states[i].cell.x*GRID_CELL_SIZE, (int)gridPosition.y + states[i].cell.y*GRID_CELL_SIZE,
|
||||||
GRID_CELL_SIZE, GRID_CELL_SIZE, LIGHTGRAY);
|
GRID_CELL_SIZE, GRID_CELL_SIZE, LIGHTGRAY);
|
||||||
for (int i = 0; i < currentUndoIndex; i++)
|
for (int i = 0; i < currentUndoIndex; i++)
|
||||||
DrawRectangle(gridPosition.x + states[i].cell.x*GRID_CELL_SIZE, gridPosition.y + states[i].cell.y*GRID_CELL_SIZE,
|
DrawRectangle((int)gridPosition.x + states[i].cell.x*GRID_CELL_SIZE, (int)gridPosition.y + states[i].cell.y*GRID_CELL_SIZE,
|
||||||
GRID_CELL_SIZE, GRID_CELL_SIZE, LIGHTGRAY);
|
GRID_CELL_SIZE, GRID_CELL_SIZE, LIGHTGRAY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw game grid
|
// Draw game grid
|
||||||
for (int y = 0; y <= MAX_GRID_CELLS_Y; y++)
|
for (int y = 0; y <= MAX_GRID_CELLS_Y; y++)
|
||||||
DrawLine(gridPosition.x, gridPosition.y + y*GRID_CELL_SIZE,
|
DrawLine((int)gridPosition.x, (int)gridPosition.y + y*GRID_CELL_SIZE,
|
||||||
gridPosition.x + MAX_GRID_CELLS_X*GRID_CELL_SIZE, gridPosition.y + y*GRID_CELL_SIZE, GRAY);
|
(int)gridPosition.x + MAX_GRID_CELLS_X*GRID_CELL_SIZE, (int)gridPosition.y + y*GRID_CELL_SIZE, GRAY);
|
||||||
for (int x = 0; x <= MAX_GRID_CELLS_X; x++)
|
for (int x = 0; x <= MAX_GRID_CELLS_X; x++)
|
||||||
DrawLine(gridPosition.x + x*GRID_CELL_SIZE, gridPosition.y,
|
DrawLine((int)gridPosition.x + x*GRID_CELL_SIZE, (int)gridPosition.y,
|
||||||
gridPosition.x + x*GRID_CELL_SIZE, gridPosition.y + MAX_GRID_CELLS_Y*GRID_CELL_SIZE, GRAY);
|
(int)gridPosition.x + x*GRID_CELL_SIZE, (int)gridPosition.y + MAX_GRID_CELLS_Y*GRID_CELL_SIZE, GRAY);
|
||||||
|
|
||||||
// Draw player
|
// Draw player
|
||||||
DrawRectangle(gridPosition.x + player.cell.x*GRID_CELL_SIZE, gridPosition.y + player.cell.y*GRID_CELL_SIZE,
|
DrawRectangle((int)gridPosition.x + player.cell.x*GRID_CELL_SIZE, (int)gridPosition.y + player.cell.y*GRID_CELL_SIZE,
|
||||||
GRID_CELL_SIZE + 1, GRID_CELL_SIZE + 1, player.color);
|
GRID_CELL_SIZE + 1, GRID_CELL_SIZE + 1, player.color);
|
||||||
|
|
||||||
// Draw undo system buffer info
|
// Draw undo system buffer info
|
||||||
DrawText("UNDO STATES:", undoInfoPos.x - 85, undoInfoPos.y + 9, 10, DARKGRAY);
|
DrawText("UNDO STATES:", (int)undoInfoPos.x - 85, (int)undoInfoPos.y + 9, 10, DARKGRAY);
|
||||||
DrawUndoBuffer(undoInfoPos, firstUndoIndex, lastUndoIndex, currentUndoIndex, 24);
|
DrawUndoBuffer(undoInfoPos, firstUndoIndex, lastUndoIndex, currentUndoIndex, 24);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
|
|
@ -247,15 +247,15 @@ int main(void)
|
||||||
static void DrawUndoBuffer(Vector2 position, int firstUndoIndex, int lastUndoIndex, int currentUndoIndex, int slotSize)
|
static void DrawUndoBuffer(Vector2 position, int firstUndoIndex, int lastUndoIndex, int currentUndoIndex, int slotSize)
|
||||||
{
|
{
|
||||||
// Draw index marks
|
// Draw index marks
|
||||||
DrawRectangle(position.x + 8 + slotSize*currentUndoIndex, position.y - 10, 8, 8, RED);
|
DrawRectangle((int)position.x + 8 + slotSize*currentUndoIndex, (int)position.y - 10, 8, 8, RED);
|
||||||
DrawRectangleLines(position.x + 2 + slotSize*firstUndoIndex, position.y + 27, 8, 8, BLACK);
|
DrawRectangleLines((int)position.x + 2 + slotSize*firstUndoIndex, (int)position.y + 27, 8, 8, BLACK);
|
||||||
DrawRectangle(position.x + 14 + slotSize*lastUndoIndex, position.y + 27, 8, 8, BLACK);
|
DrawRectangle((int)position.x + 14 + slotSize*lastUndoIndex, (int)position.y + 27, 8, 8, BLACK);
|
||||||
|
|
||||||
// Draw background gray slots
|
// Draw background gray slots
|
||||||
for (int i = 0; i < MAX_UNDO_STATES; i++)
|
for (int i = 0; i < MAX_UNDO_STATES; i++)
|
||||||
{
|
{
|
||||||
DrawRectangle(position.x + slotSize*i, position.y, slotSize, slotSize, LIGHTGRAY);
|
DrawRectangle((int)position.x + slotSize*i, (int)position.y, slotSize, slotSize, LIGHTGRAY);
|
||||||
DrawRectangleLines(position.x + slotSize*i, position.y, slotSize, slotSize, GRAY);
|
DrawRectangleLines((int)position.x + slotSize*i, (int)position.y, slotSize, slotSize, GRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw occupied slots: firstUndoIndex --> lastUndoIndex
|
// Draw occupied slots: firstUndoIndex --> lastUndoIndex
|
||||||
|
|
@ -263,22 +263,22 @@ static void DrawUndoBuffer(Vector2 position, int firstUndoIndex, int lastUndoInd
|
||||||
{
|
{
|
||||||
for (int i = firstUndoIndex; i < lastUndoIndex + 1; i++)
|
for (int i = firstUndoIndex; i < lastUndoIndex + 1; i++)
|
||||||
{
|
{
|
||||||
DrawRectangle(position.x + slotSize*i, position.y, slotSize, slotSize, SKYBLUE);
|
DrawRectangle((int)position.x + slotSize*i, (int)position.y, slotSize, slotSize, SKYBLUE);
|
||||||
DrawRectangleLines(position.x + slotSize*i, position.y, slotSize, slotSize, BLUE);
|
DrawRectangleLines((int)position.x + slotSize*i, (int)position.y, slotSize, slotSize, BLUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (lastUndoIndex < firstUndoIndex)
|
else if (lastUndoIndex < firstUndoIndex)
|
||||||
{
|
{
|
||||||
for (int i = firstUndoIndex; i < MAX_UNDO_STATES; i++)
|
for (int i = firstUndoIndex; i < MAX_UNDO_STATES; i++)
|
||||||
{
|
{
|
||||||
DrawRectangle(position.x + slotSize*i, position.y, slotSize, slotSize, SKYBLUE);
|
DrawRectangle((int)position.x + slotSize*i, (int)position.y, slotSize, slotSize, SKYBLUE);
|
||||||
DrawRectangleLines(position.x + slotSize*i, position.y, slotSize, slotSize, BLUE);
|
DrawRectangleLines((int)position.x + slotSize*i, (int)position.y, slotSize, slotSize, BLUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < lastUndoIndex + 1; i++)
|
for (int i = 0; i < lastUndoIndex + 1; i++)
|
||||||
{
|
{
|
||||||
DrawRectangle(position.x + slotSize*i, position.y, slotSize, slotSize, SKYBLUE);
|
DrawRectangle((int)position.x + slotSize*i, (int)position.y, slotSize, slotSize, SKYBLUE);
|
||||||
DrawRectangleLines(position.x + slotSize*i, position.y, slotSize, slotSize, BLUE);
|
DrawRectangleLines((int)position.x + slotSize*i, (int)position.y, slotSize, slotSize, BLUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -287,26 +287,26 @@ static void DrawUndoBuffer(Vector2 position, int firstUndoIndex, int lastUndoInd
|
||||||
{
|
{
|
||||||
for (int i = firstUndoIndex; i < currentUndoIndex; i++)
|
for (int i = firstUndoIndex; i < currentUndoIndex; i++)
|
||||||
{
|
{
|
||||||
DrawRectangle(position.x + slotSize*i, position.y, slotSize, slotSize, GREEN);
|
DrawRectangle((int)position.x + slotSize*i, (int)position.y, slotSize, slotSize, GREEN);
|
||||||
DrawRectangleLines(position.x + slotSize*i, position.y, slotSize, slotSize, LIME);
|
DrawRectangleLines((int)position.x + slotSize*i, (int)position.y, slotSize, slotSize, LIME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (currentUndoIndex < firstUndoIndex)
|
else if (currentUndoIndex < firstUndoIndex)
|
||||||
{
|
{
|
||||||
for (int i = firstUndoIndex; i < MAX_UNDO_STATES; i++)
|
for (int i = firstUndoIndex; i < MAX_UNDO_STATES; i++)
|
||||||
{
|
{
|
||||||
DrawRectangle(position.x + slotSize*i, position.y, slotSize, slotSize, GREEN);
|
DrawRectangle((int)position.x + slotSize*i, (int)position.y, slotSize, slotSize, GREEN);
|
||||||
DrawRectangleLines(position.x + slotSize*i, position.y, slotSize, slotSize, LIME);
|
DrawRectangleLines((int)position.x + slotSize*i, (int)position.y, slotSize, slotSize, LIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < currentUndoIndex; i++)
|
for (int i = 0; i < currentUndoIndex; i++)
|
||||||
{
|
{
|
||||||
DrawRectangle(position.x + slotSize*i, position.y, slotSize, slotSize, GREEN);
|
DrawRectangle((int)position.x + slotSize*i, (int)position.y, slotSize, slotSize, GREEN);
|
||||||
DrawRectangleLines(position.x + slotSize*i, position.y, slotSize, slotSize, LIME);
|
DrawRectangleLines((int)position.x + slotSize*i, (int)position.y, slotSize, slotSize, LIME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw current selected UNDO slot
|
// Draw current selected UNDO slot
|
||||||
DrawRectangle(position.x + slotSize*currentUndoIndex, position.y, slotSize, slotSize, GOLD);
|
DrawRectangle((int)position.x + slotSize*currentUndoIndex, (int)position.y, slotSize, slotSize, GOLD);
|
||||||
DrawRectangleLines(position.x + slotSize*currentUndoIndex, position.y, slotSize, slotSize, ORANGE);
|
DrawRectangleLines((int)position.x + slotSize*currentUndoIndex, (int)position.y, slotSize, slotSize, ORANGE);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,7 @@ shapes;shapes_following_eyes;★★☆☆;2.5;2.5;2013;2025;"Ramon Santamaria";@
|
||||||
shapes;shapes_easings_ball;★★☆☆;2.5;2.5;2014;2025;"Ramon Santamaria";@raysan5
|
shapes;shapes_easings_ball;★★☆☆;2.5;2.5;2014;2025;"Ramon Santamaria";@raysan5
|
||||||
shapes;shapes_easings_box;★★☆☆;2.5;2.5;2014;2025;"Ramon Santamaria";@raysan5
|
shapes;shapes_easings_box;★★☆☆;2.5;2.5;2014;2025;"Ramon Santamaria";@raysan5
|
||||||
shapes;shapes_easings_rectangles;★★★☆;2.0;2.5;2014;2025;"Ramon Santamaria";@raysan5
|
shapes;shapes_easings_rectangles;★★★☆;2.0;2.5;2014;2025;"Ramon Santamaria";@raysan5
|
||||||
|
shapes;shapes_recursive_tree;★★★☆;5.6-dev;5.6-dev;2025;2025;"Jopestpe";@jopestpe
|
||||||
shapes;shapes_ring_drawing;★★★☆;2.5;2.5;2018;2025;"Vlad Adrian";@demizdor
|
shapes;shapes_ring_drawing;★★★☆;2.5;2.5;2018;2025;"Vlad Adrian";@demizdor
|
||||||
shapes;shapes_circle_sector_drawing;★★★☆;2.5;2.5;2018;2025;"Vlad Adrian";@demizdor
|
shapes;shapes_circle_sector_drawing;★★★☆;2.5;2.5;2018;2025;"Vlad Adrian";@demizdor
|
||||||
shapes;shapes_rounded_rectangle_drawing;★★★☆;2.5;2.5;2018;2025;"Vlad Adrian";@demizdor
|
shapes;shapes_rounded_rectangle_drawing;★★★☆;2.5;2.5;2018;2025;"Vlad Adrian";@demizdor
|
||||||
|
|
@ -69,6 +70,7 @@ shapes;shapes_splines_drawing;★★★☆;5.0;5.0;2023;2025;"Ramon Santamaria";
|
||||||
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
|
shapes;shapes_dashed_line;★☆☆☆;5.5;5.5;2025;2025;"Luís Almeida";@luis605
|
||||||
|
shapes;shapes_triangle_strip;★★☆☆;5.6-dev;5.6-dev;2025;2025;"Jopestpe";@jopestpe
|
||||||
shapes;shapes_vector_angle;★★☆☆;1.0;5.0;2023;2025;"Ramon Santamaria";@raysan5
|
shapes;shapes_vector_angle;★★☆☆;1.0;5.0;2023;2025;"Ramon Santamaria";@raysan5
|
||||||
shapes;shapes_pie_chart;★☆☆☆;5.5;5.6;2025;2025;"Gideon Serfontein";@GideonSerf
|
shapes;shapes_pie_chart;★☆☆☆;5.5;5.6;2025;2025;"Gideon Serfontein";@GideonSerf
|
||||||
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
|
||||||
|
|
@ -107,7 +109,7 @@ text;text_input_box;★★☆☆;1.7;3.5;2017;2025;"Ramon Santamaria";@raysan5
|
||||||
text;text_writing_anim;★★☆☆;1.4;1.4;2016;2025;"Ramon Santamaria";@raysan5
|
text;text_writing_anim;★★☆☆;1.4;1.4;2016;2025;"Ramon Santamaria";@raysan5
|
||||||
text;text_rectangle_bounds;★★★★;2.5;4.0;2018;2025;"Vlad Adrian";@demizdor
|
text;text_rectangle_bounds;★★★★;2.5;4.0;2018;2025;"Vlad Adrian";@demizdor
|
||||||
text;text_unicode_emojis;★★★★;2.5;4.0;2019;2025;"Vlad Adrian";@demizdor
|
text;text_unicode_emojis;★★★★;2.5;4.0;2019;2025;"Vlad Adrian";@demizdor
|
||||||
text;text_unicode_ranges;★★★★;5.5;5.6;2025;2025;"Vlad Adrian";@demizdor
|
text;text_unicode_ranges;★★★★;5.5;5.6;2025;2025;"Vadim Gunko";@GuvaCode
|
||||||
text;text_3d_drawing;★★★★;3.5;4.0;2021;2025;"Vlad Adrian";@demizdor
|
text;text_3d_drawing;★★★★;3.5;4.0;2021;2025;"Vlad Adrian";@demizdor
|
||||||
text;text_codepoints_loading;★★★☆;4.2;4.2;2022;2025;"Ramon Santamaria";@raysan5
|
text;text_codepoints_loading;★★★☆;4.2;4.2;2022;2025;"Ramon Santamaria";@raysan5
|
||||||
text;text_inline_styling;★★★☆;5.6-dev;5.6-dev;2025;2025;"Wagner Barongello";@SultansOfCode
|
text;text_inline_styling;★★★☆;5.6-dev;5.6-dev;2025;2025;"Wagner Barongello";@SultansOfCode
|
||||||
|
|
@ -180,3 +182,4 @@ others;easings_testbed;★★★☆;2.5;3.0;2019;2025;"Juan Miguel López";@flas
|
||||||
others;raylib_opengl_interop;★★★★;3.8;4.0;2021;2025;"Stephan Soller";@arkanis
|
others;raylib_opengl_interop;★★★★;3.8;4.0;2021;2025;"Stephan Soller";@arkanis
|
||||||
others;embedded_files_loading;★★☆☆;3.0;3.5;2020;2025;"Kristian Holmgren";@defutura
|
others;embedded_files_loading;★★☆☆;3.0;3.5;2020;2025;"Kristian Holmgren";@defutura
|
||||||
others;web_basic_window;★☆☆☆;5.6-dev;5.6-dev;2014;2025;"Ramon Santamaria";@raysan5
|
others;web_basic_window;★☆☆☆;5.6-dev;5.6-dev;2014;2025;"Ramon Santamaria";@raysan5
|
||||||
|
shapes;shapes_kaleidoscope;★★☆☆;5.5;5.6;2025;2025;"Hugo ARNAL";@hugoarnal
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ int main(void)
|
||||||
if (!voxels[x][y][z]) continue; // Skip empty voxels
|
if (!voxels[x][y][z]) continue; // Skip empty voxels
|
||||||
|
|
||||||
// Build a bounding box for this voxel
|
// Build a bounding box for this voxel
|
||||||
Vector3 position = { x, y, z };
|
Vector3 position = { (float)x, (float)y, (float)z };
|
||||||
BoundingBox box = {
|
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 },
|
||||||
(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 }
|
||||||
|
|
@ -126,7 +126,7 @@ int main(void)
|
||||||
{
|
{
|
||||||
if (!voxels[x][y][z]) continue;
|
if (!voxels[x][y][z]) continue;
|
||||||
|
|
||||||
Vector3 position = { x, y, z };
|
Vector3 position = { (float)x, (float)y, (float)z };
|
||||||
DrawModel(cubeModel, position, 1.0f, BEIGE);
|
DrawModel(cubeModel, position, 1.0f, BEIGE);
|
||||||
DrawCubeWires(position, 1.0f, 1.0f, 1.0f, BLACK);
|
DrawCubeWires(position, 1.0f, 1.0f, 1.0f, BLACK);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ int main(void)
|
||||||
// Load image to create texture for the cube
|
// Load image to create texture for the cube
|
||||||
Model model = LoadModelFromMesh(GenMeshCube(1.0f, 1.0f, 1.0f));
|
Model model = LoadModelFromMesh(GenMeshCube(1.0f, 1.0f, 1.0f));
|
||||||
Image img = LoadImage("resources/cubicmap_atlas.png");
|
Image img = LoadImage("resources/cubicmap_atlas.png");
|
||||||
Image crop = ImageFromImage(img, (Rectangle){0, img.height/2, img.width/2, img.height/2});
|
Image crop = ImageFromImage(img, (Rectangle){0, img.height/2.0f, img.width/2.0f, img.height/2.0f});
|
||||||
Texture2D texture = LoadTextureFromImage(crop);
|
Texture2D texture = LoadTextureFromImage(crop);
|
||||||
UnloadImage(img);
|
UnloadImage(img);
|
||||||
UnloadImage(crop);
|
UnloadImage(crop);
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ int main(void)
|
||||||
{
|
{
|
||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
rotation = DEG2RAD*45.0f*GetTime();
|
rotation = DEG2RAD*45.0f*(float)GetTime();
|
||||||
|
|
||||||
for (int i = 0; i < 16; i++)
|
for (int i = 0; i < 16; i++)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ int main(void)
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [others] example - compute shader");
|
InitWindow(screenWidth, screenHeight, "raylib [others] example - compute shader");
|
||||||
|
|
||||||
const Vector2 resolution = { screenWidth, screenHeight };
|
const Vector2 resolution = { (float)screenWidth, (float)screenHeight };
|
||||||
unsigned int brushSize = 8;
|
unsigned int brushSize = 8;
|
||||||
|
|
||||||
// Game of Life logic compute shader
|
// Game of Life logic compute shader
|
||||||
|
|
|
||||||
|
|
@ -252,7 +252,11 @@ int main()
|
||||||
// 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++)
|
||||||
{
|
{
|
||||||
Color lightColor = (Color){ lights[i].color[0]*255, lights[i].color[1]*255, lights[i].color[2]*255, lights[i].color[3]*255 };
|
Color lightColor = (Color){
|
||||||
|
(unsigned char)(lights[i].color[0]*255),
|
||||||
|
(unsigned char)(lights[i].color[1] * 255),
|
||||||
|
(unsigned char)(lights[i].color[2] * 255),
|
||||||
|
(unsigned char)(lights[i].color[3] * 255) };
|
||||||
|
|
||||||
if (lights[i].enabled) DrawSphereEx(lights[i].position, 0.2f, 8, 8, lightColor);
|
if (lights[i].enabled) DrawSphereEx(lights[i].position, 0.2f, 8, 8, lightColor);
|
||||||
else DrawSphereWires(lights[i].position, 0.2f, 8, 8, ColorAlpha(lightColor, 0.3f));
|
else DrawSphereWires(lights[i].position, 0.2f, 8, 8, ColorAlpha(lightColor, 0.3f));
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ int main(void)
|
||||||
BeginBlendMode(BLEND_ADDITIVE);
|
BeginBlendMode(BLEND_ADDITIVE);
|
||||||
DrawTexturePro(
|
DrawTexturePro(
|
||||||
light,
|
light,
|
||||||
(Rectangle){ 0, 0, light.width, light.height },
|
(Rectangle){ 0, 0, (float)light.width, (float)light.height },
|
||||||
(Rectangle){ 0, 0, 20, 20 },
|
(Rectangle){ 0, 0, 20, 20 },
|
||||||
(Vector2){ 10.0, 10.0 },
|
(Vector2){ 10.0, 10.0 },
|
||||||
0.0,
|
0.0,
|
||||||
|
|
@ -110,7 +110,7 @@ int main(void)
|
||||||
);
|
);
|
||||||
DrawTexturePro(
|
DrawTexturePro(
|
||||||
light,
|
light,
|
||||||
(Rectangle){ 0, 0, light.width, light.height },
|
(Rectangle){ 0, 0, (float)light.width, (float)light.height },
|
||||||
(Rectangle){ 8, 4, 20, 20 },
|
(Rectangle){ 8, 4, 20, 20 },
|
||||||
(Vector2){ 10.0, 10.0 },
|
(Vector2){ 10.0, 10.0 },
|
||||||
0.0,
|
0.0,
|
||||||
|
|
@ -118,7 +118,7 @@ int main(void)
|
||||||
);
|
);
|
||||||
DrawTexturePro(
|
DrawTexturePro(
|
||||||
light,
|
light,
|
||||||
(Rectangle){ 0, 0, light.width, light.height },
|
(Rectangle){ 0, 0, (float)light.width, (float)light.height },
|
||||||
(Rectangle){ 8, 8, 10, 10 },
|
(Rectangle){ 8, 8, 10, 10 },
|
||||||
(Vector2){ 5.0, 5.0 },
|
(Vector2){ 5.0, 5.0 },
|
||||||
0.0,
|
0.0,
|
||||||
|
|
@ -152,7 +152,7 @@ int main(void)
|
||||||
DrawTexturePro(
|
DrawTexturePro(
|
||||||
lightmap.texture,
|
lightmap.texture,
|
||||||
(Rectangle){ 0, 0, -MAP_SIZE, -MAP_SIZE },
|
(Rectangle){ 0, 0, -MAP_SIZE, -MAP_SIZE },
|
||||||
(Rectangle){ GetRenderWidth() - MAP_SIZE*8 - 10, 10, MAP_SIZE*8, MAP_SIZE*8 },
|
(Rectangle){ (float)GetRenderWidth() - MAP_SIZE*8 - 10, 10, (float)MAP_SIZE*8, (float)MAP_SIZE*8 },
|
||||||
(Vector2){ 0.0, 0.0 },
|
(Vector2){ 0.0, 0.0 },
|
||||||
0.0,
|
0.0,
|
||||||
WHITE);
|
WHITE);
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue