More raygui functions and updated to raygui v3.2-dev.

This commit is contained in:
jussi
2022-03-25 22:31:59 +02:00
parent 55ad8773ec
commit 6d1c14e09c
10 changed files with 1631 additions and 995 deletions

235
API.md
View File

@@ -373,6 +373,180 @@ BLUE
PI PI
## Globals - GuiControlState
GUI_STATE_NORMAL
GUI_STATE_FOCUSED
GUI_STATE_PRESSED
GUI_STATE_DISABLED
## Globals - GuiTextAlignment
GUI_TEXT_ALIGN_LEFT
GUI_TEXT_ALIGN_CENTER
GUI_TEXT_ALIGN_RIGHT
## Globals - GuiControls
DEFAULT
LABEL
BUTTON
TOGGLE
SLIDER
PROGRESSBAR
CHECKBOX
COMBOBOX
DROPDOWNBOX
TEXTBOX
VALUEBOX
SPINNER
LISTVIEW
COLORPICKER
SCROLLBAR
STATUSBAR
## Globals - GuiControlProperty
BORDER_COLOR_NORMAL
BASE_COLOR_NORMAL
TEXT_COLOR_NORMAL
BORDER_COLOR_FOCUSED
BASE_COLOR_FOCUSED
TEXT_COLOR_FOCUSED
BORDER_COLOR_PRESSED
BASE_COLOR_PRESSED
TEXT_COLOR_PRESSED
BORDER_COLOR_DISABLED
BASE_COLOR_DISABLED
TEXT_COLOR_DISABLED
BORDER_WIDTH
TEXT_PADDING
TEXT_ALIGNMENT
RESERVED
## Globals - GuiDefaultProperty
TEXT_SIZE
TEXT_SPACING
LINE_COLOR
BACKGROUND_COLOR
## Globals - GuiToggleProperty
GROUP_PADDING
## Globals - GuiSliderProperty
SLIDER_WIDTH
SLIDER_PADDING
## Globals - GuiProgressBarProperty
PROGRESS_PADDING
## Globals - GuiCheckBoxProperty
CHECK_PADDING
## Globals - GuiComboBoxProperty
COMBO_BUTTON_WIDTH
COMBO_BUTTON_SPACING
## Globals - GuiDropdownBoxProperty
ARROW_PADDING
DROPDOWN_ITEMS_SPACING
## Globals - GuiTextBoxProperty
TEXT_INNER_PADDING
TEXT_LINES_SPACING
## Globals - GuiSpinnerProperty
SPIN_BUTTON_WIDTH
SPIN_BUTTON_SPACING
## Globals - GuiScrollBarProperty
ARROWS_SIZE
ARROWS_VISIBLE
SCROLL_SLIDER_PADDING
SCROLL_SLIDER_SIZE
SCROLL_PADDING
SCROLL_SPEED
## Globals - GuiListViewProperty
LIST_ITEMS_HEIGHT
LIST_ITEMS_SPACING
SCROLLBAR_WIDTH
SCROLLBAR_SIDE
## Globals - GuiColorPickerProperty
COLOR_SELECTOR_SIZE
HUEBAR_WIDTH
HUEBAR_PADDING
HUEBAR_SELECTOR_HEIGHT
HUEBAR_SELECTOR_OVERFLOW
## Types ## Types
Raylib structs in Lua Raylib structs in Lua
@@ -641,6 +815,14 @@ Set title for window ( Only PLATFORM_DESKTOP )
--- ---
> count = RL_GetMonitorCount()
Get number of connected monitors
- Success return int
---
> RL_CloseWindow() > RL_CloseWindow()
Close window and unload OpenGL context and free all resources Close window and unload OpenGL context and free all resources
@@ -3177,6 +3359,28 @@ Set gui custom font ( Global state )
--- ---
## Gui - Style
---
> success = RL_GuiSetStyle( int control, int property, int value )
Set one style property
- Failure return false
- Success return true
---
> value = RL_GuiGetStyle( int control, int property )
Get one style property
- Failure return false
- Success return int
---
## Gui - Container ## Gui - Container
--- ---
@@ -3190,7 +3394,25 @@ Window Box control, shows a window that can be closed
--- ---
> success = RL_GuiPanel( Rectangle bounds ) > success = RL_GuiGroupBox( Rectangle bounds, string text )
Group Box control with text name
- Failure return false
- Success return true
---
> success = RL_GuiLine( Rectangle bounds, string text )
Line separator control, could contain text
- Failure return false
- Success return true
---
> success = RL_GuiPanel( Rectangle bounds, string text )
Panel control, useful to group controls Panel control, useful to group controls
@@ -3199,7 +3421,7 @@ Panel control, useful to group controls
--- ---
> view, scroll = RL_GuiScrollPanel( Rectangle bounds, Rectangle content, Vector2 scroll ) > view, scroll = RL_GuiScrollPanel( Rectangle bounds, string text, Rectangle content, Vector2 scroll )
Scroll Panel control Scroll Panel control
@@ -3239,6 +3461,15 @@ Toggle Button control, returns true when active
--- ---
> index = RL_GuiToggleGroup( Rectangle bounds, string text, int active )
Toggle Group control, returns active toggle index
- Failure return false
- Success return int
---
> active = RL_GuiCheckBox( Rectangle bounds, string text, bool checked ) > active = RL_GuiCheckBox( Rectangle bounds, string text, bool checked )
Check Box control, returns true when active Check Box control, returns true when active

