summaryrefslogtreecommitdiff
path: root/src/core.c
diff options
context:
space:
mode:
authorjussi2024-11-20 18:23:42 +0200
committerjussi2024-11-20 18:23:42 +0200
commit479726a5e468a2f4d0f9337f082889082e535bfb (patch)
treed342d5ddd7ea69b1be343ae62dfd0ef1ddcef8a7 /src/core.c
parentcf2c2eb05bd5d30169771b0087df84a53124f766 (diff)
downloadreilua-enhanced-479726a5e468a2f4d0f9337f082889082e535bfb.tar.gz
reilua-enhanced-479726a5e468a2f4d0f9337f082889082e535bfb.tar.bz2
reilua-enhanced-479726a5e468a2f4d0f9337f082889082e535bfb.zip
Initial switch to raylib 5.5.
Diffstat (limited to 'src/core.c')
-rw-r--r--src/core.c77
1 files changed, 47 insertions, 30 deletions
diff --git a/src/core.c b/src/core.c
index d37b1a4..3473251 100644
--- a/src/core.c
+++ b/src/core.c
@@ -892,16 +892,16 @@ int lcoreLoadShaderFromMemory( lua_State* L ) {
}
/*
-> isReady = RL.IsShaderReady( Shader shader )
+> isReady = RL.IsShaderValid( Shader shader )
-Check if a shader is ready
+Check if a shader is valid (loaded on GPU)
- Success return bool
*/
-int lcoreIsShaderReady( lua_State* L ) {
+int lcoreIsShaderValid( lua_State* L ) {
Shader* shader = uluaGetShader( L, 1 );
- lua_pushboolean( L, IsShaderReady( *shader ) );
+ lua_pushboolean( L, IsShaderValid( *shader ) );
return 1;
}
@@ -1116,47 +1116,34 @@ int lcoreUnloadShader( lua_State* L ) {
*/
/*
-> ray = RL.GetMouseRay( Vector2 mousePosition, Camera3D camera )
+> ray = RL.GetScreenToWorldRay( Vector2 mousePosition, Camera3D camera )
-Get a ray trace from mouse position
+Get a ray trace from screen position (i.e mouse)
- Success return Ray
*/
-int lcoreGetMouseRay( lua_State* L ) {
+int lcoreGetScreenToWorldRay( lua_State* L ) {
Vector2 mousePosition = uluaGetVector2( L, 1 );
Camera3D* camera = uluaGetCamera3D( L, 2 );
- uluaPushRay( L, GetMouseRay( mousePosition, *camera ) );
+ uluaPushRay( L, GetScreenToWorldRay( mousePosition, *camera ) );
return 1;
}
/*
-> matrix = RL.GetCameraMatrix( Camera3D camera )
-
-Get camera transform matrix (view matrix)
-
-- Success return Matrix
-*/
-int lcoreGetCameraMatrix( lua_State* L ) {
- Camera3D* camera = uluaGetCamera3D( L, 1 );
-
- uluaPushMatrix( L, GetCameraMatrix( *camera ) );
-
- return 1;
-}
-
-/*
-> matrix = RL.GetCameraMatrix2D( Camera2D camera )
+> ray = RL.GetScreenToWorldRayEx( Vector2 mousePosition, Camera3D camera, Vector2 size )
-Get camera 2d transform matrix
+Get a ray trace from screen position (i.e mouse) in a viewport
-- Success return Matrix
+- Success return Ray
*/
-int lcoreGetCameraMatrix2D( lua_State* L ) {
- Camera2D* camera = uluaGetCamera2D( L, 1 );
+int lcoreGetScreenToWorldRayEx( lua_State* L ) {
+ Vector2 mousePosition = uluaGetVector2( L, 1 );
+ Camera3D* camera = uluaGetCamera3D( L, 2 );
+ Vector2 size = uluaGetVector2( L, 3 );
- uluaPushMatrix( L, GetCameraMatrix2D( *camera ) );
+ uluaPushRay( L, GetScreenToWorldRayEx( mousePosition, *camera, (int)size.x, (int)size.y ) );
return 1;
}
@@ -1227,6 +1214,36 @@ int lcoreGetScreenToWorld2D( lua_State* L ) {
}
/*
+> matrix = RL.GetCameraMatrix( Camera3D camera )
+
+Get camera transform matrix (view matrix)
+
+- Success return Matrix
+*/
+int lcoreGetCameraMatrix( lua_State* L ) {
+ Camera3D* camera = uluaGetCamera3D( L, 1 );
+
+ uluaPushMatrix( L, GetCameraMatrix( *camera ) );
+
+ return 1;
+}
+
+/*
+> matrix = RL.GetCameraMatrix2D( Camera2D camera )
+
+Get camera 2d transform matrix
+
+- Success return Matrix
+*/
+int lcoreGetCameraMatrix2D( lua_State* L ) {
+ Camera2D* camera = uluaGetCamera2D( L, 1 );
+
+ uluaPushMatrix( L, GetCameraMatrix2D( *camera ) );
+
+ return 1;
+}
+
+/*
## Core - Timing-related functions
*/
@@ -2010,7 +2027,7 @@ Unload automation events list from file
int lcoreUnloadAutomationEventList( lua_State* L ) {
AutomationEventList* list = uluaGetAutomationEventList( L, 1 );
- UnloadAutomationEventList( list );
+ UnloadAutomationEventList( *list );
memset( list, 0, sizeof( AutomationEventList ) );
return 0;