#include "quakedef.h"
-// here is the real ui drawing engine
+// here is the real ui drawing engine
/*
#define FRAME_THICKNESS 2
DrawQ_Fill(x + w, y, FRAME_THICKNESS, h, FRAME_COLOR1);
// area
DrawQ_Fill(x, y, w, h, FRAME_COLOR2);
-}
+}
static void UIG_DrawText(const char *text, float x, float y, float w, float h, float r, float g, float b, float a, float f)
{
if(w != 0 && h != 0)
DrawQ_SetClipArea(x, y, w, h);
DrawQ_String(x, y, text, 0, TEXT_FONTSIZE_X, TEXT_FONTSIZE_Y, r, g, b, a, f);
- if(w != 0 && h != 0)
+ if(w != 0 && h != 0)
DrawQ_ResetClipArea();
}
}
*/
-static mempool_t *ui_mem;
-
//#define UI_MEM_SIZE (1 << 10) << 9 // 512 KByte
#define UI_MEM_SIZE 1
void UI_Init(void)
{
- ui_mem = Mem_AllocPool("Intern UI Memory", 0, NULL);
}
-#define UI_Alloc(size) Mem_Alloc(ui_mem, size)
+#define UI_Alloc(size) Mem_Alloc(cl_mempool, size)
#define UI_Free(ptr) Mem_Free(ptr)
void UI_Event(ui_itemlist_t list, ui_message_t *in)
for(item = list->list; item != 0 && !processed; item = item->next)
{
unsigned int i;
-
+
processed = item->eventhandler(list, item, in, &out);
-
+
// process posted messages
for(i = 0; i < out.used; i++)
list->eventhandler(list, &out.queue[i]);
}
if(!processed)
- list->eventhandler(list, in);
+ list->eventhandler(list, in);
}
void UI_Draw(ui_itemlist_t list)
{
unsigned int depth = 0, nextdepth = ~0;
- while(depth != nextdepth)
+ while(depth != nextdepth)
{
for(item = list->list; item != 0; item = item->next)
{
ui_item_t UI_CloneItem(ui_item_t item)
{
ui_item_t clone;
- clone = UI_Alloc(item->size);
- clone = memcpy(clone, item, item->size);
+ clone = (ui_item_t)UI_Alloc(item->size);
+ memcpy(clone, item, item->size);
return clone;
}
// itemlist stuff
ui_itemlist_t UI_CreateItemList(void)
{
- return UI_Alloc(sizeof(ui_itemlist_t));
+ return (ui_itemlist_t)UI_Alloc(sizeof(ui_itemlist_t));
}
ui_itemlist_t UI_CloneItemList(ui_itemlist_t list)