View File

@@ -1,3 +1,6 @@
Current {
}
Backlog { Backlog {
* More and better examples * More and better examples

View File

@@ -11,6 +11,7 @@ local sliderValueRange = { 0.0, 10.0 }
local scrollbarValue = 0.0 local scrollbarValue = 0.0
local dropdownValue = 0 local dropdownValue = 0
local dropdownActive = false local dropdownActive = false
local index = 0
function init() function init()
local monitor = 0 local monitor = 0
@@ -38,9 +39,10 @@ function draw()
windowOpen = false windowOpen = false
end end
RL_GuiPanel( { 60, 260, 100, 100 } ) RL_GuiPanel( { 60, 260, 100, 100 }, "Panel" )
toggled = RL_GuiToggle( { 200, 260, 64, 32 }, "Toggle", toggled ) toggled = RL_GuiToggle( { 200, 260, 64, 32 }, "Toggle", toggled )
index = RL_GuiToggleGroup( { 520, 30, 64, 32 }, "Cat\nDog\nMonkey", index )
checkbox = RL_GuiCheckBox( { 200, 300, 16, 16 }, "CheckBox", checkbox ) checkbox = RL_GuiCheckBox( { 200, 300, 16, 16 }, "CheckBox", checkbox )
local textBoxToggle = false local textBoxToggle = false

View File

@@ -16,6 +16,7 @@ int lcoreClearWindowState( lua_State *L );
int lcoreIsWindowResized( lua_State *L ); int lcoreIsWindowResized( lua_State *L );
int lcoreSetWindowIcon( lua_State *L ); int lcoreSetWindowIcon( lua_State *L );
int lcoreSetWindowTitle( lua_State *L ); int lcoreSetWindowTitle( lua_State *L );
int lcoreGetMonitorCount( lua_State *L );
int lcoreCloseWindow( lua_State *L ); int lcoreCloseWindow( lua_State *L );
/* Timing. */ /* Timing. */
int lcoreSetTargetFPS( lua_State *L ); int lcoreSetTargetFPS( lua_State *L );

View File

@@ -1,5 +1,5 @@
/* /*
** $Id: lua.h,v 1.332.1.2 2018/06/13 16:58:17 roberto Exp $ ** $Id: lua.h $
** Lua - A Scripting Language ** Lua - A Scripting Language
** Lua.org, PUC-Rio, Brazil (http://www.lua.org) ** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
** See Copyright Notice at the end of this file ** See Copyright Notice at the end of this file
@@ -17,13 +17,15 @@
#define LUA_VERSION_MAJOR "5" #define LUA_VERSION_MAJOR "5"
#define LUA_VERSION_MINOR "3" #define LUA_VERSION_MINOR "4"
#define LUA_VERSION_NUM 503 #define LUA_VERSION_RELEASE "4"
#define LUA_VERSION_RELEASE "5"
#define LUA_VERSION_NUM 504
#define LUA_VERSION_RELEASE_NUM (LUA_VERSION_NUM * 100 + 4)
#define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR #define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR
#define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE #define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE
#define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2018 Lua.org, PUC-Rio" #define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2022 Lua.org, PUC-Rio"
#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo, W. Celes" #define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo, W. Celes"
@@ -49,8 +51,7 @@
#define LUA_ERRRUN 2 #define LUA_ERRRUN 2
#define LUA_ERRSYNTAX 3 #define LUA_ERRSYNTAX 3
#define LUA_ERRMEM 4 #define LUA_ERRMEM 4
#define LUA_ERRGCMM 5 #define LUA_ERRERR 5
#define LUA_ERRERR 6
typedef struct lua_State lua_State; typedef struct lua_State lua_State;
@@ -71,7 +72,7 @@ typedef struct lua_State lua_State;
#define LUA_TUSERDATA 7 #define LUA_TUSERDATA 7
#define LUA_TTHREAD 8 #define LUA_TTHREAD 8
#define LUA_NUMTAGS 9 #define LUA_NUMTYPES 9
@@ -124,6 +125,13 @@ typedef int (*lua_Writer) (lua_State *L, const void *p, size_t sz, void *ud);
typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize); typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize);
/*
** Type for warning functions
*/
typedef void (*lua_WarnFunction) (void *ud, const char *msg, int tocont);
/* /*
** generic extra include file ** generic extra include file
@@ -145,11 +153,12 @@ extern const char lua_ident[];
LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud); LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud);
LUA_API void (lua_close) (lua_State *L); LUA_API void (lua_close) (lua_State *L);
LUA_API lua_State *(lua_newthread) (lua_State *L); LUA_API lua_State *(lua_newthread) (lua_State *L);
LUA_API int (lua_resetthread) (lua_State *L);
LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf); LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf);
LUA_API const lua_Number *(lua_version) (lua_State *L); LUA_API lua_Number (lua_version) (lua_State *L);
/* /*
@@ -182,7 +191,7 @@ LUA_API lua_Number (lua_tonumberx) (lua_State *L, int idx, int *isnum);
LUA_API lua_Integer (lua_tointegerx) (lua_State *L, int idx, int *isnum); LUA_API lua_Integer (lua_tointegerx) (lua_State *L, int idx, int *isnum);
LUA_API int (lua_toboolean) (lua_State *L, int idx); LUA_API int (lua_toboolean) (lua_State *L, int idx);
LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len); LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len);
LUA_API size_t (lua_rawlen) (lua_State *L, int idx); LUA_API lua_Unsigned (lua_rawlen) (lua_State *L, int idx);
LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx); LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx);
LUA_API void *(lua_touserdata) (lua_State *L, int idx); LUA_API void *(lua_touserdata) (lua_State *L, int idx);
LUA_API lua_State *(lua_tothread) (lua_State *L, int idx); LUA_API lua_State *(lua_tothread) (lua_State *L, int idx);
@@ -247,9 +256,9 @@ LUA_API int (lua_rawgeti) (lua_State *L, int idx, lua_Integer n);
LUA_API int (lua_rawgetp) (lua_State *L, int idx, const void *p); LUA_API int (lua_rawgetp) (lua_State *L, int idx, const void *p);
LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec); LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec);
LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz); LUA_API void *(lua_newuserdatauv) (lua_State *L, size_t sz, int nuvalue);
LUA_API int (lua_getmetatable) (lua_State *L, int objindex); LUA_API int (lua_getmetatable) (lua_State *L, int objindex);
LUA_API int (lua_getuservalue) (lua_State *L, int idx); LUA_API int (lua_getiuservalue) (lua_State *L, int idx, int n);
/* /*
@@ -263,7 +272,7 @@ LUA_API void (lua_rawset) (lua_State *L, int idx);
LUA_API void (lua_rawseti) (lua_State *L, int idx, lua_Integer n); LUA_API void (lua_rawseti) (lua_State *L, int idx, lua_Integer n);
LUA_API void (lua_rawsetp) (lua_State *L, int idx, const void *p); LUA_API void (lua_rawsetp) (lua_State *L, int idx, const void *p);
LUA_API int (lua_setmetatable) (lua_State *L, int objindex); LUA_API int (lua_setmetatable) (lua_State *L, int objindex);
LUA_API void (lua_setuservalue) (lua_State *L, int idx); LUA_API int (lua_setiuservalue) (lua_State *L, int idx, int n);
/* /*
@@ -288,13 +297,21 @@ LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data, int strip);
*/ */
LUA_API int (lua_yieldk) (lua_State *L, int nresults, lua_KContext ctx, LUA_API int (lua_yieldk) (lua_State *L, int nresults, lua_KContext ctx,
lua_KFunction k); lua_KFunction k);
LUA_API int (lua_resume) (lua_State *L, lua_State *from, int narg); LUA_API int (lua_resume) (lua_State *L, lua_State *from, int narg,
int *nres);
LUA_API int (lua_status) (lua_State *L); LUA_API int (lua_status) (lua_State *L);
LUA_API int (lua_isyieldable) (lua_State *L); LUA_API int (lua_isyieldable) (lua_State *L);
#define lua_yield(L,n) lua_yieldk(L, (n), 0, NULL) #define lua_yield(L,n) lua_yieldk(L, (n), 0, NULL)
/*
** Warning-related functions
*/
LUA_API void (lua_setwarnf) (lua_State *L, lua_WarnFunction f, void *ud);
LUA_API void (lua_warning) (lua_State *L, const char *msg, int tocont);
/* /*
** garbage-collection function and options ** garbage-collection function and options
*/ */
@@ -308,8 +325,10 @@ LUA_API int (lua_isyieldable) (lua_State *L);
#define LUA_GCSETPAUSE 6 #define LUA_GCSETPAUSE 6
#define LUA_GCSETSTEPMUL 7 #define LUA_GCSETSTEPMUL 7
#define LUA_GCISRUNNING 9 #define LUA_GCISRUNNING 9
#define LUA_GCGEN 10
#define LUA_GCINC 11
LUA_API int (lua_gc) (lua_State *L, int what, int data); LUA_API int (lua_gc) (lua_State *L, int what, ...);
/* /*
@@ -328,6 +347,8 @@ LUA_API size_t (lua_stringtonumber) (lua_State *L, const char *s);
LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud); LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud);
LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud); LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud);
LUA_API void (lua_toclose) (lua_State *L, int idx);
LUA_API void (lua_closeslot) (lua_State *L, int idx);
/* /*
@@ -377,7 +398,7 @@ LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud);
/* /*
** {============================================================== ** {==============================================================
** compatibility macros for unsigned conversions ** compatibility macros
** =============================================================== ** ===============================================================
*/ */
#if defined(LUA_COMPAT_APIINTCASTS) #if defined(LUA_COMPAT_APIINTCASTS)
@@ -387,6 +408,13 @@ LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud);
#define lua_tounsigned(L,i) lua_tounsignedx(L,(i),NULL) #define lua_tounsigned(L,i) lua_tounsignedx(L,(i),NULL)
#endif #endif
#define lua_newuserdata(L,s) lua_newuserdatauv(L,s,1)
#define lua_getuservalue(L,idx) lua_getiuservalue(L,idx,1)
#define lua_setuservalue(L,idx) lua_setiuservalue(L,idx,1)
#define LUA_NUMTAGS LUA_NUMTYPES
/* }============================================================== */ /* }============================================================== */
/* /*
@@ -437,6 +465,7 @@ LUA_API lua_Hook (lua_gethook) (lua_State *L);
LUA_API int (lua_gethookmask) (lua_State *L); LUA_API int (lua_gethookmask) (lua_State *L);
LUA_API int (lua_gethookcount) (lua_State *L); LUA_API int (lua_gethookcount) (lua_State *L);
LUA_API int (lua_setcstacklimit) (lua_State *L, unsigned int limit);
struct lua_Debug { struct lua_Debug {
int event; int event;
@@ -444,6 +473,7 @@ struct lua_Debug {
const char *namewhat; /* (n) 'global', 'local', 'field', 'method' */ const char *namewhat; /* (n) 'global', 'local', 'field', 'method' */
const char *what; /* (S) 'Lua', 'C', 'main', 'tail' */ const char *what; /* (S) 'Lua', 'C', 'main', 'tail' */
const char *source; /* (S) */ const char *source; /* (S) */
size_t srclen; /* (S) */
int currentline; /* (l) */ int currentline; /* (l) */
int linedefined; /* (S) */ int linedefined; /* (S) */
int lastlinedefined; /* (S) */ int lastlinedefined; /* (S) */
@@ -451,6 +481,8 @@ struct lua_Debug {
unsigned char nparams;/* (u) number of parameters */ unsigned char nparams;/* (u) number of parameters */
char isvararg; /* (u) */ char isvararg; /* (u) */
char istailcall; /* (t) */ char istailcall; /* (t) */
unsigned short ftransfer; /* (r) index of first value transferred */
unsigned short ntransfer; /* (r) number of transferred values */
char short_src[LUA_IDSIZE]; /* (S) */ char short_src[LUA_IDSIZE]; /* (S) */
/* private part */ /* private part */
struct CallInfo *i_ci; /* active function */ struct CallInfo *i_ci; /* active function */
@@ -460,7 +492,7 @@ struct lua_Debug {
/****************************************************************************** /******************************************************************************
* Copyright (C) 1994-2018 Lua.org, PUC-Rio. * Copyright (C) 1994-2022 Lua.org, PUC-Rio.
* *
* Permission is hereby granted, free of charge, to any person obtaining * Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the * a copy of this software and associated documentation files (the

File diff suppressed because it is too large Load Diff

View File

@@ -7,14 +7,20 @@ int lguiGuiLock( lua_State *L );
int lguiGuiUnlock( lua_State *L ); int lguiGuiUnlock( lua_State *L );
/* Font. */ /* Font. */
int lguiGuiSetFont( lua_State *L ); int lguiGuiSetFont( lua_State *L );
/* Style */
int lguiGuiSetStyle( lua_State *L );
int lguiGuiGetStyle( lua_State *L );
/* Container. */ /* Container. */
int lguiGuiWindowBox( lua_State *L ); int lguiGuiWindowBox( lua_State *L );
int lguiGuiGroupBox( lua_State *L );
int lguiGuiLine( lua_State *L );
int lguiGuiPanel( lua_State *L ); int lguiGuiPanel( lua_State *L );
int lguiGuiScrollPanel( lua_State *L ); int lguiGuiScrollPanel( lua_State *L );
/* Basic. */ /* Basic. */
int lguiGuiLabel( lua_State *L ); int lguiGuiLabel( lua_State *L );
int lguiGuiButton( lua_State *L ); int lguiGuiButton( lua_State *L );
int lguiGuiToggle( lua_State *L ); int lguiGuiToggle( lua_State *L );
int lguiGuiToggleGroup( lua_State *L );
int lguiGuiCheckBox( lua_State *L ); int lguiGuiCheckBox( lua_State *L );
int lguiGuiTextBox( lua_State *L ); int lguiGuiTextBox( lua_State *L );
int lguiGuiTextBoxMulti( lua_State *L ); int lguiGuiTextBoxMulti( lua_State *L );

View File

@@ -301,6 +301,18 @@ int lcoreSetWindowTitle( lua_State *L ) {
return 1; return 1;
} }
/*
> count = RL_GetMonitorCount()
Get number of connected monitors
- Success return int
*/
int lcoreGetMonitorCount( lua_State *L ) {
lua_pushinteger( L, GetMonitorCount() );
return 1;
}
/* /*
> RL_CloseWindow() > RL_CloseWindow()

View File

@@ -9,6 +9,7 @@
#include "audio.h" #include "audio.h"
#include "rmath.h" #include "rmath.h"
#include "rgui.h" #include "rgui.h"
#include "raygui.h"
static void assignGlobalInt( int value, const char *name ) { static void assignGlobalInt( int value, const char *name ) {
lua_State *L = state->luaState; lua_State *L = state->luaState;
@@ -201,6 +202,93 @@ void defineGlobals() {
assignGlobalColor( BLUE, "BLUE" ); assignGlobalColor( BLUE, "BLUE" );
/* Math */ /* Math */
assignGlobalFloat( PI, "PI" ); assignGlobalFloat( PI, "PI" );
/* GuiControlState */
assignGlobalInt( GUI_STATE_NORMAL, "GUI_STATE_NORMAL" );
assignGlobalInt( GUI_STATE_FOCUSED, "GUI_STATE_FOCUSED" );
assignGlobalInt( GUI_STATE_PRESSED, "GUI_STATE_PRESSED" );
assignGlobalInt( GUI_STATE_DISABLED, "GUI_STATE_DISABLED" );
/* GuiTextAlignment */
assignGlobalInt( GUI_TEXT_ALIGN_LEFT, "GUI_TEXT_ALIGN_LEFT" );
assignGlobalInt( GUI_TEXT_ALIGN_CENTER, "GUI_TEXT_ALIGN_CENTER" );
assignGlobalInt( GUI_TEXT_ALIGN_RIGHT, "GUI_TEXT_ALIGN_RIGHT" );
/* GuiControls */
assignGlobalInt( DEFAULT, "DEFAULT" );
assignGlobalInt( LABEL, "LABEL" );
assignGlobalInt( BUTTON, "BUTTON" );
assignGlobalInt( TOGGLE, "TOGGLE" );
assignGlobalInt( SLIDER, "SLIDER" );
assignGlobalInt( PROGRESSBAR, "PROGRESSBAR" );
assignGlobalInt( CHECKBOX, "CHECKBOX" );
assignGlobalInt( COMBOBOX, "COMBOBOX" );
assignGlobalInt( DROPDOWNBOX, "DROPDOWNBOX" );
assignGlobalInt( TEXTBOX, "TEXTBOX" );
assignGlobalInt( VALUEBOX, "VALUEBOX" );
assignGlobalInt( SPINNER, "SPINNER" );
assignGlobalInt( LISTVIEW, "LISTVIEW" );
assignGlobalInt( COLORPICKER, "COLORPICKER" );
assignGlobalInt( SCROLLBAR, "SCROLLBAR" );
assignGlobalInt( STATUSBAR, "STATUSBAR" );
/* GuiControlProperty */
assignGlobalInt( BORDER_COLOR_NORMAL, "BORDER_COLOR_NORMAL" );
assignGlobalInt( BASE_COLOR_NORMAL, "BASE_COLOR_NORMAL" );
assignGlobalInt( TEXT_COLOR_NORMAL, "TEXT_COLOR_NORMAL" );
assignGlobalInt( BORDER_COLOR_FOCUSED, "BORDER_COLOR_FOCUSED" );
assignGlobalInt( BASE_COLOR_FOCUSED, "BASE_COLOR_FOCUSED" );
assignGlobalInt( TEXT_COLOR_FOCUSED, "TEXT_COLOR_FOCUSED" );
assignGlobalInt( BORDER_COLOR_PRESSED, "BORDER_COLOR_PRESSED" );
assignGlobalInt( BASE_COLOR_PRESSED, "BASE_COLOR_PRESSED" );
assignGlobalInt( TEXT_COLOR_PRESSED, "TEXT_COLOR_PRESSED" );
assignGlobalInt( BORDER_COLOR_DISABLED, "BORDER_COLOR_DISABLED" );
assignGlobalInt( BASE_COLOR_DISABLED, "BASE_COLOR_DISABLED" );
assignGlobalInt( TEXT_COLOR_DISABLED, "TEXT_COLOR_DISABLED" );
assignGlobalInt( BORDER_WIDTH, "BORDER_WIDTH" );
assignGlobalInt( TEXT_PADDING, "TEXT_PADDING" );
assignGlobalInt( TEXT_ALIGNMENT, "TEXT_ALIGNMENT" );
assignGlobalInt( RESERVED, "RESERVED" );
/* GuiDefaultProperty */
assignGlobalInt( TEXT_SIZE, "TEXT_SIZE" );
assignGlobalInt( TEXT_SPACING, "TEXT_SPACING" );
assignGlobalInt( LINE_COLOR, "LINE_COLOR" );
assignGlobalInt( BACKGROUND_COLOR, "BACKGROUND_COLOR" );
/* GuiToggleProperty */
assignGlobalInt( GROUP_PADDING, "GROUP_PADDING" );
/* GuiSliderProperty */
assignGlobalInt( SLIDER_WIDTH, "SLIDER_WIDTH" );
assignGlobalInt( SLIDER_PADDING, "SLIDER_PADDING" );
/* GuiProgressBarProperty */
assignGlobalInt( PROGRESS_PADDING, "PROGRESS_PADDING" );
/* GuiCheckBoxProperty */
assignGlobalInt( CHECK_PADDING, "CHECK_PADDING" );
/* GuiComboBoxProperty */
assignGlobalInt( COMBO_BUTTON_WIDTH, "COMBO_BUTTON_WIDTH" );
assignGlobalInt( COMBO_BUTTON_SPACING, "COMBO_BUTTON_SPACING" );
/* GuiDropdownBoxProperty */
assignGlobalInt( ARROW_PADDING, "ARROW_PADDING" );
assignGlobalInt( DROPDOWN_ITEMS_SPACING, "DROPDOWN_ITEMS_SPACING" );
/* GuiTextBoxProperty */
assignGlobalInt( TEXT_INNER_PADDING, "TEXT_INNER_PADDING" );
assignGlobalInt( TEXT_LINES_SPACING, "TEXT_LINES_SPACING" );
/* GuiSpinnerProperty */
assignGlobalInt( SPIN_BUTTON_WIDTH, "SPIN_BUTTON_WIDTH" );
assignGlobalInt( SPIN_BUTTON_SPACING, "SPIN_BUTTON_SPACING" );
/* GuiScrollBarProperty */
assignGlobalInt( ARROWS_SIZE, "ARROWS_SIZE" );
assignGlobalInt( ARROWS_VISIBLE, "ARROWS_VISIBLE" );
assignGlobalInt( SCROLL_SLIDER_PADDING, "SCROLL_SLIDER_PADDING" );
assignGlobalInt( SCROLL_SLIDER_SIZE, "SCROLL_SLIDER_SIZE" );
assignGlobalInt( SCROLL_PADDING, "SCROLL_PADDING" );
assignGlobalInt( SCROLL_SPEED, "SCROLL_SPEED" );
/* GuiListViewProperty */
assignGlobalInt( LIST_ITEMS_HEIGHT, "LIST_ITEMS_HEIGHT" );
assignGlobalInt( LIST_ITEMS_SPACING, "LIST_ITEMS_SPACING" );
assignGlobalInt( SCROLLBAR_WIDTH, "SCROLLBAR_WIDTH" );
assignGlobalInt( SCROLLBAR_SIDE, "SCROLLBAR_SIDE" );
/* GuiColorPickerProperty */
assignGlobalInt( COLOR_SELECTOR_SIZE, "COLOR_SELECTOR_SIZE" );
assignGlobalInt( HUEBAR_WIDTH, "HUEBAR_WIDTH" );
assignGlobalInt( HUEBAR_PADDING, "HUEBAR_PADDING" );
assignGlobalInt( HUEBAR_SELECTOR_HEIGHT, "HUEBAR_SELECTOR_HEIGHT" );
assignGlobalInt( HUEBAR_SELECTOR_OVERFLOW, "HUEBAR_SELECTOR_OVERFLOW" );
/*DOC_END*/ /*DOC_END*/
} }
@@ -397,6 +485,7 @@ void luaRegister() {
lua_register( L, "RL_IsWindowResized", lcoreIsWindowResized ); lua_register( L, "RL_IsWindowResized", lcoreIsWindowResized );
lua_register( L, "RL_SetWindowIcon", lcoreSetWindowIcon ); lua_register( L, "RL_SetWindowIcon", lcoreSetWindowIcon );
lua_register( L, "RL_SetWindowTitle", lcoreSetWindowTitle ); lua_register( L, "RL_SetWindowTitle", lcoreSetWindowTitle );
lua_register( L, "RL_GetMonitorCount", lcoreGetMonitorCount );
lua_register( L, "RL_CloseWindow", lcoreCloseWindow ); lua_register( L, "RL_CloseWindow", lcoreCloseWindow );
/* Timing. */ /* Timing. */
lua_register( L, "RL_SetTargetFPS", lcoreSetTargetFPS ); lua_register( L, "RL_SetTargetFPS", lcoreSetTargetFPS );
@@ -719,14 +808,20 @@ void luaRegister() {
lua_register( L, "RL_GuiUnlock", lguiGuiUnlock ); lua_register( L, "RL_GuiUnlock", lguiGuiUnlock );
/* Font. */ /* Font. */
lua_register( L, "RL_GuiSetFont", lguiGuiSetFont ); lua_register( L, "RL_GuiSetFont", lguiGuiSetFont );
/* Style. */
lua_register( L, "RL_GuiSetStyle", lguiGuiSetStyle );
lua_register( L, "RL_GuiGetStyle", lguiGuiGetStyle );
/* Container. */ /* Container. */
lua_register( L, "RL_GuiWindowBox", lguiGuiWindowBox ); lua_register( L, "RL_GuiWindowBox", lguiGuiWindowBox );
lua_register( L, "RL_GuiGroupBox", lguiGuiGroupBox );
lua_register( L, "RL_GuiLine", lguiGuiLine );
lua_register( L, "RL_GuiPanel", lguiGuiPanel ); lua_register( L, "RL_GuiPanel", lguiGuiPanel );
lua_register( L, "RL_GuiScrollPanel", lguiGuiScrollPanel ); lua_register( L, "RL_GuiScrollPanel", lguiGuiScrollPanel );
/* Basic. */ /* Basic. */
lua_register( L, "RL_GuiLabel", lguiGuiLabel ); lua_register( L, "RL_GuiLabel", lguiGuiLabel );
lua_register( L, "RL_GuiButton", lguiGuiButton ); lua_register( L, "RL_GuiButton", lguiGuiButton );
lua_register( L, "RL_GuiToggle", lguiGuiToggle ); lua_register( L, "RL_GuiToggle", lguiGuiToggle );
lua_register( L, "RL_GuiToggleGroup", lguiGuiToggleGroup );
lua_register( L, "RL_GuiCheckBox", lguiGuiCheckBox ); lua_register( L, "RL_GuiCheckBox", lguiGuiCheckBox );
lua_register( L, "RL_GuiTextBox", lguiGuiTextBox ); lua_register( L, "RL_GuiTextBox", lguiGuiTextBox );
lua_register( L, "RL_GuiTextBoxMulti", lguiGuiTextBoxMulti ); lua_register( L, "RL_GuiTextBoxMulti", lguiGuiTextBoxMulti );

View File

@@ -78,6 +78,49 @@ int lguiGuiSetFont( lua_State *L ) {
return 1; return 1;
} }
/*
## Gui - Style
*/
/*
> success = RL_GuiSetStyle( int control, int property, int value )
Set one style property
- Failure return false
- Success return true
*/
int lguiGuiSetStyle( lua_State *L ) {
if ( !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiSetStyle( int control, int property, int value )" );
lua_pushboolean( L, false );
return 1;
}
GuiSetStyle( lua_tointeger( L, -3 ), lua_tointeger( L, -2 ), lua_tointeger( L, -1 ) );
lua_pushboolean( L, true );
return 1;
}
/*
> value = RL_GuiGetStyle( int control, int property )
Get one style property
- Failure return false
- Success return int
*/
int lguiGuiGetStyle( lua_State *L ) {
if ( !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiGetStyle( int control, int property )" );
lua_pushboolean( L, false );
return 1;
}
lua_pushinteger( L, GuiGetStyle( lua_tointeger( L, -2 ), lua_tointeger( L, -1 ) ) );
return 1;
}
/* /*
## Gui - Container ## Gui - Container
*/ */
@@ -107,7 +150,57 @@ int lguiGuiWindowBox( lua_State *L ) {
} }
/* /*
> success = RL_GuiPanel( Rectangle bounds ) > success = RL_GuiGroupBox( Rectangle bounds, string text )
Group Box control with text name
- Failure return false
- Success return true
*/
int lguiGuiGroupBox( lua_State *L ) {
if ( !lua_istable( L, -2 ) || !lua_isstring( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiGroupBox( Rectangle bounds, string text )" );
lua_pushboolean( L, false );
return 1;
}
char text[ STRING_LEN ] = { '\0' };
strcpy( text, lua_tostring( L, -1 ) );
lua_pop( L, 1 );
Rectangle rect = uluaGetRectangle( L );
GuiGroupBox( rect, text );
lua_pushboolean( L, true );
return 1;
}
/*
> success = RL_GuiLine( Rectangle bounds, string text )
Line separator control, could contain text
- Failure return false
- Success return true
*/
int lguiGuiLine( lua_State *L ) {
if ( !lua_istable( L, -2 ) || !lua_isstring( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiLine( Rectangle bounds, string text )" );
lua_pushboolean( L, false );
return 1;
}
char text[ STRING_LEN ] = { '\0' };
strcpy( text, lua_tostring( L, -1 ) );
lua_pop( L, 1 );
Rectangle rect = uluaGetRectangle( L );
GuiLine( rect, text );
lua_pushboolean( L, true );
return 1;
}
/*
> success = RL_GuiPanel( Rectangle bounds, string text )
Panel control, useful to group controls Panel control, useful to group controls
@@ -115,21 +208,24 @@ Panel control, useful to group controls
- Success return true - Success return true
*/ */
int lguiGuiPanel( lua_State *L ) { int lguiGuiPanel( lua_State *L ) {
if ( !lua_istable( L, -1 ) ) { if ( !lua_istable( L, -2 ) || !lua_isstring( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiPanel( Rectangle bounds )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiPanel( Rectangle bounds, string text )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
char text[ STRING_LEN ] = { '\0' };
strcpy( text, lua_tostring( L, -1 ) );
lua_pop( L, 1 );
Rectangle rect = uluaGetRectangle( L ); Rectangle rect = uluaGetRectangle( L );
GuiPanel( rect ); GuiPanel( rect, text );
lua_pushboolean( L, true ); lua_pushboolean( L, true );
return 1; return 1;
} }
/* /*
> view, scroll = RL_GuiScrollPanel( Rectangle bounds, Rectangle content, Vector2 scroll ) > view, scroll = RL_GuiScrollPanel( Rectangle bounds, string text, Rectangle content, Vector2 scroll )
Scroll Panel control Scroll Panel control
@@ -137,8 +233,8 @@ Scroll Panel control
- Success return Rectangle, Vector2 - Success return Rectangle, Vector2
*/ */
int lguiGuiScrollPanel( lua_State *L ) { int lguiGuiScrollPanel( lua_State *L ) {
if ( !lua_istable( L, -3 ) || !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_istable( L, -4 ) || !lua_isstring( L, -3 ) || lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiScrollPanel( Rectangle bounds, Rectangle content, Vector2 scroll )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiScrollPanel( Rectangle bounds, string text, Rectangle content, Vector2 scroll )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -146,9 +242,12 @@ int lguiGuiScrollPanel( lua_State *L ) {
lua_pop( L, 1 ); lua_pop( L, 1 );
Rectangle content = uluaGetRectangle( L ); Rectangle content = uluaGetRectangle( L );
lua_pop( L, 1 ); lua_pop( L, 1 );
char text[ STRING_LEN ] = { '\0' };
strcpy( text, lua_tostring( L, -1 ) );
lua_pop( L, 1 );
Rectangle bounds = uluaGetRectangle( L ); Rectangle bounds = uluaGetRectangle( L );
uluaPushRectangle( L, GuiScrollPanel( bounds, content, &scroll ) ); uluaPushRectangle( L, GuiScrollPanel( bounds, text, content, &scroll ) );
uluaPushVector2( L, scroll ); uluaPushVector2( L, scroll );
return 2; return 2;
@@ -233,6 +332,32 @@ int lguiGuiToggle( lua_State *L ) {
return 1; return 1;
} }
/*
> index = RL_GuiToggleGroup( Rectangle bounds, string text, int active )
Toggle Group control, returns active toggle index
- Failure return false
- Success return int
*/
int lguiGuiToggleGroup( lua_State *L ) {
if ( !lua_istable( L, -3 ) || !lua_isstring( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiToggleGroup( Rectangle bounds, string text, bool active )" );
lua_pushboolean( L, false );
return 1;
}
int active = lua_tointeger( L, -1 );
lua_pop( L, 1 );
char text[ STRING_LEN ] = { '\0' };
strcpy( text, lua_tostring( L, -1 ) );
lua_pop( L, 1 );
Rectangle rect = uluaGetRectangle( L );
lua_pushinteger( L, GuiToggleGroup( rect, text, active ) );
return 1;
}
/* /*
> active = RL_GuiCheckBox( Rectangle bounds, string text, bool checked ) > active = RL_GuiCheckBox( Rectangle bounds, string text, bool checked )