-
-
Save marrub--/35ef6af49e6edf9e455a6024609025db to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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