32 #include "../cl_menu.h"
66 static void UI_Memory_f (
void)
69 const size_t nodeSize =
sizeof(
uiNode_t);
104 #define MAX_CONFUNC_SIZE 512
132 memset(memory, 0, size);
142 typedef std::vector<std::string> Names;
160 else if (
Q_streq(type,
"menu_model"))
162 else if (
Q_streq(type,
"sprite"))
171 else if (
Q_streq(type,
"component"))
173 else if (
Q_streq(type,
"menu_model"))
175 else if (
Q_streq(type,
"sprite"))
183 for (Names::iterator i = names.begin(); i != names.end(); ++
i) {
208 if (ui_global.
adata ==
nullptr)
215 for (
int nodeType = 0; nodeType < 2; ++nodeType) {
216 for (
int i = 0; i < ui_global.
numWindows; i++) {
233 if (node->
next !=
nullptr) {
259 ui_sysPool =
nullptr;
260 ui_dynStringPool =
nullptr;
261 ui_dynPool =
nullptr;
270 static bool initialized =
false;
280 cvar_t* ui_hunkSize =
Cvar_Get(
"ui_hunksize",
"3", 0,
"UI memory hunk size in megabytes");
283 ui_debug =
Cvar_Get(
"debug_ui",
"0",
CVAR_DEVELOPER,
"Prints node names for debugging purposes - valid values are 1 and 2");
292 Cmd_AddCommand(
"debug_uimemory", UI_Memory_f,
"Display info about UI memory allocation");
298 ui_dynStringPool =
Mem_CreatePool(
"Client: Dynamic string for UI");
void Cmd_vExecuteString(const char *fmt, va_list ap)
void UI_InitActions(void)
uiNode_t * windowStack[UI_MAX_WINDOWSTACK]
void Cmd_AddCommand(const char *cmdName, xcommand_t function, const char *desc)
Add a new command to the script interface.
void Cmd_RemoveCommand(const char *cmdName)
Removes a command from script interface.
QGL_EXTERN GLint GLenum type
bool UI_ParseAndLoadLuaScript(const char *name, const char **text)
Parses and loads a .ufo file holding a lua script.
Basic lua initialization for the ui.
bool UI_ParseComponent(const char *type, const char *name, const char **text)
Parse a component.
void UI_Shutdown(void)
Reset and free the UI data hunk.
This is a cvar definition. Cvars can be user modified and used in our menus e.g.
uiNode_t * components[UI_MAX_COMPONENTS]
uiBehaviour_t * behaviour
void UI_FinishInit(void)
Finish initialization after everything was loaded.
uiBehaviour_t * UI_GetNodeBehaviourByIndex(int index)
void Com_Printf(const char *const fmt,...)
void UI_FontShutdown(void)
void UI_InitLua(void)
Performs UI specific initialization. Call this after CL_InitLua.
int FS_BuildFileList(const char *fileList)
Build a filelist.
uint32_t _Mem_PoolSize(memPool_t *pool)
bool UI_ParseUIModel(const char *name, const char **text)
parses the models.ufo and all files where UI models (menu_model) are defined
Internal data use by the UI package.
static void UI_Restart_f(void)
Reloads the ui scripts and reinitializes the ui.
#define UI_MAX_WINDOWSTACK
uiNode_t * UI_PushWindow(const char *name, const char *parentName, linkedList_t *params)
Push a window onto the window stack.
void UI_InitData(void)
Initialize console command about UI shared data.
cvar_t * Cvar_Get(const char *var_name, const char *var_value, int flags, const char *desc)
Init or return a cvar.
bool Cmd_Exists(const char *cmdName)
Checks whether a function exists already.
bool UI_ParseWindow(const char *type, const char *name, const char **text)
Parse a window.
#define Mem_CreatePool(name)
void R_FontShutdown(void)
frees the SDL_ttf fonts
Atomic structure used to define most of the UI.
#define Mem_FreePool(pool)
uiNode_t * windows[UI_MAX_WINDOWS]
bool UI_ParseSprite(const char *name, const char **text)
void UI_ResetTimers(void)
#define Mem_PoolAllocTypeN(type, n, pool)
node behaviour, how a node work
char * FS_NextScriptHeader(const char *files, const char **name, const char **text)
uiBehaviour_t * UI_GetNodeBehaviour(const char *name)
Return a node behaviour by name.
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
memPool_t * ui_dynStringPool
void * UI_AllocHunkMemory(size_t size, int align, bool reset)
int UI_DebugMode(void)
Get the current debug mode (0 mean disabled)
void UI_InitWindows(void)
void UI_FinishWindowsInit(void)
Finish windows initialization.
Global data shared into all UI code.
Model that have more than one part (top and down part of an aircraft)
void UI_ShutdownLua(void)
Performs UI specific lua shutdown. Call this before CL_ShutdownLua.
int UI_GetNodeBehaviourCount(void)
bool UI_ParseFont(const char *name, const char **text)
Atomic element to store UI scripts The parser use this atom to translate script action into many tree...
void UI_ExecuteConfunc(const char *fmt,...)
Executes confunc - just to identify those confuncs in the code - in this frame.
void UI_InitFonts(void)
after a video restart we have to reinitialize the fonts