aboutsummaryrefslogtreecommitdiff
path: root/examples/textures_particles_trail_blending.lua
diff options
context:
space:
mode:
authorghassanpl <kronikarz@gmail.com>2016-08-06 16:58:48 +0200
committerghassanpl <kronikarz@gmail.com>2016-08-06 16:58:48 +0200
commit4960e6b6d7b4cba6125cfb8bb2fef043db8e5ba5 (patch)
tree88dfb074579589a5ea6eba92462bb44863d18798 /examples/textures_particles_trail_blending.lua
parentd5f5f0a9302435945b730e5ec001bda39741f3c7 (diff)
downloadraylib-4960e6b6d7b4cba6125cfb8bb2fef043db8e5ba5.tar.gz
raylib-4960e6b6d7b4cba6125cfb8bb2fef043db8e5ba5.zip
Fixes for some Lua bugs
Diffstat (limited to 'examples/textures_particles_trail_blending.lua')
-rw-r--r--examples/textures_particles_trail_blending.lua18
1 files changed, 5 insertions, 13 deletions
diff --git a/examples/textures_particles_trail_blending.lua b/examples/textures_particles_trail_blending.lua
index d5ba7841..38036bcf 100644
--- a/examples/textures_particles_trail_blending.lua
+++ b/examples/textures_particles_trail_blending.lua
@@ -12,15 +12,6 @@
MAX_PARTICLES = 200
-- Particle structure with basic data
-struct.Particle {
- position,
- color,
- alpha,
- size,
- rotation,
- active -- NOTE: Use it to activate/deactive particle
-}
-
-- Initialization
-------------------------------------------------------------------------------------------
local screenWidth = 800
@@ -33,6 +24,7 @@ local mouseTail = {}
-- Initialize particles
for i = 1, MAX_PARTICLES do
+ mouseTail[i] = {}
mouseTail[i].position = Vector2(0, 0)
mouseTail[i].color = Color(GetRandomValue(0, 255), GetRandomValue(0, 255), GetRandomValue(0, 255), 255)
mouseTail[i].alpha = 1.0
@@ -45,7 +37,7 @@ local gravity = 3.0
local smoke = LoadTexture("resources/smoke.png")
-local blending = BLEND.ALPHA
+local blending = BlendMode.ALPHA
SetTargetFPS(60)
-------------------------------------------------------------------------------------------
@@ -80,8 +72,8 @@ while not WindowShouldClose() do -- Detect window close button or ESC
end
if (IsKeyPressed(KEY.SPACE)) then
- if (blending == BLEND.ALPHA) then blending = BLEND_ADDITIVE
- else blending = BLEND.ALPHA end
+ if (blending == BlendMode.ALPHA) then blending = BlendMode.ADDITIVE
+ else blending = BlendMode.ALPHA end
end
---------------------------------------------------------------------------------------
@@ -107,7 +99,7 @@ while not WindowShouldClose() do -- Detect window close button or ESC
DrawText("PRESS SPACE to CHANGE BLENDING MODE", 180, 20, 20, BLACK)
- if (blending == BLEND_ALPHA) then DrawText("ALPHA BLENDING", 290, screenHeight - 40, 20, BLACK)
+ if (blending == BlendMode.ALPHA) then DrawText("ALPHA BLENDING", 290, screenHeight - 40, 20, BLACK)
else DrawText("ADDITIVE BLENDING", 280, screenHeight - 40, 20, RAYWHITE) end
EndDrawing()