aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorraysan5 <raysan5@gmail.com>2017-02-05 03:15:43 +0100
committerraysan5 <raysan5@gmail.com>2017-02-05 03:15:43 +0100
commit7bf6a712ccb4abe059bcbb739664ac1cadcf0b22 (patch)
treedddba3a635492f291dcaf8cfacefbbb84f995101
parentc4bd214cf07c68476c4ce972766c24ee54a982f6 (diff)
downloadraylib-7bf6a712ccb4abe059bcbb739664ac1cadcf0b22.tar.gz
raylib-7bf6a712ccb4abe059bcbb739664ac1cadcf0b22.zip
Remove rlua from raylib main repo
Moved to own repo at https://github.com/raysan5/raylib-lua
-rw-r--r--examples/audio_module_playing.lua101
-rw-r--r--examples/audio_music_stream.lua66
-rw-r--r--examples/audio_raw_stream.lua97
-rw-r--r--examples/audio_sound_loading.lua59
-rw-r--r--examples/core_2d_camera.lua130
-rw-r--r--examples/core_3d_camera_first_person.lua84
-rw-r--r--examples/core_3d_camera_free.lua72
-rw-r--r--examples/core_3d_mode.lua64
-rw-r--r--examples/core_3d_picking.lua96
-rw-r--r--examples/core_basic_window.lua44
-rw-r--r--examples/core_color_select.lua82
-rw-r--r--examples/core_drop_files.lua66
-rw-r--r--examples/core_gestures_detection.lua102
-rw-r--r--examples/core_input_gamepad.lua163
-rw-r--r--examples/core_input_keys.lua51
-rw-r--r--examples/core_input_mouse.lua54
-rw-r--r--examples/core_mouse_wheel.lua50
-rw-r--r--examples/core_oculus_rift.lua73
-rw-r--r--examples/core_random_values.lua56
-rw-r--r--examples/core_storage_values.lua74
-rw-r--r--examples/core_world_screen.lua66
-rw-r--r--examples/models_billboard.lua62
-rw-r--r--examples/models_box_collisions.lua115
-rw-r--r--examples/models_cubicmap.lua77
-rw-r--r--examples/models_geometric_shapes.lua67
-rw-r--r--examples/models_heightmap.lua72
-rw-r--r--examples/models_obj_loading.lua67
-rw-r--r--examples/rlua_execute_file.c93
-rw-r--r--examples/shaders_custom_uniform.lua113
-rw-r--r--examples/shaders_model_shader.lua83
-rw-r--r--examples/shaders_postprocessing.lua99
-rw-r--r--examples/shaders_shapes_textures.lua101
-rw-r--r--examples/shaders_standard_lighting.lua112
-rw-r--r--examples/shapes_basic_shapes.lua64
-rw-r--r--examples/shapes_colors_palette.lua89
-rw-r--r--examples/shapes_logo_raylib.lua48
-rw-r--r--examples/shapes_logo_raylib_anim.lua127
-rw-r--r--examples/text_bmfont_ttf.lua59
-rw-r--r--examples/text_bmfont_unordered.lua57
-rw-r--r--examples/text_font_select.lua143
-rw-r--r--examples/text_format_text.lua54
-rw-r--r--examples/text_rbmf_fonts.lua87
-rw-r--r--examples/text_sprite_fonts.lua72
-rw-r--r--examples/text_ttf_loading.lua118
-rw-r--r--examples/text_writing_anim.lua52
-rw-r--r--examples/textures_formats_loading.lua217
-rw-r--r--examples/textures_image_drawing.lua70
-rw-r--r--examples/textures_image_loading.lua55
-rw-r--r--examples/textures_image_processing.lua134
-rw-r--r--examples/textures_logo_raylib.lua49
-rw-r--r--examples/textures_particles_trail_blending.lua113
-rw-r--r--examples/textures_raw_data.lua83
-rw-r--r--examples/textures_rectangle.lua69
-rw-r--r--examples/textures_srcrec_dstrec.lua71
-rw-r--r--examples/textures_to_image.lua60
-rw-r--r--src/rlua.h4333
56 files changed, 0 insertions, 8935 deletions
diff --git a/examples/audio_module_playing.lua b/examples/audio_module_playing.lua
deleted file mode 100644
index 7c675424..00000000
--- a/examples/audio_module_playing.lua
+++ /dev/null
@@ -1,101 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [audio] example - Module playing (streaming)
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
-MAX_CIRCLES = 64
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [audio] example - module playing (streaming)")
-
-InitAudioDevice() -- Initialize audio device
-
-local colors = { ORANGE, RED, GOLD, LIME, BLUE, VIOLET, BROWN, LIGHTGRAY, PINK,
- YELLOW, GREEN, SKYBLUE, PURPLE, BEIGE }
-
--- Creates ome circles for visual effect
-local circles = {}
-
-for i = MAX_CIRCLES, 1, -1 do
- circles[i] = {}
- circles[i].alpha = 0.0
- circles[i].radius = GetRandomValue(10, 40)
- circles[i].position = Vector2(0, 0)
- circles[i].position.x = GetRandomValue(circles[i].radius, screenWidth - circles[i].radius)
- circles[i].position.y = GetRandomValue(circles[i].radius, screenHeight - circles[i].radius)
- circles[i].speed = GetRandomValue(1, 100)/20000.0
- circles[i].color = colors[GetRandomValue(1, 14)]
-end
-
-local xm = LoadMusicStream("resources/audio/mini1111.xm")
-
-PlayMusicStream(xm)
-
-local timePlayed = 0.0
-
-SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- for i = MAX_CIRCLES, 1, -1 do
- circles[i].alpha = circles[i].alpha + circles[i].speed
- circles[i].radius = circles[i].radius + circles[i].speed*10.0
-
- if (circles[i].alpha > 1.0) then circles[i].speed = circles[i].speed*-1 end
-
- if (circles[i].alpha <= 0.0) then
- circles[i].alpha = 0.0
- circles[i].radius = GetRandomValue(10, 40)
- circles[i].position.x = GetRandomValue(circles[i].radius, screenWidth - circles[i].radius)
- circles[i].position.y = GetRandomValue(circles[i].radius, screenHeight - circles[i].radius)
- circles[i].color = colors[GetRandomValue(1, 14)]
- circles[i].speed = GetRandomValue(1, 100)/20000.0
- end
- end
-
- -- Get timePlayed scaled to bar dimensions
- timePlayed = (GetMusicTimePlayed(xm)/GetMusicTimeLength(xm)*(screenWidth - 40))*2
-
- UpdateMusicStream(xm) -- Update music buffer with new stream data
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- for i = MAX_CIRCLES, 1, -1 do
- DrawCircleV(circles[i].position, circles[i].radius, Fade(circles[i].color, circles[i].alpha))
- end
-
- -- Draw time bar
- DrawRectangle(20, screenHeight - 20 - 12, screenWidth - 40, 12, LIGHTGRAY)
- DrawRectangle(20, screenHeight - 20 - 12, timePlayed//1, 12, MAROON)
- DrawRectangleLines(20, screenHeight - 20 - 12, screenWidth - 40, 12, WHITE)
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-UnloadMusicStream(xm) -- Unload music stream buffers from RAM
-
-CloseAudioDevice() -- Close audio device (music streaming is automatically stopped)
-
-CloseWindow() -- Close window and OpenGL context
--------------------------------------------------------------------------------------------
diff --git a/examples/audio_music_stream.lua b/examples/audio_music_stream.lua
deleted file mode 100644
index 33cf335f..00000000
--- a/examples/audio_music_stream.lua
+++ /dev/null
@@ -1,66 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [audio] example - Music playing (streaming)
---
--- NOTE: This example requires OpenAL Soft library installed
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [audio] example - music playing (streaming)")
-
-InitAudioDevice() -- Initialize audio device
-
-local music = LoadMusicStream("resources/audio/guitar_noodling.ogg")
-
-PlayMusicStream(music)
-
-local framesCounter = 0
-local timePlayed = 0.0
-
-SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- framesCounter = framesCounter + 1
-
- timePlayed = GetMusicTimePlayed(music)/GetMusicTimeLength(music)*100*4 -- We scale by 4 to fit 400 pixels
-
- UpdateMusicStream(music) -- Update music buffer with new stream data
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- DrawText("MUSIC SHOULD BE PLAYING!", 255, 200, 20, LIGHTGRAY)
-
- DrawRectangle(200, 250, 400, 12, LIGHTGRAY)
- DrawRectangle(200, 250, timePlayed//1, 12, MAROON)
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-UnloadMusicStream(music) -- Unload music stream buffers from RAM
-
-CloseAudioDevice() -- Close audio device (music streaming is automatically stopped)
-
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/audio_raw_stream.lua b/examples/audio_raw_stream.lua
deleted file mode 100644
index 070984f9..00000000
--- a/examples/audio_raw_stream.lua
+++ /dev/null
@@ -1,97 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [audio] example - Raw audio streaming
---
--- NOTE: This example requires OpenAL Soft library installed
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
-MAX_SAMPLES = 20000
-DEG2RAD = math.pi/180.0
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [audio] example - raw audio streaming")
-
-InitAudioDevice() -- Initialize audio device
-
--- Init raw audio stream (sample rate: 22050, sample size: 32bit-float, channels: 1-mono)
-local stream = InitAudioStream(22050, 32, 1)
-
--- Fill audio stream with some samples (sine wave)
-local data = {}
-
-for i = 1, MAX_SAMPLES do
- data[i] = math.sin(((2*math.pi*i)/2)*DEG2RAD)
-end
-
--- NOTE: The generated MAX_SAMPLES do not fit to close a perfect loop
--- for that reason, there is a clip everytime audio stream is looped
-
-PlayAudioStream(stream)
-
-local totalSamples = MAX_SAMPLES
-local samplesLeft = totalSamples
-
-local position = Vector2(0, 0)
-
-SetTargetFPS(30) -- Set our game to run at 30 frames-per-second
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
-
- -- Refill audio stream if required
- if (IsAudioBufferProcessed(stream)) then
- local numSamples = 0
-
- if (samplesLeft >= 4096) then numSamples = 4096
- else numSamples = samplesLeft end
-
- UpdateAudioStream(stream, data + (totalSamples - samplesLeft), numSamples)
-
- samplesLeft = samplesLeft - numSamples
-
- -- Reset samples feeding (loop audio)
- if (samplesLeft <= 0) then samplesLeft = totalSamples end
- end
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- DrawText("SINE WAVE SHOULD BE PLAYING!", 240, 140, 20, LIGHTGRAY)
-
- -- NOTE: Draw a part of the sine wave (only screen width)
- for i = 1, GetScreenWidth() do
- position.x = (i - 1)
- position.y = 250 + 50*data[i]
-
- DrawPixelV(position, RED)
- end
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-CloseAudioStream(stream) -- Close raw audio stream and delete buffers from RAM
-
-CloseAudioDevice() -- Close audio device (music streaming is automatically stopped)
-
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/audio_sound_loading.lua b/examples/audio_sound_loading.lua
deleted file mode 100644
index 7107eea4..00000000
--- a/examples/audio_sound_loading.lua
+++ /dev/null
@@ -1,59 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [audio] example - Sound loading and playing
---
--- NOTE: This example requires OpenAL Soft library installed
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [audio] example - sound loading and playing")
-
-InitAudioDevice() -- Initialize audio device
-
-local fxWav = LoadSound("resources/audio/weird.wav") -- Load WAV audio file
-local fxOgg = LoadSound("resources/audio/tanatana.ogg") -- Load OGG audio file
-
-SetTargetFPS(60)
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- if (IsKeyPressed(KEY.SPACE)) then PlaySound(fxWav) end -- Play WAV sound
- if (IsKeyPressed(KEY.ENTER)) then PlaySound(fxOgg) end -- Play OGG sound
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- DrawText("Press SPACE to PLAY the WAV sound!", 200, 180, 20, LIGHTGRAY)
-
- DrawText("Press ENTER to PLAY the OGG sound!", 200, 220, 20, LIGHTGRAY)
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-UnloadSound(fxWav) -- Unload sound data
-UnloadSound(fxOgg) -- Unload sound data
-
-CloseAudioDevice() -- Close audio device
-
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/core_2d_camera.lua b/examples/core_2d_camera.lua
deleted file mode 100644
index 95302c26..00000000
--- a/examples/core_2d_camera.lua
+++ /dev/null
@@ -1,130 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [core] example - 2d camera
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
-MAX_BUILDINGS = 100
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [core] example - 2d camera")
-
-local player = Rectangle(400, 280, 40, 40)
-local buildings = {}
-local buildColors = {}
-
-local spacing = 0;
-
-for i = 1, MAX_BUILDINGS do
- buildings[i] = Rectangle(0, 0, 0, 0)
- buildings[i].width = GetRandomValue(50, 200)
- buildings[i].height = GetRandomValue(100, 800)
- buildings[i].y = screenHeight - 130 - buildings[i].height
- buildings[i].x = -6000 + spacing
-
- spacing = spacing + buildings[i].width
-
- buildColors[i] = Color(GetRandomValue(200, 240), GetRandomValue(200, 240), GetRandomValue(200, 250), 255)
-end
-
-local camera = Camera2D(Vector2(0, 0), Vector2(0, 0), 0.0, 1.0)
-
-camera.target = Vector2(player.x + 20, player.y + 20)
-camera.offset = Vector2(0, 0)
-camera.rotation = 0.0
-camera.zoom = 1.0
-
-SetTargetFPS(60)
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- if (IsKeyDown(KEY.RIGHT)) then
- player.x = player.x + 2 -- Player movement
- camera.offset.x = camera.offset.x - 2 -- Camera displacement with player movement
- elseif (IsKeyDown(KEY.LEFT)) then
- player.x = player.x - 2 -- Player movement
- camera.offset.x = camera.offset.x + 2 -- Camera displacement with player movement
- end
-
- -- Camera target follows player
- camera.target = Vector2(player.x + 20, player.y + 20)
-
- -- Camera rotation controls
- if (IsKeyDown(KEY.A)) then camera.rotation = camera.rotation - 1
- elseif (IsKeyDown(KEY.S)) then camera.rotation = camera.rotation + 1
- end
-
- -- Limit camera rotation to 80 degrees (-40 to 40)
- if (camera.rotation > 40) then camera.rotation = 40
- elseif (camera.rotation < -40) then camera.rotation = -40
- end
-
- -- Camera zoom controls
- camera.zoom = camera.zoom + (GetMouseWheelMove()*0.05)
-
- if (camera.zoom > 3.0) then camera.zoom = 3.0
- elseif (camera.zoom < 0.1) then camera.zoom = 0.1
- end
-
- -- Camera reset (zoom and rotation)
- if (IsKeyPressed(KEY.R)) then
- camera.zoom = 1.0
- camera.rotation = 0.0
- end
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- Begin2dMode(camera)
-
- DrawRectangle(-6000, 320, 13000, 8000, DARKGRAY)
-
- for i = 1, MAX_BUILDINGS, 1 do DrawRectangleRec(buildings[i], buildColors[i]) end
-
- DrawRectangleRec(player, RED)
-
- DrawRectangle(camera.target.x, -500, 1, screenHeight*4, GREEN)
- DrawRectangle(-500, camera.target.y, screenWidth*4, 1, GREEN)
-
- End2dMode()
-
- DrawText("SCREEN AREA", 640, 10, 20, RED)
-
- DrawRectangle(0, 0, screenWidth, 5, RED)
- DrawRectangle(0, 5, 5, screenHeight - 10, RED)
- DrawRectangle(screenWidth - 5, 5, 5, screenHeight - 10, RED)
- DrawRectangle(0, screenHeight - 5, screenWidth, 5, RED)
-
- DrawRectangle( 10, 10, 250, 113, Fade(SKYBLUE, 0.5))
- DrawRectangleLines( 10, 10, 250, 113, BLUE)
-
- DrawText("Free 2d camera controls:", 20, 20, 10, BLACK)
- DrawText("- Right/Left to move Offset", 40, 40, 10, DARKGRAY)
- DrawText("- Mouse Wheel to Zoom in-out", 40, 60, 10, DARKGRAY)
- DrawText("- A / S to Rotate", 40, 80, 10, DARKGRAY)
- DrawText("- R to reset Zoom and Rotation", 40, 100, 10, DARKGRAY)
-
- EndDrawing();
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-CloseWindow() -- Close window and OpenGL context
--------------------------------------------------------------------------------------------
diff --git a/examples/core_3d_camera_first_person.lua b/examples/core_3d_camera_first_person.lua
deleted file mode 100644
index 22ccdc5c..00000000
--- a/examples/core_3d_camera_first_person.lua
+++ /dev/null
@@ -1,84 +0,0 @@
---------------------------------------------------------------------------------------------
---
--- raylib [core] example - 3d camera first person
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
---------------------------------------------------------------------------------------------
-
-MAX_COLUMNS = 20
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera first person")
-
--- Define the camera to look into our 3d world (position, target, up vector)
-local camera = Camera(Vector3(4.0, 2.0, 4.0), Vector3(0.0, 1.8, 0.0), Vector3(0.0, 1.0, 0.0), 60.0)
-
--- Generates some random columns
-local heights = {}
-local positions = {}
-local colors = {}
-
-for i = 1, MAX_COLUMNS do
- heights[i] = GetRandomValue(1, 12)
- positions[i] = Vector3(GetRandomValue(-15, 15), heights[i]/2, GetRandomValue(-15, 15))
- colors[i] = Color(GetRandomValue(20, 255), GetRandomValue(10, 55), 30, 255)
-end
-
-local playerPosition = Vector3(4.0, 2.0, 4.0) -- Define player position
-
-SetCameraMode(camera, CameraMode.FIRST_PERSON) -- Set a first person camera mode
-
-SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- camera = UpdateCamera(camera) -- Update camera
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- Begin3dMode(camera)
-
- DrawPlane(Vector3(0.0, 0.0, 0.0), Vector2(32.0, 32.0), LIGHTGRAY) -- Draw ground
- DrawCube(Vector3(-16.0, 2.5, 0.0), 1.0, 5.0, 32.0, BLUE) -- Draw a blue wall
- DrawCube(Vector3(16.0, 2.5, 0.0), 1.0, 5.0, 32.0, LIME) -- Draw a green wall
- DrawCube(Vector3(0.0, 2.5, 16.0), 32.0, 5.0, 1.0, GOLD) -- Draw a yellow wall
-
- -- Draw some cubes around
- for i = 1, MAX_COLUMNS do
- DrawCube(positions[i], 2.0, heights[i], 2.0, colors[i])
- DrawCubeWires(positions[i], 2.0, heights[i], 2.0, MAROON)
- end
-
- End3dMode()
-
- DrawRectangle( 10, 10, 220, 70, Fade(SKYBLUE, 0.5))
- DrawRectangleLines( 10, 10, 220, 70, BLUE)
-
- DrawText("First person camera default controls:", 20, 20, 10, BLACK)
- DrawText("- Move with keys: W, A, S, D", 40, 40, 10, DARKGRAY)
- DrawText("- Mouse move to look around", 40, 60, 10, DARKGRAY)
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/core_3d_camera_free.lua b/examples/core_3d_camera_free.lua
deleted file mode 100644
index 57fa7a12..00000000
--- a/examples/core_3d_camera_free.lua
+++ /dev/null
@@ -1,72 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [core] example - Initialize 3d camera free
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
---------------------------------------------------------------------------------------------
-
--- Initialization
-----------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera free")
-
--- Define the camera to look into our 3d world
-local camera = {}
-camera.position = Vector3(10.0, 10.0, 10.0) -- Camera position
-camera.target = Vector3(0.0, 0.0, 0.0) -- Camera looking at point
-camera.up = Vector3(0.0, 1.0, 0.0) -- Camera up vector (rotation towards target)
-camera.fovy = 45.0 -- Camera field-of-view Y
-
-local cubePosition = Vector3(0.0, 0.0, 0.0)
-
-SetCameraMode(camera, CameraMode.FREE) -- Set a free camera mode
-
-SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- camera = UpdateCamera(camera) -- Update camera
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- Begin3dMode(camera)
-
- DrawCube(cubePosition, 2.0, 2.0, 2.0, RED)
- DrawCubeWires(cubePosition, 2.0, 2.0, 2.0, MAROON)
-
- DrawGrid(10, 1.0)
-
- End3dMode()
-
- DrawRectangle( 10, 10, 320, 133, Fade(SKYBLUE, 0.5))
- DrawRectangleLines( 10, 10, 320, 133, BLUE)
-
- DrawText("Free camera default controls:", 20, 20, 10, BLACK)
- DrawText("- Mouse Wheel to Zoom in-out", 40, 40, 10, DARKGRAY)
- DrawText("- Mouse Wheel Pressed to Pan", 40, 60, 10, DARKGRAY)
- DrawText("- Alt + Mouse Wheel Pressed to Rotate", 40, 80, 10, DARKGRAY)
- DrawText("- Alt + Ctrl + Mouse Wheel Pressed for Smooth Zoom", 40, 100, 10, DARKGRAY)
- DrawText("- Z to zoom to (0, 0, 0)", 40, 120, 10, DARKGRAY)
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/core_3d_mode.lua b/examples/core_3d_mode.lua
deleted file mode 100644
index c0f7a038..00000000
--- a/examples/core_3d_mode.lua
+++ /dev/null
@@ -1,64 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [core] example - Initialize 3d mode
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d mode")
-
--- Define the camera to look into our 3d world
-local camera = {}
-camera.position = Vector3(0.0, 10.0, 10.0) -- Camera position
-camera.target = Vector3(0.0, 0.0, 0.0) -- Camera looking at point
-camera.up = Vector3(0.0, 1.0, 0.0) -- Camera up vector (rotation towards target)
-camera.fovy = 45.0 -- Camera field-of-view Y
-
-local cubePosition = Vector3(0.0, 0.0, 0.0)
-
-SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- -- TODO: Update your variables here
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- Begin3dMode(camera) -- ERROR: Lua Error: attempt to index a number value (?)
-
- DrawCube(cubePosition, 2.0, 2.0, 2.0, RED)
- DrawCubeWires(cubePosition, 2.0, 2.0, 2.0, MAROON)
-
- DrawGrid(10, 1.0)
-
- End3dMode()
-
- DrawText("Welcome to the third dimension!", 10, 40, 20, DARKGRAY)
-
- DrawFPS(10, 10)
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/core_3d_picking.lua b/examples/core_3d_picking.lua
deleted file mode 100644
index 230f5756..00000000
--- a/examples/core_3d_picking.lua
+++ /dev/null
@@ -1,96 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [core] example - Picking in 3d mode
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d picking")
-
--- Define the camera to look into our 3d world
-local camera = {}
-camera.position = Vector3(0.0, 10.0, 10.0) -- Camera position
-camera.target = Vector3(0.0, 0.0, 0.0) -- Camera looking at point
-camera.up = Vector3(0.0, 1.0, 0.0) -- Camera up vector (rotation towards target)
-camera.fovy = 45.0 -- Camera field-of-view Y
-
-local cubePosition = Vector3(0.0, 1.0, 0.0)
-local cubeSize = Vector3(2.0, 2.0, 2.0)
-
-local ray = Ray(Vector3(0, 0, 0), Vector3(0, 0, 0)) -- Picking line ray
-
-local collision = false
-
-SetCameraMode(camera, CameraMode.FREE) -- Set a free camera mode
-
-SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- camera = UpdateCamera(camera) -- Update camera
-
- if (IsMouseButtonPressed(MOUSE.LEFT_BUTTON)) then
- -- NOTE: This function is NOT WORKING properly!
- ray = GetMouseRay(GetMousePosition(), camera)
-
- -- Check collision between ray and box
- collision = CheckCollisionRayBox(ray,
- BoundingBox(Vector3(cubePosition.x - cubeSize.x/2, cubePosition.y - cubeSize.y/2, cubePosition.z - cubeSize.z/2),
- Vector3(cubePosition.x + cubeSize.x/2, cubePosition.y + cubeSize.y/2, cubePosition.z + cubeSize.z/2)))
-
- --print("collision check:", collision)
- end
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- Begin3dMode(camera)
-
- if (collision) then
- DrawCube(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, RED)
- DrawCubeWires(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, MAROON)
-
- DrawCubeWires(cubePosition, cubeSize.x + 0.2, cubeSize.y + 0.2, cubeSize.z + 0.2, GREEN)
- else
- DrawCube(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, GRAY)
- DrawCubeWires(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, DARKGRAY)
- end
-
- DrawRay(ray, MAROON)
-
- DrawGrid(10, 1.0)
-
- End3dMode()
-
- DrawText("Try selecting the box with mouse!", 240, 10, 20, DARKGRAY)
-
- if (collision) then
- DrawText("BOX SELECTED", (screenWidth - MeasureText("BOX SELECTED", 30))/2, screenHeight*0.1, 30, GREEN)
- end
-
- DrawFPS(10, 10)
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/core_basic_window.lua b/examples/core_basic_window.lua
deleted file mode 100644
index ea3337a1..00000000
--- a/examples/core_basic_window.lua
+++ /dev/null
@@ -1,44 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [core] example - Basic window
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window")
-
-SetTargetFPS(60) -- Set target frames-per-second
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- -- TODO: Update your variables here
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY)
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/core_color_select.lua b/examples/core_color_select.lua
deleted file mode 100644
index 2d9c7a96..00000000
--- a/examples/core_color_select.lua
+++ /dev/null
@@ -1,82 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [core] example - Color selection by mouse (collision detection)
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
-NUM_RECTANGLES = 21
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [core] example - color selection (collision detection)")
-
-local colors = { DARKGRAY, MAROON, ORANGE, DARKGREEN, DARKBLUE, DARKPURPLE, DARKBROWN,
- GRAY, RED, GOLD, LIME, BLUE, VIOLET, BROWN, LIGHTGRAY, PINK, YELLOW,
- GREEN, SKYBLUE, PURPLE, BEIGE }
-
-local colorsRecs = {} -- Rectangles array
-local selected = {}
-
--- Fills colorsRecs data (for every rectangle)
-for i = 1, NUM_RECTANGLES do
- colorsRecs[i] = Rectangle(0, 0, 0, 0)
- colorsRecs[i].x = 20 + 100*((i-1)%7) + 10*((i-1)%7)
- colorsRecs[i].y = 60 + 100*((i-1)//7) + 10*((i-1)//7) -- Using floor division: //
- colorsRecs[i].width = 100
- colorsRecs[i].height = 100
- selected[i] = false
-end
-
-local mousePoint = Vector2(0, 0)
-
-SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- mousePoint = GetMousePosition()
-
- for i = 1, NUM_RECTANGLES do -- Iterate along all the rectangles
- if (CheckCollisionPointRec(mousePoint, colorsRecs[i])) then
- colors[i].a = 120
- if (IsMouseButtonPressed(MOUSE.LEFT_BUTTON)) then selected[i] = not selected[i] end
- else colors[i].a = 255 end
- end
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- for i = 1, NUM_RECTANGLES do -- Draw all rectangles
- DrawRectangleRec(colorsRecs[i], colors[i])
-
- -- Draw four rectangles around selected rectangle
- if (selected[i]) then
- DrawRectangle(colorsRecs[i].x, colorsRecs[i].y, 100, 10, RAYWHITE) -- Square top rectangle
- DrawRectangle(colorsRecs[i].x, colorsRecs[i].y, 10, 100, RAYWHITE) -- Square left rectangle
- DrawRectangle(colorsRecs[i].x + 90, colorsRecs[i].y, 10, 100, RAYWHITE) -- Square right rectangle
- DrawRectangle(colorsRecs[i].x, colorsRecs[i].y + 90, 100, 10, RAYWHITE) -- Square bottom rectangle
- end
- end
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/core_drop_files.lua b/examples/core_drop_files.lua
deleted file mode 100644
index 1d27e618..00000000
--- a/examples/core_drop_files.lua
+++ /dev/null
@@ -1,66 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [core] example - Windows drop files
---
--- This example only works on platforms that support drag & drop (Windows, Linux, OSX)
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [core] example - drop files")
-
-local count = 0
-local droppedFiles = {}
-
-SetTargetFPS(60)
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- if (IsFileDropped()) then
- droppedFiles = GetDroppedFiles()
- count = #droppedFiles
- end
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- if (count == 0) then DrawText("Drop your files to this window!", 100, 40, 20, DARKGRAY)
- else
- DrawText("Dropped files:", 100, 40, 20, DARKGRAY)
-
- for i = 0, count-1 do
- if (i%2 == 0) then DrawRectangle(0, 85 + 40*i, screenWidth, 40, Fade(LIGHTGRAY, 0.5))
- else DrawRectangle(0, 85 + 40*i, screenWidth, 40, Fade(LIGHTGRAY, 0.3)) end
-
- DrawText(droppedFiles[i+1], 120, 100 + 40*i, 10, GRAY)
- end
-
- DrawText("Drop new files...", 100, 110 + 40*count, 20, DARKGRAY)
- end
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-ClearDroppedFiles() -- Clear internal buffers
-
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/core_gestures_detection.lua b/examples/core_gestures_detection.lua
deleted file mode 100644
index 9316b990..00000000
--- a/examples/core_gestures_detection.lua
+++ /dev/null
@@ -1,102 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [core] example - Gestures Detection
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
-MAX_GESTURE_STRINGS = 20
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [core] example - gestures detection")
-
-local touchPosition = Vector2(0, 0)
-local touchArea = Rectangle(220, 10, screenWidth - 230, screenHeight - 20)
-
-local gesturesCount = 0
-local gestureStrings = {}
-
-for i = 1, MAX_GESTURE_STRINGS do gestureStrings[i] = "" end
-
-local currentGesture = Gestures.NONE
-local lastGesture = Gestures.NONE
-
---SetGesturesEnabled(0b0000000000001001) -- Enable only some gestures to be detected
-
-SetTargetFPS(60)
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- lastGesture = currentGesture
- currentGesture = GetGestureDetected()
- touchPosition = GetTouchPosition(0)
-
- if (CheckCollisionPointRec(touchPosition, touchArea) and (currentGesture ~= Gestures.NONE)) then
- if (currentGesture ~= lastGesture) then
- -- Store gesture string
- if (currentGesture == Gestures.TAP) then gestureStrings[gesturesCount] = "GESTURE TAP"
- elseif (currentGesture == Gestures.DOUBLETAP) then gestureStrings[gesturesCount] = "GESTURE DOUBLETAP"
- elseif (currentGesture == Gestures.HOLD) then gestureStrings[gesturesCount] = "GESTURE HOLD"
- elseif (currentGesture == Gestures.DRAG) then gestureStrings[gesturesCount] = "GESTURE DRAG"
- elseif (currentGesture == Gestures.SWIPE_RIGHT) then gestureStrings[gesturesCount] = "GESTURE SWIPE RIGHT"
- elseif (currentGesture == Gestures.SWIPE_LEFT) then gestureStrings[gesturesCount] = "GESTURE SWIPE LEFT"
- elseif (currentGesture == Gestures.SWIPE_UP) then gestureStrings[gesturesCount] = "GESTURE SWIPE UP"
- elseif (currentGesture == Gestures.SWIPE_DOWN) then gestureStrings[gesturesCount] = "GESTURE SWIPE DOWN"
- elseif (currentGesture == Gestures.PINCH_IN) then gestureStrings[gesturesCount] = "GESTURE PINCH IN"
- elseif (currentGesture == Gestures.PINCH_OUT) then gestureStrings[gesturesCount] = "GESTURE PINCH OUT"
- end
-
- gesturesCount = gesturesCount + 1
-
- -- Reset gestures strings
- if (gesturesCount >= MAX_GESTURE_STRINGS) then
- for i = 1, MAX_GESTURE_STRINGS do gestureStrings[i] = "\0" end
- gesturesCount = 0
- end
- end
- end
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- DrawRectangleRec(touchArea, GRAY)
- DrawRectangle(225, 15, screenWidth - 240, screenHeight - 30, RAYWHITE)
-
- DrawText("GESTURES TEST AREA", screenWidth - 270, screenHeight - 40, 20, Fade(GRAY, 0.5))
-
- for i = 1, gesturesCount do
- if ((i - 1)%2 == 0) then DrawRectangle(10, 30 + 20*(i - 1), 200, 20, Fade(LIGHTGRAY, 0.5))
- else DrawRectangle(10, 30 + 20*(i - 1), 200, 20, Fade(LIGHTGRAY, 0.3)) end
-
- if (i < gesturesCount) then DrawText(gestureStrings[i], 35, 36 + 20*(i - 1), 10, DARKGRAY)
- else DrawText(gestureStrings[i], 35, 36 + 20*(i - 1), 10, MAROON) end
- end
-
- DrawRectangleLines(10, 29, 200, screenHeight - 50, GRAY)
- DrawText("DETECTED GESTURES", 50, 15, 10, GRAY)
-
- if (currentGesture ~= GESTURE_NONE) then DrawCircleV(touchPosition, 30, MAROON) end
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/core_input_gamepad.lua b/examples/core_input_gamepad.lua
deleted file mode 100644
index ade3f00f..00000000
--- a/examples/core_input_gamepad.lua
+++ /dev/null
@@ -1,163 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [core] example - Gamepad input
---
--- NOTE: This example requires a Gamepad connected to the system
--- raylib is configured to work with Xbox 360 gamepad, check raylib.h for buttons configuration
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [core] example - gamepad input")
-
-local texPs3Pad = LoadTexture("resources/ps3.png")
-local texXboxPad = LoadTexture("resources/xbox.png")
-
-SetTargetFPS(60) -- Set target frames-per-second
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- -- ...
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- if (IsGamepadAvailable(GAMEPAD.PLAYER1)) then
- DrawText(string.format("GP1: %s", GetGamepadName(GAMEPAD.PLAYER1)), 10, 10, 10, BLACK)
-
- if (IsGamepadName(GAMEPAD.PLAYER1, "Xbox 360 Controller")) then
- DrawTexture(texXboxPad, 0, 0, DARKGRAY)
-
- -- Draw buttons: xbox home
- if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_HOME)) then DrawCircle(394, 89, 19, RED) end
-
- -- Draw buttons: basic
- if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_START)) then DrawCircle(436, 150, 9, RED) end
- if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_SELECT)) then DrawCircle(352, 150, 9, RED) end
- if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_X)) then DrawCircle(501, 151, 15, BLUE) end
- if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_A)) then DrawCircle(536, 187, 15, LIME) end
- if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_B)) then DrawCircle(572, 151, 15, MAROON) end
- if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_Y)) then DrawCircle(536, 115, 15, GOLD) end
-
- -- Draw buttons: d-pad
- DrawRectangle(317, 202, 19, 71, BLACK)
- DrawRectangle(293, 228, 69, 19, BLACK)
- if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_UP)) then DrawRectangle(317, 202, 19, 26, RED) end
- if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_DOWN)) then DrawRectangle(317, 202 + 45, 19, 26, RED) end
- if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_LEFT)) then DrawRectangle(292, 228, 25, 19, RED) end
- if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_RIGHT)) then DrawRectangle(292 + 44, 228, 26, 19, RED) end
-
- -- Draw buttons: left-right back
- if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_LB)) then DrawCircle(259, 61, 20, RED) end
- if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.XBOX_BUTTON_RB)) then DrawCircle(536, 61, 20, RED) end
-
- -- Draw axis: left joystick
- DrawCircle(259, 152, 39, BLACK)
- DrawCircle(259, 152, 34, LIGHTGRAY)
- DrawCircle(259 + (GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.XBOX_AXIS_LEFT_X)*20),
- 152 - (GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.XBOX_AXIS_LEFT_Y)*20), 25, BLACK)
-
- -- Draw axis: right joystick
- DrawCircle(461, 237, 38, BLACK)
- DrawCircle(461, 237, 33, LIGHTGRAY)
- DrawCircle(461 + (GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.XBOX_AXIS_RIGHT_X)*20),
- 237 - (GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.XBOX_AXIS_RIGHT_Y)*20), 25, BLACK)
-
- -- Draw axis: left-right triggers
- DrawRectangle(170, 30, 15, 70, GRAY)
- DrawRectangle(604, 30, 15, 70, GRAY)
- DrawRectangle(170, 30, 15, (((1.0 + GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.XBOX_AXIS_LT))/2.0)*70), RED)
- DrawRectangle(604, 30, 15, (((1.0 + GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.XBOX_AXIS_RT))/2.0)*70), RED)
-
- --DrawText(FormatText("Xbox axis LT: %02.02f", GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.XBOX_AXIS_LT)), 10, 40, 10, BLACK)
- --DrawText(FormatText("Xbox axis RT: %02.02f", GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.XBOX_AXIS_RT)), 10, 60, 10, BLACK)
- elseif (IsGamepadName(GAMEPAD.PLAYER1, "PLAYSTATION(R)3 Controller")) then
- DrawTexture(texPs3Pad, 0, 0, DARKGRAY)
-
- -- Draw buttons: ps
- if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_PS)) then DrawCircle(396, 222, 13, RED) end
-
- -- Draw buttons: basic
- if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_SELECT)) then DrawRectangle(328, 170, 32, 13, RED) end
- if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_START)) then DrawTriangle((Vector2){ 436, 168 }, (Vector2){ 436, 185 }, (Vector2){ 464, 177 }, RED) end
- if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_TRIANGLE)) then DrawCircle(557, 144, 13, LIME) end
- if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_CIRCLE)) then DrawCircle(586, 173, 13, RED) end
- if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_CROSS)) then DrawCircle(557, 203, 13, VIOLET) end
- if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_SQUARE)) then DrawCircle(527, 173, 13, PINK) end
-
- -- Draw buttons: d-pad
- DrawRectangle(225, 132, 24, 84, BLACK)
- DrawRectangle(195, 161, 84, 25, BLACK)
- if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_UP)) then DrawRectangle(225, 132, 24, 29, RED) end
- if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_DOWN)) then DrawRectangle(225, 132 + 54, 24, 30, RED) end
- if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_LEFT)) then DrawRectangle(195, 161, 30, 25, RED) end
- if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_RIGHT)) then DrawRectangle(195 + 54, 161, 30, 25, RED) end
-
- -- Draw buttons: left-right back buttons
- if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_L1)) then DrawCircle(239, 82, 20, RED) end
- if (IsGamepadButtonDown(GAMEPAD.PLAYER1, GAMEPAD.PS3_BUTTON_R1)) then DrawCircle(557, 82, 20, RED) end
-
- -- Draw axis: left joystick
- DrawCircle(319, 255, 35, BLACK)
- DrawCircle(319, 255, 31, LIGHTGRAY)
- DrawCircle(319 + (GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.PS3_AXIS_LEFT_X)*20),
- 255 + (GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.PS3_AXIS_LEFT_Y)*20), 25, BLACK)
-
- -- Draw axis: right joystick
- DrawCircle(475, 255, 35, BLACK)
- DrawCircle(475, 255, 31, LIGHTGRAY)
- DrawCircle(475 + (GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.PS3_AXIS_RIGHT_X)*20),
- 255 + (GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.PS3_AXIS_RIGHT_Y)*20), 25, BLACK)
-
- -- Draw axis: left-right triggers
- DrawRectangle(169, 48, 15, 70, GRAY)
- DrawRectangle(611, 48, 15, 70, GRAY)
- DrawRectangle(169, 48, 15, (((1.0 - GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.PS3_AXIS_L2))/2.0)*70), RED)
- DrawRectangle(611, 48, 15, (((1.0 - GetGamepadAxisMovement(GAMEPAD.PLAYER1, GAMEPAD.PS3_AXIS_R2))/2.0)*70), RED)
- else
- DrawText("- GENERIC GAMEPAD -", 280, 180, 20, GRAY)
-
- -- TODO: Draw generic gamepad
- end
-
- DrawText(string.format("DETECTED AXIS [%i]:", GetGamepadAxisCount(GAMEPAD.PLAYER1)), 10, 50, 10, MAROON)
-
- for i = 1, GetGamepadAxisCount(GAMEPAD.PLAYER1) do -- Iterate along all the rectangles
- DrawText(string.format("AXIS %i: %.02f", i, GetGamepadAxisMovement(GAMEPAD.PLAYER1, i)), 20, 70 + 20*i, 10, DARKGRAY)
- end
-
- if (GetGamepadButtonPressed() ~= -1) then DrawText(string.format("DETECTED BUTTON: %i", GetGamepadButtonPressed()), 10, 430, 10, RED)
- else DrawText("DETECTED BUTTON: NONE", 10, 430, 10, GRAY) end
- else
- DrawText("GP1: NOT DETECTED", 10, 10, 10, GRAY)
-
- DrawTexture(texXboxPad, 0, 0, LIGHTGRAY)
- end
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-UnloadTexture(texPs3Pad) -- Unload gamepad texture
-UnloadTexture(texXboxPad) -- Unload gamepad texture
-
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/core_input_keys.lua b/examples/core_input_keys.lua
deleted file mode 100644
index 523b7317..00000000
--- a/examples/core_input_keys.lua
+++ /dev/null
@@ -1,51 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [core] example - Keyboard input
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window")
-
-local ballPosition = Vector2(screenWidth/2, screenHeight/2)
-
-SetTargetFPS(60) -- Set target frames-per-second
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- if (IsKeyDown(KEY.RIGHT)) then ballPosition.x = ballPosition.x + 0.8 end
- if (IsKeyDown(KEY.LEFT)) then ballPosition.x = ballPosition.x - 0.8 end
- if (IsKeyDown(KEY.UP)) then ballPosition.y = ballPosition.y - 0.8 end
- if (IsKeyDown(KEY.DOWN)) then ballPosition.y = ballPosition.y + 0.8 end
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- DrawText("move the ball with arrow keys", 10, 10, 20, DARKGRAY)
-
- DrawCircleV(ballPosition, 50, MAROON)
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-CloseWindow() -- Close window and OpenGL context
--------------------------------------------------------------------------------------------
diff --git a/examples/core_input_mouse.lua b/examples/core_input_mouse.lua
deleted file mode 100644
index 35ca8e73..00000000
--- a/examples/core_input_mouse.lua
+++ /dev/null
@@ -1,54 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [core] example - Mouse input
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [core] example - mouse input")
-
-local ballPosition = Vector2(-100.0, -100.0)
-local ballColor = DARKBLUE
-
-SetTargetFPS(60) -- Set target frames-per-second
------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ------------------------------------------------------------------------------------
- ballPosition = GetMousePosition()
-
- if (IsMouseButtonPressed(MOUSE.LEFT_BUTTON)) then ballColor = MAROON
- elseif (IsMouseButtonPressed(MOUSE.MIDDLE_BUTTON)) then ballColor = LIME
- elseif (IsMouseButtonPressed(MOUSE.RIGHT_BUTTON)) then ballColor = DARKBLUE
- end
- ------------------------------------------------------------------------------------
-
- -- Draw
- ------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- DrawCircleV(ballPosition, 40, ballColor)
-
- DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, DARKGRAY)
-
- EndDrawing()
- ------------------------------------------------------------------------------------
-end
-
--- De-Initialization
-----------------------------------------------------------------------------------------
-CloseWindow() -- Close window and OpenGL context
----------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/core_mouse_wheel.lua b/examples/core_mouse_wheel.lua
deleted file mode 100644
index 92e0a160..00000000
--- a/examples/core_mouse_wheel.lua
+++ /dev/null
@@ -1,50 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [core] examples - Mouse wheel
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [core] example - mouse wheel")
-
-local boxPositionY = screenHeight/2 - 40
-local scrollSpeed = 4 -- Scrolling speed in pixels
-
-SetTargetFPS(60) -- Set target frames-per-second
-----------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ------------------------------------------------------------------------------------
- boxPositionY = boxPositionY - (GetMouseWheelMove()*scrollSpeed)
- ------------------------------------------------------------------------------------
-
- -- Draw
- ------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- DrawRectangle(screenWidth/2 - 40, boxPositionY, 80, 80, MAROON)
-
- DrawText("Use mouse wheel to move the cube up and down!", 10, 10, 20, GRAY)
- DrawText(string.format("Box position Y: %03i", boxPositionY), 10, 40, 20, LIGHTGRAY)
-
- EndDrawing()
- ------------------------------------------------------------------------------------
-end
-
--- De-Initialization
-----------------------------------------------------------------------------------------
-CloseWindow() -- Close window and OpenGL context
----------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/core_oculus_rift.lua b/examples/core_oculus_rift.lua
deleted file mode 100644
index 2626d178..00000000
--- a/examples/core_oculus_rift.lua
+++ /dev/null
@@ -1,73 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [core] example - Oculus Rift CV1
---
--- NOTE: Example requires linkage with LibOVR
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 1080
-local screenHeight = 600
-
--- NOTE: screenWidth/screenHeight should match VR device aspect ratio
-
-InitWindow(screenWidth, screenHeight, "raylib [core] example - oculus rift")
-
--- NOTE: If device is not available, it fallbacks to default device (simulator)
-InitVrDevice(VrDevice.OCULUS_RIFT_CV1) -- Init VR device (Oculus Rift CV1)
-
--- Define the camera to look into our 3d world
-local camera = {}
-camera.position = Vector3(5.0, 5.0, 5.0) -- Camera position
-camera.target = Vector3(0.0, 0.0, 0.0) -- Camera looking at point
-camera.up = Vector3(0.0, 1.0, 0.0) -- Camera up vector (rotation towards target)
-camera.fovy = 60.0 -- Camera field-of-view Y
-
-local cubePosition = Vector3(0.0, 0.0, 0.0)
-
-SetTargetFPS(90) -- Set our game to run at 90 frames-per-second
-----------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ------------------------------------------------------------------------------------
- UpdateVrTracking()
-
- if (IsKeyPressed(KEY.SPACE)) then ToggleVrMode() end
- ------------------------------------------------------------------------------------
-
- -- Draw
- ------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- Begin3dMode(camera)
-
- DrawCube(cubePosition, 2.0, 2.0, 2.0, RED)
- DrawCubeWires(cubePosition, 2.0, 2.0, 2.0, MAROON)
-
- DrawGrid(10, 1.0)
-
- End3dMode()
-
- DrawFPS(10, 10)
-
- EndDrawing()
- ------------------------------------------------------------------------------------
-end
-
--- De-Initialization
-----------------------------------------------------------------------------------------
-CloseVrDevice() -- Close VR device
-
-CloseWindow() -- Close window and OpenGL context
----------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/core_random_values.lua b/examples/core_random_values.lua
deleted file mode 100644
index b80ab9e2..00000000
--- a/examples/core_random_values.lua
+++ /dev/null
@@ -1,56 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [core] example - Generate random values
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [core] example - generate random values")
-
-local framesCounter = 0 -- Variable used to count frames
-
-local randValue = GetRandomValue(-8, 5) -- Get a random integer number between -8 and 5 (both included)
-
-SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
-----------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ------------------------------------------------------------------------------------
- framesCounter = framesCounter + 1
-
- -- Every two seconds (120 frames) a new random value is generated
- if (((framesCounter/120)%2) == 1) then
- randValue = GetRandomValue(-8, 5)
- framesCounter = 0
- end
- ------------------------------------------------------------------------------------
-
- -- Draw
- ------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- DrawText("Every 2 seconds a new random value is generated:", 130, 100, 20, MAROON)
-
- DrawText(string.format("%i", randValue), 360, 180, 80, LIGHTGRAY)
-
- EndDrawing()
- ------------------------------------------------------------------------------------
-end
-
--- De-Initialization
-----------------------------------------------------------------------------------------
-CloseWindow() -- Close window and OpenGL context
----------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/core_storage_values.lua b/examples/core_storage_values.lua
deleted file mode 100644
index 878b90e4..00000000
--- a/examples/core_storage_values.lua
+++ /dev/null
@@ -1,74 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [core] example - Storage save/load values
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- NOTE: Storage positions must start with 0, directly related to file memory layout
-STORAGE_SCORE = 0
-STORAGE_HISCORE = 1
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [core] example - storage save/load values")
-
-local score = 0
-local hiscore = 0
-
-local framesCounter = 0
-
-SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- if (IsKeyPressed(KEY.R)) then
- score = GetRandomValue(1000, 2000)
- hiscore = GetRandomValue(2000, 4000)
- end
-
- if (IsKeyPressed(KEY.ENTER)) then
- StorageSaveValue(STORAGE_SCORE, score)
- StorageSaveValue(STORAGE_HISCORE, hiscore)
- elseif (IsKeyPressed(KEY.SPACE)) then
- -- NOTE: If requested position could not be found, value 0 is returned
- score = StorageLoadValue(STORAGE_SCORE)
- hiscore = StorageLoadValue(STORAGE_HISCORE)
- end
-
- framesCounter = framesCounter + 1
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- DrawText(string.format("SCORE: %i", score), 280, 130, 40, MAROON)
- DrawText(string.format("HI-SCORE: %i", hiscore), 210, 200, 50, BLACK)
-
- DrawText(string.format("frames: %i", framesCounter), 10, 10, 20, LIME)
-
- DrawText("Press R to generate random numbers", 220, 40, 20, LIGHTGRAY)
- DrawText("Press ENTER to SAVE values", 250, 310, 20, LIGHTGRAY)
- DrawText("Press SPACE to LOAD values", 252, 350, 20, LIGHTGRAY)
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/core_world_screen.lua b/examples/core_world_screen.lua
deleted file mode 100644
index 48b617dd..00000000
--- a/examples/core_world_screen.lua
+++ /dev/null
@@ -1,66 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [core] example - World to screen
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera free")
-
--- Define the camera to look into our 3d world
-local camera = Camera(Vector3(0.0, 10.0, 10.0), Vector3(0.0, 0.0, 0.0), Vector3(0.0, 1.0, 0.0), 45.0)
-
-local cubePosition = Vector3(0.0, 0.0, 0.0)
-
-local cubeScreenPosition = Vector2(0, 0)
-
-SetCameraMode(camera, CameraMode.FREE) -- Set a free camera mode
-
-SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
-----------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ------------------------------------------------------------------------------------
- camera = UpdateCamera(camera) -- Update camera
-
- -- Calculate cube screen space position (with a little offset to be in top)
- cubeScreenPosition = GetWorldToScreen(Vector3(cubePosition.x, cubePosition.y + 2.5, cubePosition.z), camera)
- ------------------------------------------------------------------------------------
-
- -- Draw
- ------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- Begin3dMode(camera)
-
- DrawCube(cubePosition, 2.0, 2.0, 2.0, RED)
- DrawCubeWires(cubePosition, 2.0, 2.0, 2.0, MAROON)
-
- DrawGrid(10, 1.0)
-
- End3dMode()
-
- DrawText("Enemy: 100 / 100", cubeScreenPosition.x//1 - MeasureText("Enemy: 100 / 100", 20)//2, cubeScreenPosition.y//1, 20, BLACK)
- DrawText("Text is always on top of the cube", (screenWidth - MeasureText("Text is always on top of the cube", 20))//2, 25, 20, GRAY)
-
- EndDrawing()
- ------------------------------------------------------------------------------------
-end
-
--- De-Initialization
-----------------------------------------------------------------------------------------
-CloseWindow() -- Close window and OpenGL context
----------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/models_billboard.lua b/examples/models_billboard.lua
deleted file mode 100644
index 9d81f6ce..00000000
--- a/examples/models_billboard.lua
+++ /dev/null
@@ -1,62 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [models] example - Drawing billboards
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [models] example - drawing billboards")
-
--- Define the camera to look into our 3d world
-local camera = Camera(Vector3(5.0, 4.0, 5.0), Vector3(0.0, 2.0, 0.0), Vector3(0.0, 1.0, 0.0), 45.0)
-
-local bill = LoadTexture("resources/billboard.png") -- Our texture billboard
-local billPosition = Vector3(0.0, 2.0, 0.0) -- Position where draw billboard
-
-SetCameraMode(camera, CameraMode.ORBITAL) -- Set an orbital camera mode
-
-SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- camera = UpdateCamera(camera) -- Update camera
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- Begin3dMode(camera)
-
- DrawBillboard(camera, bill, billPosition, 2.0, WHITE)
-
- DrawGrid(10, 1.0) -- Draw a grid
-
- End3dMode()
-
- DrawFPS(10, 10)
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-UnloadTexture(bill) -- Unload texture
-
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/models_box_collisions.lua b/examples/models_box_collisions.lua
deleted file mode 100644
index 4a3107b9..00000000
--- a/examples/models_box_collisions.lua
+++ /dev/null
@@ -1,115 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [models] example - Detect basic 3d collisions (box vs sphere vs box)
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [models] example - box collisions")
-
--- Define the camera to look into our 3d world
-local camera = Camera(Vector3(0.0, 10.0, 10.0), Vector3(0.0, 0.0, 0.0), Vector3(0.0, 1.0, 0.0), 45.0)
-
-local playerPosition = Vector3(0.0, 1.0, 2.0)
-local playerSize = Vector3(1.0, 2.0, 1.0)
-local playerColor = GREEN
-
-local enemyBoxPos = Vector3(-4.0, 1.0, 0.0)
-local enemyBoxSize = Vector3(2.0, 2.0, 2.0)
-
-local enemySpherePos = Vector3(4.0, 0.0, 0.0)
-local enemySphereSize = 1.5
-
-local collision = false
-
-SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
-
- -- Move player
- if (IsKeyDown(KEY.RIGHT)) then playerPosition.x = playerPosition.x + 0.2
- elseif (IsKeyDown(KEY.LEFT)) then playerPosition.x = playerPosition.x - 0.2
- elseif (IsKeyDown(KEY.DOWN)) then playerPosition.z = playerPosition.z + 0.2
- elseif (IsKeyDown(KEY.UP)) then playerPosition.z = playerPosition.z - 0.2 end
-
- collision = false
-
- -- Check collisions player vs enemy-box
- if (CheckCollisionBoxes(
- BoundingBox(Vector3(playerPosition.x - playerSize.x/2,
- playerPosition.y - playerSize.y/2,
- playerPosition.z - playerSize.z/2),
- Vector3(playerPosition.x + playerSize.x/2,
- playerPosition.y + playerSize.y/2,
- playerPosition.z + playerSize.z/2)),
- BoundingBox(Vector3(enemyBoxPos.x - enemyBoxSize.x/2,
- enemyBoxPos.y - enemyBoxSize.y/2,
- enemyBoxPos.z - enemyBoxSize.z/2),
- Vector3(enemyBoxPos.x + enemyBoxSize.x/2,
- enemyBoxPos.y + enemyBoxSize.y/2,
- enemyBoxPos.z + enemyBoxSize.z/2)))) then collision = true
- end
-
- -- Check collisions player vs enemy-sphere
- if (CheckCollisionBoxSphere(
- BoundingBox(Vector3(playerPosition.x - playerSize.x/2,
- playerPosition.y - playerSize.y/2,
- playerPosition.z - playerSize.z/2),
- Vector3(playerPosition.x + playerSize.x/2,
- playerPosition.y + playerSize.y/2,
- playerPosition.z + playerSize.z/2)),
- enemySpherePos, enemySphereSize)) then collision = true
- end
-
- if (collision) then playerColor = RED
- else playerColor = GREEN end
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- Begin3dMode(camera)
-
- -- Draw enemy-box
- DrawCube(enemyBoxPos, enemyBoxSize.x, enemyBoxSize.y, enemyBoxSize.z, GRAY)
- DrawCubeWires(enemyBoxPos, enemyBoxSize.x, enemyBoxSize.y, enemyBoxSize.z, DARKGRAY)
-
- -- Draw enemy-sphere
- DrawSphere(enemySpherePos, enemySphereSize, GRAY)
- DrawSphereWires(enemySpherePos, enemySphereSize, 16, 16, DARKGRAY)
-
- -- Draw player
- DrawCubeV(playerPosition, playerSize, playerColor)
-
- DrawGrid(10, 1.0) -- Draw a grid
-
- End3dMode()
-
- DrawText("Move player with cursors to collide", 220, 40, 20, GRAY)
-
- DrawFPS(10, 10)
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/models_cubicmap.lua b/examples/models_cubicmap.lua
deleted file mode 100644
index 79faafc9..00000000
--- a/examples/models_cubicmap.lua
+++ /dev/null
@@ -1,77 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [models] example - Cubicmap loading and drawing
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [models] example - cubesmap loading and drawing")
-
--- Define the camera to look into our 3d world
-local camera = Camera(Vector3(16.0, 14.0, 16.0), Vector3(0.0, 0.0, 0.0), Vector3(0.0, 1.0, 0.0), 45.0)
-
-local image = LoadImage("resources/cubicmap.png") -- Load cubicmap image (RAM)
-local cubicmap = LoadTextureFromImage(image) -- Convert image to texture to display (VRAM)
-local map = LoadCubicmap(image) -- Load cubicmap model (generate model from image)
-
--- NOTE: By default each cube is mapped to one part of texture atlas
-local texture = LoadTexture("resources/cubicmap_atlas.png") -- Load map texture
-map.material.texDiffuse = texture -- Set map diffuse texture
-
-local mapPosition = Vector3(-16.0, 0.0, -8.0) -- Set model position
-
-UnloadImage(image) -- Unload cubesmap image from RAM, already uploaded to VRAM
-
-SetCameraMode(camera, CameraMode.ORBITAL) -- Set an orbital camera mode
-
-SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- camera = UpdateCamera(camera) -- Update camera
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- Begin3dMode(camera)
-
- DrawModel(map, mapPosition, 1.0, WHITE)
-
- End3dMode()
-
- DrawTextureEx(cubicmap, (Vector2)(screenWidth - cubicmap.width*4 - 20, 20), 0.0, 4.0, WHITE)
- DrawRectangleLines(screenWidth - cubicmap.width*4 - 20, 20, cubicmap.width*4, cubicmap.height*4, GREEN)
-
- DrawText("cubicmap image used to", 658, 90, 10, GRAY)
- DrawText("generate map 3d model", 658, 104, 10, GRAY)
-
- DrawFPS(10, 10)
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-UnloadTexture(cubicmap) -- Unload cubicmap texture
-UnloadTexture(texture) -- Unload map texture
-UnloadModel(map) -- Unload map model
-
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/models_geometric_shapes.lua b/examples/models_geometric_shapes.lua
deleted file mode 100644
index 0ce08e9f..00000000
--- a/examples/models_geometric_shapes.lua
+++ /dev/null
@@ -1,67 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [models] example - Draw some basic geometric shapes (cube, sphere, cylinder...)
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [models] example - geometric shapes")
-
--- Define the camera to look into our 3d world
-local camera = Camera(Vector3(0.0, 10.0, 10.0), Vector3(0.0, 0.0, 0.0), Vector3(0.0, 1.0, 0.0), 45.0)
-
-SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- -- TODO: Update your variables here
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- Begin3dMode(camera) -- ERROR: Lua Error: attempt to index a number value
-
- DrawCube(Vector3(-4.0, 0.0, 2.0), 2.0, 5.0, 2.0, RED)
- DrawCubeWires(Vector3(-4.0, 0.0, 2.0), 2.0, 5.0, 2.0, GOLD)
- DrawCubeWires(Vector3(-4.0, 0.0, -2.0), 3.0, 6.0, 2.0, MAROON)
-
- DrawSphere(Vector3(-1.0, 0.0, -2.0), 1.0, GREEN)
- DrawSphereWires(Vector3(1.0, 0.0, 2.0), 2.0, 16, 16, LIME)
-
- DrawCylinder(Vector3(4.0, 0.0, -2.0), 1.0, 2.0, 3.0, 4, SKYBLUE)
- DrawCylinderWires(Vector3(4.0, 0.0, -2.0), 1.0, 2.0, 3.0, 4, DARKBLUE)
- DrawCylinderWires(Vector3(4.5, -1.0, 2.0), 1.0, 1.0, 2.0, 6, BROWN)
-
- DrawCylinder(Vector3(1.0, 0.0, -4.0), 0.0, 1.5, 3.0, 8, GOLD)
- DrawCylinderWires(Vector3(1.0, 0.0, -4.0), 0.0, 1.5, 3.0, 8, PINK)
-
- DrawGrid(10, 1.0) -- Draw a grid
-
- End3dMode()
-
- DrawFPS(10, 10)
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/models_heightmap.lua b/examples/models_heightmap.lua
deleted file mode 100644
index efcbfb4b..00000000
--- a/examples/models_heightmap.lua
+++ /dev/null
@@ -1,72 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [models] example - Heightmap loading and drawing
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [models] example - heightmap loading and drawing")
-
--- Define our custom camera to look into our 3d world
-local camera = Camera(Vector3(18.0, 16.0, 18.0), Vector3(0.0, 0.0, 0.0), Vector3(0.0, 1.0, 0.0), 45.0)
-
-local image = LoadImage("resources/heightmap.png") -- Load heightmap image (RAM)
-local texture = LoadTextureFromImage(image) -- Convert image to texture (VRAM)
-local map = LoadHeightmap(image, Vector3(16, 8, 16)) -- Load heightmap model with defined size
-map.material.texDiffuse = texture -- Set map diffuse texture
-local mapPosition = Vector3(-8.0, 0.0, -8.0) -- Set model position (depends on model scaling!)
-
-UnloadImage(image) -- Unload heightmap image from RAM, already uploaded to VRAM
-
-SetCameraMode(camera, CameraMode.ORBITAL) -- Set an orbital camera mode
-
-SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
-----------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- camera = UpdateCamera(camera) -- Update camera
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- Begin3dMode(camera)
-
- -- NOTE: Model is scaled to 1/4 of its original size (128x128 units)
- DrawModel(map, mapPosition, 1.0, RED)
-
- DrawGrid(20, 1.0)
-
- End3dMode()
-
- DrawTexture(texture, screenWidth - texture.width - 20, 20, WHITE)
- DrawRectangleLines(screenWidth - texture.width - 20, 20, texture.width, texture.height, GREEN)
-
- DrawFPS(10, 10)
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-UnloadTexture(texture) -- Unload texture
-UnloadModel(map) -- Unload model
-
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/models_obj_loading.lua b/examples/models_obj_loading.lua
deleted file mode 100644
index 7e5c7c4b..00000000
--- a/examples/models_obj_loading.lua
+++ /dev/null
@@ -1,67 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [models] example - Load and draw a 3d model (OBJ)
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [models] example - obj model loading")
-
--- Define the camera to look into our 3d world
-local camera = Camera(Vector3(3.0, 3.0, 3.0), Vector3(0.0, 1.5, 0.0), Vector3(0.0, 1.0, 0.0), 45.0)
-
-local dwarf = LoadModel("resources/model/dwarf.obj") -- Load OBJ model
-local texture = LoadTexture("resources/model/dwarf_diffuse.png") -- Load model texture
-dwarf.material.texDiffuse = texture -- Set dwarf model diffuse texture
-local position = Vector3(0.0, 0.0, 0.0) -- Set model position
-
-SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- -- ...
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- Begin3dMode(camera)
-
- DrawModel(dwarf, position, 2.0, WHITE) -- Draw 3d model with texture
-
- DrawGrid(10, 1.0) -- Draw a grid
-
- DrawGizmo(position) -- Draw gizmo
-
- End3dMode()
-
- DrawText("(c) Dwarf 3D model by David Moreno", screenWidth - 200, screenHeight - 20, 10, GRAY)
-
- DrawFPS(10, 10)
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-UnloadTexture(texture) -- Unload texture
-UnloadModel(dwarf) -- Unload model
-
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/rlua_execute_file.c b/examples/rlua_execute_file.c
deleted file mode 100644
index a91ce42f..00000000
--- a/examples/rlua_execute_file.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************************
-*
-* raylib [rlua] example - Lua file execution
-*
-* NOTE: This example requires Lua library (http://luabinaries.sourceforge.net/download.html)
-*
-* Compile example using:
-* gcc -o $(NAME_PART).exe $(FILE_NAME) $(RAYLIB_DIR)\raylib_icon /
-* -I../src -I../src/external/lua/include -L../src/external/lua/lib /
-* -lraylib -lglfw3 -lopengl32 -lgdi32 -lopenal32 -lwinmm -llua53 /
-* -std=c99 -Wl,-allow-multiple-definition -Wl,--subsystem,windows
-*
-* This example has been created using raylib 1.6 (www.raylib.com)
-* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
-*
-* Copyright (c) 2013-2016 Ramon Santamaria (@raysan5)
-*
-********************************************************************************************/
-
-#include "raylib.h"
-
-#define RLUA_IMPLEMENTATION
-#include "rlua.h"
-
-int main()
-{
- // Initialization
- //--------------------------------------------------------------------------------------
- InitLuaDevice();
- //--------------------------------------------------------------------------------------
-
- ExecuteLuaFile("core_basic_window.lua"); // OK!
- // ExecuteLuaFile("core_input_keys.lua"); // OK!
- // ExecuteLuaFile("core_input_mouse.lua"); // OK!
- // ExecuteLuaFile("core_mouse_wheel.lua"); // OK!
- // ExecuteLuaFile("core_input_gamepad.lua"); // OK!
- // ExecuteLuaFile("core_random_values.lua"); // OK!
- // ExecuteLuaFile("core_color_select.lua"); // OK!
- // ExecuteLuaFile("core_drop_files.lua"); // OK!
- // ExecuteLuaFile("core_storage_values.lua"); // OK!
- // ExecuteLuaFile("core_gestures_detection.lua"); // OK!
- // ExecuteLuaFile("core_3d_mode.lua"); // OK!
- // ExecuteLuaFile("core_3d_picking.lua"); // OK!
- // ExecuteLuaFile("core_3d_camera_free.lua"); // OK!
- // ExecuteLuaFile("core_3d_camera_first_person.lua"); // OK!
- // ExecuteLuaFile("core_2d_camera.lua"); // OK!
- // ExecuteLuaFile("core_world_screen.lua"); // OK!
- // ExecuteLuaFile("core_oculus_rift.lua"); // OK!
- // ExecuteLuaFile("shapes_logo_raylib.lua"); // OK!
- // ExecuteLuaFile("shapes_basic_shapes.lua"); // OK!
- // ExecuteLuaFile("shapes_colors_palette.lua"); // OK!
- // ExecuteLuaFile("shapes_logo_raylib_anim.lua"); // OK! NOTE: Use lua string.sub() instead of raylib SubText()
- // ExecuteLuaFile("textures_logo_raylib.lua"); // OK!
- // ExecuteLuaFile("textures_image_loading.lua"); // OK!
- // ExecuteLuaFile("textures_rectangle.lua"); // OK!
- // ExecuteLuaFile("textures_srcrec_dstrec.lua"); // OK!
- // ExecuteLuaFile("textures_to_image.lua"); // OK!
- // ExecuteLuaFile("textures_raw_data.lua"); // ERROR: LoadImageEx()
- // ExecuteLuaFile("textures_formats_loading.lua"); // OK!
- // ExecuteLuaFile("textures_particles_trail_blending.lua"); // OK!
- // ExecuteLuaFile("textures_image_processing.lua"); // ERROR: GetImageData() --> UpdateTexture()
- // ExecuteLuaFile("textures_image_drawing.lua"); // OK!
- // ExecuteLuaFile("text_sprite_fonts.lua"); // OK!
- // ExecuteLuaFile("text_bmfont_ttf.lua"); // OK!
- // ExecuteLuaFile("text_rbmf_fonts.lua"); // OK!
- // ExecuteLuaFile("text_format_text.lua"); // OK! NOTE: Use lua string.format() instead of raylib FormatText()
- // ExecuteLuaFile("text_font_select.lua"); // OK!
- // ExecuteLuaFile("text_writing_anim.lua"); // OK!
- // ExecuteLuaFile("text_ttf_loading.lua"); // ISSUE: Attempt to index a SpriteFont value (local 'font')
- // ExecuteLuaFile("text_bmfont_unordered.lua"); // OK!
- // ExecuteLuaFile("models_geometric_shapes.lua"); // OK!
- // ExecuteLuaFile("models_box_collisions.lua"); // OK!
- // ExecuteLuaFile("models_billboard.lua"); // OK!
- // ExecuteLuaFile("models_obj_loading.lua"); // OK!
- // ExecuteLuaFile("models_heightmap.lua"); // OK!
- // ExecuteLuaFile("models_cubicmap.lua"); // OK!
- // ExecuteLuaFile("shaders_model_shader.lua"); // OK!
- // ExecuteLuaFile("shaders_shapes_textures.lua"); // OK!
- // ExecuteLuaFile("shaders_custom_uniform.lua"); // OK!
- // ExecuteLuaFile("shaders_postprocessing.lua"); // OK!
- // ExecuteLuaFile("shaders_standard_lighting.lua"); // OK!
- // ExecuteLuaFile("audio_sound_loading.lua"); // OK!
- // ExecuteLuaFile("audio_music_stream.lua"); // OK!
- // ExecuteLuaFile("audio_module_playing.lua"); // OK!
- // ExecuteLuaFile("audio_raw_stream.lua"); // ERROR: UpdateAudioStream()
-
- // De-Initialization
- //--------------------------------------------------------------------------------------
- CloseLuaDevice(); // Close Lua device and free resources
- //--------------------------------------------------------------------------------------
-
- return 0;
-} \ No newline at end of file
diff --git a/examples/shaders_custom_uniform.lua b/examples/shaders_custom_uniform.lua
deleted file mode 100644
index dafd3b84..00000000
--- a/examples/shaders_custom_uniform.lua
+++ /dev/null
@@ -1,113 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [shaders] example - Apply a postprocessing shader and connect a custom uniform variable
---
--- NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support,
--- OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version.
---
--- NOTE: Shaders used in this example are #version 330 (OpenGL 3.3), to test this example
--- on OpenGL ES 2.0 platforms (Android, Raspberry Pi, HTML5), use #version 100 shaders
--- raylib comes with shaders ready for both versions, check raylib/shaders install folder
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-SetConfigFlags(FLAG.MSAA_4X_HINT) -- Enable Multi Sampling Anti Aliasing 4x (if available)
-
-InitWindow(screenWidth, screenHeight, "raylib [shaders] example - custom uniform variable")
-
--- Define the camera to look into our 3d world
-local camera = Camera(Vector3(3.0, 3.0, 3.0), Vector3(0.0, 1.5, 0.0), Vector3(0.0, 1.0, 0.0), 45.0)
-
-local dwarf = LoadModel("resources/model/dwarf.obj") -- Load OBJ model
-local texture = LoadTexture("resources/model/dwarf_diffuse.png") -- Load model texture (diffuse map)
-dwarf.material.texDiffuse = texture -- Set dwarf model diffuse texture
-
-local position = Vector3(0.0, 0.0, 0.0) -- Set model position
-
-local shader = LoadShader("resources/shaders/glsl330/base.vs",
- "resources/shaders/glsl330/swirl.fs") -- Load postpro shader
-
--- Get variable (uniform) location on the shader to connect with the program
--- NOTE: If uniform variable could not be found in the shader, function returns -1
-local swirlCenterLoc = GetShaderLocation(shader, "center")
-
-local swirlCenter = { screenWidth/2, screenHeight/2 }
-
--- Create a RenderTexture2D to be used for render to texture
-local target = LoadRenderTexture(screenWidth, screenHeight)
-
--- Setup orbital camera
-SetCameraMode(camera, CameraMode.ORBITAL) -- Set an orbital camera mode
-
-SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- local mousePosition = GetMousePosition()
-
- swirlCenter[1] = mousePosition.x
- swirlCenter[2] = screenHeight - mousePosition.y
-
- -- Send new value to the shader to be used on drawing
- SetShaderValue(shader, swirlCenterLoc, swirlCenter)
-
- camera = UpdateCamera(camera) -- Update camera
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- BeginTextureMode(target) -- Enable drawing to texture
-
- Begin3dMode(camera)
-
- DrawModel(dwarf, position, 2.0, WHITE) -- Draw 3d model with texture
-
- DrawGrid(10, 1.0) -- Draw a grid
-
- End3dMode()
-
- DrawText("TEXT DRAWN IN RENDER TEXTURE", 200, 10, 30, RED)
-
- EndTextureMode() -- End drawing to texture (now we have a texture available for next passes)
-
- BeginShaderMode(shader)
-
- -- NOTE: Render texture must be y-flipped due to default OpenGL coordinates (left-bottom)
- DrawTextureRec(target.texture, Rectangle(0, 0, target.texture.width, -target.texture.height), Vector2(0, 0), WHITE)
-
- EndShaderMode()
-
- DrawText("(c) Dwarf 3D model by David Moreno", screenWidth - 200, screenHeight - 20, 10, GRAY)
-
- DrawFPS(10, 10)
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-UnloadShader(shader) -- Unload shader
-UnloadTexture(texture) -- Unload texture
-UnloadModel(dwarf) -- Unload model
-UnloadRenderTexture(target) -- Unload render texture
-
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/shaders_model_shader.lua b/examples/shaders_model_shader.lua
deleted file mode 100644
index 38f0fd30..00000000
--- a/examples/shaders_model_shader.lua
+++ /dev/null
@@ -1,83 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [shaders] example - Apply a shader to a 3d model
---
--- NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support,
--- OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version.
---
--- NOTE: Shaders used in this example are #version 330 (OpenGL 3.3), to test this example
--- on OpenGL ES 2.0 platforms (Android, Raspberry Pi, HTML5), use #version 100 shaders
--- raylib comes with shaders ready for both versions, check raylib/shaders install folder
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-SetConfigFlags(FLAG.MSAA_4X_HINT) -- Enable Multi Sampling Anti Aliasing 4x (if available)
-
-InitWindow(screenWidth, screenHeight, "raylib [shaders] example - model shader")
-
--- Define the camera to look into our 3d world
-local camera = Camera(Vector3(3.0, 3.0, 3.0), Vector3(0.0, 1.5, 0.0), Vector3(0.0, 1.0, 0.0), 45.0)
-
-local dwarf = LoadModel("resources/model/dwarf.obj") -- Load OBJ model
-local texture = LoadTexture("resources/model/dwarf_diffuse.png") -- Load model texture
-local shader = LoadShader("resources/shaders/glsl330/base.vs",
- "resources/shaders/glsl330/grayscale.fs") -- Load model shader
-
-dwarf.material.shader = shader -- Set shader effect to 3d model
-dwarf.material.texDiffuse = texture -- Bind texture to model
-
-local position = Vector3(0.0, 0.0, 0.0) -- Set model position
-
--- Setup orbital camera
-SetCameraMode(camera, CameraMode.ORBITAL) -- Set an orbital camera mode
-
-SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- camera = UpdateCamera(camera) -- Update camera
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- Begin3dMode(camera)
-
- DrawModel(dwarf, position, 2.0, WHITE) -- Draw 3d model with texture
-
- DrawGrid(10, 1.0) -- Draw a grid
-
- End3dMode()
-
- DrawText("(c) Dwarf 3D model by David Moreno", screenWidth - 200, screenHeight - 20, 10, GRAY)
-
- DrawFPS(10, 10)
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-UnloadShader(shader) -- Unload shader
-UnloadTexture(texture) -- Unload texture
-UnloadModel(dwarf) -- Unload model
-
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/shaders_postprocessing.lua b/examples/shaders_postprocessing.lua
deleted file mode 100644
index 7dfac816..00000000
--- a/examples/shaders_postprocessing.lua
+++ /dev/null
@@ -1,99 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [shaders] example - Apply a postprocessing shader to a scene
---
--- NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support,
--- OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version.
---
--- NOTE: Shaders used in this example are #version 330 (OpenGL 3.3), to test this example
--- on OpenGL ES 2.0 platforms (Android, Raspberry Pi, HTML5), use #version 100 shaders
--- raylib comes with shaders ready for both versions, check raylib/shaders install folder
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-SetConfigFlags(FLAG.MSAA_4X_HINT) -- Enable Multi Sampling Anti Aliasing 4x (if available)
-
-InitWindow(screenWidth, screenHeight, "raylib [shaders] example - postprocessing shader")
-
--- Define the camera to look into our 3d world
-local camera = Camera(Vector3(3.0, 3.0, 3.0), Vector3(0.0, 1.5, 0.0), Vector3(0.0, 1.0, 0.0), 45.0)
-
-local dwarf = LoadModel("resources/model/dwarf.obj") -- Load OBJ model
-local texture = LoadTexture("resources/model/dwarf_diffuse.png") -- Load model texture (diffuse map)
-dwarf.material.texDiffuse = texture -- Set dwarf model diffuse texture
-
-local position = Vector3(0.0, 0.0, 0.0) -- Set model position
-
-local shader = LoadShader("resources/shaders/glsl330/base.vs",
- "resources/shaders/glsl330/bloom.fs") -- Load postpro shader
-
--- Create a RenderTexture2D to be used for render to texture
-local target = LoadRenderTexture(screenWidth, screenHeight)
-
--- Setup orbital camera
-SetCameraMode(camera, CameraMode.ORBITAL) -- Set an orbital camera mode
-
-SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- camera = UpdateCamera(camera) -- Update camera
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- BeginTextureMode(target) -- Enable drawing to texture
-
- Begin3dMode(camera)
-
- DrawModel(dwarf, position, 2.0, WHITE) -- Draw 3d model with texture
-
- DrawGrid(10, 1.0) -- Draw a grid
-
- End3dMode()
-
- DrawText("HELLO POSTPROCESSING!", 70, 190, 50, RED)
-
- EndTextureMode() -- End drawing to texture (now we have a texture available for next passes)
-
- BeginShaderMode(shader)
-
- -- NOTE: Render texture must be y-flipped due to default OpenGL coordinates (left-bottom)
- DrawTextureRec(target.texture, Rectangle(0, 0, target.texture.width, -target.texture.height), Vector2(0, 0), WHITE)
-
- EndShaderMode()
-
- DrawText("(c) Dwarf 3D model by David Moreno", screenWidth - 200, screenHeight - 20, 10, DARKGRAY)
-
- DrawFPS(10, 10)
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-UnloadShader(shader) -- Unload shader
-UnloadTexture(texture) -- Unload texture
-UnloadModel(dwarf) -- Unload model
-UnloadRenderTexture(target) -- Unload render texture
-
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/shaders_shapes_textures.lua b/examples/shaders_shapes_textures.lua
deleted file mode 100644
index caaeba1a..00000000
--- a/examples/shaders_shapes_textures.lua
+++ /dev/null
@@ -1,101 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [shaders] example - Apply a shader to some shape or texture
---
--- NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support,
--- OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version.
---
--- NOTE: Shaders used in this example are #version 330 (OpenGL 3.3), to test this example
--- on OpenGL ES 2.0 platforms (Android, Raspberry Pi, HTML5), use #version 100 shaders
--- raylib comes with shaders ready for both versions, check raylib/shaders install folder
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [shaders] example - shapes and texture shaders")
-
-local sonic = LoadTexture("resources/texture_formats/sonic.png")
-
--- NOTE: Using GLSL 330 shader version, on OpenGL ES 2.0 use GLSL 100 shader version
-local shader = LoadShader("resources/shaders/glsl330/base.vs",
- "resources/shaders/glsl330/grayscale.fs")
-
--- Shader usage is also different than models/postprocessing, shader is just activated when required
-
-SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- -- TODO: Update your variables here
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- -- Start drawing with default shader
-
- DrawText("USING DEFAULT SHADER", 20, 40, 10, RED)
-
- DrawCircle(80, 120, 35, DARKBLUE)
- DrawCircleGradient(80, 220, 60, GREEN, SKYBLUE)
- DrawCircleLines(80, 340, 80, DARKBLUE)
-
-
- -- Activate our custom shader to be applied on next shapes/textures drawings
- BeginShaderMode(shader)
-
- DrawText("USING CUSTOM SHADER", 190, 40, 10, RED)
-
- DrawRectangle(250 - 60, 90, 120, 60, RED)
- DrawRectangleGradient(250 - 90, 170, 180, 130, MAROON, GOLD)
- DrawRectangleLines(250 - 40, 320, 80, 60, ORANGE)
-
- -- Activate our default shader for next drawings
- EndShaderMode()
-
- DrawText("USING DEFAULT SHADER", 370, 40, 10, RED)
-
- DrawTriangle(Vector2(430, 80),
- Vector2(430 - 60, 150),
- Vector2(430 + 60, 150), VIOLET)
-
- DrawTriangleLines(Vector2(430, 160),
- Vector2(430 - 20, 230),
- Vector2(430 + 20, 230), DARKBLUE)
-
- DrawPoly(Vector2(430, 320), 6, 80, 0, BROWN)
-
- -- Activate our custom shader to be applied on next shapes/textures drawings
- BeginShaderMode(shader)
-
- DrawTexture(sonic, 380, -10, WHITE) -- Using custom shader
-
- -- Activate our default shader for next drawings
- EndShaderMode()
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-UnloadShader(shader) -- Unload shader
-UnloadTexture(sonic) -- Unload texture
-
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/shaders_standard_lighting.lua b/examples/shaders_standard_lighting.lua
deleted file mode 100644
index 1d4dcfcf..00000000
--- a/examples/shaders_standard_lighting.lua
+++ /dev/null
@@ -1,112 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [shaders] example - Standard lighting (materials and lights)
---
--- NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support,
--- OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version.
---
--- NOTE: Shaders used in this example are #version 330 (OpenGL 3.3), to test this example
--- on OpenGL ES 2.0 platforms (Android, Raspberry Pi, HTML5), use #version 100 shaders
--- raylib comes with shaders ready for both versions, check raylib/shaders install folder
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-SetConfigFlags(FLAG.MSAA_4X_HINT) -- Enable Multi Sampling Anti Aliasing 4x (if available)
-
-InitWindow(screenWidth, screenHeight, "raylib [shaders] example - model shader")
-
--- Define the camera to look into our 3d world
-local camera = Camera(Vector3(4.0, 4.0, 4.0), Vector3(0.0, 1.5, 0.0), Vector3(0.0, 1.0, 0.0), 45.0)
-
-local dwarf = LoadModel("resources/model/dwarf.obj") -- Load OBJ model
-local position = Vector3(0.0, 0.0, 0.0) -- Set model position
-
-local material = LoadStandardMaterial()
-
-material.texDiffuse = LoadTexture("resources/model/dwarf_diffuse.png") -- Load model diffuse texture
-material.texNormal = LoadTexture("resources/model/dwarf_normal.png") -- Load model normal texture
-material.texSpecular = LoadTexture("resources/model/dwarf_specular.png") -- Load model specular texture
-material.colDiffuse = WHITE
-material.colAmbient = Color(0, 0, 10, 255)
-material.colSpecular = WHITE
-material.glossiness = 50.0
-
-dwarf.material = material -- Apply material to model
-
-local spotLight = CreateLight(LightType.SPOT, Vector3(3.0, 5.0, 2.0), Color(255, 255, 255, 255))
-spotLight.target = Vector3(0.0, 0.0, 0.0)
-spotLight.intensity = 2.0
-spotLight.diffuse = Color(255, 100, 100, 255)
-spotLight.coneAngle = 60.0
-
-local dirLight = CreateLight(LightType.DIRECTIONAL, Vector3(0.0, -3.0, -3.0), Color(255, 255, 255, 255))
-dirLight.target = Vector3(1.0, -2.0, -2.0)
-dirLight.intensity = 2.0
-dirLight.diffuse = Color(100, 255, 100, 255)
-
-local pointLight = CreateLight(LightType.POINT, Vector3(0.0, 4.0, 5.0), Color(255, 255, 255, 255))
-pointLight.intensity = 2.0
-pointLight.diffuse = Color(100, 100, 255, 255)
-pointLight.radius = 3.0
-
--- Setup orbital camera
-SetCameraMode(camera, CameraMode.ORBITAL) -- Set an orbital camera mode
-
-SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- camera = UpdateCamera(camera) -- Update camera
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- Begin3dMode(camera)
-
- DrawModel(dwarf, position, 2.0, WHITE) -- Draw 3d model with texture
-
- DrawLight(spotLight) -- Draw spot light
- DrawLight(dirLight) -- Draw directional light
- DrawLight(pointLight) -- Draw point light
-
- DrawGrid(10, 1.0) -- Draw a grid
-
- End3dMode()
-
- DrawText("(c) Dwarf 3D model by David Moreno", screenWidth - 200, screenHeight - 20, 10, GRAY)
-
- DrawFPS(10, 10)
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-UnloadMaterial(material) -- Unload material and assigned textures
-UnloadModel(dwarf) -- Unload model
-
--- Destroy all created lights
-DestroyLight(pointLight)
-DestroyLight(dirLight)
-DestroyLight(spotLight)
-
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/shapes_basic_shapes.lua b/examples/shapes_basic_shapes.lua
deleted file mode 100644
index cc943ba3..00000000
--- a/examples/shapes_basic_shapes.lua
+++ /dev/null
@@ -1,64 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [shapes] example - Draw basic shapes 2d (rectangle, circle, line...)
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [shapes] example - basic shapes drawing")
-
-SetTargetFPS(60) -- Set target frames-per-second
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- -- TODO: Update your variables here
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- DrawText("some basic shapes available on raylib", 20, 20, 20, DARKGRAY)
-
- DrawLine(18, 42, screenWidth - 18, 42, BLACK)
-
- DrawCircle(screenWidth/4, 120, 35, DARKBLUE)
- DrawCircleGradient(screenWidth/4, 220, 60, GREEN, SKYBLUE)
- DrawCircleLines(screenWidth/4, 340, 80, DARKBLUE)
-
- DrawRectangle(screenWidth/4*2 - 60, 100, 120, 60, RED)
- DrawRectangleGradient(screenWidth/4*2 - 90, 170, 180, 130, MAROON, GOLD)
- DrawRectangleLines(screenWidth/4*2 - 40, 320, 80, 60, ORANGE)
-
- DrawTriangle(Vector2(screenWidth/4*3, 80),
- Vector2(screenWidth/4*3 - 60, 150),
- Vector2(screenWidth/4*3 + 60, 150), VIOLET)
-
- DrawTriangleLines(Vector2(screenWidth/4*3, 160),
- Vector2(screenWidth/4*3 - 20, 230),
- Vector2(screenWidth/4*3 + 20, 230), DARKBLUE)
-
- DrawPoly(Vector2(screenWidth/4*3, 320), 6, 80, 0, BROWN)
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/shapes_colors_palette.lua b/examples/shapes_colors_palette.lua
deleted file mode 100644
index e884cd3e..00000000
--- a/examples/shapes_colors_palette.lua
+++ /dev/null
@@ -1,89 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [shapes] example - Draw raylib custom color palette
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [shapes] example - raylib color palette")
-
-SetTargetFPS(60) -- Set target frames-per-second
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- -- TODO: Update your variables here
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- DrawText("raylib color palette", 28, 42, 20, BLACK)
-
- DrawRectangle(26, 80, 100, 100, DARKGRAY)
- DrawRectangle(26, 188, 100, 100, GRAY)
- DrawRectangle(26, 296, 100, 100, LIGHTGRAY)
- DrawRectangle(134, 80, 100, 100, MAROON)
- DrawRectangle(134, 188, 100, 100, RED)
- DrawRectangle(134, 296, 100, 100, PINK)
- DrawRectangle(242, 80, 100, 100, ORANGE)
- DrawRectangle(242, 188, 100, 100, GOLD)
- DrawRectangle(242, 296, 100, 100, YELLOW)
- DrawRectangle(350, 80, 100, 100, DARKGREEN)
- DrawRectangle(350, 188, 100, 100, LIME)
- DrawRectangle(350, 296, 100, 100, GREEN)
- DrawRectangle(458, 80, 100, 100, DARKBLUE)
- DrawRectangle(458, 188, 100, 100, BLUE)
- DrawRectangle(458, 296, 100, 100, SKYBLUE)
- DrawRectangle(566, 80, 100, 100, DARKPURPLE)
- DrawRectangle(566, 188, 100, 100, VIOLET)
- DrawRectangle(566, 296, 100, 100, PURPLE)
- DrawRectangle(674, 80, 100, 100, DARKBROWN)
- DrawRectangle(674, 188, 100, 100, BROWN)
- DrawRectangle(674, 296, 100, 100, BEIGE)
-
-
- DrawText("DARKGRAY", 65, 166, 10, BLACK)
- DrawText("GRAY", 93, 274, 10, BLACK)
- DrawText("LIGHTGRAY", 61, 382, 10, BLACK)
- DrawText("MAROON", 186, 166, 10, BLACK)
- DrawText("RED", 208, 274, 10, BLACK)
- DrawText("PINK", 204, 382, 10, BLACK)
- DrawText("ORANGE", 295, 166, 10, BLACK)
- DrawText("GOLD", 310, 274, 10, BLACK)
- DrawText("YELLOW", 300, 382, 10, BLACK)
- DrawText("DARKGREEN", 382, 166, 10, BLACK)
- DrawText("LIME", 420, 274, 10, BLACK)
- DrawText("GREEN", 410, 382, 10, BLACK)
- DrawText("DARKBLUE", 498, 166, 10, BLACK)
- DrawText("BLUE", 526, 274, 10, BLACK)
- DrawText("SKYBLUE", 505, 382, 10, BLACK)
- DrawText("DARKPURPLE", 592, 166, 10, BLACK)
- DrawText("VIOLET", 621, 274, 10, BLACK)
- DrawText("PURPLE", 620, 382, 10, BLACK)
- DrawText("DARKBROWN", 705, 166, 10, BLACK)
- DrawText("BROWN", 733, 274, 10, BLACK)
- DrawText("BEIGE", 737, 382, 10, BLACK)
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/shapes_logo_raylib.lua b/examples/shapes_logo_raylib.lua
deleted file mode 100644
index 4e7f18c4..00000000
--- a/examples/shapes_logo_raylib.lua
+++ /dev/null
@@ -1,48 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [shapes] example - Draw raylib logo using basic shapes
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [shapes] example - raylib logo using shapes")
-
-SetTargetFPS(60) -- Set target frames-per-second
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- -- TODO: Update your variables here
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- DrawRectangle(screenWidth/2 - 128, screenHeight/2 - 128, 256, 256, BLACK)
- DrawRectangle(screenWidth/2 - 112, screenHeight/2 - 112, 224, 224, RAYWHITE)
- DrawText("raylib", screenWidth/2 - 44, screenHeight/2 + 48, 50, BLACK)
-
- DrawText("this is NOT a texture!", 350, 370, 10, GRAY)
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/shapes_logo_raylib_anim.lua b/examples/shapes_logo_raylib_anim.lua
deleted file mode 100644
index c6c44995..00000000
--- a/examples/shapes_logo_raylib_anim.lua
+++ /dev/null
@@ -1,127 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [shapes] example - raylib logo animation
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [shapes] example - raylib logo animation")
-
-local logoPositionX = screenWidth/2 - 128
-local logoPositionY = screenHeight/2 - 128
-
-local framesCounter = 0
-local lettersCount = 0
-
-local topSideRecWidth = 16
-local leftSideRecHeight = 16
-
-local bottomSideRecWidth = 16
-local rightSideRecHeight = 16
-
-local state = 0 -- Tracking animation states (State Machine)
-local alpha = 1.0 -- Useful for fading
-
-SetTargetFPS(60) -- Set target frames-per-second
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- if (state == 0) then -- State 0: Small box blinking
- framesCounter = framesCounter + 1
-
- if (framesCounter == 120) then
- state = 1
- framesCounter = 0 -- Reset counter... will be used later...
- end
- elseif (state == 1) then -- State 1: Top and left bars growing
- topSideRecWidth = topSideRecWidth + 4
- leftSideRecHeight = leftSideRecHeight + 4
-
- if (topSideRecWidth == 256) then state = 2 end
- elseif (state == 2) then -- State 2: Bottom and right bars growing
- bottomSideRecWidth = bottomSideRecWidth + 4
- rightSideRecHeight = rightSideRecHeight + 4
-
- if (bottomSideRecWidth == 256) then state = 3 end
- elseif (state == 3) then -- State 3: Letters appearing (one by one)
- framesCounter = framesCounter + 1
-
- if (framesCounter//12 == 1) then -- Every 12 frames, one more letter!
- lettersCount = lettersCount + 1
- framesCounter = 0
- end
-
- if (lettersCount >= 10) then -- When all letters have appeared, just fade out everything
- alpha = alpha - 0.02
-
- if (alpha <= 0.0) then
- alpha = 0.0
- state = 4
- end
- end
- elseif (state == 4) then -- State 4: Reset and Replay
- if (IsKeyPressed(KEY.R)) then
- framesCounter = 0
- lettersCount = 0
-
- topSideRecWidth = 16
- leftSideRecHeight = 16
-
- bottomSideRecWidth = 16
- rightSideRecHeight = 16
-
- alpha = 1.0
- state = 0 -- Return to State 0
- end
- end
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- if (state == 0) then
- if ((framesCounter//15)%2 == 1) then DrawRectangle(logoPositionX, logoPositionY, 16, 16, BLACK) end
- elseif (state == 1) then
- DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, BLACK)
- DrawRectangle(logoPositionX, logoPositionY, 16, leftSideRecHeight, BLACK)
- elseif (state == 2) then
- DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, BLACK)
- DrawRectangle(logoPositionX, logoPositionY, 16, leftSideRecHeight, BLACK)
-
- DrawRectangle(logoPositionX + 240, logoPositionY, 16, rightSideRecHeight, BLACK)
- DrawRectangle(logoPositionX, logoPositionY + 240, bottomSideRecWidth, 16, BLACK)
- elseif (state == 3) then
- DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, Fade(BLACK, alpha))
- DrawRectangle(logoPositionX, logoPositionY + 16, 16, leftSideRecHeight - 32, Fade(BLACK, alpha))
-
- DrawRectangle(logoPositionX + 240, logoPositionY + 16, 16, rightSideRecHeight - 32, Fade(BLACK, alpha))
- DrawRectangle(logoPositionX, logoPositionY + 240, bottomSideRecWidth, 16, Fade(BLACK, alpha))
-
- DrawRectangle(screenWidth/2 - 112, screenHeight/2 - 112, 224, 224, Fade(RAYWHITE, alpha))
-
- DrawText(string.sub("raylib", 0, lettersCount), screenWidth/2 - 44, screenHeight/2 + 48, 50, Fade(BLACK, alpha))
- elseif (state == 4) then DrawText("[R] REPLAY", 340, 200, 20, GRAY) end
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/text_bmfont_ttf.lua b/examples/text_bmfont_ttf.lua
deleted file mode 100644
index 3b8bf004..00000000
--- a/examples/text_bmfont_ttf.lua
+++ /dev/null
@@ -1,59 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [text] example - BMFont and TTF SpriteFonts loading
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [text] example - bmfont and ttf sprite fonts loading")
-
-local msgBm = "THIS IS AN AngelCode SPRITE FONT"
-local msgTtf = "THIS FONT has been GENERATED from TTF"
-
--- NOTE: Textures/Fonts MUST be loaded after Window initialization (OpenGL context is required)
-local fontBm = LoadSpriteFont("resources/fonts/bmfont.fnt") -- BMFont (AngelCode)
-local fontTtf = LoadSpriteFont("resources/fonts/pixantiqua.ttf") -- TTF font
-
-local fontPosition = Vector2(0, 0)
-fontPosition.x = screenWidth/2 - MeasureTextEx(fontBm, msgBm, fontBm.size, 0).x/2
-fontPosition.y = screenHeight/2 - fontBm.size/2 - 80
-
-SetTargetFPS(60) -- Set target frames-per-second
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- -- TODO: Update variables here...
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- DrawTextEx(fontBm, msgBm, fontPosition, fontBm.size, 0, MAROON)
- DrawTextEx(fontTtf, msgTtf, Vector2(60.0, 240.0), fontTtf.size, 2, LIME)
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-UnloadSpriteFont(fontBm) -- AngelCode SpriteFont unloading
-UnloadSpriteFont(fontTtf) -- TTF SpriteFont unloading
-
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/text_bmfont_unordered.lua b/examples/text_bmfont_unordered.lua
deleted file mode 100644
index f324ca19..00000000
--- a/examples/text_bmfont_unordered.lua
+++ /dev/null
@@ -1,57 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [text] example - BMFont unordered chars loading and drawing
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [text] example - bmfont unordered loading and drawing")
-
--- NOTE: Using chars outside the [32..127] limits!
--- NOTE: If a character is not found in the font, it just renders a space
-local msg = "ASCII extended characters:\n¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆ\nÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæ\nçèéêëìíîïðñòóôõö÷øùúûüýþÿ"
-
--- NOTE: Loaded font has an unordered list of characters (chars in the range 32..255)
-local font = LoadSpriteFont("resources/fonts/pixantiqua.fnt") -- BMFont (AngelCode)
-
-SetTargetFPS(60)
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- -- TODO: Update variables here...
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- DrawText("Font name: PixAntiqua", 40, 50, 20, GRAY)
- DrawText(string.format("Font base size: %i", font.size), 40, 80, 20, GRAY)
- DrawText(string.format("Font chars number: %i", font.numChars), 40, 110, 20, GRAY)
-
- DrawTextEx(font, msg, Vector2(40, 180), font.size, 0, MAROON)
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-UnloadSpriteFont(font) -- AngelCode SpriteFont unloading
-
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/text_font_select.lua b/examples/text_font_select.lua
deleted file mode 100644
index f6cea881..00000000
--- a/examples/text_font_select.lua
+++ /dev/null
@@ -1,143 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [text] example - Font selector
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [text] example - font selector")
-
--- NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
-local fonts = {} -- SpriteFont array
-
-fonts[1] = LoadSpriteFont("resources/fonts/alagard.rbmf") -- SpriteFont loading
-fonts[2] = LoadSpriteFont("resources/fonts/pixelplay.rbmf") -- SpriteFont loading
-fonts[3] = LoadSpriteFont("resources/fonts/mecha.rbmf") -- SpriteFont loading
-fonts[4] = LoadSpriteFont("resources/fonts/setback.rbmf") -- SpriteFont loading
-fonts[5] = LoadSpriteFont("resources/fonts/romulus.rbmf") -- SpriteFont loading
-fonts[6] = LoadSpriteFont("resources/fonts/pixantiqua.rbmf") -- SpriteFont loading
-fonts[7] = LoadSpriteFont("resources/fonts/alpha_beta.rbmf") -- SpriteFont loading
-fonts[8] = LoadSpriteFont("resources/fonts/jupiter_crash.rbmf") -- SpriteFont loading
-
-local currentFont = 1 -- Selected font
-
-local colors = { MAROON, ORANGE, DARKGREEN, DARKBLUE, DARKPURPLE, LIME, GOLD, RED }
-
-local fontNames = { "[1] Alagard", "[2] PixelPlay", "[3] MECHA", "[4] Setback",
- "[5] Romulus", "[6] PixAntiqua", "[7] Alpha Beta", "[8] Jupiter Crash" }
-
-local text = "THIS is THE FONT you SELECTED!" -- Main text
-
-local textSize = MeasureTextEx(fonts[currentFont], text, fonts[currentFont].size*3, 1)
-
-local mousePoint
-
-local btnNextOutColor = DARKBLUE -- Button color (outside line)
-local btnNextInColor = SKYBLUE -- Button color (inside)
-
-local framesCounter = 0 -- Useful to count frames button is 'active' = clicked
-
-local positionY = 180 -- Text selector and button Y position
-
-local btnNextRec = Rectangle(673, positionY, 109, 44) -- Button rectangle (useful for collision)
-
-SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
-
- -- Keyboard-based font selection (easy)
- if (IsKeyPressed(KEY.RIGHT)) then
- if (currentFont < 8) then currentFont = currentFont + 1 end
- end
-
- if (IsKeyPressed(KEY.LEFT)) then
- if (currentFont > 1) then currentFont = currentFont - 1 end
- end
-
- if (IsKeyPressed(KEY.ZERO)) then currentFont = 0
- elseif (IsKeyPressed(KEY.ONE)) then currentFont = 1
- elseif (IsKeyPressed(KEY.TWO)) then currentFont = 2
- elseif (IsKeyPressed(KEY.THREE)) then currentFont = 3
- elseif (IsKeyPressed(KEY.FOUR)) then currentFont = 4
- elseif (IsKeyPressed(KEY.FIVE)) then currentFont = 5
- elseif (IsKeyPressed(KEY.SIX)) then currentFont = 6
- elseif (IsKeyPressed(KEY.SEVEN)) then currentFont = 7
- end
-
- -- Mouse-based font selection (NEXT button logic)
- mousePoint = GetMousePosition()
-
- if (CheckCollisionPointRec(mousePoint, btnNextRec)) then
- -- Mouse hover button logic
- if (framesCounter == 0) then
- btnNextOutColor = DARKPURPLE
- btnNextInColor = PURPLE
- end
-
- if (IsMouseButtonDown(MOUSE.LEFT_BUTTON)) then
- framesCounter = 20 -- Frames button is 'active'
- btnNextOutColor = MAROON
- btnNextInColor = RED
- end
- else
- -- Mouse not hover button
- btnNextOutColor = DARKBLUE
- btnNextInColor = SKYBLUE
- end
-
- if (framesCounter > 0) then framesCounter = framesCounter - 1 end
-
- if (framesCounter == 1) then -- We change font on frame 1
- currentFont = currentFont + 1
- if (currentFont > 7) then currentFont = 0 end
- end
-
- -- Text measurement for better positioning on screen
- textSize = MeasureTextEx(fonts[currentFont], text, fonts[currentFont].size*3, 1)
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- DrawText("font selector - use arroys, button or numbers", 160, 80, 20, DARKGRAY)
- DrawLine(120, 120, 680, 120, DARKGRAY)
-
- DrawRectangle(18, positionY, 644, 44, DARKGRAY)
- DrawRectangle(20, positionY + 2, 640, 40, LIGHTGRAY)
- DrawText(fontNames[currentFont], 30, positionY + 13, 20, BLACK)
- DrawText("< >", 610, positionY + 8, 30, BLACK)
-
- DrawRectangleRec(btnNextRec, btnNextOutColor)
- DrawRectangle(675, positionY + 2, 105, 40, btnNextInColor)
- DrawText("NEXT", 700, positionY + 13, 20, btnNextOutColor)
-
- DrawTextEx(fonts[currentFont], text, Vector2(screenWidth/2 - textSize.x/2,
- 260 + (70 - textSize.y)/2), fonts[currentFont].size*3,
- 1, colors[currentFont])
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-for i = 1, 8 do UnloadSpriteFont(fonts[i]) end -- SpriteFont(s) unloading
-
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/text_format_text.lua b/examples/text_format_text.lua
deleted file mode 100644
index ba121db3..00000000
--- a/examples/text_format_text.lua
+++ /dev/null
@@ -1,54 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [text] example - Text formatting
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [text] example - text formatting")
-
-local score = 100020
-local hiscore = 200450
-local lives = 5
-
-SetTargetFPS(60) -- Set target frames-per-second
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- -- TODO: Update your variables here
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- DrawText(string.format("Score: %08i", score), 200, 80, 20, RED)
-
- DrawText(string.format("HiScore: %08i", hiscore), 200, 120, 20, GREEN)
-
- DrawText(string.format("Lives: %02i", lives), 200, 160, 40, BLUE)
-
- DrawText(string.format("Elapsed Time: %02.02f ms", GetFrameTime()*1000), 200, 220, 20, BLACK)
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/text_rbmf_fonts.lua b/examples/text_rbmf_fonts.lua
deleted file mode 100644
index 31a733f1..00000000
--- a/examples/text_rbmf_fonts.lua
+++ /dev/null
@@ -1,87 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [text] example - raylib bitmap font (rbmf) loading and usage
---
--- NOTE: raylib is distributed with some free to use fonts (even for commercial pourposes!)
--- To view details and credits for those fonts, check raylib license file
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [text] example - rBMF fonts")
-
--- NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
-local fonts = {}
-
-fonts[1] = LoadSpriteFont("resources/fonts/alagard.rbmf") -- rBMF font loading
-fonts[2] = LoadSpriteFont("resources/fonts/pixelplay.rbmf") -- rBMF font loading
-fonts[3] = LoadSpriteFont("resources/fonts/mecha.rbmf") -- rBMF font loading
-fonts[4] = LoadSpriteFont("resources/fonts/setback.rbmf") -- rBMF font loading
-fonts[5] = LoadSpriteFont("resources/fonts/romulus.rbmf") -- rBMF font loading
-fonts[6] = LoadSpriteFont("resources/fonts/pixantiqua.rbmf") -- rBMF font loading
-fonts[7] = LoadSpriteFont("resources/fonts/alpha_beta.rbmf") -- rBMF font loading
-fonts[8] = LoadSpriteFont("resources/fonts/jupiter_crash.rbmf") -- rBMF font loading
-
-local messages = { "ALAGARD FONT designed by Hewett Tsoi",
- "PIXELPLAY FONT designed by Aleksander Shevchuk",
- "MECHA FONT designed by Captain Falcon",
- "SETBACK FONT designed by Brian Kent (AEnigma)",
- "ROMULUS FONT designed by Hewett Tsoi",
- "PIXANTIQUA FONT designed by Gerhard Grossmann",
- "ALPHA_BETA FONT designed by Brian Kent (AEnigma)",
- "JUPITER_CRASH FONT designed by Brian Kent (AEnigma)" }
-
-local spacings = { 2, 4, 8, 4, 3, 4, 4, 1 }
-
-local positions = {}
-
-for i = 1, 8 do
- positions[i] = Vector2(0, 0)
- positions[i].x = screenWidth/2 - MeasureTextEx(fonts[i], messages[i], fonts[i].size*2, spacings[i]).x/2
- positions[i].y = 60 + fonts[i].size + 45*(i - 1)
-end
-
-local colors = { MAROON, ORANGE, DARKGREEN, DARKBLUE, DARKPURPLE, LIME, GOLD, BLACK }
-
-SetTargetFPS(60) -- Set target frames-per-second
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- -- TODO: Update your variables here
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- DrawText("free fonts included with raylib", 250, 20, 20, DARKGRAY)
- DrawLine(220, 50, 590, 50, DARKGRAY)
-
- for i = 1, 8 do
- DrawTextEx(fonts[i], messages[i], positions[i], fonts[i].size*2, spacings[i], colors[i])
- end
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-for i = 1, 8 do UnloadSpriteFont(fonts[i]) end -- SpriteFont unloading
-
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/text_sprite_fonts.lua b/examples/text_sprite_fonts.lua
deleted file mode 100644
index 341e2ffe..00000000
--- a/examples/text_sprite_fonts.lua
+++ /dev/null
@@ -1,72 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [text] example - SpriteFont loading and usage
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [text] example - sprite fonts usage")
-
-local msg1 = "THIS IS A custom SPRITE FONT..."
-local msg2 = "...and this is ANOTHER CUSTOM font..."
-local msg3 = "...and a THIRD one! GREAT! :D"
-
--- NOTE: Textures/Fonts MUST be loaded after Window initialization (OpenGL context is required)
-local font1 = LoadSpriteFont("resources/fonts/custom_mecha.png") -- SpriteFont loading
-local font2 = LoadSpriteFont("resources/fonts/custom_alagard.png") -- SpriteFont loading
-local font3 = LoadSpriteFont("resources/fonts/custom_jupiter_crash.png") -- SpriteFont loading
-
-local fontPosition1 = Vector2(0, 0)
-local fontPosition2 = Vector2(0, 0)
-local fontPosition3 = Vector2(0, 0)
-
-fontPosition1.x = screenWidth/2 - MeasureTextEx(font1, msg1, font1.size, -3).x/2
-fontPosition1.y = screenHeight/2 - font1.size/2 - 80
-
-fontPosition2.x = screenWidth/2 - MeasureTextEx(font2, msg2, font2.size, -2).x/2
-fontPosition2.y = screenHeight/2 - font2.size/2 - 10
-
-fontPosition3.x = screenWidth/2 - MeasureTextEx(font3, msg3, font3.size, 2).x/2
-fontPosition3.y = screenHeight/2 - font3.size/2 + 50
-
-SetTargetFPS(60) -- Set target frames-per-second
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- -- TODO: Update variables here...
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- DrawTextEx(font1, msg1, fontPosition1, font1.size, -3, WHITE)
- DrawTextEx(font2, msg2, fontPosition2, font2.size, -2, WHITE)
- DrawTextEx(font3, msg3, fontPosition3, font3.size, 2, WHITE)
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-UnloadSpriteFont(font1) -- SpriteFont unloading
-UnloadSpriteFont(font2) -- SpriteFont unloading
-UnloadSpriteFont(font3) -- SpriteFont unloading
-
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/text_ttf_loading.lua b/examples/text_ttf_loading.lua
deleted file mode 100644
index 26443212..00000000
--- a/examples/text_ttf_loading.lua
+++ /dev/null
@@ -1,118 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [text] example - TTF loading and usage
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800;
-local screenHeight = 450;
-
-InitWindow(screenWidth, screenHeight, "raylib [text] example - ttf loading")
-
-local msg = "TTF SpriteFont"
-
--- NOTE: Textures/Fonts MUST be loaded after Window initialization (OpenGL context is required)
-
--- TTF SpriteFont loading with custom generation parameters
-local font = LoadSpriteFontTTF("resources/fonts/KAISG.ttf", 96, 0, 0)
-
--- Generate mipmap levels to use trilinear filtering
--- NOTE: On 2D drawing it won't be noticeable, it looks like FILTER_BILINEAR
---font.texture = GenTextureMipmaps(font.texture) -- ISSUE: attempt to index a SpriteFont value (local 'font')
-
-local fontSize = font.size
-local fontPosition = Vector2(40, screenHeight/2 + 50)
-local textSize
-
-SetTextureFilter(font.texture, TextureFilter.POINT)
-local currentFontFilter = 0 -- Default: FILTER_POINT
-
-local count = 0
-local droppedFiles
-
-SetTargetFPS(60)
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- fontSize = fontSize + GetMouseWheelMove()*4.0
-
- -- Choose font texture filter method
- if (IsKeyPressed(KEY.ONE)) then
- SetTextureFilter(font.texture, TextureFilter.POINT)
- currentFontFilter = 0
- elseif (IsKeyPressed(KEY.TWO)) then
- SetTextureFilter(font.texture, TextureFilter.BILINEAR)
- currentFontFilter = 1
- elseif (IsKeyPressed(KEY.THREE)) then
- -- NOTE: Trilinear filter won't be noticed on 2D drawing
- SetTextureFilter(font.texture, TextureFilter.TRILINEAR)
- currentFontFilter = 2
- end
-
- textSize = MeasureTextEx(font, msg, fontSize, 0)
-
- if (IsKeyDown(KEY.LEFT)) then fontPosition.x = fontPosition.x - 10
- elseif (IsKeyDown(KEY.RIGHT)) then fontPosition.x = fontPosition.x + 10
- end
-
- -- Load a dropped TTF file dynamically (at current fontSize)
- if (IsFileDropped()) then
- droppedFiles = GetDroppedFiles()
- count = #droppedFiles
-
- if (count == 1) then -- Only support one ttf file dropped
- UnloadSpriteFont(font)
- font = LoadSpriteFontTTF(droppedFiles[1], fontSize, 0, 0)
- ClearDroppedFiles()
- end
- end
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- DrawText("Use mouse wheel to change font size", 20, 20, 10, GRAY)
- DrawText("Use KEY_RIGHT and KEY_LEFT to move text", 20, 40, 10, GRAY)
- DrawText("Use 1, 2, 3 to change texture filter", 20, 60, 10, GRAY)
- DrawText("Drop a new TTF font for dynamic loading", 20, 80, 10, DARKGRAY)
-
- DrawTextEx(font, msg, fontPosition, fontSize, 0, BLACK)
-
- -- TODO: It seems texSize measurement is not accurate due to chars offsets...
- --DrawRectangleLines(fontPosition.x, fontPosition.y, textSize.x, textSize.y, RED)
-
- DrawRectangle(0, screenHeight - 80, screenWidth, 80, LIGHTGRAY)
- DrawText(string.format("Font size: %02.02f", fontSize), 20, screenHeight - 50, 10, DARKGRAY)
- DrawText(string.format("Text size: [%02.02f, %02.02f]", textSize.x, textSize.y), 20, screenHeight - 30, 10, DARKGRAY)
- DrawText("CURRENT TEXTURE FILTER:", 250, 400, 20, GRAY)
-
- if (currentFontFilter == 0) then DrawText("POINT", 570, 400, 20, BLACK)
- elseif (currentFontFilter == 1) then DrawText("BILINEAR", 570, 400, 20, BLACK)
- elseif (currentFontFilter == 2) then DrawText("TRILINEAR", 570, 400, 20, BLACK)
- end
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-UnloadSpriteFont(font) -- SpriteFont unloading
-
-ClearDroppedFiles() -- Clear internal buffers
-
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/text_writing_anim.lua b/examples/text_writing_anim.lua
deleted file mode 100644
index f4af9f58..00000000
--- a/examples/text_writing_anim.lua
+++ /dev/null
@@ -1,52 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [text] example - Text Writing Animation
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [text] example - text writing anim")
-
-local message = "This sample illustrates a text writing\nanimation effect! Check it out! )"
-
-local framesCounter = 0
-
-SetTargetFPS(60) -- Set target frames-per-second
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- framesCounter = framesCounter + 1
-
- if (IsKeyPressed(KEY.ENTER)) then framesCounter = 0 end
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- DrawText(string.sub(message, 0, framesCounter//10), 210, 160, 20, MAROON)
-
- DrawText("PRESS [ENTER] to RESTART!", 240, 280, 20, LIGHTGRAY)
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/textures_formats_loading.lua b/examples/textures_formats_loading.lua
deleted file mode 100644
index 1ce10492..00000000
--- a/examples/textures_formats_loading.lua
+++ /dev/null
@@ -1,217 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [textures] example - texture formats loading (compressed and uncompressed)
---
--- NOTE: This example requires raylib OpenGL 3.3+ or ES2 versions for compressed textures,
--- OpenGL 1.1 does not support compressed textures, only uncompressed ones.
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
-NUM_TEXTURES = 24
-
-PNG_R8G8B8A8 = 1
-PVR_GRAYSCALE = 2
-PVR_GRAY_ALPHA = 3
-PVR_R5G6B5 = 4
-PVR_R5G5B5A1 = 5
-PVR_R4G4B4A4 = 6
-DDS_R5G6B5 = 7
-DDS_R5G5B5A1 = 8
-DDS_R4G4B4A4 = 9
-DDS_R8G8B8A8 = 10
-DDS_DXT1_RGB = 11
-DDS_DXT1_RGBA = 12
-DDS_DXT3_RGBA = 13
-DDS_DXT5_RGBA = 14
-PKM_ETC1_RGB = 15
-PKM_ETC2_RGB = 16
-PKM_ETC2_EAC_RGBA = 17
-KTX_ETC1_RGB = 18
-KTX_ETC2_RGB = 19
-KTX_ETC2_EAC_RGBA = 20
-ASTC_4x4_LDR = 21
-ASTC_8x8_LDR = 22
-PVR_PVRT_RGB = 23
-PVR_PVRT_RGBA = 24
-
-local formatText = {
- "PNG_R8G8B8A8",
- "PVR_GRAYSCALE",
- "PVR_GRAY_ALPHA",
- "PVR_R5G6B5",
- "PVR_R5G5B5A1",
- "PVR_R4G4B4A4",
- "DDS_R5G6B5",
- "DDS_R5G5B5A1",
- "DDS_R4G4B4A4",
- "DDS_R8G8B8A8",
- "DDS_DXT1_RGB",
- "DDS_DXT1_RGBA",
- "DDS_DXT3_RGBA",
- "DDS_DXT5_RGBA",
- "PKM_ETC1_RGB",
- "PKM_ETC2_RGB",
- "PKM_ETC2_EAC_RGBA",
- "KTX_ETC1_RGB",
- "KTX_ETC2_RGB",
- "KTX_ETC2_EAC_RGBA",
- "ASTC_4x4_LDR",
- "ASTC_8x8_LDR",
- "PVR_PVRT_RGB",
- "PVR_PVRT_RGBA"
-}
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [textures] example - texture formats loading")
-
--- NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
-
-local sonic = {}
-
-sonic[PNG_R8G8B8A8] = LoadTexture("resources/texture_formats/sonic.png")
-
--- Load UNCOMPRESSED PVR texture data
-sonic[PVR_GRAYSCALE] = LoadTexture("resources/texture_formats/sonic_GRAYSCALE.pvr")
-sonic[PVR_GRAY_ALPHA] = LoadTexture("resources/texture_formats/sonic_L8A8.pvr")
-sonic[PVR_R5G6B5] = LoadTexture("resources/texture_formats/sonic_R5G6B5.pvr")
-sonic[PVR_R5G5B5A1] = LoadTexture("resources/texture_formats/sonic_R5G5B5A1.pvr")
-sonic[PVR_R4G4B4A4] = LoadTexture("resources/texture_formats/sonic_R4G4B4A4.pvr")
-
--- Load UNCOMPRESSED DDS texture data
-sonic[DDS_R5G6B5] = LoadTexture("resources/texture_formats/sonic_R5G6B5.dds")
-sonic[DDS_R5G5B5A1] = LoadTexture("resources/texture_formats/sonic_A1R5G5B5.dds")
-sonic[DDS_R4G4B4A4] = LoadTexture("resources/texture_formats/sonic_A4R4G4B4.dds")
-sonic[DDS_R8G8B8A8] = LoadTexture("resources/texture_formats/sonic_A8R8G8B8.dds")
-
--- Load COMPRESSED DXT DDS texture data (if supported)
-sonic[DDS_DXT1_RGB] = LoadTexture("resources/texture_formats/sonic_DXT1_RGB.dds")
-sonic[DDS_DXT1_RGBA] = LoadTexture("resources/texture_formats/sonic_DXT1_RGBA.dds")
-sonic[DDS_DXT3_RGBA] = LoadTexture("resources/texture_formats/sonic_DXT3_RGBA.dds")
-sonic[DDS_DXT5_RGBA] = LoadTexture("resources/texture_formats/sonic_DXT5_RGBA.dds")
-
--- Load COMPRESSED ETC texture data (if supported)
-sonic[PKM_ETC1_RGB] = LoadTexture("resources/texture_formats/sonic_ETC1_RGB.pkm")
-sonic[PKM_ETC2_RGB] = LoadTexture("resources/texture_formats/sonic_ETC2_RGB.pkm")
-sonic[PKM_ETC2_EAC_RGBA] = LoadTexture("resources/texture_formats/sonic_ETC2_EAC_RGBA.pkm")
-
-sonic[KTX_ETC1_RGB] = LoadTexture("resources/texture_formats/sonic_ETC1_RGB.ktx")
-sonic[KTX_ETC2_RGB] = LoadTexture("resources/texture_formats/sonic_ETC2_RGB.ktx")
-sonic[KTX_ETC2_EAC_RGBA] = LoadTexture("resources/texture_formats/sonic_ETC2_EAC_RGBA.ktx")
-
--- Load COMPRESSED ASTC texture data (if supported)
-sonic[ASTC_4x4_LDR] = LoadTexture("resources/texture_formats/sonic_ASTC_4x4_ldr.astc")
-sonic[ASTC_8x8_LDR] = LoadTexture("resources/texture_formats/sonic_ASTC_8x8_ldr.astc")
-
--- Load COMPRESSED PVR texture data (if supported)
-sonic[PVR_PVRT_RGB] = LoadTexture("resources/texture_formats/sonic_PVRT_RGB.pvr")
-sonic[PVR_PVRT_RGBA] = LoadTexture("resources/texture_formats/sonic_PVRT_RGBA.pvr")
-
-local selectedFormat = PNG_R8G8B8A8
-
-local selectRecs = {}
-
-for i = 1, NUM_TEXTURES do
- if ((i - 1) < NUM_TEXTURES//2) then selectRecs[i] = Rectangle(40, 30 + 32*(i - 1), 150, 30)
- else selectRecs[i] = Rectangle(40 + 152, 30 + 32*((i - 1) - NUM_TEXTURES//2), 150, 30) end
-end
-
--- Texture sizes in KB
-local textureSizes = {
- 512*512*32/8/1024, --PNG_R8G8B8A8 (32 bpp)
- 512*512*8/8/1024, --PVR_GRAYSCALE (8 bpp)
- 512*512*16/8/1024, --PVR_GRAY_ALPHA (16 bpp)
- 512*512*16/8/1024, --PVR_R5G6B5 (16 bpp)
- 512*512*16/8/1024, --PVR_R5G5B5A1 (16 bpp)
- 512*512*16/8/1024, --PVR_R4G4B4A4 (16 bpp)
- 512*512*16/8/1024, --DDS_R5G6B5 (16 bpp)
- 512*512*16/8/1024, --DDS_R5G5B5A1 (16 bpp)
- 512*512*16/8/1024, --DDS_R4G4B4A4 (16 bpp)
- 512*512*32/8/1024, --DDS_R8G8B8A8 (32 bpp)
- 512*512*4/8/1024, --DDS_DXT1_RGB (4 bpp) -Compressed-
- 512*512*4/8/1024, --DDS_DXT1_RGBA (4 bpp) -Compressed-
- 512*512*8/8/1024, --DDS_DXT3_RGBA (8 bpp) -Compressed-
- 512*512*8/8/1024, --DDS_DXT5_RGBA (8 bpp) -Compressed-
- 512*512*4/8/1024, --PKM_ETC1_RGB (4 bpp) -Compressed-
- 512*512*4/8/1024, --PKM_ETC2_RGB (4 bpp) -Compressed-
- 512*512*8/8/1024, --PKM_ETC2_EAC_RGBA (8 bpp) -Compressed-
- 512*512*4/8/1024, --KTX_ETC1_RGB (4 bpp) -Compressed-
- 512*512*4/8/1024, --KTX_ETC2_RGB (4 bpp) -Compressed-
- 512*512*8/8/1024, --KTX_ETC2_EAC_RGBA (8 bpp) -Compressed-
- 512*512*8/8/1024, --ASTC_4x4_LDR (8 bpp) -Compressed-
- 512*512*2/8/1024, --ASTC_8x8_LDR (2 bpp) -Compressed-
- 512*512*4/8/1024, --PVR_PVRT_RGB (4 bpp) -Compressed-
- 512*512*4/8/1024, --PVR_PVRT_RGBA (4 bpp) -Compressed-
-}
-
-SetTargetFPS(60) -- Set our game to run at 60 frames-per-second
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- if (IsKeyPressed(KEY.DOWN)) then
- selectedFormat = selectedFormat + 1
- if (selectedFormat > NUM_TEXTURES) then selectedFormat = 1 end
- elseif (IsKeyPressed(KEY.UP)) then
- selectedFormat = selectedFormat - 1
- if (selectedFormat < 1) then selectedFormat = NUM_TEXTURES end
- elseif (IsKeyPressed(KEY.RIGHT)) then
- if (selectedFormat < NUM_TEXTURES//2) then selectedFormat = selectedFormat + NUM_TEXTURES//2 end
- elseif (IsKeyPressed(KEY.LEFT)) then
- if (selectedFormat > NUM_TEXTURES//2) then selectedFormat = selectedFormat - NUM_TEXTURES//2 end
- end
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
-
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- -- Draw rectangles
- for i = 1, NUM_TEXTURES do
- if (i == selectedFormat) then
- DrawRectangleRec(selectRecs[i], SKYBLUE)
- DrawRectangleLines(selectRecs[i].x, selectRecs[i].y, selectRecs[i].width, selectRecs[i].height, BLUE)
- DrawText(formatText[i], selectRecs[i].x + selectRecs[i].width/2 - MeasureText(formatText[i], 10)//2, selectRecs[i].y + 11, 10, DARKBLUE)
- else
- DrawRectangleRec(selectRecs[i], LIGHTGRAY)
- DrawRectangleLines(selectRecs[i].x, selectRecs[i].y, selectRecs[i].width, selectRecs[i].height, GRAY)
- DrawText(formatText[i], selectRecs[i].x + selectRecs[i].width/2 - MeasureText(formatText[i], 10)//2, selectRecs[i].y + 11, 10, DARKGRAY)
- end
- end
-
- -- Draw selected texture
- if (sonic[selectedFormat].id ~= 0) then DrawTexture(sonic[selectedFormat], 350, -10, WHITE)
- else
- DrawRectangleLines(488, 165, 200, 110, DARKGRAY)
- DrawText("FORMAT", 550, 180, 20, MAROON)
- DrawText("NOT SUPPORTED", 500, 210, 20, MAROON)
- DrawText("ON YOUR GPU", 520, 240, 20, MAROON)
- end
-
- DrawText("Select texture format (use cursor keys):", 40, 10, 10, DARKGRAY)
- DrawText("Required GPU memory size (VRAM):", 40, 427, 10, DARKGRAY)
- DrawText(string.format("%4.0f KB", textureSizes[selectedFormat]), 240, 420, 20, DARKBLUE)
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-for i = 1, NUM_TEXTURES do UnloadTexture(sonic[i]) end
-
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/textures_image_drawing.lua b/examples/textures_image_drawing.lua
deleted file mode 100644
index 0261b243..00000000
--- a/examples/textures_image_drawing.lua
+++ /dev/null
@@ -1,70 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [textures] example - Image loading and drawing on it
---
--- NOTE: Images are loaded in CPU memory (RAM) textures are loaded in GPU memory (VRAM)
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [textures] example - image drawing")
-
--- NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
-
-local cat = LoadImage("resources/cat.png") -- Load image in CPU memory (RAM)
-cat = ImageCrop(cat, Rectangle(100, 10, 280, 380)) -- Crop an image piece
-cat = ImageFlipHorizontal(cat) -- Flip cropped image horizontally
-cat = ImageResize(cat, 150, 200) -- Resize flipped-cropped image
-
-local parrots = LoadImage("resources/parrots.png") -- Load image in CPU memory (RAM)
-
--- Draw one image over the other with a scaling of 1.5f
-parrots = ImageDraw(parrots, cat, Rectangle(0, 0, cat.width, cat.height), Rectangle(30, 40, cat.width*1.5, cat.height*1.5))
-parrots = ImageCrop(parrots, Rectangle(0, 50, parrots.width, parrots.height - 100)) -- Crop resulting image
-
-UnloadImage(cat) -- Unload image from RAM
-
-local texture = LoadTextureFromImage(parrots) -- Image converted to texture, uploaded to GPU memory (VRAM)
-UnloadImage(parrots) -- Once image has been converted to texture and uploaded to VRAM, it can be unloaded from RAM
-
-SetTargetFPS(60)
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- -- TODO: Update your variables here
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- DrawTexture(texture, screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2 - 40, WHITE)
- DrawRectangleLines(screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2 - 40, texture.width, texture.height, DARKGRAY)
-
- DrawText("We are drawing only one texture from various images composed!", 240, 350, 10, DARKGRAY)
- DrawText("Source images have been cropped, scaled, flipped and copied one over the other.", 190, 370, 10, DARKGRAY)
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-UnloadTexture(texture) -- Texture unloading
-
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/textures_image_loading.lua b/examples/textures_image_loading.lua
deleted file mode 100644
index 05dbce7f..00000000
--- a/examples/textures_image_loading.lua
+++ /dev/null
@@ -1,55 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [textures] example - Image loading and texture creation
---
--- NOTE: Images are loaded in CPU memory (RAM) textures are loaded in GPU memory (VRAM)
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [textures] example - image loading")
-
--- NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
-
-local image = LoadImage("resources/raylib_logo.png") -- Loaded in CPU memory (RAM)
-local texture = LoadTextureFromImage(image) -- Image converted to texture, GPU memory (VRAM)
-
-UnloadImage(image) -- Once image has been converted to texture and uploaded to VRAM, it can be unloaded from RAM
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- -- TODO: Update your variables here
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- DrawTexture(texture, screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2, WHITE)
-
- DrawText("this IS a texture loaded from an image!", 300, 370, 10, GRAY)
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-UnloadTexture(texture) -- Texture unloading
-
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/textures_image_processing.lua b/examples/textures_image_processing.lua
deleted file mode 100644
index b7304b37..00000000
--- a/examples/textures_image_processing.lua
+++ /dev/null
@@ -1,134 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [textures] example - Image processing
---
--- NOTE: Images are loaded in CPU memory (RAM) textures are loaded in GPU memory (VRAM)
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
---#include <stdlib.h> -- Required for: free()
-
-NUM_PROCESSES = 8
-
--- enum ImageProcess
-local COLOR_NONE = 1
-local COLOR_GRAYSCALE = 2
-local COLOR_TINT = 3
-local COLOR_INVERT = 4
-local COLOR_CONTRAST = 5
-local COLOR_BRIGHTNESS = 6
-local FLIP_VERTICAL = 7
-local FLIP_HORIZONTAL = 8
-
-local processText = {
- "NO PROCESSING",
- "COLOR GRAYSCALE",
- "COLOR TINT",
- "COLOR INVERT",
- "COLOR CONTRAST",
- "COLOR BRIGHTNESS",
- "FLIP VERTICAL",
- "FLIP HORIZONTAL"
-}
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [textures] example - image processing")
-
--- NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
-
-local image = LoadImage("resources/parrots.png") -- Loaded in CPU memory (RAM)
-image = ImageFormat(image, TextureFormat.UNCOMPRESSED_R8G8B8A8) -- Format image to RGBA 32bit (required for texture update)
-local texture = LoadTextureFromImage(image) -- Image converted to texture, GPU memory (VRAM)
-
-local currentProcess = COLOR_NONE
-local textureReload = false
-
-local selectRecs = {}
-
-for i = 1, NUM_PROCESSES do selectRecs[i] = Rectangle(40, 50 + 32*i, 150, 30) end
-
-SetTargetFPS(60)
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- if (IsKeyPressed(KEY.DOWN)) then
- currentProcess = currentProcess + 1
- if (currentProcess > NUM_PROCESSES) then currentProcess = 1 end
- textureReload = true
- elseif (IsKeyPressed(KEY.UP)) then
- currentProcess = currentProcess - 1
- if (currentProcess < 1) then currentProcess = NUM_PROCESSES end
- textureReload = true
- end
-
- if (textureReload) then
- UnloadImage(image) -- Unload current image data
- image = LoadImage("resources/parrots.png") -- Re-load image data
-
- -- NOTE: Image processing is a costly CPU process to be done every frame,
- -- If image processing is required in a frame-basis, it should be done
- -- with a texture and by shaders
- if (currentProcess == COLOR_GRAYSCALE) then image = ImageColorGrayscale(image)
- elseif (currentProcess == COLOR_TINT) then image = ImageColorTint(image, GREEN)
- elseif (currentProcess == COLOR_INVERT) then image = ImageColorInvert(image)
- elseif (currentProcess == COLOR_CONTRAST) then image = ImageColorContrast(image, -40)
- elseif (currentProcess == COLOR_BRIGHTNESS) then image = ImageColorBrightness(image, -80)
- elseif (currentProcess == FLIP_VERTICAL) then image = ImageFlipVertical(image)
- elseif (currentProcess == FLIP_HORIZONTAL) then image = ImageFlipHorizontal(image)
- end
-
- local pixels = {}
- pixels = GetImageData(image) -- Get pixel data from image (RGBA 32bit)
- texture = UpdateTexture(texture, pixels) -- Update texture with new image data
-
- textureReload = false
- end
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- DrawText("IMAGE PROCESSING:", 40, 30, 10, DARKGRAY)
-
- -- Draw rectangles
- for i = 1, NUM_PROCESSES do
- if (i == currentProcess) then
- DrawRectangleRec(selectRecs[i], SKYBLUE)
- DrawRectangleLines(selectRecs[i].x, selectRecs[i].y, selectRecs[i].width, selectRecs[i].height, BLUE)
- DrawText(processText[i], selectRecs[i].x + selectRecs[i].width/2 - MeasureText(processText[i], 10)//2, selectRecs[i].y + 11, 10, DARKBLUE)
- else
- DrawRectangleRec(selectRecs[i], LIGHTGRAY)
- DrawRectangleLines(selectRecs[i].x, selectRecs[i].y, selectRecs[i].width, selectRecs[i].height, GRAY)
- DrawText(processText[i], selectRecs[i].x + selectRecs[i].width/2 - MeasureText(processText[i], 10)//2, selectRecs[i].y + 11, 10, DARKGRAY)
- end
- end
-
- DrawTexture(texture, screenWidth - texture.width - 60, screenHeight/2 - texture.height/2, WHITE)
- DrawRectangleLines(screenWidth - texture.width - 60, screenHeight/2 - texture.height/2, texture.width, texture.height, BLACK)
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-UnloadTexture(texture) -- Unload texture from VRAM
-UnloadImage(image) -- Unload image from RAM
-
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/textures_logo_raylib.lua b/examples/textures_logo_raylib.lua
deleted file mode 100644
index 3abcd802..00000000
--- a/examples/textures_logo_raylib.lua
+++ /dev/null
@@ -1,49 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [textures] example - Texture loading and drawing
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [textures] example - texture loading and drawing")
-
--- NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
-local texture = LoadTexture("resources/raylib_logo.png") -- Texture loading
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- -- TODO: Update your variables here
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- DrawTexture(texture, screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2, WHITE)
-
- DrawText("this IS a texture!", 360, 370, 10, GRAY)
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-UnloadTexture(texture) -- Texture unloading
-
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/textures_particles_trail_blending.lua b/examples/textures_particles_trail_blending.lua
deleted file mode 100644
index d2c2518e..00000000
--- a/examples/textures_particles_trail_blending.lua
+++ /dev/null
@@ -1,113 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib example - particles trail blending
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
-MAX_PARTICLES = 200
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [textures] example - particles trail blending")
-
--- Particles pool, reuse them!
-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
- mouseTail[i].size = GetRandomValue(1, 30)/20.0
- mouseTail[i].rotation = GetRandomValue(0, 360)
- mouseTail[i].active = false
-end
-
-local gravity = 3.0
-
-local smoke = LoadTexture("resources/smoke.png")
-
-local blending = BlendMode.ALPHA
-
-SetTargetFPS(60)
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
-
- -- Activate one particle every frame and Update active particles
- -- NOTE: Particles initial position should be mouse position when activated
- -- NOTE: Particles fall down with gravity and rotation... and disappear after 2 seconds (alpha = 0)
- -- NOTE: When a particle disappears, active = false and it can be reused.
- for i = 1, MAX_PARTICLES do
- if (not mouseTail[i].active) then
- mouseTail[i].active = true
- mouseTail[i].alpha = 1.0
- mouseTail[i].position = GetMousePosition()
- break
- end
- end
-
- for i = 1, MAX_PARTICLES do
- if (mouseTail[i].active) then
- mouseTail[i].position.y = mouseTail[i].position.y + gravity
- mouseTail[i].alpha = mouseTail[i].alpha - 0.01
-
- if (mouseTail[i].alpha <= 0.0) then mouseTail[i].active = false end
-
- mouseTail[i].rotation = mouseTail[i].rotation + 5.0
- end
- end
-
- if (IsKeyPressed(KEY.SPACE)) then
- if (blending == BlendMode.ALPHA) then blending = BlendMode.ADDITIVE
- else blending = BlendMode.ALPHA end
- end
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(DARKGRAY)
-
- BeginBlendMode(blending)
-
- -- Draw active particles
- for i = 1, MAX_PARTICLES do
- if (mouseTail[i].active) then
- DrawTexturePro(smoke, Rectangle(0, 0, smoke.width, smoke.height),
- Rectangle(mouseTail[i].position.x, mouseTail[i].position.y,
- smoke.width*mouseTail[i].size//1, smoke.height*mouseTail[i].size//1),
- Vector2(smoke.width*mouseTail[i].size/2, smoke.height*mouseTail[i].size/2),
- mouseTail[i].rotation, Fade(mouseTail[i].color, mouseTail[i].alpha)) end
- end
-
- EndBlendMode()
-
- DrawText("PRESS SPACE to CHANGE BLENDING MODE", 180, 20, 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()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-UnloadTexture(smoke)
-
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/textures_raw_data.lua b/examples/textures_raw_data.lua
deleted file mode 100644
index 0bad1771..00000000
--- a/examples/textures_raw_data.lua
+++ /dev/null
@@ -1,83 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [textures] example - Load textures from raw data
---
--- NOTE: Images are loaded in CPU memory (RAM) textures are loaded in GPU memory (VRAM)
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
---#include <stdlib.h> -- Required for malloc() and free()
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [textures] example - texture from raw data")
-
--- NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
-
--- Load RAW image data (512x512, 32bit RGBA, no file header)
-local sonicRaw = LoadImageRaw("resources/texture_formats/sonic_R8G8B8A8.raw", 512, 512, TextureFormat.UNCOMPRESSED_R8G8B8A8, 0)
-local sonic = LoadTextureFromImage(sonicRaw) -- Upload CPU (RAM) image to GPU (VRAM)
-UnloadImage(sonicRaw) -- Unload CPU (RAM) image data
-
--- Generate a checked texture by code (1024x1024 pixels)
-local width = 1024
-local height = 1024
-
--- Dynamic memory allocation to store pixels data (Color type)
-local pixels = {}
-
-for y = 1, height do
- for x = 1, width do
- if ((((x - 1)/32+(y - 1)//32)//1)%2 == 0) then pixels[(y - 1)*height + x] = DARKBLUE
- else pixels[(y - 1)*height + x] = SKYBLUE end
- end
-end
-
--- Load pixels data into an image structure and create texture
-local checkedIm = LoadImageEx(pixels, width, height)
-local checked = LoadTextureFromImage(checkedIm)
-UnloadImage(checkedIm) -- Unload CPU (RAM) image data
-
--- Dynamic memory must be freed after using it
---free(pixels) -- Unload CPU (RAM) pixels data
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- -- TODO: Update your variables here
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- DrawTexture(checked, screenWidth/2 - checked.width/2, screenHeight/2 - checked.height/2, Fade(WHITE, 0.3))
- DrawTexture(sonic, 330, -20, WHITE)
-
- DrawText("CHECKED TEXTURE ", 84, 100, 30, DARKBLUE)
- DrawText("GENERATED by CODE", 72, 164, 30, DARKBLUE)
- DrawText("and RAW IMAGE LOADING", 46, 226, 30, DARKBLUE)
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-UnloadTexture(sonic) -- Texture unloading
-UnloadTexture(checked) -- Texture unloading
-
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/textures_rectangle.lua b/examples/textures_rectangle.lua
deleted file mode 100644
index 5f481679..00000000
--- a/examples/textures_rectangle.lua
+++ /dev/null
@@ -1,69 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [textures] example - Texture loading and drawing a part defined by a rectangle
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [texture] example - texture rectangle")
-
--- NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
-local guybrush = LoadTexture("resources/guybrush.png") -- Texture loading
-
-local position = Vector2(350.0, 240.0)
-local frameRec = Rectangle(0, 0, guybrush.width/7, guybrush.height)
-local currentFrame = 0
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- if (IsKeyPressed(KEY.RIGHT)) then
- currentFrame = currentFrame + 1
-
- if (currentFrame > 6) then currentFrame = 0 end
-
- frameRec.x = currentFrame*guybrush.width/7
- end
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- DrawTexture(guybrush, 35, 40, WHITE)
- DrawRectangleLines(35, 40, guybrush.width, guybrush.height, LIME)
-
- DrawTextureRec(guybrush, frameRec, position, WHITE) -- Draw part of the texture
-
- DrawRectangleLines(35 + frameRec.x, 40 + frameRec.y, frameRec.width, frameRec.height, RED)
-
- DrawText("PRESS RIGHT KEY to", 540, 310, 10, GRAY)
- DrawText("CHANGE DRAWING RECTANGLE", 520, 330, 10, GRAY)
-
- DrawText("Guybrush Ulysses Threepwood,", 100, 300, 10, GRAY)
- DrawText("main character of the Monkey Island series", 80, 320, 10, GRAY)
- DrawText("of computer adventure games by LucasArts.", 80, 340, 10, GRAY)
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-UnloadTexture(guybrush) -- Texture unloading
-
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/textures_srcrec_dstrec.lua b/examples/textures_srcrec_dstrec.lua
deleted file mode 100644
index f94deb3e..00000000
--- a/examples/textures_srcrec_dstrec.lua
+++ /dev/null
@@ -1,71 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [textures] example - Texture source and destination rectangles
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [textures] examples - texture source and destination rectangles")
-
--- NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
-local guybrush = LoadTexture("resources/guybrush.png") -- Texture loading
-
-local frameWidth = guybrush.width/7
-local frameHeight = guybrush.height
-
--- NOTE: Source rectangle (part of the texture to use for drawing)
-local sourceRec = Rectangle(0, 0, frameWidth, frameHeight)
-
--- NOTE: Destination rectangle (screen rectangle where drawing part of texture)
-local destRec = Rectangle(screenWidth/2, screenHeight/2, frameWidth*2, frameHeight*2)
-
--- NOTE: Origin of the texture (rotation/scale point), it's relative to destination rectangle size
-local origin = Vector2(frameWidth, frameHeight)
-
-local rotation = 0
-
-SetTargetFPS(60)
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- rotation = rotation + 1
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- -- NOTE: Using DrawTexturePro() we can easily rotate and scale the part of the texture we draw
- -- sourceRec defines the part of the texture we use for drawing
- -- destRec defines the rectangle where our texture part will fit (scaling it to fit)
- -- origin defines the point of the texture used as reference for rotation and scaling
- -- rotation defines the texture rotation (using origin as rotation point)
- DrawTexturePro(guybrush, sourceRec, destRec, origin, rotation, WHITE)
-
- DrawLine(destRec.x, 0, destRec.x, screenHeight, GRAY)
- DrawLine(0, destRec.y, screenWidth, destRec.y, GRAY)
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-UnloadTexture(guybrush) -- Texture unloading
-
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/examples/textures_to_image.lua b/examples/textures_to_image.lua
deleted file mode 100644
index b7a2d4ed..00000000
--- a/examples/textures_to_image.lua
+++ /dev/null
@@ -1,60 +0,0 @@
--------------------------------------------------------------------------------------------
---
--- raylib [textures] example - Retrieve image data from texture: GetTextureData()
---
--- NOTE: Images are loaded in CPU memory (RAM) textures are loaded in GPU memory (VRAM)
---
--- This example has been created using raylib 1.6 (www.raylib.com)
--- raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
---
--- Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
---
--------------------------------------------------------------------------------------------
-
--- Initialization
--------------------------------------------------------------------------------------------
-local screenWidth = 800
-local screenHeight = 450
-
-InitWindow(screenWidth, screenHeight, "raylib [textures] example - texture to image")
-
--- NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
-
-local image = LoadImage("resources/raylib_logo.png") -- Load image data into CPU memory (RAM)
-local texture = LoadTextureFromImage(image) -- Image converted to texture, GPU memory (RAM -> VRAM)
-UnloadImage(image) -- Unload image data from CPU memory (RAM)
-
-image = GetTextureData(texture) -- Retrieve image data from GPU memory (VRAM -> RAM)
-UnloadTexture(texture) -- Unload texture from GPU memory (VRAM)
-
-texture = LoadTextureFromImage(image) -- Recreate texture from retrieved image data (RAM -> VRAM)
-UnloadImage(image) -- Unload retrieved image data from CPU memory (RAM)
--------------------------------------------------------------------------------------------
-
--- Main game loop
-while not WindowShouldClose() do -- Detect window close button or ESC key
- -- Update
- ---------------------------------------------------------------------------------------
- -- TODO: Update your variables here
- ---------------------------------------------------------------------------------------
-
- -- Draw
- ---------------------------------------------------------------------------------------
- BeginDrawing()
-
- ClearBackground(RAYWHITE)
-
- DrawTexture(texture, screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2, WHITE)
-
- DrawText("this IS a texture loaded from an image!", 300, 370, 10, GRAY)
-
- EndDrawing()
- ---------------------------------------------------------------------------------------
-end
-
--- De-Initialization
--------------------------------------------------------------------------------------------
-UnloadTexture(texture) -- Texture unloading
-
-CloseWindow() -- Close window and OpenGL context
-------------------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/src/rlua.h b/src/rlua.h
deleted file mode 100644
index 80dede41..00000000
--- a/src/rlua.h
+++ /dev/null
@@ -1,4333 +0,0 @@
-/**********************************************************************************************
-*
-* rlua - raylib Lua bindings
-*
-* NOTE 01:
-* The following types:
-* Color, Vector2, Vector3, Rectangle, Ray, Camera, Camera2D
-* are treated as objects with named fields, same as in C.
-*
-* Lua defines utility functions for creating those objects.
-* Usage:
-* local cl = Color(255,255,255,255)
-* local rec = Rectangle(10, 10, 100, 100)
-* local ray = Ray(Vector3(20, 20, 20), Vector3(50, 50, 50))
-* local x2 = rec.x + rec.width
-*
-* The following types:
-* Image, Texture2D, RenderTexture2D, SpriteFont
-* are immutable, and you can only read their non-pointer arguments (e.g. sprfnt.baseSize).
-*
-* All other object types are opaque, that is, you cannot access or
-* change their fields directly.
-*
-* Remember that ALL raylib types have REFERENCE SEMANTICS in Lua.
-* There is currently no way to create a copy of an opaque object.
-*
-* NOTE 02:
-* Some raylib functions take a pointer to an array, and the size of that array.
-* The equivalent Lua functions take only an array table of the specified type UNLESS
-* it's a pointer to a large char array (e.g. for images), then it takes (and potentially returns)
-* a Lua string (without the size argument, as Lua strings are sized by default).
-*
-* NOTE 03:
-* Some raylib functions take pointers to objects to modify (e.g. ImageToPOT, etc.)
-* In Lua, these functions take values and return a new changed value, instead.
-* So, in C:
-* ImageToPOT(&img, BLACK);
-* In Lua becomes:
-* img = ImageToPOT(img, BLACK)
-*
-* Remember that functions can return multiple values, so:
-* UpdateCameraPlayer(&cam, &playerPos);
-* Vector3 vec = ResolveCollisionCubicmap(img, mapPos, &playerPos, 5.0);
-* becomes:
-* cam, playerPos = UpdateCameraPlayer(cam, playerPos)
-* vec, playerPos = ResolveCollisionCubicmap(img, mapPos, playerPos, 5)
-*
-* This is to preserve value semantics of raylib objects.
-*
-*
-* This Lua binding for raylib was originally created by Ghassan Al-Mashareqa (ghassan@ghassan.pl)
-* for raylib 1.3 and later on reviewed and updated to raylib 1.6 by Ramon Santamaria.
-*
-* Copyright (c) 2015-2016 Ghassan Al-Mashareqa and Ramon Santamaria (@raysan5)
-*
-* 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.
-*
-**********************************************************************************************/
-
-#pragma once
-
-#include "raylib.h"
-
-#define RLUA_STATIC
-#ifdef RLUA_STATIC
- #define RLUADEF static // Functions just visible to module including this file
-#else
- #ifdef __cplusplus
- #define RLUADEF extern "C" // Functions visible from other files (no name mangling of functions in C++)
- #else
- #define RLUADEF extern // Functions visible from other files
- #endif
-#endif
-
-//----------------------------------------------------------------------------------
-// Global Variables Definition
-//----------------------------------------------------------------------------------
-// ...
-
-//----------------------------------------------------------------------------------
-// Module Functions Declaration
-//----------------------------------------------------------------------------------
-RLUADEF void InitLuaDevice(void); // Initialize Lua system
-RLUADEF void ExecuteLuaCode(const char *code); // Execute raylib Lua code
-RLUADEF void ExecuteLuaFile(const char *filename); // Execute raylib Lua script
-RLUADEF void CloseLuaDevice(void); // De-initialize Lua system
-
-/***********************************************************************************
-*
-* RLUA IMPLEMENTATION
-*
-************************************************************************************/
-
-#if defined(RLUA_IMPLEMENTATION)
-
-#include "raylib.h"
-#include "utils.h"
-#include "raymath.h"
-
-#include <string.h>
-#include <stdlib.h>
-
-#include <lua.h>
-#include <lauxlib.h>
-#include <lualib.h>
-
-//----------------------------------------------------------------------------------
-// Defines and Macros
-//----------------------------------------------------------------------------------
-#define LuaPush_Image(L, img) LuaPushOpaqueTypeWithMetatable(L, img, Image)
-#define LuaPush_Texture2D(L, tex) LuaPushOpaqueTypeWithMetatable(L, tex, Texture2D)
-#define LuaPush_RenderTexture2D(L, tex) LuaPushOpaqueTypeWithMetatable(L, tex, RenderTexture2D)
-#define LuaPush_SpriteFont(L, sf) LuaPushOpaqueTypeWithMetatable(L, sf, SpriteFont)
-#define LuaPush_Mesh(L, vd) LuaPushOpaqueType(L, vd)
-#define LuaPush_Shader(L, s) LuaPushOpaqueType(L, s)
-#define LuaPush_Light(L, light) LuaPushOpaqueTypeWithMetatable(L, light, Light)
-#define LuaPush_Sound(L, snd) LuaPushOpaqueType(L, snd)
-#define LuaPush_Wave(L, wav) LuaPushOpaqueType(L, wav)
-#define LuaPush_Music(L, mus) LuaPushOpaqueType(L, mus)
-#define LuaPush_AudioStream(L, aud) LuaPushOpaqueType(L, aud)
-
-#define LuaGetArgument_string luaL_checkstring
-#define LuaGetArgument_ptr (void *)luaL_checkinteger
-#define LuaGetArgument_int (int)luaL_checkinteger
-#define LuaGetArgument_unsigned (unsigned)luaL_checkinteger
-#define LuaGetArgument_char (char)luaL_checkinteger
-#define LuaGetArgument_float (float)luaL_checknumber
-#define LuaGetArgument_double luaL_checknumber
-
-#define LuaGetArgument_Image(L, img) *(Image*)LuaGetArgumentOpaqueTypeWithMetatable(L, img, "Image")
-#define LuaGetArgument_Texture2D(L, tex) *(Texture2D*)LuaGetArgumentOpaqueTypeWithMetatable(L, tex, "Texture2D")
-#define LuaGetArgument_RenderTexture2D(L, rtex) *(RenderTexture2D*)LuaGetArgumentOpaqueTypeWithMetatable(L, rtex, "RenderTexture2D")
-#define LuaGetArgument_SpriteFont(L, sf) *(SpriteFont*)LuaGetArgumentOpaqueTypeWithMetatable(L, sf, "SpriteFont")
-#define LuaGetArgument_Mesh(L, vd) *(Mesh*)LuaGetArgumentOpaqueType(L, vd)
-#define LuaGetArgument_Shader(L, s) *(Shader*)LuaGetArgumentOpaqueType(L, s)
-#define LuaGetArgument_Light(L, light) *(Light*)LuaGetArgumentOpaqueType(L, light)
-#define LuaGetArgument_Sound(L, snd) *(Sound*)LuaGetArgumentOpaqueType(L, snd)
-#define LuaGetArgument_Wave(L, wav) *(Wave*)LuaGetArgumentOpaqueType(L, wav)
-#define LuaGetArgument_Music(L, mus) *(Music*)LuaGetArgumentOpaqueType(L, mus)
-#define LuaGetArgument_AudioStream(L, aud) *(AudioStream*)LuaGetArgumentOpaqueType(L, aud)
-
-#define LuaPushOpaqueType(L, str) LuaPushOpaque(L, &str, sizeof(str))
-#define LuaPushOpaqueTypeWithMetatable(L, str, meta) LuaPushOpaqueWithMetatable(L, &str, sizeof(str), #meta)
-
-//----------------------------------------------------------------------------------
-// Global Variables Definition
-//----------------------------------------------------------------------------------
-static lua_State* mainLuaState = 0;
-static lua_State* L = 0;
-
-//----------------------------------------------------------------------------------
-// Module specific Functions Declaration
-//----------------------------------------------------------------------------------
-static void LuaPush_Color(lua_State* L, Color color);
-static void LuaPush_Vector2(lua_State* L, Vector2 vec);
-static void LuaPush_Vector3(lua_State* L, Vector3 vec);
-static void LuaPush_Quaternion(lua_State* L, Quaternion vec);
-static void LuaPush_Matrix(lua_State* L, Matrix *matrix);
-static void LuaPush_Rectangle(lua_State* L, Rectangle rect);
-static void LuaPush_Model(lua_State* L, Model mdl);
-static void LuaPush_Ray(lua_State* L, Ray ray);
-static void LuaPush_Camera(lua_State* L, Camera cam);
-
-static Vector2 LuaGetArgument_Vector2(lua_State* L, int index);
-static Vector3 LuaGetArgument_Vector3(lua_State* L, int index);
-static Quaternion LuaGetArgument_Quaternion(lua_State* L, int index);
-static Color LuaGetArgument_Color(lua_State* L, int index);
-static Rectangle LuaGetArgument_Rectangle(lua_State* L, int index);
-static Camera LuaGetArgument_Camera(lua_State* L, int index);
-static Camera2D LuaGetArgument_Camera2D(lua_State* L, int index);
-static Ray LuaGetArgument_Ray(lua_State* L, int index);
-static Matrix LuaGetArgument_Matrix(lua_State* L, int index);
-static Model LuaGetArgument_Model(lua_State* L, int index);
-
-//----------------------------------------------------------------------------------
-// rlua Helper Functions
-//----------------------------------------------------------------------------------
-static void LuaStartEnum(void)
-{
- lua_newtable(L);
-}
-
-static void LuaSetEnum(const char *name, int value)
-{
- lua_pushinteger(L, value);
- lua_setfield(L, -2, name);
-}
-
-static void LuaSetEnumColor(const char *name, Color color)
-{
- LuaPush_Color(L, color);
- lua_setfield(L, -2, name);
-}
-
-static void LuaEndEnum(const char *name)
-{
- lua_setglobal(L, name);
-}
-
-static void LuaPushOpaque(lua_State* L, void *ptr, size_t size)
-{
- void *ud = lua_newuserdata(L, size);
- memcpy(ud, ptr, size);
-}
-
-static void LuaPushOpaqueWithMetatable(lua_State* L, void *ptr, size_t size, const char *metatable_name)
-{
- void *ud = lua_newuserdata(L, size);
- memcpy(ud, ptr, size);
- luaL_setmetatable(L, metatable_name);
-}
-
-static void* LuaGetArgumentOpaqueType(lua_State* L, int index)
-{
- return lua_touserdata(L, index);
-}
-
-static void* LuaGetArgumentOpaqueTypeWithMetatable(lua_State* L, int index, const char *metatable_name)
-{
- return luaL_checkudata(L, index, metatable_name);
-}
-
-//----------------------------------------------------------------------------------
-// LuaIndex* functions
-//----------------------------------------------------------------------------------
-static int LuaIndexImage(lua_State* L)
-{
- Image img = LuaGetArgument_Image(L, 1);
- const char *key = luaL_checkstring(L, 2);
- if (!strcmp(key, "width"))
- lua_pushinteger(L, img.width);
- else if (!strcmp(key, "height"))
- lua_pushinteger(L, img.height);
- else if (!strcmp(key, "mipmaps"))
- lua_pushinteger(L, img.mipmaps);
- else if (!strcmp(key, "format"))
- lua_pushinteger(L, img.format);
- else
- return 0;
- return 1;
-}
-
-static int LuaIndexTexture2D(lua_State* L)
-{
- Texture2D img = LuaGetArgument_Texture2D(L, 1);
- const char *key = luaL_checkstring(L, 2);
- if (!strcmp(key, "width"))
- lua_pushinteger(L, img.width);
- else if (!strcmp(key, "height"))
- lua_pushinteger(L, img.height);
- else if (!strcmp(key, "mipmaps"))
- lua_pushinteger(L, img.mipmaps);
- else if (!strcmp(key, "format"))
- lua_pushinteger(L, img.format);
- else if (!strcmp(key, "id"))
- lua_pushinteger(L, img.id);
- else
- return 0;
- return 1;
-}
-
-static int LuaIndexRenderTexture2D(lua_State* L)
-{
- RenderTexture2D img = LuaGetArgument_RenderTexture2D(L, 1);
- const char *key = luaL_checkstring(L, 2);
- if (!strcmp(key, "texture"))
- LuaPush_Texture2D(L, img.texture);
- else if (!strcmp(key, "depth"))
- LuaPush_Texture2D(L, img.depth);
- else
- return 0;
- return 1;
-}
-
-static int LuaIndexSpriteFont(lua_State* L)
-{
- SpriteFont img = LuaGetArgument_SpriteFont(L, 1);
- const char *key = luaL_checkstring(L, 2);
- if (!strcmp(key, "size"))
- lua_pushinteger(L, img.size);
- else if (!strcmp(key, "texture"))
- LuaPush_Texture2D(L, img.texture);
- else if (!strcmp(key, "charsCount"))
- lua_pushinteger(L, img.charsCount);
- else
- return 0;
- return 1;
-}
-
-static int LuaIndexLight(lua_State* L)
-{
- Light light = LuaGetArgument_Light(L, 1);
- const char *key = luaL_checkstring(L, 2);
- if (!strcmp(key, "id"))
- lua_pushinteger(L, light->id);
- else if (!strcmp(key, "enabled"))
- lua_pushboolean(L, light->enabled);
- else if (!strcmp(key, "type"))
- lua_pushinteger(L, light->type);
- else if (!strcmp(key, "position"))
- LuaPush_Vector3(L, light->position);
- else if (!strcmp(key, "target"))
- LuaPush_Vector3(L, light->target);
- else if (!strcmp(key, "radius"))
- lua_pushnumber(L, light->radius);
- else if (!strcmp(key, "diffuse"))
- LuaPush_Color(L, light->diffuse);
- else if (!strcmp(key, "intensity"))
- lua_pushnumber(L, light->intensity);
- else if (!strcmp(key, "coneAngle"))
- lua_pushnumber(L, light->coneAngle);
- else
- return 0;
- return 1;
-}
-
-static int LuaNewIndexLight(lua_State* L)
-{
- Light light = LuaGetArgument_Light(L, 1);
- const char *key = luaL_checkstring(L, 2);
- if (!strcmp(key, "id"))
- light->id = LuaGetArgument_int(L, 3);
- else if (!strcmp(key, "enabled"))
- light->enabled = lua_toboolean(L, 3);
- else if (!strcmp(key, "type"))
- light->type = LuaGetArgument_int(L, 3);
- else if (!strcmp(key, "position"))
- light->position = LuaGetArgument_Vector3(L, 3);
- else if (!strcmp(key, "target"))
- light->target = LuaGetArgument_Vector3(L, 3);
- else if (!strcmp(key, "radius"))
- light->radius = LuaGetArgument_float(L, 3);
- else if (!strcmp(key, "diffuse"))
- light->diffuse = LuaGetArgument_Color(L, 3);
- else if (!strcmp(key, "intensity"))
- light->intensity = LuaGetArgument_float(L, 3);
- else if (!strcmp(key, "coneAngle"))
- light->coneAngle = LuaGetArgument_float(L, 3);
- return 0;
-}
-
-static void LuaBuildOpaqueMetatables(void)
-{
- luaL_newmetatable(L, "Image");
- lua_pushcfunction(L, &LuaIndexImage);
- lua_setfield(L, -2, "__index");
- lua_pop(L, 1);
-
- luaL_newmetatable(L, "Texture2D");
- lua_pushcfunction(L, &LuaIndexTexture2D);
- lua_setfield(L, -2, "__index");
- lua_pop(L, 1);
-
- luaL_newmetatable(L, "RenderTexture2D");
- lua_pushcfunction(L, &LuaIndexRenderTexture2D);
- lua_setfield(L, -2, "__index");
- lua_pop(L, 1);
-
- luaL_newmetatable(L, "SpriteFont");
- lua_pushcfunction(L, &LuaIndexSpriteFont);
- lua_setfield(L, -2, "__index");
- lua_pop(L, 1);
-
- luaL_newmetatable(L, "Light");
- lua_pushcfunction(L, &LuaIndexLight);
- lua_setfield(L, -2, "__index");
- lua_pushcfunction(L, &LuaNewIndexLight);
- lua_setfield(L, -2, "__newindex");
- lua_pop(L, 1);
-}
-
-//----------------------------------------------------------------------------------
-// LuaGetArgument functions
-//----------------------------------------------------------------------------------
-
-static Vector2 LuaGetArgument_Vector2(lua_State* L, int index)
-{
- index = lua_absindex(L, index); // Makes sure we use absolute indices because we push multiple values
- luaL_argcheck(L, lua_getfield(L, index, "x") == LUA_TNUMBER, index, "Expected Vector2");
- float x = (float)lua_tonumber(L, -1);
- luaL_argcheck(L, lua_getfield(L, index, "y") == LUA_TNUMBER, index, "Expected Vector2");
- float y = (float)lua_tonumber(L, -1);
- lua_pop(L, 2);
- return (Vector2) { x, y };
-}
-
-static Vector3 LuaGetArgument_Vector3(lua_State* L, int index)
-{
- index = lua_absindex(L, index); // Makes sure we use absolute indices because we push multiple values
- luaL_argcheck(L, lua_getfield(L, index, "x") == LUA_TNUMBER, index, "Expected Vector3");
- float x = (float)lua_tonumber(L, -1);
- luaL_argcheck(L, lua_getfield(L, index, "y") == LUA_TNUMBER, index, "Expected Vector3");
- float y = (float)lua_tonumber(L, -1);
- luaL_argcheck(L, lua_getfield(L, index, "z") == LUA_TNUMBER, index, "Expected Vector3");
- float z = (float)lua_tonumber(L, -1);
- lua_pop(L, 3);
- return (Vector3) { x, y, z };
-}
-
-static Quaternion LuaGetArgument_Quaternion(lua_State* L, int index)
-{
- index = lua_absindex(L, index); // Makes sure we use absolute indices because we push multiple values
- luaL_argcheck(L, lua_getfield(L, index, "x") == LUA_TNUMBER, index, "Expected Quaternion");
- float x = (float)lua_tonumber(L, -1);
- luaL_argcheck(L, lua_getfield(L, index, "y") == LUA_TNUMBER, index, "Expected Quaternion");
- float y = (float)lua_tonumber(L, -1);
- luaL_argcheck(L, lua_getfield(L, index, "z") == LUA_TNUMBER, index, "Expected Quaternion");
- float z = (float)lua_tonumber(L, -1);
- luaL_argcheck(L, lua_getfield(L, index, "w") == LUA_TNUMBER, index, "Expected Quaternion");
- float w = (float)lua_tonumber(L, -1);
- lua_pop(L, 4);
- return (Quaternion) { x, y, z, w };
-}
-
-static Color LuaGetArgument_Color(lua_State* L, int index)
-{
- index = lua_absindex(L, index); // Makes sure we use absolute indices because we push multiple values
- luaL_argcheck(L, lua_getfield(L, index, "r") == LUA_TNUMBER, index, "Expected Color");
- unsigned char r = (unsigned char)lua_tointeger(L, -1);
- luaL_argcheck(L, lua_getfield(L, index, "g") == LUA_TNUMBER, index, "Expected Color");
- unsigned char g = (unsigned char)lua_tointeger(L, -1);
- luaL_argcheck(L, lua_getfield(L, index, "b") == LUA_TNUMBER, index, "Expected Color");
- unsigned char b = (unsigned char)lua_tointeger(L, -1);
- luaL_argcheck(L, lua_getfield(L, index, "a") == LUA_TNUMBER, index, "Expected Color");
- unsigned char a = (unsigned char)lua_tointeger(L, -1);
- lua_pop(L, 4);
- return (Color) { r, g, b, a };
-}
-
-static Rectangle LuaGetArgument_Rectangle(lua_State* L, int index)
-{
- index = lua_absindex(L, index); // Makes sure we use absolute indices because we push multiple values
- luaL_argcheck(L, lua_getfield(L, index, "x") == LUA_TNUMBER, index, "Expected Rectangle");
- int x = (int)lua_tointeger(L, -1);
- luaL_argcheck(L, lua_getfield(L, index, "y") == LUA_TNUMBER, index, "Expected Rectangle");
- int y = (int)lua_tointeger(L, -1);
- luaL_argcheck(L, lua_getfield(L, index, "width") == LUA_TNUMBER, index, "Expected Rectangle");
- int w = (int)lua_tointeger(L, -1);
- luaL_argcheck(L, lua_getfield(L, index, "height") == LUA_TNUMBER, index, "Expected Rectangle");
- int h = (int)lua_tointeger(L, -1);
- lua_pop(L, 4);
- return (Rectangle) { x, y, w, h };
-}
-
-static Camera LuaGetArgument_Camera(lua_State* L, int index)
-{
- Camera result;
- index = lua_absindex(L, index); // Makes sure we use absolute indices because we push multiple values
- luaL_argcheck(L, lua_getfield(L, index, "position") == LUA_TTABLE, index, "Expected Camera");
- result.position = LuaGetArgument_Vector3(L, -1);
- luaL_argcheck(L, lua_getfield(L, index, "target") == LUA_TTABLE, index, "Expected Camera");
- result.target = LuaGetArgument_Vector3(L, -1);
- luaL_argcheck(L, lua_getfield(L, index, "up") == LUA_TTABLE, index, "Expected Camera");
- result.up = LuaGetArgument_Vector3(L, -1);
- luaL_argcheck(L, lua_getfield(L, index, "fovy") == LUA_TNUMBER, index, "Expected Camera");
- result.fovy = LuaGetArgument_float(L, -1);
- lua_pop(L, 4);
- return result;
-}
-
-static Camera2D LuaGetArgument_Camera2D(lua_State* L, int index)
-{
- Camera2D result;
- index = lua_absindex(L, index); // Makes sure we use absolute indices because we push multiple values
- luaL_argcheck(L, lua_getfield(L, index, "offset") == LUA_TTABLE, index, "Expected Camera2D");
- result.offset = LuaGetArgument_Vector2(L, -1);
- luaL_argcheck(L, lua_getfield(L, index, "target") == LUA_TTABLE, index, "Expected Camera2D");
- result.target = LuaGetArgument_Vector2(L, -1);
- luaL_argcheck(L, lua_getfield(L, index, "rotation") == LUA_TNUMBER, index, "Expected Camera2D");
- result.rotation = LuaGetArgument_float(L, -1);
- luaL_argcheck(L, lua_getfield(L, index, "zoom") == LUA_TNUMBER, index, "Expected Camera2D");
- result.zoom = LuaGetArgument_float(L, -1);
- lua_pop(L, 4);
- return result;
-}
-
-static BoundingBox LuaGetArgument_BoundingBox(lua_State* L, int index)
-{
- BoundingBox result;
- index = lua_absindex(L, index); // Makes sure we use absolute indices because we push multiple values
- luaL_argcheck(L, lua_getfield(L, index, "min") == LUA_TTABLE, index, "Expected BoundingBox");
- result.min = LuaGetArgument_Vector3(L, -1);
- luaL_argcheck(L, lua_getfield(L, index, "max") == LUA_TTABLE, index, "Expected BoundingBox");
- result.max = LuaGetArgument_Vector3(L, -1);
- lua_pop(L, 2);
- return result;
-}
-
-static Ray LuaGetArgument_Ray(lua_State* L, int index)
-{
- Ray result;
- index = lua_absindex(L, index); // Makes sure we use absolute indices because we push multiple values
- luaL_argcheck(L, lua_getfield(L, index, "position") == LUA_TTABLE, index, "Expected Ray");
- result.position = LuaGetArgument_Vector3(L, -1);
- luaL_argcheck(L, lua_getfield(L, index, "direction") == LUA_TTABLE, index, "Expected Ray");
- result.direction = LuaGetArgument_Vector3(L, -1);
- lua_pop(L, 2);
- return result;
-}
-
-static Matrix LuaGetArgument_Matrix(lua_State* L, int index)
-{
- Matrix result = { 0 };
- float* ptr = &result.m0;
- index = lua_absindex(L, index); // Makes sure we use absolute indices because we push multiple values
-
- for (int i = 0; i < 16; i++)
- {
- lua_geti(L, index, i+1);
- ptr[i] = luaL_checknumber(L, -1);
- }
- lua_pop(L, 16);
- return result;
-}
-
-static Material LuaGetArgument_Material(lua_State* L, int index)
-{
- Material result;
- index = lua_absindex(L, index); // Makes sure we use absolute indices because we push multiple values
- luaL_argcheck(L, lua_getfield(L, index, "shader") == LUA_TUSERDATA, index, "Expected Material");
- result.shader = LuaGetArgument_Shader(L, -1);
- luaL_argcheck(L, lua_getfield(L, index, "texDiffuse") == LUA_TUSERDATA, index, "Expected Material");
- result.texDiffuse = LuaGetArgument_Texture2D(L, -1);
- luaL_argcheck(L, lua_getfield(L, index, "texNormal") == LUA_TUSERDATA, index, "Expected Material");
- result.texNormal = LuaGetArgument_Texture2D(L, -1);
- luaL_argcheck(L, lua_getfield(L, index, "texSpecular") == LUA_TUSERDATA, index, "Expected Material");
- result.texSpecular = LuaGetArgument_Texture2D(L, -1);
- luaL_argcheck(L, lua_getfield(L, index, "colDiffuse") == LUA_TTABLE, index, "Expected Material");
- result.colDiffuse = LuaGetArgument_Color(L, -1);
- luaL_argcheck(L, lua_getfield(L, index, "colAmbient") == LUA_TTABLE, index, "Expected Material");
- result.colAmbient = LuaGetArgument_Color(L, -1);
- luaL_argcheck(L, lua_getfield(L, index, "colSpecular") == LUA_TTABLE, index, "Expected Material");
- result.colSpecular = LuaGetArgument_Color(L, -1);
- luaL_argcheck(L, lua_getfield(L, index, "glossiness") == LUA_TNUMBER, index, "Expected Material");
- result.glossiness = LuaGetArgument_float(L, -1);
- lua_pop(L, 8);
- return result;
-}
-
-static Model LuaGetArgument_Model(lua_State* L, int index)
-{
- Model result;
- index = lua_absindex(L, index); // Makes sure we use absolute indices because we push multiple values
- luaL_argcheck(L, lua_getfield(L, index, "mesh") == LUA_TUSERDATA, index, "Expected Model");
- result.mesh = LuaGetArgument_Mesh(L, -1);
- luaL_argcheck(L, lua_getfield(L, index, "transform") == LUA_TTABLE, index, "Expected Model");
- result.transform = LuaGetArgument_Matrix(L, -1);
- luaL_argcheck(L, lua_getfield(L, index, "material") == LUA_TTABLE, index, "Expected Model");
- result.material = LuaGetArgument_Material(L, -1);
- lua_pop(L, 3);
- return result;
-}
-
-//----------------------------------------------------------------------------------
-// LuaPush functions
-//----------------------------------------------------------------------------------
-static void LuaPush_Color(lua_State* L, Color color)
-{
- lua_createtable(L, 0, 4);
- lua_pushinteger(L, color.r);
- lua_setfield(L, -2, "r");
- lua_pushinteger(L, color.g);
- lua_setfield(L, -2, "g");
- lua_pushinteger(L, color.b);
- lua_setfield(L, -2, "b");
- lua_pushinteger(L, color.a);
- lua_setfield(L, -2, "a");
-}
-
-static void LuaPush_Vector2(lua_State* L, Vector2 vec)
-{
- lua_createtable(L, 0, 2);
- lua_pushnumber(L, vec.x);
- lua_setfield(L, -2, "x");
- lua_pushnumber(L, vec.y);
- lua_setfield(L, -2, "y");
-}
-
-static void LuaPush_Vector3(lua_State* L, Vector3 vec)
-{
- lua_createtable(L, 0, 3);
- lua_pushnumber(L, vec.x);
- lua_setfield(L, -2, "x");
- lua_pushnumber(L, vec.y);
- lua_setfield(L, -2, "y");
- lua_pushnumber(L, vec.z);
- lua_setfield(L, -2, "z");
-}
-
-static void LuaPush_Quaternion(lua_State* L, Quaternion vec)
-{
- lua_createtable(L, 0, 4);
- lua_pushnumber(L, vec.x);
- lua_setfield(L, -2, "x");
- lua_pushnumber(L, vec.y);
- lua_setfield(L, -2, "y");
- lua_pushnumber(L, vec.z);
- lua_setfield(L, -2, "z");
- lua_pushnumber(L, vec.w);
- lua_setfield(L, -2, "w");
-}
-
-static void LuaPush_Matrix(lua_State* L, Matrix *matrix)
-{
- int i;
- lua_createtable(L, 16, 0);
- float* num = (&matrix->m0);
- for (i = 0; i < 16; i++)
- {
- lua_pushnumber(L, num[i]);
- lua_rawseti(L, -2, i + 1);
- }
-}
-
-static void LuaPush_Rectangle(lua_State* L, Rectangle rect)
-{
- lua_createtable(L, 0, 4);
- lua_pushinteger(L, rect.x);
- lua_setfield(L, -2, "x");
- lua_pushinteger(L, rect.y);
- lua_setfield(L, -2, "y");
- lua_pushinteger(L, rect.width);
- lua_setfield(L, -2, "width");
- lua_pushinteger(L, rect.height);
- lua_setfield(L, -2, "height");
-}
-
-static void LuaPush_Ray(lua_State* L, Ray ray)
-{
- lua_createtable(L, 0, 2);
- LuaPush_Vector3(L, ray.position);
- lua_setfield(L, -2, "position");
- LuaPush_Vector3(L, ray.direction);
- lua_setfield(L, -2, "direction");
-}
-
-static void LuaPush_BoundingBox(lua_State* L, BoundingBox bb)
-{
- lua_createtable(L, 0, 2);
- LuaPush_Vector3(L, bb.min);
- lua_setfield(L, -2, "min");
- LuaPush_Vector3(L, bb.max);
- lua_setfield(L, -2, "max");
-}
-
-static void LuaPush_Camera(lua_State* L, Camera cam)
-{
- lua_createtable(L, 0, 4);
- LuaPush_Vector3(L, cam.position);
- lua_setfield(L, -2, "position");
- LuaPush_Vector3(L, cam.target);
- lua_setfield(L, -2, "target");
- LuaPush_Vector3(L, cam.up);
- lua_setfield(L, -2, "up");
- lua_pushnumber(L, cam.fovy);
- lua_setfield(L, -2, "fovy");
-}
-
-static void LuaPush_Camera2D(lua_State* L, Camera2D cam)
-{
- lua_createtable(L, 0, 4);
- LuaPush_Vector2(L, cam.offset);
- lua_setfield(L, -2, "offset");
- LuaPush_Vector2(L, cam.target);
- lua_setfield(L, -2, "target");
- lua_pushnumber(L, cam.rotation);
- lua_setfield(L, -2, "rotation");
- lua_pushnumber(L, cam.zoom);
- lua_setfield(L, -2, "zoom");
-}
-
-static void LuaPush_Material(lua_State* L, Material mat)
-{
- lua_createtable(L, 0, 8);
- LuaPush_Shader(L, mat.shader);
- lua_setfield(L, -2, "shader");
- LuaPush_Texture2D(L, mat.texDiffuse);
- lua_setfield(L, -2, "texDiffuse");
- LuaPush_Texture2D(L, mat.texNormal);
- lua_setfield(L, -2, "texNormal");
- LuaPush_Texture2D(L, mat.texSpecular);
- lua_setfield(L, -2, "texSpecular");
- LuaPush_Color(L, mat.colDiffuse);
- lua_setfield(L, -2, "colDiffuse");
- LuaPush_Color(L, mat.colAmbient);
- lua_setfield(L, -2, "colAmbient");
- LuaPush_Color(L, mat.colSpecular);
- lua_setfield(L, -2, "colSpecular");
- lua_pushnumber(L, mat.glossiness);
- lua_setfield(L, -2, "glossiness");
-}
-
-static void LuaPush_Model(lua_State* L, Model mdl)
-{
- lua_createtable(L, 0, 4);
- LuaPush_Mesh(L, mdl.mesh);
- lua_setfield(L, -2, "mesh");
- LuaPush_Matrix(L, &mdl.transform);
- lua_setfield(L, -2, "transform");
- LuaPush_Material(L, mdl.material);
- lua_setfield(L, -2, "material");
-}
-
-//----------------------------------------------------------------------------------
-// raylib Lua Structure constructors
-//----------------------------------------------------------------------------------
-static int lua_Color(lua_State* L)
-{
- LuaPush_Color(L, (Color) { (unsigned char)luaL_checkinteger(L, 1), (unsigned char)luaL_checkinteger(L, 2), (unsigned char)luaL_checkinteger(L, 3), (unsigned char)luaL_checkinteger(L, 4) });
- return 1;
-}
-
-static int lua_Vector2(lua_State* L)
-{
- LuaPush_Vector2(L, (Vector2) { (float)luaL_checknumber(L, 1), (float)luaL_checknumber(L, 2) });
- return 1;
-}
-
-static int lua_Vector3(lua_State* L)
-{
- LuaPush_Vector3(L, (Vector3) { (float)luaL_checknumber(L, 1), (float)luaL_checknumber(L, 2), (float)luaL_checknumber(L, 3) });
- return 1;
-}
-
-static int lua_Quaternion(lua_State* L)
-{
- LuaPush_Quaternion(L, (Quaternion) { (float)luaL_checknumber(L, 1), (float)luaL_checknumber(L, 2), (float)luaL_checknumber(L, 3), (float)luaL_checknumber(L, 4) });
- return 1;
-}
-
-static int lua_Rectangle(lua_State* L)
-{
- LuaPush_Rectangle(L, (Rectangle) { (int)luaL_checkinteger(L, 1), (int)luaL_checkinteger(L, 2), (int)luaL_checkinteger(L, 3), (int)luaL_checkinteger(L, 4) });
- return 1;
-}
-
-static int lua_Ray(lua_State* L)
-{
- Vector2 pos = LuaGetArgument_Vector2(L, 1);
- Vector2 dir = LuaGetArgument_Vector2(L, 2);
- LuaPush_Ray(L, (Ray) { { pos.x, pos.y }, { dir.x, dir.y } });
- return 1;
-}
-
-static int lua_BoundingBox(lua_State* L)
-{
- Vector3 min = LuaGetArgument_Vector3(L, 1);
- Vector3 max = LuaGetArgument_Vector3(L, 2);
- LuaPush_BoundingBox(L, (BoundingBox) { { min.x, min.y, min.z }, { max.x, max.y, max.z } });
- return 1;
-}
-
-static int lua_Camera(lua_State* L)
-{
- Vector3 pos = LuaGetArgument_Vector3(L, 1);
- Vector3 tar = LuaGetArgument_Vector3(L, 2);
- Vector3 up = LuaGetArgument_Vector3(L, 3);
- float fovy = LuaGetArgument_float(L, 4);
- LuaPush_Camera(L, (Camera) { { pos.x, pos.y, pos.z }, { tar.x, tar.y, tar.z }, { up.x, up.y, up.z }, fovy });
- return 1;
-}
-
-static int lua_Camera2D(lua_State* L)
-{
- Vector2 off = LuaGetArgument_Vector2(L, 1);
- Vector2 tar = LuaGetArgument_Vector2(L, 2);
- float rot = LuaGetArgument_float(L, 3);
- float zoom = LuaGetArgument_float(L, 4);
- LuaPush_Camera2D(L, (Camera2D) { { off.x, off.y }, { tar.x, tar.y }, rot, zoom });
- return 1;
-}
-
-/*************************************************************************************
-* raylib Lua Functions Bindings
-**************************************************************************************/
-
-//------------------------------------------------------------------------------------
-// raylib [core] module functions - Window and Graphics Device
-//------------------------------------------------------------------------------------
-int lua_InitWindow(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- const char * arg3 = LuaGetArgument_string(L, 3);
- InitWindow(arg1, arg2, arg3);
- return 0;
-}
-
-int lua_CloseWindow(lua_State* L)
-{
- CloseWindow();
- return 0;
-}
-
-int lua_WindowShouldClose(lua_State* L)
-{
- bool result = WindowShouldClose();
- lua_pushboolean(L, result);
- return 1;
-}
-
-int lua_IsWindowMinimized(lua_State* L)
-{
- bool result = IsWindowMinimized();
- lua_pushboolean(L, result);
- return 1;
-}
-
-int lua_ToggleFullscreen(lua_State* L)
-{
- ToggleFullscreen();
- return 0;
-}
-
-int lua_GetScreenWidth(lua_State* L)
-{
- int result = GetScreenWidth();
- lua_pushinteger(L, result);
- return 1;
-}
-
-int lua_GetScreenHeight(lua_State* L)
-{
- int result = GetScreenHeight();
- lua_pushinteger(L, result);
- return 1;
-}
-
-int lua_ShowCursor(lua_State* L)
-{
- ShowCursor();
- return 0;
-}
-
-int lua_HideCursor(lua_State* L)
-{
- HideCursor();
- return 0;
-}
-
-int lua_IsCursorHidden(lua_State* L)
-{
- bool result = IsCursorHidden();
- lua_pushboolean(L, result);
- return 1;
-}
-
-int lua_EnableCursor(lua_State* L)
-{
- EnableCursor();
- return 0;
-}
-
-int lua_DisableCursor(lua_State* L)
-{
- DisableCursor();
- return 0;
-}
-
-int lua_ClearBackground(lua_State* L)
-{
- Color arg1 = LuaGetArgument_Color(L, 1);
- ClearBackground(arg1);
- return 0;
-}
-
-int lua_BeginDrawing(lua_State* L)
-{
- BeginDrawing();
- return 0;
-}
-
-int lua_EndDrawing(lua_State* L)
-{
- EndDrawing();
- return 0;
-}
-
-int lua_Begin2dMode(lua_State* L)
-{
- Camera2D arg1 = LuaGetArgument_Camera2D(L, 1);
- Begin2dMode(arg1);
- return 0;
-}
-
-int lua_End2dMode(lua_State* L)
-{
- End2dMode();
- return 0;
-}
-
-int lua_Begin3dMode(lua_State* L)
-{
- Camera arg1 = LuaGetArgument_Camera(L, 1);
- Begin3dMode(arg1);
- return 0;
-}
-
-int lua_End3dMode(lua_State* L)
-{
- End3dMode();
- return 0;
-}
-
-int lua_BeginTextureMode(lua_State* L)
-{
- RenderTexture2D arg1 = LuaGetArgument_RenderTexture2D(L, 1);
- BeginTextureMode(arg1);
- return 0;
-}
-
-int lua_EndTextureMode(lua_State* L)
-{
- EndTextureMode();
- return 0;
-}
-
-int lua_GetMouseRay(lua_State* L)
-{
- Vector2 arg1 = LuaGetArgument_Vector2(L, 1);
- Camera arg2 = LuaGetArgument_Camera(L, 2);
- Ray result = GetMouseRay(arg1, arg2);
- LuaPush_Ray(L, result);
- return 1;
-}
-
-int lua_GetWorldToScreen(lua_State* L)
-{
- Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
- Camera arg2 = LuaGetArgument_Camera(L, 2);
- Vector2 result = GetWorldToScreen(arg1, arg2);
- LuaPush_Vector2(L, result);
- return 1;
-}
-
-int lua_GetCameraMatrix(lua_State* L)
-{
- Camera arg1 = LuaGetArgument_Camera(L, 1);
- Matrix result = GetCameraMatrix(arg1);
- LuaPush_Matrix(L, &result);
- return 1;
-}
-
-#if defined(PLATFORM_WEB)
-
-static int LuaDrawLoopFunc;
-
-static void LuaDrawLoop()
-{
- lua_rawgeti(L, LUA_REGISTRYINDEX, LuaDrawLoopFunc);
- lua_call(L, 0, 0);
-}
-
-int lua_SetDrawingLoop(lua_State* L)
-{
- luaL_argcheck(L, lua_isfunction(L, 1), 1, "Loop function expected");
- lua_pushvalue(L, 1);
- LuaDrawLoopFunc = luaL_ref(L, LUA_REGISTRYINDEX);
- SetDrawingLoop(&LuaDrawLoop);
- return 0;
-}
-
-#else
-
-int lua_SetTargetFPS(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- SetTargetFPS(arg1);
- return 0;
-}
-#endif
-
-int lua_GetFPS(lua_State* L)
-{
- float result = GetFPS();
- lua_pushnumber(L, result);
- return 1;
-}
-
-int lua_GetFrameTime(lua_State* L)
-{
- float result = GetFrameTime();
- lua_pushnumber(L, result);
- return 1;
-}
-
-int lua_GetColor(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- Color result = GetColor(arg1);
- LuaPush_Color(L, result);
- return 1;
-}
-
-int lua_GetHexValue(lua_State* L)
-{
- Color arg1 = LuaGetArgument_Color(L, 1);
- int result = GetHexValue(arg1);
- lua_pushinteger(L, result);
- return 1;
-}
-
-int lua_ColorToFloat(lua_State* L)
-{
- Color arg1 = LuaGetArgument_Color(L, 1);
- float * result = ColorToFloat(arg1);
- lua_createtable(L, 4, 0);
- for (int i = 0; i < 4; i++)
- {
- lua_pushnumber(L, result[i]);
- lua_rawseti(L, -2, i + 1);
- }
- free(result);
- return 1;
-}
-
-int lua_VectorToFloat(lua_State* L)
-{
- Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
- float * result = VectorToFloat(arg1);
- lua_createtable(L, 3, 0);
- for (int i = 0; i < 3; i++)
- {
- lua_pushnumber(L, result[i]);
- lua_rawseti(L, -2, i + 1);
- }
- free(result);
- return 1;
-}
-
-int lua_MatrixToFloat(lua_State* L)
-{
- Matrix arg1 = LuaGetArgument_Matrix(L, 1);
- float * result = MatrixToFloat(arg1);
- lua_createtable(L, 16, 0);
- for (int i = 0; i < 16; i++)
- {
- lua_pushnumber(L, result[i]);
- lua_rawseti(L, -2, i + 1);
- }
- free(result);
- return 1;
-}
-
-int lua_GetRandomValue(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- int result = GetRandomValue(arg1, arg2);
- lua_pushinteger(L, result);
- return 1;
-}
-
-int lua_Fade(lua_State* L)
-{
- Color arg1 = LuaGetArgument_Color(L, 1);
- float arg2 = LuaGetArgument_float(L, 2);
- Color result = Fade(arg1, arg2);
- LuaPush_Color(L, result);
- return 1;
-}
-
-int lua_SetConfigFlags(lua_State* L)
-{
- char arg1 = LuaGetArgument_char(L, 1);
- SetConfigFlags(arg1);
- return 0;
-}
-
-int lua_ShowLogo(lua_State* L)
-{
- ShowLogo();
- return 0;
-}
-
-int lua_IsFileDropped(lua_State* L)
-{
- bool result = IsFileDropped();
- lua_pushboolean(L, result);
- return 1;
-}
-
-int lua_GetDroppedFiles(lua_State* L)
-{
- int count = 0;
- char ** result = GetDroppedFiles(&count);
- lua_createtable(L, count, 0);
- for (int i = 0; i < count; i++)
- {
- lua_pushstring(L, result[i]);
- lua_rawseti(L, -2, i + 1);
- }
- return 1;
-}
-
-int lua_ClearDroppedFiles(lua_State* L)
-{
- ClearDroppedFiles();
- return 0;
-}
-
-int lua_StorageSaveValue(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- StorageSaveValue(arg1, arg2);
- return 0;
-}
-
-int lua_StorageLoadValue(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- int result = StorageLoadValue(arg1);
- lua_pushinteger(L, result);
- return 1;
-}
-
-//------------------------------------------------------------------------------------
-// raylib [core] module functions - Input Handling
-//------------------------------------------------------------------------------------
-int lua_IsKeyPressed(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- bool result = IsKeyPressed(arg1);
- lua_pushboolean(L, result);
- return 1;
-}
-
-int lua_IsKeyDown(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- bool result = IsKeyDown(arg1);
- lua_pushboolean(L, result);
- return 1;
-}
-
-int lua_IsKeyReleased(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- bool result = IsKeyReleased(arg1);
- lua_pushboolean(L, result);
- return 1;
-}
-
-int lua_IsKeyUp(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- bool result = IsKeyUp(arg1);
- lua_pushboolean(L, result);
- return 1;
-}
-
-int lua_GetKeyPressed(lua_State* L)
-{
- int result = GetKeyPressed();
- lua_pushinteger(L, result);
- return 1;
-}
-
-int lua_SetExitKey(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- SetExitKey(arg1);
- return 0;
-}
-
-int lua_IsGamepadAvailable(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- bool result = IsGamepadAvailable(arg1);
- lua_pushboolean(L, result);
- return 1;
-}
-
-int lua_IsGamepadName(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- const char * arg2 = LuaGetArgument_string(L, 2);
- bool result = IsGamepadName(arg1, arg2);
- lua_pushboolean(L, result);
- return 1;
-}
-
-int lua_GetGamepadName(lua_State* L)
-{
- // TODO: Return gamepad name id
-
- int arg1 = LuaGetArgument_int(L, 1);
- const char * result = GetGamepadName(arg1);
- //lua_pushboolean(L, result);
- return 1;
-}
-
-int lua_IsGamepadButtonPressed(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- bool result = IsGamepadButtonPressed(arg1, arg2);
- lua_pushboolean(L, result);
- return 1;
-}
-
-int lua_IsGamepadButtonDown(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- bool result = IsGamepadButtonDown(arg1, arg2);
- lua_pushboolean(L, result);
- return 1;
-}
-
-int lua_IsGamepadButtonReleased(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- bool result = IsGamepadButtonReleased(arg1, arg2);
- lua_pushboolean(L, result);
- return 1;
-}
-
-int lua_IsGamepadButtonUp(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- bool result = IsGamepadButtonUp(arg1, arg2);
- lua_pushboolean(L, result);
- return 1;
-}
-
-int lua_GetGamepadButtonPressed(lua_State* L)
-{
- int result = GetGamepadButtonPressed();
- lua_pushinteger(L, result);
- return 1;
-}
-
-int lua_GetGamepadAxisCount(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- int result = GetGamepadAxisCount(arg1);
- lua_pushinteger(L, result);
- return 1;
-}
-
-int lua_GetGamepadAxisMovement(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- float result = GetGamepadAxisMovement(arg1, arg2);
- lua_pushnumber(L, result);
- return 1;
-}
-
-int lua_IsMouseButtonPressed(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- bool result = IsMouseButtonPressed(arg1);
- lua_pushboolean(L, result);
- return 1;
-}
-
-int lua_IsMouseButtonDown(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- bool result = IsMouseButtonDown(arg1);
- lua_pushboolean(L, result);
- return 1;
-}
-
-int lua_IsMouseButtonReleased(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- bool result = IsMouseButtonReleased(arg1);
- lua_pushboolean(L, result);
- return 1;
-}
-
-int lua_IsMouseButtonUp(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- bool result = IsMouseButtonUp(arg1);
- lua_pushboolean(L, result);
- return 1;
-}
-
-int lua_GetMouseX(lua_State* L)
-{
- int result = GetMouseX();
- lua_pushinteger(L, result);
- return 1;
-}
-
-int lua_GetMouseY(lua_State* L)
-{
- int result = GetMouseY();
- lua_pushinteger(L, result);
- return 1;
-}
-
-int lua_GetMousePosition(lua_State* L)
-{
- Vector2 result = GetMousePosition();
- LuaPush_Vector2(L, result);
- return 1;
-}
-
-int lua_SetMousePosition(lua_State* L)
-{
- Vector2 arg1 = LuaGetArgument_Vector2(L, 1);
- SetMousePosition(arg1);
- return 0;
-}
-
-int lua_GetMouseWheelMove(lua_State* L)
-{
- int result = GetMouseWheelMove();
- lua_pushinteger(L, result);
- return 1;
-}
-
-int lua_GetTouchX(lua_State* L)
-{
- int result = GetTouchX();
- lua_pushinteger(L, result);
- return 1;
-}
-
-int lua_GetTouchY(lua_State* L)
-{
- int result = GetTouchY();
- lua_pushinteger(L, result);
- return 1;
-}
-
-int lua_GetTouchPosition(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- Vector2 result = GetTouchPosition(arg1);
- LuaPush_Vector2(L, result);
- return 1;
-}
-
-
-#if defined(PLATFORM_ANDROID)
-int lua_IsButtonPressed(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- bool result = IsButtonPressed(arg1);
- lua_pushboolean(L, result);
- return 1;
-}
-
-int lua_IsButtonDown(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- bool result = IsButtonDown(arg1);
- lua_pushboolean(L, result);
- return 1;
-}
-
-int lua_IsButtonReleased(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- bool result = IsButtonReleased(arg1);
- lua_pushboolean(L, result);
- return 1;
-}
-#endif
-
-//------------------------------------------------------------------------------------
-// raylib [gestures] module functions - Gestures and Touch Handling
-//------------------------------------------------------------------------------------
-int lua_SetGesturesEnabled(lua_State* L)
-{
- unsigned arg1 = LuaGetArgument_unsigned(L, 1);
- SetGesturesEnabled(arg1);
- return 0;
-}
-
-int lua_IsGestureDetected(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- bool result = IsGestureDetected(arg1);
- lua_pushboolean(L, result);
- return 1;
-}
-
-int lua_GetTouchPointsCount(lua_State* L)
-{
- int result = GetTouchPointsCount();
- lua_pushinteger(L, result);
- return 1;
-}
-
-int lua_GetGestureDetected(lua_State* L)
-{
- int result = GetGestureDetected();
- lua_pushinteger(L, result);
- return 1;
-}
-
-int lua_GetGestureHoldDuration(lua_State* L)
-{
- int result = GetGestureHoldDuration();
- lua_pushinteger(L, result);
- return 1;
-}
-
-int lua_GetGestureDragVector(lua_State* L)
-{
- Vector2 result = GetGestureDragVector();
- LuaPush_Vector2(L, result);
- return 1;
-}
-
-int lua_GetGestureDragAngle(lua_State* L)
-{
- float result = GetGestureDragAngle();
- lua_pushnumber(L, result);
- return 1;
-}
-
-int lua_GetGesturePinchVector(lua_State* L)
-{
- Vector2 result = GetGesturePinchVector();
- LuaPush_Vector2(L, result);
- return 1;
-}
-
-int lua_GetGesturePinchAngle(lua_State* L)
-{
- float result = GetGesturePinchAngle();
- lua_pushnumber(L, result);
- return 1;
-}
-
-//------------------------------------------------------------------------------------
-// raylib [camera] module functions - Camera System
-//------------------------------------------------------------------------------------
-int lua_SetCameraMode(lua_State* L)
-{
- Camera arg1 = LuaGetArgument_Camera(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- SetCameraMode(arg1, arg2);
- return 0;
-}
-
-int lua_UpdateCamera(lua_State* L)
-{
- Camera arg1 = LuaGetArgument_Camera(L, 1);
- UpdateCamera(&arg1);
- LuaPush_Camera(L, arg1);
- return 1;
-}
-
-int lua_SetCameraPanControl(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- SetCameraPanControl(arg1);
- return 0;
-}
-
-int lua_SetCameraAltControl(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- SetCameraAltControl(arg1);
- return 0;
-}
-
-int lua_SetCameraSmoothZoomControl(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- SetCameraSmoothZoomControl(arg1);
- return 0;
-}
-
-int lua_SetCameraMoveControls(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- int arg3 = LuaGetArgument_int(L, 3);
- int arg4 = LuaGetArgument_int(L, 4);
- int arg5 = LuaGetArgument_int(L, 5);
- int arg6 = LuaGetArgument_int(L, 6);
- SetCameraMoveControls(arg1, arg2, arg3, arg4, arg5, arg6);
- return 0;
-}
-
-//------------------------------------------------------------------------------------
-// raylib [shapes] module functions - Basic Shapes Drawing
-//------------------------------------------------------------------------------------
-int lua_DrawPixel(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- Color arg3 = LuaGetArgument_Color(L, 3);
- DrawPixel(arg1, arg2, arg3);
- return 0;
-}
-
-int lua_DrawPixelV(lua_State* L)
-{
- Vector2 arg1 = LuaGetArgument_Vector2(L, 1);
- Color arg2 = LuaGetArgument_Color(L, 2);
- DrawPixelV(arg1, arg2);
- return 0;
-}
-
-int lua_DrawLine(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- int arg3 = LuaGetArgument_int(L, 3);
- int arg4 = LuaGetArgument_int(L, 4);
- Color arg5 = LuaGetArgument_Color(L, 5);
- DrawLine(arg1, arg2, arg3, arg4, arg5);
- return 0;
-}
-
-int lua_DrawLineV(lua_State* L)
-{
- Vector2 arg1 = LuaGetArgument_Vector2(L, 1);
- Vector2 arg2 = LuaGetArgument_Vector2(L, 2);
- Color arg3 = LuaGetArgument_Color(L, 3);
- DrawLineV(arg1, arg2, arg3);
- return 0;
-}
-
-int lua_DrawCircle(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- float arg3 = LuaGetArgument_float(L, 3);
- Color arg4 = LuaGetArgument_Color(L, 4);
- DrawCircle(arg1, arg2, arg3, arg4);
- return 0;
-}
-
-int lua_DrawCircleGradient(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- float arg3 = LuaGetArgument_float(L, 3);
- Color arg4 = LuaGetArgument_Color(L, 4);
- Color arg5 = LuaGetArgument_Color(L, 5);
- DrawCircleGradient(arg1, arg2, arg3, arg4, arg5);
- return 0;
-}
-
-int lua_DrawCircleV(lua_State* L)
-{
- Vector2 arg1 = LuaGetArgument_Vector2(L, 1);
- float arg2 = LuaGetArgument_float(L, 2);
- Color arg3 = LuaGetArgument_Color(L, 3);
- DrawCircleV(arg1, arg2, arg3);
- return 0;
-}
-
-int lua_DrawCircleLines(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- float arg3 = LuaGetArgument_float(L, 3);
- Color arg4 = LuaGetArgument_Color(L, 4);
- DrawCircleLines(arg1, arg2, arg3, arg4);
- return 0;
-}
-
-int lua_DrawRectangle(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- int arg3 = LuaGetArgument_int(L, 3);
- int arg4 = LuaGetArgument_int(L, 4);
- Color arg5 = LuaGetArgument_Color(L, 5);
- DrawRectangle(arg1, arg2, arg3, arg4, arg5);
- return 0;
-}
-
-int lua_DrawRectangleRec(lua_State* L)
-{
- Rectangle arg1 = LuaGetArgument_Rectangle(L, 1);
- Color arg2 = LuaGetArgument_Color(L, 2);
- DrawRectangleRec(arg1, arg2);
- return 0;
-}
-
-int lua_DrawRectangleGradient(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- int arg3 = LuaGetArgument_int(L, 3);
- int arg4 = LuaGetArgument_int(L, 4);
- Color arg5 = LuaGetArgument_Color(L, 5);
- Color arg6 = LuaGetArgument_Color(L, 6);
- DrawRectangleGradient(arg1, arg2, arg3, arg4, arg5, arg6);
- return 0;
-}
-
-int lua_DrawRectangleV(lua_State* L)
-{
- Vector2 arg1 = LuaGetArgument_Vector2(L, 1);
- Vector2 arg2 = LuaGetArgument_Vector2(L, 2);
- Color arg3 = LuaGetArgument_Color(L, 3);
- DrawRectangleV(arg1, arg2, arg3);
- return 0;
-}
-
-int lua_DrawRectangleLines(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- int arg3 = LuaGetArgument_int(L, 3);
- int arg4 = LuaGetArgument_int(L, 4);
- Color arg5 = LuaGetArgument_Color(L, 5);
- DrawRectangleLines(arg1, arg2, arg3, arg4, arg5);
- return 0;
-}
-
-int lua_DrawTriangle(lua_State* L)
-{
- Vector2 arg1 = LuaGetArgument_Vector2(L, 1);
- Vector2 arg2 = LuaGetArgument_Vector2(L, 2);
- Vector2 arg3 = LuaGetArgument_Vector2(L, 3);
- Color arg4 = LuaGetArgument_Color(L, 4);
- DrawTriangle(arg1, arg2, arg3, arg4);
- return 0;
-}
-
-int lua_DrawTriangleLines(lua_State* L)
-{
- Vector2 arg1 = LuaGetArgument_Vector2(L, 1);
- Vector2 arg2 = LuaGetArgument_Vector2(L, 2);
- Vector2 arg3 = LuaGetArgument_Vector2(L, 3);
- Color arg4 = LuaGetArgument_Color(L, 4);
- DrawTriangleLines(arg1, arg2, arg3, arg4);
- return 0;
-}
-
-int lua_DrawPoly(lua_State* L)
-{
- Vector2 arg1 = LuaGetArgument_Vector2(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- float arg3 = LuaGetArgument_float(L, 3);
- float arg4 = LuaGetArgument_float(L, 4);
- Color arg5 = LuaGetArgument_Color(L, 5);
- DrawPoly(arg1, arg2, arg3, arg4, arg5);
- return 0;
-}
-
-#define GET_TABLE(type, name, index) \
- type* name = 0; \
- size_t name##_size = 0; \
- { \
- size_t sz = 0; \
- luaL_checktype(L, index, LUA_TTABLE); \
- lua_pushnil(L); \
- while (lua_next(L, index)) { \
- LuaGetArgument_##type(L, -1); \
- sz++; \
- lua_pop(L, 1); \
- } \
- name = calloc(sz, sizeof(type)); \
- sz = 0; \
- lua_pushnil(L); \
- while (lua_next(L, index)) { \
- name[sz] = LuaGetArgument_##type(L, -1); \
- sz++; \
- lua_pop(L, 1); \
- } \
- lua_pop(L, 1); \
- name##_size = sz; \
- }
-
-
-int lua_DrawPolyEx(lua_State* L)
-{
- GET_TABLE(Vector2, arg1, 1);
- Color arg2 = LuaGetArgument_Color(L, 2);
- DrawPolyEx(arg1, arg1_size, arg2);
- free(arg1);
- return 0;
-}
-
-int lua_DrawPolyExLines(lua_State* L)
-{
- GET_TABLE(Vector2, arg1, 1);
- Color arg2 = LuaGetArgument_Color(L, 2);
- DrawPolyExLines(arg1, arg1_size, arg2);
- free(arg1);
- return 0;
-}
-
-int lua_CheckCollisionRecs(lua_State* L)
-{
- Rectangle arg1 = LuaGetArgument_Rectangle(L, 1);
- Rectangle arg2 = LuaGetArgument_Rectangle(L, 2);
- bool result = CheckCollisionRecs(arg1, arg2);
- lua_pushboolean(L, result);
- return 1;
-}
-
-int lua_CheckCollisionCircles(lua_State* L)
-{
- Vector2 arg1 = LuaGetArgument_Vector2(L, 1);
- float arg2 = LuaGetArgument_float(L, 2);
- Vector2 arg3 = LuaGetArgument_Vector2(L, 3);
- float arg4 = LuaGetArgument_float(L, 4);
- bool result = CheckCollisionCircles(arg1, arg2, arg3, arg4);
- lua_pushboolean(L, result);
- return 1;
-}
-
-int lua_CheckCollisionCircleRec(lua_State* L)
-{
- Vector2 arg1 = LuaGetArgument_Vector2(L, 1);
- float arg2 = LuaGetArgument_float(L, 2);
- Rectangle arg3 = LuaGetArgument_Rectangle(L, 3);
- bool result = CheckCollisionCircleRec(arg1, arg2, arg3);
- lua_pushboolean(L, result);
- return 1;
-}
-
-int lua_GetCollisionRec(lua_State* L)
-{
- Rectangle arg1 = LuaGetArgument_Rectangle(L, 1);
- Rectangle arg2 = LuaGetArgument_Rectangle(L, 2);
- Rectangle result = GetCollisionRec(arg1, arg2);
- LuaPush_Rectangle(L, result);
- return 1;
-}
-
-int lua_CheckCollisionPointRec(lua_State* L)
-{
- Vector2 arg1 = LuaGetArgument_Vector2(L, 1);
- Rectangle arg2 = LuaGetArgument_Rectangle(L, 2);
- bool result = CheckCollisionPointRec(arg1, arg2);
- lua_pushboolean(L, result);
- return 1;
-}
-
-int lua_CheckCollisionPointCircle(lua_State* L)
-{
- Vector2 arg1 = LuaGetArgument_Vector2(L, 1);
- Vector2 arg2 = LuaGetArgument_Vector2(L, 2);
- float arg3 = LuaGetArgument_float(L, 3);
- bool result = CheckCollisionPointCircle(arg1, arg2, arg3);
- lua_pushboolean(L, result);
- return 1;
-}
-
-int lua_CheckCollisionPointTriangle(lua_State* L)
-{
- Vector2 arg1 = LuaGetArgument_Vector2(L, 1);
- Vector2 arg2 = LuaGetArgument_Vector2(L, 2);
- Vector2 arg3 = LuaGetArgument_Vector2(L, 3);
- Vector2 arg4 = LuaGetArgument_Vector2(L, 4);
- bool result = CheckCollisionPointTriangle(arg1, arg2, arg3, arg4);
- lua_pushboolean(L, result);
- return 1;
-}
-
-//------------------------------------------------------------------------------------
-// raylib [textures] module functions - Texture Loading and Drawing
-//------------------------------------------------------------------------------------
-int lua_LoadImage(lua_State* L)
-{
- const char * arg1 = LuaGetArgument_string(L, 1);
- Image result = LoadImage(arg1);
- LuaPush_Image(L, result);
- return 1;
-}
-
-int lua_LoadImageEx(lua_State* L)
-{
- // TODO: Image LoadImageEx(Color *pixels, int width, int height);
-
- GET_TABLE(Color, arg1, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- int arg3 = LuaGetArgument_int(L, 3);
- Image result = LoadImageEx(arg1, arg2, arg3); // ISSUE: #3 number expected, got no value
- LuaPush_Image(L, result);
- free(arg1);
- return 1;
-}
-
-int lua_LoadImageRaw(lua_State* L)
-{
- const char * arg1 = LuaGetArgument_string(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- int arg3 = LuaGetArgument_int(L, 3);
- int arg4 = LuaGetArgument_int(L, 4);
- int arg5 = LuaGetArgument_int(L, 5);
- Image result = LoadImageRaw(arg1, arg2, arg3, arg4, arg5);
- LuaPush_Image(L, result);
- return 1;
-}
-
-int lua_LoadImageFromRES(lua_State* L)
-{
- const char * arg1 = LuaGetArgument_string(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- Image result = LoadImageFromRES(arg1, arg2);
- LuaPush_Image(L, result);
- return 1;
-}
-
-int lua_LoadTexture(lua_State* L)
-{
- const char * arg1 = LuaGetArgument_string(L, 1);
- Texture2D result = LoadTexture(arg1);
- LuaPush_Texture2D(L, result);
- return 1;
-}
-
-int lua_LoadTextureEx(lua_State* L)
-{
- void * arg1 = (char *)LuaGetArgument_string(L, 1); // NOTE: getting argument as string?
- int arg2 = LuaGetArgument_int(L, 2);
- int arg3 = LuaGetArgument_int(L, 3);
- int arg4 = LuaGetArgument_int(L, 4);
- Texture2D result = LoadTextureEx(arg1, arg2, arg3, arg4);
- LuaPush_Texture2D(L, result);
- return 1;
-}
-
-int lua_LoadTextureFromRES(lua_State* L)
-{
- const char * arg1 = LuaGetArgument_string(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- Texture2D result = LoadTextureFromRES(arg1, arg2);
- LuaPush_Texture2D(L, result);
- return 1;
-}
-
-int lua_LoadTextureFromImage(lua_State* L)
-{
- Image arg1 = LuaGetArgument_Image(L, 1);
- Texture2D result = LoadTextureFromImage(arg1);
- LuaPush_Texture2D(L, result);
- return 1;
-}
-
-int lua_LoadRenderTexture(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- RenderTexture2D result = LoadRenderTexture(arg1, arg2);
- LuaPush_RenderTexture2D(L, result);
- return 1;
-}
-
-int lua_UnloadImage(lua_State* L)
-{
- Image arg1 = LuaGetArgument_Image(L, 1);
- UnloadImage(arg1);
- return 0;
-}
-
-int lua_UnloadTexture(lua_State* L)
-{
- Texture2D arg1 = LuaGetArgument_Texture2D(L, 1);
- UnloadTexture(arg1);
- return 0;
-}
-
-int lua_UnloadRenderTexture(lua_State* L)
-{
- RenderTexture2D arg1 = LuaGetArgument_RenderTexture2D(L, 1);
- UnloadRenderTexture(arg1);
- return 0;
-}
-
-int lua_GetImageData(lua_State* L)
-{
- // TODO: Color *GetImageData(Image image);
-
- Image arg1 = LuaGetArgument_Image(L, 1);
- Color * result = GetImageData(arg1);
- lua_createtable(L, arg1.width*arg1.height, 0);
- for (int i = 0; i < arg1.width*arg1.height; i++)
- {
- LuaPush_Color(L, result[i]);
- lua_rawseti(L, -2, i + 1);
- }
- free(result);
- return 1;
-}
-
-int lua_GetTextureData(lua_State* L)
-{
- Texture2D arg1 = LuaGetArgument_Texture2D(L, 1);
- Image result = GetTextureData(arg1);
- LuaPush_Image(L, result);
- return 1;
-}
-
-int lua_UpdateTexture(lua_State* L)
-{
- // TODO: void UpdateTexture(Texture2D texture, void *pixels);
-
- Texture2D arg1 = LuaGetArgument_Texture2D(L, 1);
- void * arg2 = (char *)LuaGetArgument_string(L, 2); // NOTE: Getting (void *) as string?
- UpdateTexture(arg1, arg2); // ISSUE: #2 string expected, got table -> GetImageData() returns a table!
- return 0;
-}
-
-int lua_ImageToPOT(lua_State* L)
-{
- Image arg1 = LuaGetArgument_Image(L, 1);
- Color arg2 = LuaGetArgument_Color(L, 2);
- ImageToPOT(&arg1, arg2);
- LuaPush_Image(L, arg1);
- return 1;
-}
-
-int lua_ImageFormat(lua_State* L)
-{
- Image arg1 = LuaGetArgument_Image(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- ImageFormat(&arg1, arg2);
- LuaPush_Image(L, arg1);
- return 1;
-}
-
-int lua_ImageDither(lua_State* L)
-{
- Image arg1 = LuaGetArgument_Image(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- int arg3 = LuaGetArgument_int(L, 3);
- int arg4 = LuaGetArgument_int(L, 4);
- int arg5 = LuaGetArgument_int(L, 5);
- ImageDither(&arg1, arg2, arg3, arg4, arg5);
- LuaPush_Image(L, arg1);
- return 1;
-}
-
-int lua_ImageCopy(lua_State* L)
-{
- Image arg1 = LuaGetArgument_Image(L, 1);
- Image result = ImageCopy(arg1);
- LuaPush_Image(L, result);
- return 1;
-}
-
-int lua_ImageCrop(lua_State* L)
-{
- Image arg1 = LuaGetArgument_Image(L, 1);
- Rectangle arg2 = LuaGetArgument_Rectangle(L, 2);
- ImageCrop(&arg1, arg2);
- LuaPush_Image(L, arg1);
- return 1;
-}
-
-int lua_ImageResize(lua_State* L)
-{
- Image arg1 = LuaGetArgument_Image(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- int arg3 = LuaGetArgument_int(L, 3);
- ImageResize(&arg1, arg2, arg3);
- LuaPush_Image(L, arg1);
- return 1;
-}
-
-int lua_ImageResizeNN(lua_State* L)
-{
- Image arg1 = LuaGetArgument_Image(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- int arg3 = LuaGetArgument_int(L, 3);
- ImageResizeNN(&arg1, arg2, arg3);
- LuaPush_Image(L, arg1);
- return 1;
-}
-
-int lua_ImageText(lua_State* L)
-{
- const char * arg1 = LuaGetArgument_string(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- Color arg3 = LuaGetArgument_Color(L, 3);
- Image result = ImageText(arg1, arg2, arg3);
- LuaPush_Image(L, result);
- return 1;
-}
-
-int lua_ImageTextEx(lua_State* L)
-{
- SpriteFont arg1 = LuaGetArgument_SpriteFont(L, 1);
- const char * arg2 = LuaGetArgument_string(L, 2);
- int arg3 = LuaGetArgument_int(L, 3);
- int arg4 = LuaGetArgument_int(L, 4);
- Color arg5 = LuaGetArgument_Color(L, 5);
- Image result = ImageTextEx(arg1, arg2, arg3, arg4, arg5);
- LuaPush_Image(L, result);
- return 1;
-}
-
-int lua_ImageDraw(lua_State* L)
-{
- Image arg1 = LuaGetArgument_Image(L, 1);
- Image arg2 = LuaGetArgument_Image(L, 2);
- Rectangle arg3 = LuaGetArgument_Rectangle(L, 3);
- Rectangle arg4 = LuaGetArgument_Rectangle(L, 4);
- ImageDraw(&arg1, arg2, arg3, arg4);
- LuaPush_Image(L, arg1);
- return 1;
-}
-
-int lua_ImageDrawText(lua_State* L)
-{
- Image arg1 = LuaGetArgument_Image(L, 1);
- Vector2 arg2 = LuaGetArgument_Vector2(L, 2);
- const char * arg3 = LuaGetArgument_string(L, 3);
- int arg4 = LuaGetArgument_int(L, 4);
- Color arg5 = LuaGetArgument_Color(L, 5);
- ImageDrawText(&arg1, arg2, arg3, arg4, arg5);
- LuaPush_Image(L, arg1);
- return 1;
-}
-
-int lua_ImageDrawTextEx(lua_State* L)
-{
- Image arg1 = LuaGetArgument_Image(L, 1);
- Vector2 arg2 = LuaGetArgument_Vector2(L, 2);
- SpriteFont arg3 = LuaGetArgument_SpriteFont(L, 3);
- const char * arg4 = LuaGetArgument_string(L, 4);
- float arg5 = LuaGetArgument_float(L, 5);
- int arg6 = LuaGetArgument_int(L, 6);
- Color arg7 = LuaGetArgument_Color(L, 7);
- ImageDrawTextEx(&arg1, arg2, arg3, arg4, arg5, arg6, arg7);
- LuaPush_Image(L, arg1);
- return 1;
-}
-
-int lua_ImageFlipVertical(lua_State* L)
-{
- Image arg1 = LuaGetArgument_Image(L, 1);
- ImageFlipVertical(&arg1);
- LuaPush_Image(L, arg1);
- return 1;
-}
-
-int lua_ImageFlipHorizontal(lua_State* L)
-{
- Image arg1 = LuaGetArgument_Image(L, 1);
- ImageFlipHorizontal(&arg1);
- LuaPush_Image(L, arg1);
- return 1;
-}
-
-int lua_ImageColorTint(lua_State* L)
-{
- Image arg1 = LuaGetArgument_Image(L, 1);
- Color arg2 = LuaGetArgument_Color(L, 2);
- ImageColorTint(&arg1, arg2);
- LuaPush_Image(L, arg1);
- return 1;
-}
-
-int lua_ImageColorInvert(lua_State* L)
-{
- Image arg1 = LuaGetArgument_Image(L, 1);
- ImageColorInvert(&arg1);
- LuaPush_Image(L, arg1);
- return 1;
-}
-
-int lua_ImageColorGrayscale(lua_State* L)
-{
- Image arg1 = LuaGetArgument_Image(L, 1);
- ImageColorGrayscale(&arg1);
- LuaPush_Image(L, arg1);
- return 1;
-}
-
-int lua_ImageColorContrast(lua_State* L)
-{
- Image arg1 = LuaGetArgument_Image(L, 1);
- float arg2 = LuaGetArgument_float(L, 2);
- ImageColorContrast(&arg1, arg2);
- LuaPush_Image(L, arg1);
- return 1;
-}
-
-int lua_ImageColorBrightness(lua_State* L)
-{
- Image arg1 = LuaGetArgument_Image(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- ImageColorBrightness(&arg1, arg2);
- LuaPush_Image(L, arg1);
- return 1;
-}
-
-int lua_GenTextureMipmaps(lua_State* L)
-{
- Texture2D arg1 = LuaGetArgument_Texture2D(L, 1);
- GenTextureMipmaps(&arg1);
- LuaPush_Texture2D(L, arg1);
- return 1;
-}
-
-int lua_SetTextureFilter(lua_State* L)
-{
- Texture2D arg1 = LuaGetArgument_Texture2D(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- SetTextureFilter(arg1, arg2);
- return 0;
-}
-
-int lua_SetTextureWrap(lua_State* L)
-{
- Texture2D arg1 = LuaGetArgument_Texture2D(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- SetTextureWrap(arg1, arg2);
- return 0;
-}
-
-int lua_DrawTexture(lua_State* L)
-{
- Texture2D arg1 = LuaGetArgument_Texture2D(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- int arg3 = LuaGetArgument_int(L, 3);
- Color arg4 = LuaGetArgument_Color(L, 4);
- DrawTexture(arg1, arg2, arg3, arg4);
- return 0;
-}
-
-int lua_DrawTextureV(lua_State* L)
-{
- Texture2D arg1 = LuaGetArgument_Texture2D(L, 1);
- Vector2 arg2 = LuaGetArgument_Vector2(L, 2);
- Color arg3 = LuaGetArgument_Color(L, 3);
- DrawTextureV(arg1, arg2, arg3);
- return 0;
-}
-
-int lua_DrawTextureEx(lua_State* L)
-{
- Texture2D arg1 = LuaGetArgument_Texture2D(L, 1);
- Vector2 arg2 = LuaGetArgument_Vector2(L, 2);
- float arg3 = LuaGetArgument_float(L, 3);
- float arg4 = LuaGetArgument_float(L, 4);
- Color arg5 = LuaGetArgument_Color(L, 5);
- DrawTextureEx(arg1, arg2, arg3, arg4, arg5);
- return 0;
-}
-
-int lua_DrawTextureRec(lua_State* L)
-{
- Texture2D arg1 = LuaGetArgument_Texture2D(L, 1);
- Rectangle arg2 = LuaGetArgument_Rectangle(L, 2);
- Vector2 arg3 = LuaGetArgument_Vector2(L, 3);
- Color arg4 = LuaGetArgument_Color(L, 4);
- DrawTextureRec(arg1, arg2, arg3, arg4);
- return 0;
-}
-
-int lua_DrawTexturePro(lua_State* L)
-{
- Texture2D arg1 = LuaGetArgument_Texture2D(L, 1);
- Rectangle arg2 = LuaGetArgument_Rectangle(L, 2);
- Rectangle arg3 = LuaGetArgument_Rectangle(L, 3);
- Vector2 arg4 = LuaGetArgument_Vector2(L, 4);
- float arg5 = LuaGetArgument_float(L, 5);
- Color arg6 = LuaGetArgument_Color(L, 6);
- DrawTexturePro(arg1, arg2, arg3, arg4, arg5, arg6);
- return 0;
-}
-
-//------------------------------------------------------------------------------------
-// raylib [text] module functions - Font Loading and Text Drawing
-//------------------------------------------------------------------------------------
-int lua_GetDefaultFont(lua_State* L)
-{
- SpriteFont result = GetDefaultFont();
- LuaPush_SpriteFont(L, result);
- return 1;
-}
-
-int lua_LoadSpriteFont(lua_State* L)
-{
- const char * arg1 = LuaGetArgument_string(L, 1);
- SpriteFont result = LoadSpriteFont(arg1);
- LuaPush_SpriteFont(L, result);
- return 1;
-}
-
-int lua_LoadSpriteFontTTF(lua_State* L)
-{
- const char * arg1 = LuaGetArgument_string(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- int arg3 = LuaGetArgument_int(L, 3);
- int arg4 = LuaGetArgument_int(L, 4);
- //LoadSpriteFontTTF(const char *fileName, int fontSize, int charsCount, int *fontChars);
- SpriteFont result = LoadSpriteFontTTF(arg1, arg2, arg3, &arg4);
- LuaPush_SpriteFont(L, result);
- return 1;
-}
-
-int lua_UnloadSpriteFont(lua_State* L)
-{
- SpriteFont arg1 = LuaGetArgument_SpriteFont(L, 1);
- UnloadSpriteFont(arg1);
- return 0;
-}
-
-int lua_DrawText(lua_State* L)
-{
- const char * arg1 = LuaGetArgument_string(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- int arg3 = LuaGetArgument_int(L, 3);
- int arg4 = LuaGetArgument_int(L, 4);
- Color arg5 = LuaGetArgument_Color(L, 5);
- DrawText(arg1, arg2, arg3, arg4, arg5);
- return 0;
-}
-
-int lua_DrawTextEx(lua_State* L)
-{
- SpriteFont arg1 = LuaGetArgument_SpriteFont(L, 1);
- const char * arg2 = LuaGetArgument_string(L, 2);
- Vector2 arg3 = LuaGetArgument_Vector2(L, 3);
- float arg4 = LuaGetArgument_float(L, 4);
- int arg5 = LuaGetArgument_int(L, 5);
- Color arg6 = LuaGetArgument_Color(L, 6);
- DrawTextEx(arg1, arg2, arg3, arg4, arg5, arg6);
- return 0;
-}
-
-int lua_MeasureText(lua_State* L)
-{
- const char * arg1 = LuaGetArgument_string(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- int result = MeasureText(arg1, arg2);
- lua_pushinteger(L, result);
- return 1;
-}
-
-int lua_MeasureTextEx(lua_State* L)
-{
- SpriteFont arg1 = LuaGetArgument_SpriteFont(L, 1);
- const char * arg2 = LuaGetArgument_string(L, 2);
- int arg3 = LuaGetArgument_int(L, 3);
- int arg4 = LuaGetArgument_int(L, 4);
- Vector2 result = MeasureTextEx(arg1, arg2, arg3, arg4);
- LuaPush_Vector2(L, result);
- return 1;
-}
-
-int lua_DrawFPS(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- DrawFPS(arg1, arg2);
- return 0;
-}
-
-// NOTE: FormatText() can be replaced by Lua function: string.format()
-// NOTE: SubText() can be replaced by Lua function: string.sub()
-
-//------------------------------------------------------------------------------------
-// raylib [models] module functions - Basic 3d Shapes Drawing Functions
-//------------------------------------------------------------------------------------
-int lua_DrawLine3D(lua_State* L)
-{
- Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
- Vector3 arg2 = LuaGetArgument_Vector3(L, 2);
- Color arg3 = LuaGetArgument_Color(L, 3);
- DrawLine3D(arg1, arg2, arg3);
- return 0;
-}
-
-int lua_DrawCircle3D(lua_State* L)
-{
- Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
- float arg2 = LuaGetArgument_float(L, 2);
- Vector3 arg3 = LuaGetArgument_Vector3(L, 3);
- float arg4 = LuaGetArgument_float(L, 4);
- Color arg5 = LuaGetArgument_Color(L, 5);
- DrawCircle3D(arg1, arg2, arg3, arg4, arg5);
- return 0;
-}
-
-int lua_DrawCube(lua_State* L)
-{
- Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
- float arg2 = LuaGetArgument_float(L, 2);
- float arg3 = LuaGetArgument_float(L, 3);
- float arg4 = LuaGetArgument_float(L, 4);
- Color arg5 = LuaGetArgument_Color(L, 5);
- DrawCube(arg1, arg2, arg3, arg4, arg5);
- return 0;
-}
-
-int lua_DrawCubeV(lua_State* L)
-{
- Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
- Vector3 arg2 = LuaGetArgument_Vector3(L, 2);
- Color arg3 = LuaGetArgument_Color(L, 3);
- DrawCubeV(arg1, arg2, arg3);
- return 0;
-}
-
-int lua_DrawCubeWires(lua_State* L)
-{
- Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
- float arg2 = LuaGetArgument_float(L, 2);
- float arg3 = LuaGetArgument_float(L, 3);
- float arg4 = LuaGetArgument_float(L, 4);
- Color arg5 = LuaGetArgument_Color(L, 5);
- DrawCubeWires(arg1, arg2, arg3, arg4, arg5);
- return 0;
-}
-
-int lua_DrawCubeTexture(lua_State* L)
-{
- Texture2D arg1 = LuaGetArgument_Texture2D(L, 1);
- Vector3 arg2 = LuaGetArgument_Vector3(L, 2);
- float arg3 = LuaGetArgument_float(L, 3);
- float arg4 = LuaGetArgument_float(L, 4);
- float arg5 = LuaGetArgument_float(L, 5);
- Color arg6 = LuaGetArgument_Color(L, 6);
- DrawCubeTexture(arg1, arg2, arg3, arg4, arg5, arg6);
- return 0;
-}
-
-int lua_DrawSphere(lua_State* L)
-{
- Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
- float arg2 = LuaGetArgument_float(L, 2);
- Color arg3 = LuaGetArgument_Color(L, 3);
- DrawSphere(arg1, arg2, arg3);
- return 0;
-}
-
-int lua_DrawSphereEx(lua_State* L)
-{
- Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
- float arg2 = LuaGetArgument_float(L, 2);
- int arg3 = LuaGetArgument_int(L, 3);
- int arg4 = LuaGetArgument_int(L, 4);
- Color arg5 = LuaGetArgument_Color(L, 5);
- DrawSphereEx(arg1, arg2, arg3, arg4, arg5);
- return 0;
-}
-
-int lua_DrawSphereWires(lua_State* L)
-{
- Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
- float arg2 = LuaGetArgument_float(L, 2);
- int arg3 = LuaGetArgument_int(L, 3);
- int arg4 = LuaGetArgument_int(L, 4);
- Color arg5 = LuaGetArgument_Color(L, 5);
- DrawSphereWires(arg1, arg2, arg3, arg4, arg5);
- return 0;
-}
-
-int lua_DrawCylinder(lua_State* L)
-{
- Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
- float arg2 = LuaGetArgument_float(L, 2);
- float arg3 = LuaGetArgument_float(L, 3);
- float arg4 = LuaGetArgument_float(L, 4);
- int arg5 = LuaGetArgument_int(L, 5);
- Color arg6 = LuaGetArgument_Color(L, 6);
- DrawCylinder(arg1, arg2, arg3, arg4, arg5, arg6);
- return 0;
-}
-
-int lua_DrawCylinderWires(lua_State* L)
-{
- Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
- float arg2 = LuaGetArgument_float(L, 2);
- float arg3 = LuaGetArgument_float(L, 3);
- float arg4 = LuaGetArgument_float(L, 4);
- int arg5 = LuaGetArgument_int(L, 5);
- Color arg6 = LuaGetArgument_Color(L, 6);
- DrawCylinderWires(arg1, arg2, arg3, arg4, arg5, arg6);
- return 0;
-}
-
-int lua_DrawPlane(lua_State* L)
-{
- Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
- Vector2 arg2 = LuaGetArgument_Vector2(L, 2);
- Color arg3 = LuaGetArgument_Color(L, 3);
- DrawPlane(arg1, arg2, arg3);
- return 0;
-}
-
-int lua_DrawRay(lua_State* L)
-{
- Ray arg1 = LuaGetArgument_Ray(L, 1);
- Color arg2 = LuaGetArgument_Color(L, 2);
- DrawRay(arg1, arg2);
- return 0;
-}
-
-int lua_DrawGrid(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- float arg2 = LuaGetArgument_float(L, 2);
- DrawGrid(arg1, arg2);
- return 0;
-}
-
-int lua_DrawGizmo(lua_State* L)
-{
- Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
- DrawGizmo(arg1);
- return 0;
-}
-
-int lua_DrawLight(lua_State* L)
-{
- Light arg1 = LuaGetArgument_Light(L, 1);
- DrawLight(arg1);
- return 0;
-}
-
-//------------------------------------------------------------------------------------
-// raylib [models] module functions
-//------------------------------------------------------------------------------------
-int lua_LoadModel(lua_State* L)
-{
- const char * arg1 = LuaGetArgument_string(L, 1);
- Model result = LoadModel(arg1);
- LuaPush_Model(L, result);
- return 1;
-}
-
-int lua_LoadModelEx(lua_State* L)
-{
- Mesh arg1 = LuaGetArgument_Mesh(L, 1);
- bool arg2 = LuaGetArgument_int(L, 2);
- Model result = LoadModelEx(arg1, arg2);
- LuaPush_Model(L, result);
- return 1;
-}
-
-int lua_LoadModelFromRES(lua_State* L)
-{
- const char * arg1 = LuaGetArgument_string(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- Model result = LoadModelFromRES(arg1, arg2);
- LuaPush_Model(L, result);
- return 1;
-}
-
-int lua_LoadHeightmap(lua_State* L)
-{
- Image arg1 = LuaGetArgument_Image(L, 1);
- Vector3 arg2 = LuaGetArgument_Vector3(L, 2);
- Model result = LoadHeightmap(arg1, arg2);
- LuaPush_Model(L, result);
- return 1;
-}
-
-int lua_LoadCubicmap(lua_State* L)
-{
- Image arg1 = LuaGetArgument_Image(L, 1);
- Model result = LoadCubicmap(arg1);
- LuaPush_Model(L, result);
- return 1;
-}
-
-int lua_UnloadModel(lua_State* L)
-{
- Model arg1 = LuaGetArgument_Model(L, 1);
- UnloadModel(arg1);
- return 0;
-}
-
-// TODO: GenMesh*() functionality (not ready yet on raylib 1.6)
-
-int lua_LoadMaterial(lua_State* L)
-{
- const char * arg1 = LuaGetArgument_string(L, 1);
- Material result = LoadMaterial(arg1);
- LuaPush_Material(L, result);
- return 1;
-}
-
-int lua_LoadDefaultMaterial(lua_State* L)
-{
- Material result = LoadDefaultMaterial();
- LuaPush_Material(L, result);
- return 1;
-}
-
-int lua_LoadStandardMaterial(lua_State* L)
-{
- Material result = LoadStandardMaterial();
- LuaPush_Material(L, result);
- return 1;
-}
-
-int lua_UnloadMaterial(lua_State* L)
-{
- Material arg1 = LuaGetArgument_Material(L, 1);
- UnloadMaterial(arg1);
- return 0;
-}
-
-int lua_DrawModel(lua_State* L)
-{
- Model arg1 = LuaGetArgument_Model(L, 1);
- Vector3 arg2 = LuaGetArgument_Vector3(L, 2);
- float arg3 = LuaGetArgument_float(L, 3);
- Color arg4 = LuaGetArgument_Color(L, 4);
- DrawModel(arg1, arg2, arg3, arg4);
- return 0;
-}
-
-int lua_DrawModelEx(lua_State* L)
-{
- Model arg1 = LuaGetArgument_Model(L, 1);
- Vector3 arg2 = LuaGetArgument_Vector3(L, 2);
- Vector3 arg3 = LuaGetArgument_Vector3(L, 3);
- float arg4 = LuaGetArgument_float(L, 4);
- Vector3 arg5 = LuaGetArgument_Vector3(L, 5);
- Color arg6 = LuaGetArgument_Color(L, 6);
- DrawModelEx(arg1, arg2, arg3, arg4, arg5, arg6);
- return 0;
-}
-
-int lua_DrawModelWires(lua_State* L)
-{
- Model arg1 = LuaGetArgument_Model(L, 1);
- Vector3 arg2 = LuaGetArgument_Vector3(L, 2);
- float arg3 = LuaGetArgument_float(L, 3);
- Color arg4 = LuaGetArgument_Color(L, 4);
- DrawModelWires(arg1, arg2, arg3, arg4);
- return 0;
-}
-
-int lua_DrawModelWiresEx(lua_State* L)
-{
- Model arg1 = LuaGetArgument_Model(L, 1);
- Vector3 arg2 = LuaGetArgument_Vector3(L, 2);
- Vector3 arg3 = LuaGetArgument_Vector3(L, 3);
- float arg4 = LuaGetArgument_float(L, 4);
- Vector3 arg5 = LuaGetArgument_Vector3(L, 5);
- Color arg6 = LuaGetArgument_Color(L, 6);
- DrawModelWiresEx(arg1, arg2, arg3, arg4, arg5, arg6);
- return 0;
-}
-
-int lua_DrawBillboard(lua_State* L)
-{
- Camera arg1 = LuaGetArgument_Camera(L, 1);
- Texture2D arg2 = LuaGetArgument_Texture2D(L, 2);
- Vector3 arg3 = LuaGetArgument_Vector3(L, 3);
- float arg4 = LuaGetArgument_float(L, 4);
- Color arg5 = LuaGetArgument_Color(L, 5);
- DrawBillboard(arg1, arg2, arg3, arg4, arg5);
- return 0;
-}
-
-int lua_DrawBillboardRec(lua_State* L)
-{
- Camera arg1 = LuaGetArgument_Camera(L, 1);
- Texture2D arg2 = LuaGetArgument_Texture2D(L, 2);
- Rectangle arg3 = LuaGetArgument_Rectangle(L, 3);
- Vector3 arg4 = LuaGetArgument_Vector3(L, 4);
- float arg5 = LuaGetArgument_float(L, 5);
- Color arg6 = LuaGetArgument_Color(L, 6);
- DrawBillboardRec(arg1, arg2, arg3, arg4, arg5, arg6);
- return 0;
-}
-
-int lua_CalculateBoundingBox(lua_State* L)
-{
- Mesh arg1 = LuaGetArgument_Mesh(L, 1);
- BoundingBox result = CalculateBoundingBox(arg1);
- LuaPush_BoundingBox(L, result);
- return 1;
-}
-
-int lua_CheckCollisionSpheres(lua_State* L)
-{
- Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
- float arg2 = LuaGetArgument_float(L, 2);
- Vector3 arg3 = LuaGetArgument_Vector3(L, 3);
- float arg4 = LuaGetArgument_float(L, 4);
- bool result = CheckCollisionSpheres(arg1, arg2, arg3, arg4);
- lua_pushboolean(L, result);
- return 1;
-}
-
-int lua_CheckCollisionBoxes(lua_State* L)
-{
- BoundingBox arg1 = LuaGetArgument_BoundingBox(L, 1);
- BoundingBox arg2 = LuaGetArgument_BoundingBox(L, 2);
- bool result = CheckCollisionBoxes(arg1, arg2);
- lua_pushboolean(L, result);
- return 1;
-}
-
-int lua_CheckCollisionBoxSphere(lua_State* L)
-{
- BoundingBox arg1 = LuaGetArgument_BoundingBox(L, 1);
- Vector3 arg2 = LuaGetArgument_Vector3(L, 2);
- float arg3 = LuaGetArgument_float(L, 3);
- bool result = CheckCollisionBoxSphere(arg1, arg2, arg3);
- lua_pushboolean(L, result);
- return 1;
-}
-
-int lua_CheckCollisionRaySphere(lua_State* L)
-{
- Ray arg1 = LuaGetArgument_Ray(L, 1);
- Vector3 arg2 = LuaGetArgument_Vector3(L, 2);
- float arg3 = LuaGetArgument_float(L, 3);
- bool result = CheckCollisionRaySphere(arg1, arg2, arg3);
- lua_pushboolean(L, result);
- return 1;
-}
-
-int lua_CheckCollisionRaySphereEx(lua_State* L)
-{
- Ray arg1 = LuaGetArgument_Ray(L, 1);
- Vector3 arg2 = LuaGetArgument_Vector3(L, 2);
- float arg3 = LuaGetArgument_float(L, 3);
- Vector3 arg4 = LuaGetArgument_Vector3(L, 4);
- bool result = CheckCollisionRaySphereEx(arg1, arg2, arg3, &arg4);
- lua_pushboolean(L, result);
- LuaPush_Vector3(L, arg4);
- return 2;
-}
-
-int lua_CheckCollisionRayBox(lua_State* L)
-{
- Ray arg1 = LuaGetArgument_Ray(L, 1);
- BoundingBox arg2 = LuaGetArgument_BoundingBox(L, 2);
- bool result = CheckCollisionRayBox(arg1, arg2);
- lua_pushboolean(L, result);
- return 1;
-}
-
-//------------------------------------------------------------------------------------
-// raylib [raymath] module functions - Shaders
-//------------------------------------------------------------------------------------
-int lua_LoadShader(lua_State* L)
-{
- char * arg1 = (char *)LuaGetArgument_string(L, 1);
- char * arg2 = (char *)LuaGetArgument_string(L, 2);
- Shader result = LoadShader(arg1, arg2);
- LuaPush_Shader(L, result);
- return 1;
-}
-
-int lua_UnloadShader(lua_State* L)
-{
- Shader arg1 = LuaGetArgument_Shader(L, 1);
- UnloadShader(arg1);
- return 0;
-}
-
-int lua_GetDefaultShader(lua_State* L)
-{
- Shader result = GetDefaultShader();
- LuaPush_Shader(L, result);
- return 1;
-}
-
-int lua_GetStandardShader(lua_State* L)
-{
- Shader result = GetStandardShader();
- LuaPush_Shader(L, result);
- return 1;
-}
-
-int lua_GetDefaultTexture(lua_State* L)
-{
- Texture2D result = GetDefaultTexture();
- LuaPush_Texture2D(L, result);
- return 1;
-}
-
-int lua_GetShaderLocation(lua_State* L)
-{
- Shader arg1 = LuaGetArgument_Shader(L, 1);
- const char * arg2 = LuaGetArgument_string(L, 2);
- int result = GetShaderLocation(arg1, arg2);
- lua_pushinteger(L, result);
- return 1;
-}
-
-int lua_SetShaderValue(lua_State* L)
-{
- Shader arg1 = LuaGetArgument_Shader(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- GET_TABLE(float, arg3, 3);
- SetShaderValue(arg1, arg2, arg3, arg3_size);
- free(arg3);
- return 0;
-}
-
-int lua_SetShaderValuei(lua_State* L)
-{
- Shader arg1 = LuaGetArgument_Shader(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- GET_TABLE(int, arg3, 3);
- SetShaderValuei(arg1, arg2, arg3, arg3_size);
- free(arg3);
- return 0;
-}
-
-int lua_SetShaderValueMatrix(lua_State* L)
-{
- Shader arg1 = LuaGetArgument_Shader(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- Matrix arg3 = LuaGetArgument_Matrix(L, 3);
- SetShaderValueMatrix(arg1, arg2, arg3);
- return 0;
-}
-
-int lua_SetMatrixProjection(lua_State* L)
-{
- Matrix arg1 = LuaGetArgument_Matrix(L, 1);
- SetMatrixProjection(arg1);
- return 0;
-}
-
-int lua_SetMatrixModelview(lua_State* L)
-{
- Matrix arg1 = LuaGetArgument_Matrix(L, 1);
- SetMatrixModelview(arg1);
- return 0;
-}
-
-int lua_BeginShaderMode(lua_State* L)
-{
- Shader arg1 = LuaGetArgument_Shader(L, 1);
- BeginShaderMode(arg1);
- return 0;
-}
-
-int lua_EndShaderMode(lua_State* L)
-{
- EndShaderMode();
- return 0;
-}
-
-int lua_BeginBlendMode(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- BeginBlendMode(arg1);
- return 0;
-}
-
-int lua_EndBlendMode(lua_State* L)
-{
- EndBlendMode();
- return 0;
-}
-
-int lua_CreateLight(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- Vector3 arg2 = LuaGetArgument_Vector3(L, 2);
- Color arg3 = LuaGetArgument_Color(L, 3);
- Light result = CreateLight(arg1, arg2, arg3);
- LuaPush_Light(L, result);
- return 1;
-}
-
-int lua_DestroyLight(lua_State* L)
-{
- Light arg1 = LuaGetArgument_Light(L, 1);
- DestroyLight(arg1);
- return 0;
-}
-
-
-//------------------------------------------------------------------------------------
-// raylib [rlgl] module functions - VR experience
-//------------------------------------------------------------------------------------
-int lua_InitVrDevice(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- InitVrDevice(arg1);
- return 0;
-}
-
-int lua_CloseVrDevice(lua_State* L)
-{
- CloseVrDevice();
- return 0;
-}
-
-int lua_IsVrDeviceReady(lua_State* L)
-{
- bool result = IsVrDeviceReady();
- lua_pushboolean(L, result);
- return 1;
-}
-
-int lua_IsVrSimulator(lua_State* L)
-{
- bool result = IsVrSimulator();
- lua_pushboolean(L, result);
- return 1;
-}
-
-int lua_UpdateVrTracking(lua_State* L)
-{
- Camera arg1 = LuaGetArgument_Camera(L, 1);
- UpdateVrTracking(&arg1);
- LuaPush_Camera(L, arg1);
- return 1;
-}
-
-int lua_ToggleVrMode(lua_State* L)
-{
- ToggleVrMode();
- return 0;
-}
-
-//------------------------------------------------------------------------------------
-// raylib [audio] module functions - Audio Loading and Playing
-//------------------------------------------------------------------------------------
-int lua_InitAudioDevice(lua_State* L)
-{
- InitAudioDevice();
- return 0;
-}
-
-int lua_CloseAudioDevice(lua_State* L)
-{
- CloseAudioDevice();
- return 0;
-}
-
-int lua_IsAudioDeviceReady(lua_State* L)
-{
- bool result = IsAudioDeviceReady();
- lua_pushboolean(L, result);
- return 1;
-}
-
-int lua_LoadWave(lua_State* L)
-{
- const char * arg1 = LuaGetArgument_string(L, 1);
- Wave result = LoadWave((char *)arg1);
- LuaPush_Wave(L, result);
- return 1;
-}
-
-int lua_LoadWaveEx(lua_State* L)
-{
- // TODO: Wave LoadWaveEx(float *data, int sampleCount, int sampleRate, int sampleSize, int channels);
-
- float * arg1 = 0;
- int arg2 = LuaGetArgument_int(L, 2);
- int arg3 = LuaGetArgument_int(L, 3);
- int arg4 = LuaGetArgument_int(L, 4);
- int arg5 = LuaGetArgument_int(L, 5);
- Wave result = LoadWaveEx(arg1, arg2, arg3, arg4, arg5);
- LuaPush_Wave(L, result);
- return 1;
-}
-
-int lua_LoadSound(lua_State* L)
-{
- const char * arg1 = LuaGetArgument_string(L, 1);
- Sound result = LoadSound((char*)arg1);
- LuaPush_Sound(L, result);
- return 1;
-}
-
-int lua_LoadSoundFromWave(lua_State* L)
-{
- Wave arg1 = LuaGetArgument_Wave(L, 1);
- Sound result = LoadSoundFromWave(arg1);
- LuaPush_Sound(L, result);
- return 1;
-}
-
-int lua_LoadSoundFromRES(lua_State* L)
-{
- const char * arg1 = LuaGetArgument_string(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- Sound result = LoadSoundFromRES(arg1, arg2);
- LuaPush_Sound(L, result);
- return 1;
-}
-
-int lua_UpdateSound(lua_State* L)
-{
- // TODO: void UpdateSound(Sound sound, void *data, int numSamples);
-
- Sound arg1 = LuaGetArgument_Sound(L, 1);
- const char * arg2 = LuaGetArgument_string(L, 2);
- int arg3 = LuaGetArgument_int(L, 3);
- UpdateSound(arg1, arg2, arg3);
- return 0;
-}
-
-int lua_UnloadWave(lua_State* L)
-{
- Wave arg1 = LuaGetArgument_Wave(L, 1);
- UnloadWave(arg1);
- return 0;
-}
-
-int lua_UnloadSound(lua_State* L)
-{
- Sound arg1 = LuaGetArgument_Sound(L, 1);
- UnloadSound(arg1);
- return 0;
-}
-
-int lua_PlaySound(lua_State* L)
-{
- Sound arg1 = LuaGetArgument_Sound(L, 1);
- PlaySound(arg1);
- return 0;
-}
-
-int lua_PauseSound(lua_State* L)
-{
- Sound arg1 = LuaGetArgument_Sound(L, 1);
- PauseSound(arg1);
- return 0;
-}
-
-int lua_ResumeSound(lua_State* L)
-{
- Sound arg1 = LuaGetArgument_Sound(L, 1);
- ResumeSound(arg1);
- return 0;
-}
-
-int lua_StopSound(lua_State* L)
-{
- Sound arg1 = LuaGetArgument_Sound(L, 1);
- StopSound(arg1);
- return 0;
-}
-
-int lua_IsSoundPlaying(lua_State* L)
-{
- Sound arg1 = LuaGetArgument_Sound(L, 1);
- bool result = IsSoundPlaying(arg1);
- lua_pushboolean(L, result);
- return 1;
-}
-
-int lua_SetSoundVolume(lua_State* L)
-{
- Sound arg1 = LuaGetArgument_Sound(L, 1);
- float arg2 = LuaGetArgument_float(L, 2);
- SetSoundVolume(arg1, arg2);
- return 0;
-}
-
-int lua_SetSoundPitch(lua_State* L)
-{
- Sound arg1 = LuaGetArgument_Sound(L, 1);
- float arg2 = LuaGetArgument_float(L, 2);
- SetSoundPitch(arg1, arg2);
- return 0;
-}
-
-int lua_WaveFormat(lua_State* L)
-{
- Wave arg1 = LuaGetArgument_Wave(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- int arg3 = LuaGetArgument_int(L, 3);
- int arg4 = LuaGetArgument_int(L, 4);
- WaveFormat(&arg1, arg2, arg3, arg4);
- return 0;
-}
-
-int lua_WaveCopy(lua_State* L)
-{
- Wave arg1 = LuaGetArgument_Wave(L, 1);
- Wave result = WaveCopy(arg1);
- LuaPush_Wave(L, result);
- return 1;
-}
-
-int lua_WaveCrop(lua_State* L)
-{
- Wave arg1 = LuaGetArgument_Wave(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- int arg3 = LuaGetArgument_int(L, 3);
- WaveCrop(&arg1, arg2, arg3);
- return 0;
-}
-
-int lua_GetWaveData(lua_State* L)
-{
- // TODO: float *GetWaveData(Wave wave);
-
- Wave arg1 = LuaGetArgument_Wave(L, 1);
- float * result = GetWaveData(arg1);
- //LuaPush_float(L, result);
- //lua_pushnumber(L, result);
- return 0;
-}
-
-int lua_LoadMusicStream(lua_State* L)
-{
- const char * arg1 = LuaGetArgument_string(L, 1);
- Music result = LoadMusicStream((char *)arg1);
- LuaPush_Music(L, result);
- return 1;
-}
-
-int lua_UnloadMusicStream(lua_State* L)
-{
- Music arg1 = LuaGetArgument_Music(L, 1);
- UnloadMusicStream(arg1);
- return 0;
-}
-
-int lua_UpdateMusicStream(lua_State* L)
-{
- Music arg1 = LuaGetArgument_Music(L, 1);
- UpdateMusicStream(arg1);
- return 0;
-}
-
-int lua_PlayMusicStream(lua_State* L)
-{
- Music arg1 = LuaGetArgument_Music(L, 1);
- PlayMusicStream(arg1);
- return 0;
-}
-
-int lua_StopMusicStream(lua_State* L)
-{
- Music arg1 = LuaGetArgument_Music(L, 1);
- StopMusicStream(arg1);
- return 0;
-}
-
-int lua_PauseMusicStream(lua_State* L)
-{
- Music arg1 = LuaGetArgument_Music(L, 1);
- PauseMusicStream(arg1);
- return 0;
-}
-
-int lua_ResumeMusicStream(lua_State* L)
-{
- Music arg1 = LuaGetArgument_Music(L, 1);
- ResumeMusicStream(arg1);
- return 0;
-}
-
-int lua_IsMusicPlaying(lua_State* L)
-{
- Music arg1 = LuaGetArgument_Music(L, 1);
- bool result = IsMusicPlaying(arg1);
- lua_pushboolean(L, result);
- return 1;
-}
-
-int lua_SetMusicVolume(lua_State* L)
-{
- Music arg1 = LuaGetArgument_Music(L, 1);
- float arg2 = LuaGetArgument_float(L, 2);
- SetMusicVolume(arg1, arg2);
- return 0;
-}
-
-int lua_SetMusicPitch(lua_State* L)
-{
- Music arg1 = LuaGetArgument_Music(L, 1);
- float arg2 = LuaGetArgument_float(L, 2);
- SetMusicPitch(arg1, arg2);
- return 0;
-}
-
-int lua_GetMusicTimeLength(lua_State* L)
-{
- Music arg1 = LuaGetArgument_Music(L, 1);
- float result = GetMusicTimeLength(arg1);
- lua_pushnumber(L, result);
- return 1;
-}
-
-int lua_GetMusicTimePlayed(lua_State* L)
-{
- Music arg1 = LuaGetArgument_Music(L, 1);
- float result = GetMusicTimePlayed(arg1);
- lua_pushnumber(L, result);
- return 1;
-}
-
-int lua_InitAudioStream(lua_State* L)
-{
- int arg1 = LuaGetArgument_int(L, 1);
- int arg2 = LuaGetArgument_int(L, 2);
- int arg3 = LuaGetArgument_int(L, 3);
- AudioStream result = InitAudioStream(arg1, arg2, arg3);
- LuaPush_AudioStream(L, result);
- return 1;
-}
-
-int lua_CloseAudioStream(lua_State* L)
-{
- AudioStream arg1 = LuaGetArgument_AudioStream(L, 1);
- CloseAudioStream(arg1);
- return 0;
-}
-
-int lua_UpdateAudioStream(lua_State* L)
-{
- // TODO: void UpdateAudioStream(AudioStream stream, void *data, int numSamples);
-
- AudioStream arg1 = LuaGetArgument_AudioStream(L, 1);
- void * arg2 = (char *)LuaGetArgument_string(L, 2);
- int arg3 = LuaGetArgument_int(L, 3);
- UpdateAudioStream(arg1, arg2, arg3);
- return 0;
-}
-
-int lua_IsAudioBufferProcessed(lua_State* L)
-{
- AudioStream arg1 = LuaGetArgument_AudioStream(L, 1);
- bool result = IsAudioBufferProcessed(arg1);
- lua_pushboolean(L, result);
- return 1;
-}
-
-int lua_PlayAudioStream(lua_State* L)
-{
- AudioStream arg1 = LuaGetArgument_AudioStream(L, 1);
- PlayAudioStream(arg1);
- return 0;
-}
-
-
-int lua_StopAudioStream(lua_State* L)
-{
- AudioStream arg1 = LuaGetArgument_AudioStream(L, 1);
- StopAudioStream(arg1);
- return 0;
-}
-
-int lua_PauseAudioStream(lua_State* L)
-{
- AudioStream arg1 = LuaGetArgument_AudioStream(L, 1);
- PauseAudioStream(arg1);
- return 0;
-}
-
-int lua_ResumeAudioStream(lua_State* L)
-{
- AudioStream arg1 = LuaGetArgument_AudioStream(L, 1);
- ResumeAudioStream(arg1);
- return 0;
-}
-
-//----------------------------------------------------------------------------------
-// raylib [utils] module functions
-//----------------------------------------------------------------------------------
-int lua_DecompressData(lua_State* L)
-{
- unsigned char *arg1 = (unsigned char *)LuaGetArgument_string(L, 1);
- unsigned arg2 = (unsigned)LuaGetArgument_int(L, 2);
- int arg3 = LuaGetArgument_int(L, 3);
- unsigned char *result = DecompressData(arg1, arg2, arg3);
- lua_pushlstring(L, (const char *)result, arg3);
- return 1;
-}
-
-#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI)
-int lua_WriteBitmap(lua_State* L)
-{
- const char * arg1 = LuaGetArgument_string(L, 1);
- unsigned char* arg2 = (unsigned char*)LuaGetArgument_string(L, 2);
- int arg3 = LuaGetArgument_int(L, 3);
- int arg4 = LuaGetArgument_int(L, 4);
- WriteBitmap(arg1, arg2, arg3, arg4);
- return 0;
-}
-
-int lua_WritePNG(lua_State* L)
-{
- const char * arg1 = LuaGetArgument_string(L, 1);
- unsigned char* arg2 = (unsigned char*)LuaGetArgument_string(L, 2);
- int arg3 = LuaGetArgument_int(L, 3);
- int arg4 = LuaGetArgument_int(L, 4);
- int arg5 = LuaGetArgument_int(L, 5);
- WritePNG(arg1, arg2, arg3, arg4, arg5);
- return 0;
-}
-#endif
-
-int lua_TraceLog(lua_State* L)
-{
- int num_args = lua_gettop(L) - 1;
- int arg1 = LuaGetArgument_int(L, 1);
-
- /// type, fmt, args...
-
- lua_rotate(L, 1, -1); /// fmt, args..., type
- lua_pop(L, 1); /// fmt, args...
-
- lua_getglobal(L, "string"); /// fmt, args..., [string]
- lua_getfield(L, 1, "format"); /// fmt, args..., [string], format()
- lua_rotate(L, 1, 2); /// [string], format(), fmt, args...
- lua_call(L, num_args, 1); /// [string], formatted_string
-
- TraceLog(arg1, "%s", luaL_checkstring(L,-1));
- return 0;
-}
-
-int lua_GetExtension(lua_State* L)
-{
- const char * arg1 = LuaGetArgument_string(L, 1);
- const char* result = GetExtension(arg1);
- lua_pushstring(L, result);
- return 1;
-}
-
-//----------------------------------------------------------------------------------
-// raylib [raymath] module functions - Vector3 math
-//----------------------------------------------------------------------------------
-int lua_VectorAdd(lua_State* L)
-{
- Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
- Vector3 arg2 = LuaGetArgument_Vector3(L, 2);
- Vector3 result = VectorAdd(arg1, arg2);
- LuaPush_Vector3(L, result);
- return 1;
-}
-
-int lua_VectorSubtract(lua_State* L)
-{
- Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
- Vector3 arg2 = LuaGetArgument_Vector3(L, 2);
- Vector3 result = VectorSubtract(arg1, arg2);
- LuaPush_Vector3(L, result);
- return 1;
-}
-
-int lua_VectorCrossProduct(lua_State* L)
-{
- Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
- Vector3 arg2 = LuaGetArgument_Vector3(L, 2);
- Vector3 result = VectorCrossProduct(arg1, arg2);
- LuaPush_Vector3(L, result);
- return 1;
-}
-
-int lua_VectorPerpendicular(lua_State* L)
-{
- Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
- Vector3 result = VectorPerpendicular(arg1);
- LuaPush_Vector3(L, result);
- return 1;
-}
-
-int lua_VectorDotProduct(lua_State* L)
-{
- Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
- Vector3 arg2 = LuaGetArgument_Vector3(L, 2);
- float result = VectorDotProduct(arg1, arg2);
- lua_pushnumber(L, result);
- return 1;
-}
-
-int lua_VectorLength(lua_State* L)
-{
- const Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
- float result = VectorLength(arg1);
- lua_pushnumber(L, result);
- return 1;
-}
-
-int lua_VectorScale(lua_State* L)
-{
- Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
- float arg2 = LuaGetArgument_float(L, 2);
- VectorScale(&arg1, arg2);
- LuaPush_Vector3(L, arg1);
- return 1;
-}
-
-int lua_VectorNegate(lua_State* L)
-{
- Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
- VectorNegate(&arg1);
- LuaPush_Vector3(L, arg1);
- return 1;
-}
-
-int lua_VectorNormalize(lua_State* L)
-{
- Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
- VectorNormalize(&arg1);
- LuaPush_Vector3(L, arg1);
- return 1;
-}
-
-int lua_VectorDistance(lua_State* L)
-{
- Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
- Vector3 arg2 = LuaGetArgument_Vector3(L, 2);
- float result = VectorDistance(arg1, arg2);
- lua_pushnumber(L, result);
- return 1;
-}
-
-int lua_VectorLerp(lua_State* L)
-{
- Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
- Vector3 arg2 = LuaGetArgument_Vector3(L, 2);
- float arg3 = LuaGetArgument_float(L, 3);
- Vector3 result = VectorLerp(arg1, arg2, arg3);
- LuaPush_Vector3(L, result);
- return 1;
-}
-
-int lua_VectorReflect(lua_State* L)
-{
- Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
- Vector3 arg2 = LuaGetArgument_Vector3(L, 2);
- Vector3 result = VectorReflect(arg1, arg2);
- LuaPush_Vector3(L, result);
- return 1;
-}
-
-int lua_VectorTransform(lua_State* L)
-{
- Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
- Matrix arg2 = LuaGetArgument_Matrix(L, 2);
- VectorTransform(&arg1, arg2);
- LuaPush_Vector3(L, arg1);
- return 1;
-}
-
-int lua_VectorZero(lua_State* L)
-{
- Vector3 result = VectorZero();
- LuaPush_Vector3(L, result);
- return 1;
-}
-
-//----------------------------------------------------------------------------------
-// raylib [raymath] module functions - Matrix math
-//----------------------------------------------------------------------------------
-int lua_MatrixDeterminant(lua_State* L)
-{
- Matrix arg1 = LuaGetArgument_Matrix(L, 1);
- float result = MatrixDeterminant(arg1);
- lua_pushnumber(L, result);
- return 1;
-}
-
-int lua_MatrixTrace(lua_State* L)
-{
- Matrix arg1 = LuaGetArgument_Matrix(L, 1);
- float result = MatrixTrace(arg1);
- lua_pushnumber(L, result);
- return 1;
-}
-
-int lua_MatrixTranspose(lua_State* L)
-{
- Matrix arg1 = LuaGetArgument_Matrix(L, 1);
- MatrixTranspose(&arg1);
- LuaPush_Matrix(L, &arg1);
- return 1;
-}
-
-int lua_MatrixInvert(lua_State* L)
-{
- Matrix arg1 = LuaGetArgument_Matrix(L, 1);
- MatrixInvert(&arg1);
- LuaPush_Matrix(L, &arg1);
- return 1;
-}
-
-int lua_MatrixNormalize(lua_State* L)
-{
- Matrix arg1 = LuaGetArgument_Matrix(L, 1);
- MatrixNormalize(&arg1);
- LuaPush_Matrix(L, &arg1);
- return 1;
-}
-
-int lua_MatrixIdentity(lua_State* L)
-{
- Matrix result = MatrixIdentity();
- LuaPush_Matrix(L, &result);
- return 1;
-}
-
-int lua_MatrixAdd(lua_State* L)
-{
- Matrix arg1 = LuaGetArgument_Matrix(L, 1);
- Matrix arg2 = LuaGetArgument_Matrix(L, 2);
- Matrix result = MatrixAdd(arg1, arg2);
- LuaPush_Matrix(L, &result);
- return 1;
-}
-
-int lua_MatrixSubstract(lua_State* L)
-{
- Matrix arg1 = LuaGetArgument_Matrix(L, 1);
- Matrix arg2 = LuaGetArgument_Matrix(L, 2);
- Matrix result = MatrixSubstract(arg1, arg2);
- LuaPush_Matrix(L, &result);
- return 1;
-}
-
-int lua_MatrixTranslate(lua_State* L)
-{
- float arg1 = LuaGetArgument_float(L, 1);
- float arg2 = LuaGetArgument_float(L, 2);
- float arg3 = LuaGetArgument_float(L, 3);
- Matrix result = MatrixTranslate(arg1, arg2, arg3);
- LuaPush_Matrix(L, &result);
- return 1;
-}
-
-int lua_MatrixRotate(lua_State* L)
-{
- Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
- float arg2 = LuaGetArgument_float(L, 2);
- Matrix result = MatrixRotate(arg1, arg2);
- LuaPush_Matrix(L, &result);
- return 1;
-}
-
-int lua_MatrixRotateX(lua_State* L)
-{
- float arg1 = LuaGetArgument_float(L, 1);
- Matrix result = MatrixRotateX(arg1);
- LuaPush_Matrix(L, &result);
- return 1;
-}
-
-int lua_MatrixRotateY(lua_State* L)
-{
- float arg1 = LuaGetArgument_float(L, 1);
- Matrix result = MatrixRotateY(arg1);
- LuaPush_Matrix(L, &result);
- return 1;
-}
-
-int lua_MatrixRotateZ(lua_State* L)
-{
- float arg1 = LuaGetArgument_float(L, 1);
- Matrix result = MatrixRotateZ(arg1);
- LuaPush_Matrix(L, &result);
- return 1;
-}
-
-int lua_MatrixScale(lua_State* L)
-{
- float arg1 = LuaGetArgument_float(L, 1);
- float arg2 = LuaGetArgument_float(L, 2);
- float arg3 = LuaGetArgument_float(L, 3);
- Matrix result = MatrixScale(arg1, arg2, arg3);
- LuaPush_Matrix(L, &result);
- return 1;
-}
-
-int lua_MatrixMultiply(lua_State* L)
-{
- Matrix arg1 = LuaGetArgument_Matrix(L, 1);
- Matrix arg2 = LuaGetArgument_Matrix(L, 2);
- Matrix result = MatrixMultiply(arg1, arg2);
- LuaPush_Matrix(L, &result);
- return 1;
-}
-
-int lua_MatrixFrustum(lua_State* L)
-{
- double arg1 = LuaGetArgument_double(L, 1);
- double arg2 = LuaGetArgument_double(L, 2);
- double arg3 = LuaGetArgument_double(L, 3);
- double arg4 = LuaGetArgument_double(L, 4);
- double arg5 = LuaGetArgument_double(L, 5);
- double arg6 = LuaGetArgument_double(L, 6);
- Matrix result = MatrixFrustum(arg1, arg2, arg3, arg4, arg5, arg6);
- LuaPush_Matrix(L, &result);
- return 1;
-}
-
-int lua_MatrixPerspective(lua_State* L)
-{
- double arg1 = LuaGetArgument_double(L, 1);
- double arg2 = LuaGetArgument_double(L, 2);
- double arg3 = LuaGetArgument_double(L, 3);
- double arg4 = LuaGetArgument_double(L, 4);
- Matrix result = MatrixPerspective(arg1, arg2, arg3, arg4);
- LuaPush_Matrix(L, &result);
- return 1;
-}
-
-int lua_MatrixOrtho(lua_State* L)
-{
- double arg1 = LuaGetArgument_double(L, 1);
- double arg2 = LuaGetArgument_double(L, 2);
- double arg3 = LuaGetArgument_double(L, 3);
- double arg4 = LuaGetArgument_double(L, 4);
- double arg5 = LuaGetArgument_double(L, 5);
- double arg6 = LuaGetArgument_double(L, 6);
- Matrix result = MatrixOrtho(arg1, arg2, arg3, arg4, arg5, arg6);
- LuaPush_Matrix(L, &result);
- return 1;
-}
-
-int lua_MatrixLookAt(lua_State* L)
-{
- Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
- Vector3 arg2 = LuaGetArgument_Vector3(L, 2);
- Vector3 arg3 = LuaGetArgument_Vector3(L, 3);
- Matrix result = MatrixLookAt(arg1, arg2, arg3);
- LuaPush_Matrix(L, &result);
- return 1;
-}
-
-//----------------------------------------------------------------------------------
-// raylib [raymath] module functions - Quaternion math
-//----------------------------------------------------------------------------------
-int lua_QuaternionLength(lua_State* L)
-{
- Quaternion arg1 = LuaGetArgument_Quaternion(L, 1);
- float result = QuaternionLength(arg1);
- lua_pushnumber(L, result);
- return 1;
-}
-
-int lua_QuaternionNormalize(lua_State* L)
-{
- Quaternion arg1 = LuaGetArgument_Quaternion(L, 1);
- QuaternionNormalize(&arg1);
- LuaPush_Quaternion(L, arg1);
- return 1;
-}
-
-int lua_QuaternionMultiply(lua_State* L)
-{
- Quaternion arg1 = LuaGetArgument_Quaternion(L, 1);
- Quaternion arg2 = LuaGetArgument_Quaternion(L, 2);
- Quaternion result = QuaternionMultiply(arg1, arg2);
- LuaPush_Quaternion(L, result);
- return 1;
-}
-
-int lua_QuaternionSlerp(lua_State* L)
-{
- Quaternion arg1 = LuaGetArgument_Quaternion(L, 1);
- Quaternion arg2 = LuaGetArgument_Quaternion(L, 2);
- float arg3 = LuaGetArgument_float(L, 3);
- Quaternion result = QuaternionSlerp(arg1, arg2, arg3);
- LuaPush_Quaternion(L, result);
- return 1;
-}
-
-int lua_QuaternionFromMatrix(lua_State* L)
-{
- Matrix arg1 = LuaGetArgument_Matrix(L, 1);
- Quaternion result = QuaternionFromMatrix(arg1);
- LuaPush_Quaternion(L, result);
- return 1;
-}
-
-int lua_QuaternionToMatrix(lua_State* L)
-{
- Quaternion arg1 = LuaGetArgument_Quaternion(L, 1);
- Matrix result = QuaternionToMatrix(arg1);
- LuaPush_Matrix(L, &result);
- return 1;
-}
-
-int lua_QuaternionFromAxisAngle(lua_State* L)
-{
- Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
- float arg2 = LuaGetArgument_float(L, 2);
- Quaternion result = QuaternionFromAxisAngle(arg1, arg2);
- LuaPush_Quaternion(L, result);
- return 1;
-}
-
-int lua_QuaternionToAxisAngle(lua_State* L)
-{
- Quaternion arg1 = LuaGetArgument_Quaternion(L, 1);
- Vector3 arg2;
- float arg3 = 0;
- QuaternionToAxisAngle(arg1, &arg2, &arg3);
- LuaPush_Vector3(L, arg2);
- lua_pushnumber(L, arg3);
- return 2;
-}
-
-int lua_QuaternionTransform(lua_State* L)
-{
- Quaternion arg1 = LuaGetArgument_Quaternion(L, 1);
- Matrix arg2 = LuaGetArgument_Matrix(L, 2);
- QuaternionTransform(&arg1, arg2);
- LuaPush_Quaternion(L, arg1);
- return 1;
-}
-
-
-//----------------------------------------------------------------------------------
-// Functions Registering
-//----------------------------------------------------------------------------------
-#define REG(name) { #name, lua_##name },
-
-// raylib Functions (and data types) list
-static luaL_Reg raylib_functions[] = {
-
- // Register non-opaque data types
- REG(Color)
- REG(Vector2)
- REG(Vector3)
- //REG(Matrix)
- REG(Quaternion)
- REG(Rectangle)
- REG(Ray)
- REG(Camera)
- REG(Camera2D)
- REG(BoundingBox)
- //REG(Material)
-
- // Register functions
- REG(InitWindow)
- REG(CloseWindow)
- REG(WindowShouldClose)
- REG(IsWindowMinimized)
- REG(ToggleFullscreen)
- REG(GetScreenWidth)
- REG(GetScreenHeight)
-
- REG(ShowCursor)
- REG(HideCursor)
- REG(IsCursorHidden)
- REG(EnableCursor)
- REG(DisableCursor)
-
- REG(ClearBackground)
- REG(BeginDrawing)
- REG(EndDrawing)
- REG(Begin2dMode)
- REG(End2dMode)
- REG(Begin3dMode)
- REG(End3dMode)
- REG(BeginTextureMode)
- REG(EndTextureMode)
-
- REG(GetMouseRay)
- REG(GetWorldToScreen)
- REG(GetCameraMatrix)
-
-#if defined(PLATFORM_WEB)
- REG(SetDrawingLoop)
-#else
- REG(SetTargetFPS)
-#endif
- REG(GetFPS)
- REG(GetFrameTime)
-
- REG(GetColor)
- REG(GetHexValue)
- REG(ColorToFloat)
- REG(VectorToFloat)
- REG(MatrixToFloat)
- REG(GetRandomValue)
- REG(Fade)
- REG(SetConfigFlags)
- REG(ShowLogo)
-
- REG(IsFileDropped)
- REG(GetDroppedFiles)
- REG(ClearDroppedFiles)
- REG(StorageSaveValue)
- REG(StorageLoadValue)
-
- REG(IsKeyPressed)
- REG(IsKeyDown)
- REG(IsKeyReleased)
- REG(IsKeyUp)
- REG(GetKeyPressed)
- REG(SetExitKey)
-
- REG(IsGamepadAvailable)
- REG(IsGamepadName)
- REG(GetGamepadName)
- REG(IsGamepadButtonPressed)
- REG(IsGamepadButtonDown)
- REG(IsGamepadButtonReleased)
- REG(IsGamepadButtonUp)
- REG(GetGamepadButtonPressed)
- REG(GetGamepadAxisCount)
- REG(GetGamepadAxisMovement)
-
- REG(IsMouseButtonPressed)
- REG(IsMouseButtonDown)
- REG(IsMouseButtonReleased)
- REG(IsMouseButtonUp)
- REG(GetMouseX)
- REG(GetMouseY)
- REG(GetMousePosition)
- REG(SetMousePosition)
- REG(GetMouseWheelMove)
- REG(GetTouchX)
- REG(GetTouchY)
- REG(GetTouchPosition)
-
-#if defined(PLATFORM_ANDROID)
- REG(IsButtonPressed)
- REG(IsButtonDown)
- REG(IsButtonReleased)
-#endif
-
- REG(SetGesturesEnabled)
- REG(IsGestureDetected)
- REG(GetGestureDetected)
- REG(GetTouchPointsCount)
- REG(GetGestureHoldDuration)
- REG(GetGestureDragVector)
- REG(GetGestureDragAngle)
- REG(GetGesturePinchVector)
- REG(GetGesturePinchAngle)
-
- REG(SetCameraMode)
- REG(UpdateCamera)
- REG(SetCameraPanControl)
- REG(SetCameraAltControl)
- REG(SetCameraSmoothZoomControl)
- REG(SetCameraMoveControls)
-
- REG(DrawPixel)
- REG(DrawPixelV)
- REG(DrawLine)
- REG(DrawLineV)
- REG(DrawCircle)
- REG(DrawCircleGradient)
- REG(DrawCircleV)
- REG(DrawCircleLines)
- REG(DrawRectangle)
- REG(DrawRectangleRec)
- REG(DrawRectangleGradient)
- REG(DrawRectangleV)
- REG(DrawRectangleLines)
- REG(DrawTriangle)
- REG(DrawTriangleLines)
- REG(DrawPoly)
- REG(DrawPolyEx)
- REG(DrawPolyExLines)
-
- REG(CheckCollisionRecs)
- REG(CheckCollisionCircles)
- REG(CheckCollisionCircleRec)
- REG(GetCollisionRec)
- REG(CheckCollisionPointRec)
- REG(CheckCollisionPointCircle)
- REG(CheckCollisionPointTriangle)
-
- REG(LoadImage)
- REG(LoadImageEx)
- REG(LoadImageRaw)
- REG(LoadImageFromRES)
- REG(LoadTexture)
- REG(LoadTextureEx)
- REG(LoadTextureFromRES)
- REG(LoadTextureFromImage)
- REG(LoadRenderTexture)
- REG(UnloadImage)
- REG(UnloadTexture)
- REG(UnloadRenderTexture)
- REG(GetImageData)
- REG(GetTextureData)
- REG(UpdateTexture)
- REG(ImageToPOT)
- REG(ImageFormat)
- REG(ImageDither)
- REG(ImageCopy)
- REG(ImageCrop)
- REG(ImageResize)
- REG(ImageResizeNN)
- REG(ImageText)
- REG(ImageTextEx)
- REG(ImageDraw)
- REG(ImageDrawText)
- REG(ImageDrawTextEx)
- REG(ImageFlipVertical)
- REG(ImageFlipHorizontal)
- REG(ImageColorTint)
- REG(ImageColorInvert)
- REG(ImageColorGrayscale)
- REG(ImageColorContrast)
- REG(ImageColorBrightness)
- REG(GenTextureMipmaps)
- REG(SetTextureFilter)
- REG(SetTextureWrap)
-
- REG(DrawTexture)
- REG(DrawTextureV)
- REG(DrawTextureEx)
- REG(DrawTextureRec)
- REG(DrawTexturePro)
-
- REG(GetDefaultFont)
- REG(LoadSpriteFont)
- REG(LoadSpriteFontTTF)
- REG(UnloadSpriteFont)
- REG(DrawText)
- REG(DrawTextEx)
- REG(MeasureText)
- REG(MeasureTextEx)
- REG(DrawFPS)
-
- REG(DrawLine3D)
- REG(DrawCircle3D)
- REG(DrawCube)
- REG(DrawCubeV)
- REG(DrawCubeWires)
- REG(DrawCubeTexture)
- REG(DrawSphere)
- REG(DrawSphereEx)
- REG(DrawSphereWires)
- REG(DrawCylinder)
- REG(DrawCylinderWires)
- REG(DrawPlane)
- REG(DrawRay)
- REG(DrawGrid)
- REG(DrawGizmo)
- REG(DrawLight)
-
- REG(LoadModel)
- REG(LoadModelEx)
- REG(LoadModelFromRES)
- REG(LoadHeightmap)
- REG(LoadCubicmap)
- REG(UnloadModel)
- REG(LoadMaterial)
- REG(LoadDefaultMaterial)
- REG(LoadStandardMaterial)
- REG(UnloadMaterial)
- //REG(GenMesh*) // Not ready yet...
-
- REG(DrawModel)
- REG(DrawModelEx)
- REG(DrawModelWires)
- REG(DrawModelWiresEx)
- REG(DrawBillboard)
- REG(DrawBillboardRec)
- REG(CalculateBoundingBox)
- REG(CheckCollisionSpheres)
- REG(CheckCollisionBoxes)
- REG(CheckCollisionBoxSphere)
- REG(CheckCollisionRaySphere)
- REG(CheckCollisionRaySphereEx)
- REG(CheckCollisionRayBox)
-
- REG(LoadShader)
- REG(UnloadShader)
- REG(GetDefaultShader)
- REG(GetStandardShader)
- REG(GetDefaultTexture)
- REG(GetShaderLocation)
- REG(SetShaderValue)
- REG(SetShaderValuei)
- REG(SetShaderValueMatrix)
- REG(SetMatrixProjection)
- REG(SetMatrixModelview)
- REG(BeginShaderMode)
- REG(EndShaderMode)
- REG(BeginBlendMode)
- REG(EndBlendMode)
- REG(CreateLight)
- REG(DestroyLight)
-
- REG(InitVrDevice)
- REG(CloseVrDevice)
- REG(IsVrDeviceReady)
- REG(IsVrSimulator)
- REG(UpdateVrTracking)
- REG(ToggleVrMode)
-
- REG(InitAudioDevice)
- REG(CloseAudioDevice)
- REG(IsAudioDeviceReady)
- REG(LoadWave)
- REG(LoadWaveEx)
- REG(LoadSound)
- REG(LoadSoundFromWave)
- REG(LoadSoundFromRES)
- REG(UpdateSound)
- REG(UnloadWave)
- REG(UnloadSound)
- REG(PlaySound)
- REG(PauseSound)
- REG(ResumeSound)
- REG(StopSound)
- REG(IsSoundPlaying)
- REG(SetSoundVolume)
- REG(SetSoundPitch)
- REG(WaveFormat)
- REG(WaveCopy)
- REG(WaveCrop)
- REG(GetWaveData)
-
- REG(LoadMusicStream)
- REG(UnloadMusicStream)
- REG(UpdateMusicStream)
- REG(PlayMusicStream)
- REG(StopMusicStream)
- REG(PauseMusicStream)
- REG(ResumeMusicStream)
- REG(IsMusicPlaying)
- REG(SetMusicVolume)
- REG(SetMusicPitch)
- REG(GetMusicTimeLength)
- REG(GetMusicTimePlayed)
-
- REG(InitAudioStream)
- REG(UpdateAudioStream)
- REG(CloseAudioStream)
- REG(IsAudioBufferProcessed)
- REG(PlayAudioStream)
- REG(PauseAudioStream)
- REG(ResumeAudioStream)
- REG(StopAudioStream)
-
- /// Math and util
- REG(DecompressData)
-#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI)
- REG(WriteBitmap)
- REG(WritePNG)
-#endif
- REG(TraceLog)
- REG(GetExtension)
- REG(VectorAdd)
- REG(VectorSubtract)
- REG(VectorCrossProduct)
- REG(VectorPerpendicular)
- REG(VectorDotProduct)
- REG(VectorLength)
- REG(VectorScale)
- REG(VectorNegate)
- REG(VectorNormalize)
- REG(VectorDistance)
- REG(VectorLerp)
- REG(VectorReflect)
- REG(VectorTransform)
- REG(VectorZero)
- REG(MatrixDeterminant)
- REG(MatrixTrace)
- REG(MatrixTranspose)
- REG(MatrixInvert)
- REG(MatrixNormalize)
- REG(MatrixIdentity)
- REG(MatrixAdd)
- REG(MatrixSubstract)
- REG(MatrixTranslate)
- REG(MatrixRotate)
- REG(MatrixRotateX)
- REG(MatrixRotateY)
- REG(MatrixRotateZ)
- REG(MatrixScale)
- REG(MatrixMultiply)
- REG(MatrixFrustum)
- REG(MatrixPerspective)
- REG(MatrixOrtho)
- REG(MatrixLookAt)
- REG(QuaternionLength)
- REG(QuaternionNormalize)
- REG(QuaternionMultiply)
- REG(QuaternionSlerp)
- REG(QuaternionFromMatrix)
- REG(QuaternionToMatrix)
- REG(QuaternionFromAxisAngle)
- REG(QuaternionToAxisAngle)
- REG(QuaternionTransform)
-
- {NULL, NULL} // sentinel: end signal
-};
-
-// Register raylib functionality
-static void LuaRegisterRayLib(const char *opt_table)
-{
- if (opt_table) lua_createtable(L, 0, sizeof(raylib_functions)/sizeof(raylib_functions[0]));
- else lua_pushglobaltable(L);
-
- luaL_setfuncs(L, raylib_functions, 0);
-}
-
-//----------------------------------------------------------------------------------
-// raylib Lua API
-//----------------------------------------------------------------------------------
-
-// Initialize Lua system
-RLUADEF void InitLuaDevice(void)
-{
- mainLuaState = luaL_newstate();
- L = mainLuaState;
-
- LuaStartEnum();
- LuaSetEnum("FULLSCREEN_MODE", 1);
- LuaSetEnum("SHOW_LOGO", 2);
- LuaSetEnum("SHOW_MOUSE_CURSOR", 4);
- LuaSetEnum("CENTERED_MODE", 8);
- LuaSetEnum("MSAA_4X_HINT", 16);
- LuaSetEnum("VSYNC_HINT", 32);
- LuaEndEnum("FLAG");
-
- LuaStartEnum();
- LuaSetEnum("SPACE", 32);
- LuaSetEnum("ESCAPE", 256);
- LuaSetEnum("ENTER", 257);
- LuaSetEnum("BACKSPACE", 259);
- LuaSetEnum("RIGHT", 262);
- LuaSetEnum("LEFT", 263);
- LuaSetEnum("DOWN", 264);
- LuaSetEnum("UP", 265);
- LuaSetEnum("F1", 290);
- LuaSetEnum("F2", 291);
- LuaSetEnum("F3", 292);
- LuaSetEnum("F4", 293);
- LuaSetEnum("F5", 294);
- LuaSetEnum("F6", 295);
- LuaSetEnum("F7", 296);
- LuaSetEnum("F8", 297);
- LuaSetEnum("F9", 298);
- LuaSetEnum("F10", 299);
- LuaSetEnum("LEFT_SHIFT", 340);
- LuaSetEnum("LEFT_CONTROL", 341);
- LuaSetEnum("LEFT_ALT", 342);
- LuaSetEnum("RIGHT_SHIFT", 344);
- LuaSetEnum("RIGHT_CONTROL", 345);
- LuaSetEnum("RIGHT_ALT", 346);
- LuaSetEnum("ZERO", 48);
- LuaSetEnum("ONE", 49);
- LuaSetEnum("TWO", 50);
- LuaSetEnum("THREE", 51);
- LuaSetEnum("FOUR", 52);
- LuaSetEnum("FIVE", 53);
- LuaSetEnum("SIX", 54);
- LuaSetEnum("SEVEN", 55);
- LuaSetEnum("EIGHT", 56);
- LuaSetEnum("NINE", 57);
- LuaSetEnum("A", 65);
- LuaSetEnum("B", 66);
- LuaSetEnum("C", 67);
- LuaSetEnum("D", 68);
- LuaSetEnum("E", 69);
- LuaSetEnum("F", 70);
- LuaSetEnum("G", 71);
- LuaSetEnum("H", 72);
- LuaSetEnum("I", 73);
- LuaSetEnum("J", 74);
- LuaSetEnum("K", 75);
- LuaSetEnum("L", 76);
- LuaSetEnum("M", 77);
- LuaSetEnum("N", 78);
- LuaSetEnum("O", 79);
- LuaSetEnum("P", 80);
- LuaSetEnum("Q", 81);
- LuaSetEnum("R", 82);
- LuaSetEnum("S", 83);
- LuaSetEnum("T", 84);
- LuaSetEnum("U", 85);
- LuaSetEnum("V", 86);
- LuaSetEnum("W", 87);
- LuaSetEnum("X", 88);
- LuaSetEnum("Y", 89);
- LuaSetEnum("Z", 90);
- LuaEndEnum("KEY");
-
- LuaStartEnum();
- LuaSetEnum("LEFT_BUTTON", 0);
- LuaSetEnum("RIGHT_BUTTON", 1);
- LuaSetEnum("MIDDLE_BUTTON", 2);
- LuaEndEnum("MOUSE");
-
- LuaStartEnum();
- LuaSetEnum("PLAYER1", 0);
- LuaSetEnum("PLAYER2", 1);
- LuaSetEnum("PLAYER3", 2);
- LuaSetEnum("PLAYER4", 3);
-
- LuaSetEnum("PS3_BUTTON_TRIANGLE", 0);
- LuaSetEnum("PS3_BUTTON_CIRCLE", 1);
- LuaSetEnum("PS3_BUTTON_CROSS", 2);
- LuaSetEnum("PS3_BUTTON_SQUARE", 3);
- LuaSetEnum("PS3_BUTTON_L1", 6);
- LuaSetEnum("PS3_BUTTON_R1", 7);
- LuaSetEnum("PS3_BUTTON_L2", 4);
- LuaSetEnum("PS3_BUTTON_R2", 5);
- LuaSetEnum("PS3_BUTTON_START", 8);
- LuaSetEnum("PS3_BUTTON_SELECT", 9);
- LuaSetEnum("PS3_BUTTON_UP", 24);
- LuaSetEnum("PS3_BUTTON_RIGHT", 25);
- LuaSetEnum("PS3_BUTTON_DOWN", 26);
- LuaSetEnum("PS3_BUTTON_LEFT", 27);
- LuaSetEnum("PS3_BUTTON_PS", 12);
- LuaSetEnum("PS3_AXIS_LEFT_X", 0);
- LuaSetEnum("PS3_AXIS_LEFT_Y", 1);
- LuaSetEnum("PS3_AXIS_RIGHT_X", 2);
- LuaSetEnum("PS3_AXIS_RIGHT_Y", 5);
- LuaSetEnum("PS3_AXIS_L2", 3); // [1..-1] (pressure-level)
- LuaSetEnum("PS3_AXIS_R2", 4); // [1..-1] (pressure-level)
-
-// Xbox360 USB Controller Buttons
- LuaSetEnum("XBOX_BUTTON_A", 0);
- LuaSetEnum("XBOX_BUTTON_B", 1);
- LuaSetEnum("XBOX_BUTTON_X", 2);
- LuaSetEnum("XBOX_BUTTON_Y", 3);
- LuaSetEnum("XBOX_BUTTON_LB", 4);
- LuaSetEnum("XBOX_BUTTON_RB", 5);
- LuaSetEnum("XBOX_BUTTON_SELECT", 6);
- LuaSetEnum("XBOX_BUTTON_START", 7);
- LuaSetEnum("XBOX_BUTTON_UP", 10);
- LuaSetEnum("XBOX_BUTTON_RIGHT", 11);
- LuaSetEnum("XBOX_BUTTON_DOWN", 12);
- LuaSetEnum("XBOX_BUTTON_LEFT", 13);
- LuaSetEnum("XBOX_BUTTON_HOME", 8);
-#if defined(PLATFORM_RPI)
- LuaSetEnum("XBOX_AXIS_LEFT_X", 0); // [-1..1] (left->right)
- LuaSetEnum("XBOX_AXIS_LEFT_Y", 1); // [-1..1] (up->down)
- LuaSetEnum("XBOX_AXIS_RIGHT_X", 3); // [-1..1] (left->right)
- LuaSetEnum("XBOX_AXIS_RIGHT_Y", 4); // [-1..1] (up->down)
- LuaSetEnum("XBOX_AXIS_LT", 2); // [-1..1] (pressure-level)
- LuaSetEnum("XBOX_AXIS_RT", 5); // [-1..1] (pressure-level)
-#else
- LuaSetEnum("XBOX_AXIS_LEFT_X", 0); // [-1..1] (left->right)
- LuaSetEnum("XBOX_AXIS_LEFT_Y", 1); // [1..-1] (up->down)
- LuaSetEnum("XBOX_AXIS_RIGHT_X", 2); // [-1..1] (left->right)
- LuaSetEnum("XBOX_AXIS_RIGHT_Y", 3); // [1..-1] (up->down)
- LuaSetEnum("XBOX_AXIS_LT", 4); // [-1..1] (pressure-level)
- LuaSetEnum("XBOX_AXIS_RT", 5); // [-1..1] (pressure-level)
-#endif
- LuaEndEnum("GAMEPAD");
-
- lua_pushglobaltable(L);
- LuaSetEnumColor("LIGHTGRAY", LIGHTGRAY);
- LuaSetEnumColor("GRAY", GRAY);
- LuaSetEnumColor("DARKGRAY", DARKGRAY);
- LuaSetEnumColor("YELLOW", YELLOW);
- LuaSetEnumColor("GOLD", GOLD);
- LuaSetEnumColor("ORANGE", ORANGE);
- LuaSetEnumColor("PINK", PINK);
- LuaSetEnumColor("RED", RED);
- LuaSetEnumColor("MAROON", MAROON);
- LuaSetEnumColor("GREEN", GREEN);
- LuaSetEnumColor("LIME", LIME);
- LuaSetEnumColor("DARKGREEN", DARKGREEN);
- LuaSetEnumColor("SKYBLUE", SKYBLUE);
- LuaSetEnumColor("BLUE", BLUE);
- LuaSetEnumColor("DARKBLUE", DARKBLUE);
- LuaSetEnumColor("PURPLE", PURPLE);
- LuaSetEnumColor("VIOLET", VIOLET);
- LuaSetEnumColor("DARKPURPLE", DARKPURPLE);
- LuaSetEnumColor("BEIGE", BEIGE);
- LuaSetEnumColor("BROWN", BROWN);
- LuaSetEnumColor("DARKBROWN", DARKBROWN);
- LuaSetEnumColor("WHITE", WHITE);
- LuaSetEnumColor("BLACK", BLACK);
- LuaSetEnumColor("BLANK", BLANK);
- LuaSetEnumColor("MAGENTA", MAGENTA);
- LuaSetEnumColor("RAYWHITE", RAYWHITE);
- lua_pop(L, 1);
-
- LuaStartEnum();
- LuaSetEnum("UNCOMPRESSED_GRAYSCALE", UNCOMPRESSED_GRAYSCALE);
- LuaSetEnum("UNCOMPRESSED_GRAY_ALPHA", UNCOMPRESSED_GRAY_ALPHA);
- LuaSetEnum("UNCOMPRESSED_R5G6B5", UNCOMPRESSED_R5G6B5);
- LuaSetEnum("UNCOMPRESSED_R8G8B8", UNCOMPRESSED_R8G8B8);
- LuaSetEnum("UNCOMPRESSED_R5G5B5A1", UNCOMPRESSED_R5G5B5A1);
- LuaSetEnum("UNCOMPRESSED_R4G4B4A4", UNCOMPRESSED_R4G4B4A4);
- LuaSetEnum("UNCOMPRESSED_R8G8B8A8", UNCOMPRESSED_R8G8B8A8);
- LuaSetEnum("COMPRESSED_DXT1_RGB", COMPRESSED_DXT1_RGB);
- LuaSetEnum("COMPRESSED_DXT1_RGBA", COMPRESSED_DXT1_RGBA);
- LuaSetEnum("COMPRESSED_DXT3_RGBA", COMPRESSED_DXT3_RGBA);
- LuaSetEnum("COMPRESSED_DXT5_RGBA", COMPRESSED_DXT5_RGBA);
- LuaSetEnum("COMPRESSED_ETC1_RGB", COMPRESSED_ETC1_RGB);
- LuaSetEnum("COMPRESSED_ETC2_RGB", COMPRESSED_ETC2_RGB);
- LuaSetEnum("COMPRESSED_ETC2_EAC_RGBA", COMPRESSED_ETC2_EAC_RGBA);
- LuaSetEnum("COMPRESSED_PVRT_RGB", COMPRESSED_PVRT_RGB);
- LuaSetEnum("COMPRESSED_PVRT_RGBA", COMPRESSED_PVRT_RGBA);
- LuaSetEnum("COMPRESSED_ASTC_4x4_RGBA", COMPRESSED_ASTC_4x4_RGBA);
- LuaSetEnum("COMPRESSED_ASTC_8x8_RGBA", COMPRESSED_ASTC_8x8_RGBA);
- LuaEndEnum("TextureFormat");
-
- LuaStartEnum();
- LuaSetEnum("ALPHA", BLEND_ALPHA);
- LuaSetEnum("ADDITIVE", BLEND_ADDITIVE);
- LuaSetEnum("MULTIPLIED", BLEND_MULTIPLIED);
- LuaEndEnum("BlendMode");
-
- LuaStartEnum();
- LuaSetEnum("POINT", LIGHT_POINT);
- LuaSetEnum("DIRECTIONAL", LIGHT_DIRECTIONAL);
- LuaSetEnum("SPOT", LIGHT_SPOT);
- LuaEndEnum("LightType");
-
- LuaStartEnum();
- LuaSetEnum("POINT", FILTER_POINT);
- LuaSetEnum("BILINEAR", FILTER_BILINEAR);
- LuaSetEnum("TRILINEAR", FILTER_TRILINEAR);
- LuaSetEnum("ANISOTROPIC_4X", FILTER_ANISOTROPIC_4X);
- LuaSetEnum("ANISOTROPIC_8X", FILTER_ANISOTROPIC_8X);
- LuaSetEnum("ANISOTROPIC_16X", FILTER_ANISOTROPIC_16X);
- LuaEndEnum("TextureFilter");
-
- LuaStartEnum();
- LuaSetEnum("NONE", GESTURE_NONE);
- LuaSetEnum("TAP", GESTURE_TAP);
- LuaSetEnum("DOUBLETAP", GESTURE_DOUBLETAP);
- LuaSetEnum("HOLD", GESTURE_HOLD);
- LuaSetEnum("DRAG", GESTURE_DRAG);
- LuaSetEnum("SWIPE_RIGHT", GESTURE_SWIPE_RIGHT);
- LuaSetEnum("SWIPE_LEFT", GESTURE_SWIPE_LEFT);
- LuaSetEnum("SWIPE_UP", GESTURE_SWIPE_UP);
- LuaSetEnum("SWIPE_DOWN", GESTURE_SWIPE_DOWN);
- LuaSetEnum("PINCH_IN", GESTURE_PINCH_IN);
- LuaSetEnum("PINCH_OUT", GESTURE_PINCH_OUT);
- LuaEndEnum("Gestures");
-
- LuaStartEnum();
- LuaSetEnum("CUSTOM", CAMERA_CUSTOM);
- LuaSetEnum("FREE", CAMERA_FREE);
- LuaSetEnum("ORBITAL", CAMERA_ORBITAL);
- LuaSetEnum("FIRST_PERSON", CAMERA_FIRST_PERSON);
- LuaSetEnum("THIRD_PERSON", CAMERA_THIRD_PERSON);
- LuaEndEnum("CameraMode");
-
- LuaStartEnum();
- LuaSetEnum("DEFAULT_DEVICE", HMD_DEFAULT_DEVICE);
- LuaSetEnum("OCULUS_RIFT_DK2", HMD_OCULUS_RIFT_DK2);
- LuaSetEnum("OCULUS_RIFT_CV1", HMD_OCULUS_RIFT_CV1);
- LuaSetEnum("VALVE_HTC_VIVE", HMD_VALVE_HTC_VIVE);
- LuaSetEnum("SAMSUNG_GEAR_VR", HMD_SAMSUNG_GEAR_VR);
- LuaSetEnum("GOOGLE_CARDBOARD", HMD_GOOGLE_CARDBOARD);
- LuaSetEnum("SONY_PLAYSTATION_VR", HMD_SONY_PLAYSTATION_VR);
- LuaSetEnum("RAZER_OSVR", HMD_RAZER_OSVR);
- LuaSetEnum("FOVE_VR", HMD_FOVE_VR);
- LuaEndEnum("VrDevice");
-
- lua_pushglobaltable(L);
- LuaSetEnum("INFO", INFO);
- LuaSetEnum("ERROR", ERROR);
- LuaSetEnum("WARNING", WARNING);
- LuaSetEnum("DEBUG", DEBUG);
- LuaSetEnum("OTHER", OTHER);
- lua_pop(L, 1);
-
- lua_pushboolean(L, true);
-#if defined(PLATFORM_DESKTOP)
- lua_setglobal(L, "PLATFORM_DESKTOP");
-#elif defined(PLATFORM_ANDROID)
- lua_setglobal(L, "PLATFORM_ANDROID");
-#elif defined(PLATFORM_RPI)
- lua_setglobal(L, "PLATFORM_RPI");
-#elif defined(PLATFORM_WEB)
- lua_setglobal(L, "PLATFORM_WEB");
-#endif
-
- luaL_openlibs(L);
- LuaBuildOpaqueMetatables();
-
- LuaRegisterRayLib(0);
-}
-
-// De-initialize Lua system
-RLUADEF void CloseLuaDevice(void)
-{
- if (mainLuaState)
- {
- lua_close(mainLuaState);
- mainLuaState = 0;
- L = 0;
- }
-}
-
-// Execute raylib Lua code
-RLUADEF void ExecuteLuaCode(const char *code)
-{
- if (!mainLuaState)
- {
- TraceLog(WARNING, "Lua device not initialized");
- return;
- }
-
- int result = luaL_dostring(L, code);
-
- switch (result)
- {
- case LUA_OK: break;
- case LUA_ERRRUN: TraceLog(ERROR, "Lua Runtime Error: %s", lua_tostring(L, -1)); break;
- case LUA_ERRMEM: TraceLog(ERROR, "Lua Memory Error: %s", lua_tostring(L, -1)); break;
- default: TraceLog(ERROR, "Lua Error: %s", lua_tostring(L, -1)); break;
- }
-}
-
-// Execute raylib Lua script
-RLUADEF void ExecuteLuaFile(const char *filename)
-{
- if (!mainLuaState)
- {
- TraceLog(WARNING, "Lua device not initialized");
- return;
- }
-
- int result = luaL_dofile(L, filename);
-
- switch (result)
- {
- case LUA_OK: break;
- case LUA_ERRRUN: TraceLog(ERROR, "Lua Runtime Error: %s", lua_tostring(L, -1));
- case LUA_ERRMEM: TraceLog(ERROR, "Lua Memory Error: %s", lua_tostring(L, -1));
- default: TraceLog(ERROR, "Lua Error: %s", lua_tostring(L, -1));
- }
-}
-
-#endif // RLUA_IMPLEMENTATION