summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--API.md27
-rw-r--r--README.md1
-rw-r--r--examples/2D_camera/main.lua1
-rw-r--r--examples/dungeon_crawler/main.lua1
-rw-r--r--examples/gui/main.lua1
-rw-r--r--examples/heightmap/main.lua1
-rw-r--r--examples/image_draw/main.lua1
-rw-r--r--examples/iqm_test/main.lua1
-rw-r--r--examples/lightmap/main.lua1
-rw-r--r--examples/pixelated/main.lua1
-rw-r--r--examples/platformer/main.lua2
-rw-r--r--examples/point_triangle_collision/main.lua3
-rw-r--r--examples/pong/main.lua1
-rw-r--r--examples/ray/main.lua1
-rw-r--r--examples/resources/lib/utillib.lua2
-rw-r--r--examples/shaders/main.lua1
-rw-r--r--examples/snake/main.lua1
-rw-r--r--examples/waving_cubes/main.lua1
-rw-r--r--examples/window/main.lua1
-rw-r--r--include/state.h1
-rw-r--r--include/text.h3
-rw-r--r--src/core.c2
-rw-r--r--src/lua_core.c6
-rw-r--r--src/text.c75
24 files changed, 130 insertions, 6 deletions
diff --git a/API.md b/API.md
index 0312aae..ce8dc0f 100644
--- a/API.md
+++ b/API.md
@@ -3727,6 +3727,33 @@ Measure string size for Font
---
+> baseSize = RL_GetFontBaseSize( Font font )
+
+Get font baseSize
+
+- Failure return false
+- Success return int
+
+---
+
+> glyphCount = RL_GetFontGlyphCount( Font font )
+
+Get font glyphCount
+
+- Failure return false
+- Success return int
+
+---
+
+> glyphPadding = RL_GetFontGlyphPadding( Font font )
+
+Get font glyphPadding
+
+- Failure return false
+- Success return int
+
+---
+
## Models - Basic
---
diff --git a/README.md b/README.md
index 96ea1ec..dea78db 100644
--- a/README.md
+++ b/README.md
@@ -25,6 +25,7 @@ List of some MISSING features that are planned to be included. For specific func
* LoadImageFromMemory
* Text
* LoadFontFromMemory
+ * GlyphInfo
* Audio
* LoadWaveFromMemory
* LoadMusicStreamFromMemory
diff --git a/examples/2D_camera/main.lua b/examples/2D_camera/main.lua
index 23128dc..54d3ec6 100644
--- a/examples/2D_camera/main.lua
+++ b/examples/2D_camera/main.lua
@@ -14,6 +14,7 @@ function init()
local winSize = RL_GetWindowSize()
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
+ RL_SetWindowState( FLAG_VSYNC_HINT )
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
RL_SetWindowTitle( "Camera 2D" )
diff --git a/examples/dungeon_crawler/main.lua b/examples/dungeon_crawler/main.lua
index 03f499b..070eb97 100644
--- a/examples/dungeon_crawler/main.lua
+++ b/examples/dungeon_crawler/main.lua
@@ -74,6 +74,7 @@ function init()
RL_SetExitKey( KEY_ESCAPE )
-- framebuffer = RL_LoadRenderTexture( res )
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
+ RL_SetWindowState( FLAG_VSYNC_HINT )
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
texture = RL_LoadTexture( RL_GetBasePath().."../resources/images/tiles.png" )
diff --git a/examples/gui/main.lua b/examples/gui/main.lua
index 4c84af8..e412201 100644
--- a/examples/gui/main.lua
+++ b/examples/gui/main.lua
@@ -28,6 +28,7 @@ function init()
RL_GuiSetFont( 0 )
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
+ RL_SetWindowState( FLAG_VSYNC_HINT )
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
end
diff --git a/examples/heightmap/main.lua b/examples/heightmap/main.lua
index 3cae3e4..4b5e70e 100644
--- a/examples/heightmap/main.lua
+++ b/examples/heightmap/main.lua
@@ -24,6 +24,7 @@ function init()
local winSize = RL_GetWindowSize()
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
+ RL_SetWindowState( FLAG_VSYNC_HINT )
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
camera = RL_CreateCamera3D()
diff --git a/examples/image_draw/main.lua b/examples/image_draw/main.lua
index ee9757c..7d5cb90 100644
--- a/examples/image_draw/main.lua
+++ b/examples/image_draw/main.lua
@@ -11,6 +11,7 @@ function init()
local winSize = RL_GetWindowSize()
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
+ RL_SetWindowState( FLAG_VSYNC_HINT )
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
image = RL_GenImageColor( winSize[1], winSize[2], WHITE )
-- Test changing working directory.
diff --git a/examples/iqm_test/main.lua b/examples/iqm_test/main.lua
index 1420f92..105af12 100644
--- a/examples/iqm_test/main.lua
+++ b/examples/iqm_test/main.lua
@@ -18,6 +18,7 @@ function init()
local winSize = RL_GetWindowSize()
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
+ RL_SetWindowState( FLAG_VSYNC_HINT )
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
camera = RL_CreateCamera3D()
RL_SetCamera3DPosition( camera, { 0, 2, 4 } )
diff --git a/examples/lightmap/main.lua b/examples/lightmap/main.lua
index 251b700..8f8038e 100644
--- a/examples/lightmap/main.lua
+++ b/examples/lightmap/main.lua
@@ -16,6 +16,7 @@ function init()
local winSize = RL_GetWindowSize()
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
+ RL_SetWindowState( FLAG_VSYNC_HINT )
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
camera = RL_CreateCamera3D()
diff --git a/examples/pixelated/main.lua b/examples/pixelated/main.lua
index 24ba913..d130c1c 100644
--- a/examples/pixelated/main.lua
+++ b/examples/pixelated/main.lua
@@ -12,6 +12,7 @@ local winSize = { res[1] * scale, res[2] * scale }
function init()
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
+ RL_SetWindowState( FLAG_VSYNC_HINT )
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
RL_SetWindowSize( winSize )
tex = RL_LoadTexture( RL_GetBasePath().."../resources/images/cat.png" )
diff --git a/examples/platformer/main.lua b/examples/platformer/main.lua
index 2c954be..5bfa6ab 100644
--- a/examples/platformer/main.lua
+++ b/examples/platformer/main.lua
@@ -90,9 +90,9 @@ function init()
local monitorPos = Vec2:new( RL_GetMonitorPosition( monitor ) )
local monitorSize = Vec2:new( RL_GetMonitorSize( monitor ) )
- RL_SetConfigFlags( FLAG_VSYNC_HINT )
RL_SetWindowTitle( "Platformer" )
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
+ RL_SetWindowState( FLAG_VSYNC_HINT )
RL_SetWindowSize( winSize )
RL_SetWindowPosition( { monitorPos.x + monitorSize.x / 2 - winSize.x / 2, monitorPos.y + monitorSize.y / 2 - winSize.y / 2 } )
diff --git a/examples/point_triangle_collision/main.lua b/examples/point_triangle_collision/main.lua
index 96c864d..0a7c1ea 100644
--- a/examples/point_triangle_collision/main.lua
+++ b/examples/point_triangle_collision/main.lua
@@ -34,9 +34,8 @@ function init()
local mSize = RL_GetMonitorSize( monitor )
local winSize = { 1920, 1080 }
- RL_SetConfigFlags( FLAG_VSYNC_HINT )
-
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
+ RL_SetWindowState( FLAG_VSYNC_HINT )
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
RL_SetWindowSize( winSize )
camera = RL_CreateCamera3D()
diff --git a/examples/pong/main.lua b/examples/pong/main.lua
index b3f3f99..7de5517 100644
--- a/examples/pong/main.lua
+++ b/examples/pong/main.lua
@@ -53,6 +53,7 @@ function init()
local mPos = RL_GetMonitorPosition( monitor )
local mSize = RL_GetMonitorSize( monitor )
+ RL_SetWindowState( FLAG_VSYNC_HINT )
RL_SetWindowSize( winSize )
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
RL_SetWindowTitle( "Pong" )
diff --git a/examples/ray/main.lua b/examples/ray/main.lua
index ed74f6e..248cec6 100644
--- a/examples/ray/main.lua
+++ b/examples/ray/main.lua
@@ -9,6 +9,7 @@ local function setupWindow()
local winSize = RL_GetWindowSize()
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
+ RL_SetWindowState( FLAG_VSYNC_HINT )
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
end
diff --git a/examples/resources/lib/utillib.lua b/examples/resources/lib/utillib.lua
index 66916fe..8d3ce9e 100644
--- a/examples/resources/lib/utillib.lua
+++ b/examples/resources/lib/utillib.lua
@@ -13,7 +13,7 @@ function utillib.deepCopy( orig )
copy = {}
for origKey, origValue in next, orig, nil do
- -- If object has clone method use that. Mainly for vector libraries.
+ -- If object has clone method, use that.
if type( origValue ) == "table" and type( origValue.clone ) == "function" then
copy[ utillib.deepCopy( origKey ) ] = orig_value:clone()
else
diff --git a/examples/shaders/main.lua b/examples/shaders/main.lua
index eea9344..f603a5d 100644
--- a/examples/shaders/main.lua
+++ b/examples/shaders/main.lua
@@ -14,6 +14,7 @@ function init()
local winSize = RL_GetWindowSize()
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
+ RL_SetWindowState( FLAG_VSYNC_HINT )
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
texture = RL_LoadTexture( RL_GetBasePath().."../resources/images/cat.png" )
diff --git a/examples/snake/main.lua b/examples/snake/main.lua
index d6e4fa5..dd752e4 100644
--- a/examples/snake/main.lua
+++ b/examples/snake/main.lua
@@ -66,6 +66,7 @@ end
function init()
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
+ RL_SetWindowState( FLAG_VSYNC_HINT )
RL_SetWindowSize( winSize )
RL_SetWindowPosition( { monitorPos[1] + monitorSize[1] / 2 - winSize[1] / 2, monitorPos[2] + monitorSize[2] / 2 - winSize[2] / 2 } )
RL_SetWindowTitle( "Snake" )
diff --git a/examples/waving_cubes/main.lua b/examples/waving_cubes/main.lua
index 90e7b5d..faf4a9f 100644
--- a/examples/waving_cubes/main.lua
+++ b/examples/waving_cubes/main.lua
@@ -17,6 +17,7 @@ function init()
RL_SetWindowTitle( "Waving cubes" )
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
+ RL_SetWindowState( FLAG_VSYNC_HINT )
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
camera = RL_CreateCamera3D()
diff --git a/examples/window/main.lua b/examples/window/main.lua
index 44d9fa7..7ddf828 100644
--- a/examples/window/main.lua
+++ b/examples/window/main.lua
@@ -5,6 +5,7 @@ local text = "Congrats! You created your first window!"
function init()
RL_SetWindowTitle( "First window" )
+ RL_SetWindowState( FLAG_VSYNC_HINT )
end
function process( delta )
diff --git a/include/state.h b/include/state.h
index 7599052..fc3c957 100644
--- a/include/state.h
+++ b/include/state.h
@@ -78,5 +78,4 @@ typedef struct {
extern State *state;
bool stateInit( const char *exePath );
-// bool stateRun();
void stateFree();
diff --git a/include/text.h b/include/text.h
index a07b320..523d9d0 100644
--- a/include/text.h
+++ b/include/text.h
@@ -12,3 +12,6 @@ int ltextDrawText( lua_State *L );
int ltextDrawTextPro( lua_State *L );
/* Misc. */
int ltextMeasureText( lua_State *L );
+int ltextGetFontBaseSize( lua_State *L );
+int ltextGetFontGlyphCount( lua_State *L );
+int ltextGetFontGlyphPadding( lua_State *L );
diff --git a/src/core.c b/src/core.c
index d549eb0..8e48c0a 100644
--- a/src/core.c
+++ b/src/core.c
@@ -664,7 +664,7 @@ int lcoreSetConfigFlags( lua_State *L ) {
lua_pushboolean( L, false );
return 1;
}
- SetConfigFlags( lua_tointeger( L, -1 ) );
+ SetConfigFlags( (unsigned int)lua_tointeger( L, -1 ) );
lua_pushboolean( L, true );
return 1;
diff --git a/src/lua_core.c b/src/lua_core.c
index f17872e..23f6534 100644
--- a/src/lua_core.c
+++ b/src/lua_core.c
@@ -529,6 +529,9 @@ bool luaInit() {
luaRegister();
defineGlobals();
+ // SetConfigFlags( FLAG_VSYNC_HINT );
+ // SetWindowState( FLAG_VSYNC_HINT );
+
return luaCallMain();
}
@@ -1060,6 +1063,9 @@ void luaRegister() {
lua_register( L, "RL_DrawTextPro", ltextDrawTextPro );
/* Misc. */
lua_register( L, "RL_MeasureText", ltextMeasureText );
+ lua_register( L, "RL_GetFontBaseSize", ltextGetFontBaseSize );
+ lua_register( L, "RL_GetFontGlyphCount", ltextGetFontGlyphCount );
+ lua_register( L, "RL_GetFontGlyphPadding", ltextGetFontGlyphPadding );
/* Audio. */
/* Audio device management. */
diff --git a/src/text.c b/src/text.c
index ace5e20..564204d 100644
--- a/src/text.c
+++ b/src/text.c
@@ -261,3 +261,78 @@ int ltextMeasureText( lua_State *L ) {
return 1;
}
+
+/*
+> baseSize = RL_GetFontBaseSize( Font font )
+
+Get font baseSize
+
+- Failure return false
+- Success return int
+*/
+int ltextGetFontBaseSize( lua_State *L ) {
+ if ( !lua_isnumber( L, -1 ) ) {
+ TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GetFontBaseSize( Font font )" );
+ lua_pushboolean( L, false );
+ return 1;
+ }
+ size_t fontId = lua_tointeger( L, -1 );
+
+ if ( !validFont( fontId ) ) {
+ lua_pushboolean( L, false );
+ return 1;
+ }
+ lua_pushinteger( L, state->fonts[ fontId ]->baseSize );
+
+ return 1;
+}
+
+/*
+> glyphCount = RL_GetFontGlyphCount( Font font )
+
+Get font glyphCount
+
+- Failure return false
+- Success return int
+*/
+int ltextGetFontGlyphCount( lua_State *L ) {
+ if ( !lua_isnumber( L, -1 ) ) {
+ TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GetFontGlyphCount( Font font )" );
+ lua_pushboolean( L, false );
+ return 1;
+ }
+ size_t fontId = lua_tointeger( L, -1 );
+
+ if ( !validFont( fontId ) ) {
+ lua_pushboolean( L, false );
+ return 1;
+ }
+ lua_pushinteger( L, state->fonts[ fontId ]->glyphCount );
+
+ return 1;
+}
+
+/*
+> glyphPadding = RL_GetFontGlyphPadding( Font font )
+
+Get font glyphPadding
+
+- Failure return false
+- Success return int
+*/
+int ltextGetFontGlyphPadding( lua_State *L ) {
+ if ( !lua_isnumber( L, -1 ) ) {
+ TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GetFontGlyphPadding( Font font )" );
+ lua_pushboolean( L, false );
+ return 1;
+ }
+ size_t fontId = lua_tointeger( L, -1 );
+
+ if ( !validFont( fontId ) ) {
+ lua_pushboolean( L, false );
+ return 1;
+ }
+ lua_pushinteger( L, state->fonts[ fontId ]->glyphPadding );
+
+ return 1;
+}