summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjussi2023-04-10 16:05:45 +0300
committerjussi2023-04-10 16:05:45 +0300
commit6938cdbaede7eb63b9bc2adb9e0a93e243e291ee (patch)
tree67f072df6b9a3d2e9b1f5ab7cc47fd5a62ff50f4
parent1cbadf56f33641e85fc634a326c0db6935947c23 (diff)
downloadreilua-enhanced-6938cdbaede7eb63b9bc2adb9e0a93e243e291ee.tar.gz
reilua-enhanced-6938cdbaede7eb63b9bc2adb9e0a93e243e291ee.tar.bz2
reilua-enhanced-6938cdbaede7eb63b9bc2adb9e0a93e243e291ee.zip
LoadShaderFromMemory fix.
-rw-r--r--API.md6
-rw-r--r--ReiLua_API.lua7
-rw-r--r--changelog5
-rw-r--r--devnotes14
-rw-r--r--examples/dungeon_crawler/main.lua5
-rw-r--r--examples/lightmap/main.lua11
-rw-r--r--examples/ray/main.lua5
-rw-r--r--src/core.c7
-rw-r--r--src/textures.c4
9 files changed, 21 insertions, 43 deletions
diff --git a/API.md b/API.md
index 7ced98d..514c6e5 100644
--- a/API.md
+++ b/API.md
@@ -1172,7 +1172,7 @@ Set window minimum dimensions ( for FLAG_WINDOW_RESIZABLE )
---
-> position = RL.GetMonitorPosition( )
+> position = RL.GetMonitorPosition( int monitor )
Get specified monitor position
@@ -3692,7 +3692,7 @@ Returns src alpha-blended into dst color with tint
---
-> Color = RL.GetColor( unsigned int hexValue )
+> color = RL.GetColor( unsigned int hexValue )
Get Color structure from hexadecimal value
@@ -3701,7 +3701,7 @@ Get Color structure from hexadecimal value
---
-> Color = RL.GetPixelColor( Texture2D texture, Vector2 position )
+> color = RL.GetPixelColor( Texture2D texture, Vector2 position )
Get pixel color from source texture
diff --git a/ReiLua_API.lua b/ReiLua_API.lua
index 2433dbf..c6c5b7e 100644
--- a/ReiLua_API.lua
+++ b/ReiLua_API.lua
@@ -605,8 +605,9 @@ function RL.SetWindowMinSize( size ) end
---Get specified monitor position
---- Failure return nil
---- Success return Vector2
+---@param monitor integer
---@return any position
-function RL.GetMonitorPosition() end
+function RL.GetMonitorPosition( monitor ) end
---Get specified monitor size
---- Failure return nil
@@ -2754,7 +2755,7 @@ function RL.ColorAlphaBlend( dst, src, tint ) end
---- Failure return false
---- Success return Color
---@param int any
----@return any Color
+---@return any color
function RL.GetColor( int ) end
---Get pixel color from source texture
@@ -2762,7 +2763,7 @@ function RL.GetColor( int ) end
---- Success return Color
---@param texture any
---@param position table
----@return any Color
+---@return any color
function RL.GetPixelColor( texture, position ) end
---Get pixel data size in bytes for certain format
diff --git a/changelog b/changelog
index 0c875a9..e15567c 100644
--- a/changelog
+++ b/changelog
@@ -6,6 +6,8 @@ KEY CHANGES:
- CHANGED: All examples are now changed to use new RL table method.
- ADDED: doc_parser creates also ReiLua_API.lua that can be used in projects with Lua Language Server.
- CHANGED: Switched to Raylib vertion 4.5. Removed some functions and added others. Main changes to camera3D.
+ - REVISED: How Lua argumets are handled. Now uluaGet*Index functions can take stack index(positive only).
+ Also using positive stack indexing.
Detailed changes:
- FIXED: uluaGetRay was looking for integers instead of tables.
@@ -33,8 +35,7 @@ Detailed changes:
- CHANGED: DrawLineStrip no longer require pointsCount
- CHANGED: DrawTriangleFan no longer require pointsCount
- CHANGED: DrawTriangleStrip no longer require pointsCount
- - REVISED: How argumets are handled. Now uluaGet*Index functions can take stack index(positive only).
- Also using mostly positive stack indexing.
+ - FIXED: LoadShaderFromMemory
------------------------------------------------------------------------
Release: ReiLua version 0.4.0 Using Raylib 4.2
diff --git a/devnotes b/devnotes
index a5e0683..0fdba57 100644
--- a/devnotes
+++ b/devnotes
@@ -26,24 +26,10 @@ Backlog {
* Needs Testing
* UpdateTexture
* UpdateTextureRec
- * GetColor
- * LoadShader
- * LoadShaderFromMemory
* LoadSoundFromWave
* LoadFont
* LoadFontEx
* LoadFontFromImage
- * DrawText
- * DrawQuad3DTexture
- * GenMeshCustom
* UpdateMesh
- * DrawMeshInstanced
- * LoadModelAnimations
- * LoadMaterialDefault
- * CreateMaterial
- * LoadModel
* LoadModelFromMesh
- * SetModelMaterial
- * UpdateModelAnimation
- * GetRayCollisionMesh
}
diff --git a/examples/dungeon_crawler/main.lua b/examples/dungeon_crawler/main.lua
index c572348..3818f67 100644
--- a/examples/dungeon_crawler/main.lua
+++ b/examples/dungeon_crawler/main.lua
@@ -82,11 +82,6 @@ function RL.init()
RL.SetCamera3DTarget( camera, { 0, 0, 0 } )
RL.SetCamera3DUp( camera, { 0, 1, 0 } )
- -- for x = 0, 3 do
- -- for y = 0, 9 do
- -- table.insert( sprites, { pos = { x + 0.5, y + 0.5 + 1 }, tile = { 1, 1 }, dis = 0, size = 0.8 } )
- -- end
- -- end
table.insert( sprites, { pos = { 2.5, 2.5 }, tile = { 1, 1 }, dis = 0, size = 0.8 } )
table.insert( sprites, { pos = { 1.5, 3.5 }, tile = { 3, 1 }, dis = 0, size = 0.5 } )
table.insert( sprites, { pos = { 0.5, 3.5 }, tile = { 3, 0 }, dis = 0, size = 0.7 } )
diff --git a/examples/lightmap/main.lua b/examples/lightmap/main.lua
index ae81345..a85527e 100644
--- a/examples/lightmap/main.lua
+++ b/examples/lightmap/main.lua
@@ -23,7 +23,6 @@ function RL.init()
RL.SetCamera3DPosition( camera, { 0, 8, 16 } )
RL.SetCamera3DTarget( camera, { 0, 0, 0 } )
RL.SetCamera3DUp( camera, { 0, 1, 0 } )
- RL.SetCameraMode( camera, RL.CAMERA_FREE )
local ts = PLANE_SIZE
local meshData = {
@@ -40,12 +39,6 @@ function RL.init()
}
mesh = RL.GenMeshCustom( meshData, true )
- -- local meshEdit = {
- -- vertices = { { 0, 1, 0 }, { 0, 0, PLANE_SIZE }, { PLANE_SIZE, 0, PLANE_SIZE },
- -- { 0, 1, 0 }, { PLANE_SIZE, 0, PLANE_SIZE }, { PLANE_SIZE, 0, 0 } },
- -- }
- -- RL.UpdateMesh( mesh, meshEdit )
-
tileTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/tile.png" )
RL.GenTextureMipmaps( tileTexture )
RL.SetTextureFilter( tileTexture, RL.TEXTURE_FILTER_TRILINEAR )
@@ -85,8 +78,8 @@ end
function RL.draw()
RL.ClearBackground( { 25, 50, 50 } )
- RL.UpdateCamera3D( camera )
-
+ RL.UpdateCamera3D( camera, RL.CAMERA_ORBITAL )
+
RL.BeginMode3D( camera )
RL.DrawMesh( mesh, material, matrix )
RL.EndMode3D()
diff --git a/examples/ray/main.lua b/examples/ray/main.lua
index 79ba7ee..9e09683 100644
--- a/examples/ray/main.lua
+++ b/examples/ray/main.lua
@@ -1,6 +1,7 @@
local camera = -1
local sphereMesh = -1
local ray = { { 0.5, 0, 4 }, { 0.1, 0, -1 } }
+local rayCol = {}
local function setupWindow()
local monitor = 0
@@ -14,7 +15,7 @@ local function setupWindow()
end
function ray_collision()
- local rayCol = RL.GetRayCollisionMesh( ray, sphereMesh, RL.MatrixIdentity() )
+ rayCol = RL.GetRayCollisionMesh( ray, sphereMesh, RL.MatrixIdentity() )
if rayCol ~= nil and rayCol.hit then
print( "hit", rayCol.hit )
@@ -53,5 +54,7 @@ function RL.draw()
RL.DrawRay( ray, { 255, 100, 100 } )
RL.DrawMesh( sphereMesh, 0, RL.MatrixIdentity() )
+ RL.DrawSphereWires( rayCol.point, 0.05, 4, 8, RL.BLUE )
+ RL.DrawLine3D( rayCol.point, RL.Vector3Add( rayCol.point, rayCol.normal ), RL.GREEN )
RL.EndMode3D()
end
diff --git a/src/core.c b/src/core.c
index bcc00ee..84b6991 100644
--- a/src/core.c
+++ b/src/core.c
@@ -248,7 +248,7 @@ int lcoreSetWindowMinSize( lua_State *L ) {
}
/*
-> position = RL.GetMonitorPosition( )
+> position = RL.GetMonitorPosition( int monitor )
Get specified monitor position
@@ -1022,18 +1022,17 @@ int lcoreLoadShaderFromMemory( lua_State *L ) {
lua_pushinteger( L, -1 );
return 1;
}
-
char *vs = NULL;
char *fs = NULL;
if ( lua_isstring( L, 1 ) ) {
- size_t vsLen = lua_rawlen( L, 1 );
+ size_t vsLen = lua_rawlen( L, 1 ) + 1;
vs = malloc( vsLen * sizeof( char ) );
strcpy( vs, lua_tostring( L, 1 ) );
}
if ( lua_isstring( L, 2 ) ) {
- size_t fsLen = lua_rawlen( L, 2 );
+ size_t fsLen = lua_rawlen( L, 2 ) + 1;
fs = malloc( fsLen * sizeof( char ) );
strcpy( fs, lua_tostring( L, 2 ) );
diff --git a/src/textures.c b/src/textures.c
index 1797bc7..b96bb5b 100644
--- a/src/textures.c
+++ b/src/textures.c
@@ -2531,7 +2531,7 @@ int ltexturesColorAlphaBlend( lua_State *L ) {
}
/*
-> Color = RL.GetColor( unsigned int hexValue )
+> color = RL.GetColor( unsigned int hexValue )
Get Color structure from hexadecimal value
@@ -2552,7 +2552,7 @@ int ltexturesGetColor( lua_State *L ) {
}
/*
-> Color = RL.GetPixelColor( Texture2D texture, Vector2 position )
+> color = RL.GetPixelColor( Texture2D texture, Vector2 position )
Get pixel color from source texture