1
0
Fork 0
forked from fte/fteqw
fteqw/quakec/csqctest/src/cs/menu.qc
Spoike d95a523f80 Just messing with stuff.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3794 fc73d0e0-1445-4013-8a0c-d673dee63da5
2011-05-20 04:10:59 +00:00

55 lines
1.1 KiB
C++

float inmenu;
enum {
ME_KEYDOWN,
ME_KEYUP,
ME_MOUSEMOVE,
ME_DRAW = 200
};
nonstatic void(void(float, float, float, float) fnc) Menu_Activate =
{
inmenu = TRUE;
MenuEventFunc = fnc;
};
noref vector mousepos; //z is not set
float (float event, float parama, float paramb) Menu_InputEvent =
{
if (!inmenu)
return false; //let the engine do what it wants.
if (event == INPUT_MOUSEMOVE)
{
mousepos_x += parama;
if (mousepos_x < 0)
mousepos_x = 0;
if (mousepos_x >= 640)
mousepos_x = 640;
mousepos_y += paramb;
if (mousepos_y < 0)
mousepos_y = 0;
if (mousepos_y >= 480)
mousepos_y = 480;
}
MenuEventFunc(event, parama, mousepos_x, mousepos_y);
return true;
};
nonstatic void() Menu_Think =
{
if (!inmenu)
return;
MenuEventFunc(ME_MOUSEMOVE, 0, mousepos_x, mousepos_y);
MenuEventFunc(ME_DRAW, 0, mousepos_x, mousepos_y);
};
//We don't have a main menu for the csqc yet, so just pop it instead, so submenus can close properly.
nonstatic void() Menu_Main =
{
inmenu = FALSE;
};