Skip to content

Instantly share code, notes, and snippets.

@marrub--

marrub--/asdfas.c Secret

Created Mar 16, 2017
Embed
What would you like to do?
// ZScript
override bool InputProcess(InputEvent e)
{
if (e.type == InputEvent.Type_Mouse)
return CallACS("P_CL_Mouse", consoleplayer, e.mousex, -e.mousey);
else if (e.type == InputEvent.Type_KeyDown)
return CallACS("P_CL_KeyPress", consoleplayer, e.keyscan, true);
else if (e.type == InputEvent.Type_KeyUp)
return CallACS("P_CL_KeyPress", consoleplayer, e.keyscan, false);
else
return false;
}
// C
void G_Mouse(gui_state_t *g, int relx, int rely)
{
g->cx += relx * 0.5;
g->cy += rely * 1.8;
g->cx = M_MinMax(g->cx, 0, g->w);
g->cy = M_MinMax(g->cy, 0, g->h);
}
script_extern bool P_CL_Mouse(int pid, int relx, int rely)
{
player_t *p = &Player[pid];
if (p->gui.focus)
{
G_Mouse(&p->gui, relx, rely);
return true;
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.