FontCopy.
This commit is contained in:
10
API.md
10
API.md
@@ -6830,6 +6830,14 @@ Load Font from data
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
> font = RL.FontCopy( Font font )
|
||||||
|
|
||||||
|
Load font copy as new userdata
|
||||||
|
|
||||||
|
- Success return Font
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
> isReady = RL.IsFontReady( Font font )
|
> isReady = RL.IsFontReady( Font font )
|
||||||
|
|
||||||
Check if a font is ready
|
Check if a font is ready
|
||||||
@@ -9395,7 +9403,7 @@ Set gui custom font (global state)
|
|||||||
|
|
||||||
> font = RL.GuiGetFont()
|
> font = RL.GuiGetFont()
|
||||||
|
|
||||||
Get gui custom font (global state). Return as lightuserdata
|
Get gui font (global state). Return as lightuserdata
|
||||||
|
|
||||||
- Success return Font
|
- Success return Font
|
||||||
|
|
||||||
|
|||||||
@@ -3992,6 +3992,12 @@ function RL.LoadFontFromMemory( fileType, fileData, fontSize, codepoints ) end
|
|||||||
---@return any font
|
---@return any font
|
||||||
function RL.LoadFontFromData( fontData ) end
|
function RL.LoadFontFromData( fontData ) end
|
||||||
|
|
||||||
|
---Load font copy as new userdata
|
||||||
|
---- Success return Font
|
||||||
|
---@param font any
|
||||||
|
---@return any font
|
||||||
|
function RL.FontCopy( font ) end
|
||||||
|
|
||||||
---Check if a font is ready
|
---Check if a font is ready
|
||||||
---- Success return bool
|
---- Success return bool
|
||||||
---@param font any
|
---@param font any
|
||||||
@@ -6326,7 +6332,7 @@ function RL.GuiGetState() end
|
|||||||
---@return any RL.GuiSetFont
|
---@return any RL.GuiSetFont
|
||||||
function RL.GuiSetFont( font ) end
|
function RL.GuiSetFont( font ) end
|
||||||
|
|
||||||
---Get gui custom font (global state). Return as lightuserdata
|
---Get gui font (global state). Return as lightuserdata
|
||||||
---- Success return Font
|
---- Success return Font
|
||||||
---@return any font
|
---@return any font
|
||||||
function RL.GuiGetFont() end
|
function RL.GuiGetFont() end
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ DETAILED CHANGES:
|
|||||||
- ADDED: GetBufferAsString.
|
- ADDED: GetBufferAsString.
|
||||||
- FIXED: rlSetVertexAttribute takes pointer as Buffer.
|
- FIXED: rlSetVertexAttribute takes pointer as Buffer.
|
||||||
- CHANGE: UnloadMaterial can also optionally free textures and shader.
|
- CHANGE: UnloadMaterial can also optionally free textures and shader.
|
||||||
|
- ADDED: FontCopy.
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
Release: ReiLua version 0.7.0 Using Raylib 5.0 and Forked Raygui 4.0
|
Release: ReiLua version 0.7.0 Using Raylib 5.0 and Forked Raygui 4.0
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ typedef struct {
|
|||||||
Vector2 resolution;
|
Vector2 resolution;
|
||||||
int logLevelInvalid;
|
int logLevelInvalid;
|
||||||
Font defaultFont;
|
Font defaultFont;
|
||||||
Font guiDefaultFont;
|
Font guiFont;
|
||||||
Material defaultMaterial;
|
Material defaultMaterial;
|
||||||
Texture defaultTexture;
|
Texture defaultTexture;
|
||||||
int* RLGLcurrentShaderLocs;
|
int* RLGLcurrentShaderLocs;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ int ltextLoadFontEx( lua_State* L );
|
|||||||
int ltextLoadFontFromImage( lua_State* L );
|
int ltextLoadFontFromImage( lua_State* L );
|
||||||
int ltextLoadFontFromMemory( lua_State* L );
|
int ltextLoadFontFromMemory( lua_State* L );
|
||||||
int ltextLoadFontFromData( lua_State* L );
|
int ltextLoadFontFromData( lua_State* L );
|
||||||
|
int ltextFontCopy( lua_State* L );
|
||||||
int ltextIsFontReady( lua_State* L );
|
int ltextIsFontReady( lua_State* L );
|
||||||
int ltextLoadFontData( lua_State* L );
|
int ltextLoadFontData( lua_State* L );
|
||||||
int ltextGenImageFontAtlas( lua_State* L );
|
int ltextGenImageFontAtlas( lua_State* L );
|
||||||
|
|||||||
@@ -1834,6 +1834,7 @@ void luaRegister() {
|
|||||||
assingGlobalFunction( "LoadFontFromImage", ltextLoadFontFromImage );
|
assingGlobalFunction( "LoadFontFromImage", ltextLoadFontFromImage );
|
||||||
assingGlobalFunction( "LoadFontFromMemory", ltextLoadFontFromMemory );
|
assingGlobalFunction( "LoadFontFromMemory", ltextLoadFontFromMemory );
|
||||||
assingGlobalFunction( "LoadFontFromData", ltextLoadFontFromData );
|
assingGlobalFunction( "LoadFontFromData", ltextLoadFontFromData );
|
||||||
|
assingGlobalFunction( "FontCopy", ltextFontCopy );
|
||||||
assingGlobalFunction( "IsFontReady", ltextIsFontReady );
|
assingGlobalFunction( "IsFontReady", ltextIsFontReady );
|
||||||
assingGlobalFunction( "LoadFontData", ltextLoadFontData );
|
assingGlobalFunction( "LoadFontData", ltextLoadFontData );
|
||||||
assingGlobalFunction( "GenImageFontAtlas", ltextGenImageFontAtlas );
|
assingGlobalFunction( "GenImageFontAtlas", ltextGenImageFontAtlas );
|
||||||
|
|||||||
13
src/rgui.c
13
src/rgui.c
@@ -129,7 +129,8 @@ int lguiGuiSetFont( lua_State* L ) {
|
|||||||
Font* font = uluaGetFont( L, 1 );
|
Font* font = uluaGetFont( L, 1 );
|
||||||
|
|
||||||
GuiSetFont( *font );
|
GuiSetFont( *font );
|
||||||
state->guiDefaultFont = GuiGetFont();
|
// state->guiFont = GuiGetFont();
|
||||||
|
state->guiFont = *font;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -137,12 +138,12 @@ int lguiGuiSetFont( lua_State* L ) {
|
|||||||
/*
|
/*
|
||||||
> font = RL.GuiGetFont()
|
> font = RL.GuiGetFont()
|
||||||
|
|
||||||
Get gui custom font (global state). Return as lightuserdata
|
Get gui font (global state). Return as lightuserdata
|
||||||
|
|
||||||
- Success return Font
|
- Success return Font
|
||||||
*/
|
*/
|
||||||
int lguiGuiGetFont( lua_State* L ) {
|
int lguiGuiGetFont( lua_State* L ) {
|
||||||
lua_pushlightuserdata( L, &state->guiDefaultFont );
|
lua_pushlightuserdata( L, &state->guiFont );
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -162,7 +163,6 @@ int lguiGuiSetStyle( lua_State* L ) {
|
|||||||
int value = luaL_checkinteger( L, 3 );
|
int value = luaL_checkinteger( L, 3 );
|
||||||
|
|
||||||
GuiSetStyle( control, property, value );
|
GuiSetStyle( control, property, value );
|
||||||
state->guiDefaultFont = GuiGetFont();
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -198,11 +198,12 @@ Load style file over global style variable (.rgs)
|
|||||||
int lguiGuiLoadStyle( lua_State* L ) {
|
int lguiGuiLoadStyle( lua_State* L ) {
|
||||||
if ( FileExists( luaL_checkstring( L, 1 ) ) ) {
|
if ( FileExists( luaL_checkstring( L, 1 ) ) ) {
|
||||||
GuiLoadStyle( lua_tostring( L, 1 ) );
|
GuiLoadStyle( lua_tostring( L, 1 ) );
|
||||||
|
state->guiFont = GuiGetFont();
|
||||||
lua_pushboolean( L, true );
|
lua_pushboolean( L, true );
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
state->guiDefaultFont = GuiGetFont();
|
// state->guiFont = GuiGetFont();
|
||||||
TraceLog( state->logLevelInvalid, "Invalid file '%s'", lua_tostring( L, 1 ) );
|
TraceLog( state->logLevelInvalid, "Invalid file '%s'", lua_tostring( L, 1 ) );
|
||||||
lua_pushnil( L );
|
lua_pushnil( L );
|
||||||
|
|
||||||
@@ -216,7 +217,7 @@ Load style default over global style
|
|||||||
*/
|
*/
|
||||||
int lguiGuiLoadStyleDefault( lua_State* L ) {
|
int lguiGuiLoadStyleDefault( lua_State* L ) {
|
||||||
GuiLoadStyleDefault();
|
GuiLoadStyleDefault();
|
||||||
state->guiDefaultFont = GuiGetFont();
|
state->guiFont = GuiGetFont();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ bool stateInit( int argn, const char** argc, const char* basePath ) {
|
|||||||
state->run = luaInit( argn, argc );
|
state->run = luaInit( argn, argc );
|
||||||
}
|
}
|
||||||
state->defaultFont = GetFontDefault();
|
state->defaultFont = GetFontDefault();
|
||||||
state->guiDefaultFont = GuiGetFont();
|
state->guiFont = GuiGetFont();
|
||||||
state->defaultMaterial = LoadMaterialDefault();
|
state->defaultMaterial = LoadMaterialDefault();
|
||||||
state->defaultTexture = (Texture){ 1, 1, 1, 1, 7 };
|
state->defaultTexture = (Texture){ 1, 1, 1, 1, 7 };
|
||||||
state->RLGLcurrentShaderLocs = malloc( RL_MAX_SHADER_LOCATIONS * sizeof( int ) );
|
state->RLGLcurrentShaderLocs = malloc( RL_MAX_SHADER_LOCATIONS * sizeof( int ) );
|
||||||
|
|||||||
15
src/text.c
15
src/text.c
@@ -279,6 +279,21 @@ int ltextLoadFontFromData( lua_State* L ) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> font = RL.FontCopy( Font font )
|
||||||
|
|
||||||
|
Load font copy as new userdata
|
||||||
|
|
||||||
|
- Success return Font
|
||||||
|
*/
|
||||||
|
int ltextFontCopy( lua_State* L ) {
|
||||||
|
Font* font = uluaGetFont( L, 1 );
|
||||||
|
|
||||||
|
uluaPushFont( L, *font );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
> isReady = RL.IsFontReady( Font font )
|
> isReady = RL.IsFontReady( Font font )
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user