summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--API.md9
-rw-r--r--changelog1
-rw-r--r--devnotes2
-rw-r--r--examples/ReiLuaGui_examples/file_explorer.lua2
-rw-r--r--examples/instancing/main.lua1
-rw-r--r--examples/resources/lib/gui.lua4
-rw-r--r--include/core.h1
-rw-r--r--src/core.c18
-rw-r--r--src/lua_core.c1
9 files changed, 34 insertions, 5 deletions
diff --git a/API.md b/API.md
index f5d1473..81e365f 100644
--- a/API.md
+++ b/API.md
@@ -2003,6 +2003,15 @@ Check file extension ( Including point: .png, .wav )
---
+> length = RL_GetFileLength( string fileName )
+
+Get file length in bytes ( NOTE: GetFileSize() conflicts with windows.h )
+
+- Failure return false
+- Success return int
+
+---
+
> extension = RL_GetFileExtension( string fileName )
Get pointer to extension for a filename string ( Includes dot: '.png' )
diff --git a/changelog b/changelog
index 2877f0f..e6798c9 100644
--- a/changelog
+++ b/changelog
@@ -23,3 +23,4 @@ ADDED: Color lib.
FIXED: RL_DrawEllipse and RL_DrawEllipseLines expecting wrong arguments.
ADDED: RL_IsPathFile.
ADDED: RL_SetMaterialShader.
+ADDED: RL_GetFileLength.
diff --git a/devnotes b/devnotes
index eb6a635..29800b7 100644
--- a/devnotes
+++ b/devnotes
@@ -7,4 +7,6 @@ Backlog {
* Text
* Codepoints?
* VR.
+ * Core.
+ * Compression/Encoding functionality.
}
diff --git a/examples/ReiLuaGui_examples/file_explorer.lua b/examples/ReiLuaGui_examples/file_explorer.lua
index 692093e..7ead361 100644
--- a/examples/ReiLuaGui_examples/file_explorer.lua
+++ b/examples/ReiLuaGui_examples/file_explorer.lua
@@ -201,7 +201,7 @@ function FileExplorer:fileSelect( file )
end
function FileExplorer:openFile()
- print( self.file )
+ print( self.file, RL_GetFileLength( self.file ) )
end
function FileExplorer:updateFiles()
diff --git a/examples/instancing/main.lua b/examples/instancing/main.lua
index bcd9575..17a2acb 100644
--- a/examples/instancing/main.lua
+++ b/examples/instancing/main.lua
@@ -23,7 +23,6 @@ function init()
local mPos = RL_GetMonitorPosition( monitor )
local mSize = RL_GetMonitorSize( monitor )
local winSize = RL_GetWindowSize()
- -- local winSize = { 1920, 1080 }
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
RL_SetWindowSize( winSize )
diff --git a/examples/resources/lib/gui.lua b/examples/resources/lib/gui.lua
index da46744..305fb47 100644
--- a/examples/resources/lib/gui.lua
+++ b/examples/resources/lib/gui.lua
@@ -51,7 +51,7 @@ Gui = {
_cells = {},
_mousePos = Vec2:new( 0, 0 ), -- Last mouse position that was passed to Gui.process.
- _inputElement = nil,
+ _inputElement = nil, -- Element that has the input text item.
_inputItem = nil, -- Must be type Text.
}
@@ -637,8 +637,6 @@ function Container:mouseScroll( v )
self:scroll( mousePos )
end
-
--- //TODO Add this
function Container:isMouseOver( mousePosition )
local over = RL_CheckCollisionPointRec( mousePosition, self.bounds )
diff --git a/include/core.h b/include/core.h
index af9e8bd..3c2cb65 100644
--- a/include/core.h
+++ b/include/core.h
@@ -78,6 +78,7 @@ int lcoreGetBasePath( lua_State *L );
int lcoreFileExists( lua_State *L );
int lcoreDirectoryExists( lua_State *L );
int lcoreIsFileExtension( lua_State *L );
+int lcoreGetFileLength( lua_State *L );
int lcoreGetFileExtension( lua_State *L );
int lcoreGetFileName( lua_State *L );
int lcoreGetFileNameWithoutExt( lua_State *L );
diff --git a/src/core.c b/src/core.c
index dd2783a..a4bff1a 100644
--- a/src/core.c
+++ b/src/core.c
@@ -2070,6 +2070,24 @@ int lcoreIsFileExtension( lua_State *L ) {
}
/*
+> length = RL_GetFileLength( string fileName )
+
+Get file length in bytes ( NOTE: GetFileSize() conflicts with windows.h )
+
+- Failure return false
+- Success return int
+*/
+int lcoreGetFileLength( lua_State *L ) {
+ if ( !lua_isstring( L, -1 ) ) {
+ TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GetFileLength( string fileName )" );
+ lua_pushboolean( L, false );
+ return 1;
+ }
+ lua_pushinteger( L, GetFileLength( lua_tostring( L, -1 ) ) );
+ return 1;
+}
+
+/*
> extension = RL_GetFileExtension( string fileName )
Get pointer to extension for a filename string ( Includes dot: '.png' )
diff --git a/src/lua_core.c b/src/lua_core.c
index acf4843..1033c74 100644
--- a/src/lua_core.c
+++ b/src/lua_core.c
@@ -741,6 +741,7 @@ void luaRegister() {
lua_register( L, "RL_FileExists", lcoreFileExists );
lua_register( L, "RL_DirectoryExists", lcoreDirectoryExists );
lua_register( L, "RL_IsFileExtension", lcoreIsFileExtension );
+ lua_register( L, "RL_GetFileLength", lcoreGetFileLength );
lua_register( L, "RL_GetFileExtension", lcoreGetFileExtension );
lua_register( L, "RL_GetFileName", lcoreGetFileName );
lua_register( L, "RL_GetFileNameWithoutExt", lcoreGetFileNameWithoutExt );