summaryrefslogtreecommitdiff
path: root/src/text.c
diff options
context:
space:
mode:
authorjussi2023-10-30 00:04:11 +0200
committerjussi2023-10-30 00:04:11 +0200
commitd287078c658d26d41a28f92b62b023048c5503ce (patch)
treefb045110fde9329782d21324cc7a9092128a1126 /src/text.c
parent992310fb90832ddf493ec33f1099dbbf3e0987f3 (diff)
downloadreilua-enhanced-d287078c658d26d41a28f92b62b023048c5503ce.tar.gz
reilua-enhanced-d287078c658d26d41a28f92b62b023048c5503ce.tar.bz2
reilua-enhanced-d287078c658d26d41a28f92b62b023048c5503ce.zip
Userdata objects can be referenced with lightuserdata.
Diffstat (limited to 'src/text.c')
-rw-r--r--src/text.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/text.c b/src/text.c
index 1f8606e..1a8f0fd 100644
--- a/src/text.c
+++ b/src/text.c
@@ -87,7 +87,7 @@ Load font from Image ( XNA style)
- Success return Font
*/
int ltextLoadFontFromImage( lua_State *L ) {
- Image *image = luaL_checkudata( L, 1, "Image" );
+ Image *image = uluaGetImage( L, 1 );
Color key = uluaGetColorIndex( L, 2 );
int firstChar = luaL_checkinteger( L, 3 );
@@ -119,7 +119,7 @@ int ltextDrawFPS( lua_State *L ) {
Draw text using font and additional parameters
*/
int ltextDrawText( lua_State *L ) {
- Font *font = luaL_checkudata( L, 1, "Font" );
+ Font *font = uluaGetFont( L, 1 );
Vector2 position = uluaGetVector2Index( L, 3 );
float fontSize = luaL_checknumber( L, 4 );
float spacing = luaL_checknumber( L, 5 );
@@ -136,7 +136,7 @@ int ltextDrawText( lua_State *L ) {
Draw text using Font and pro parameters (rotation)
*/
int ltextDrawTextPro( lua_State *L ) {
- Font *font = luaL_checkudata( L, 1, "Font" );
+ Font *font = uluaGetFont( L, 1 );
Vector2 position = uluaGetVector2Index( L, 3 );
Vector2 origin = uluaGetVector2Index( L, 4 );
float rotation = luaL_checknumber( L, 5 );
@@ -161,7 +161,7 @@ Measure string size for Font
- Success return Vector2
*/
int ltextMeasureText( lua_State *L ) {
- Font *font = luaL_checkudata( L, 1, "Font" );
+ Font *font = uluaGetFont( L, 1 );
float fontSize = luaL_checknumber( L, 3 );
float spacing = luaL_checknumber( L, 4 );
@@ -178,7 +178,7 @@ Get font base size (default chars height)
- Success return int
*/
int ltextGetFontBaseSize( lua_State *L ) {
- Font *font = luaL_checkudata( L, 1, "Font" );
+ Font *font = uluaGetFont( L, 1 );
lua_pushinteger( L, font->baseSize );
@@ -193,7 +193,7 @@ Get font number of glyph characters
- Success return int
*/
int ltextGetFontGlyphCount( lua_State *L ) {
- Font *font = luaL_checkudata( L, 1, "Font" );
+ Font *font = uluaGetFont( L, 1 );
lua_pushinteger( L, font->glyphCount );
@@ -208,7 +208,7 @@ Get font padding around the glyph characters
- Success return int
*/
int ltextGetFontGlyphPadding( lua_State *L ) {
- Font *font = luaL_checkudata( L, 1, "Font" );
+ Font *font = uluaGetFont( L, 1 );
lua_pushinteger( L, font->glyphPadding );
@@ -223,7 +223,7 @@ Get font texture atlas containing the glyphs.
- Success return Texture
*/
int ltextGetFontTexture( lua_State *L ) {
- Font *font = luaL_checkudata( L, 1, "Font" );
+ Font *font = uluaGetFont( L, 1 );
uluaPushTexture( L, font->texture );