From 599cde356b576759475d34dbfadb5548926c089d Mon Sep 17 00:00:00 2001 From: kitty piapiac Date: Tue, 18 Apr 2023 18:29:03 -0700 Subject: input init --- input.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 input.c (limited to 'input.c') diff --git a/input.c b/input.c new file mode 100644 index 0000000..8248ded --- /dev/null +++ b/input.c @@ -0,0 +1,13 @@ +#include +#include +#include"mino.h" +#include"graph.h" +#include"input.h" +#define SDLBUT(x)SDL_BUTTON(SDL_BUTTON_##x) +InputPoint input_point(V){InputPoint ip;SDL_GetMouseState((S32*)&ip.x,(S32*)&ip.y);ip.y=graph_win_h-ip.y;R ip;} +InputButtons input_button(V){InputButtons ib={0};U32 mb;mb=SDL_GetMouseState(0,0); + Q(SDLBUT(LEFT)&mb, ib.f|=IB_1) + Q(SDLBUT(MIDDLE)&mb, ib.f|=IB_2) + Q(SDLBUT(RIGHT)&mb, ib.f|=IB_3) + Q(SDLBUT(X1)&mb, ib.f|=IB_4) + R ib;} -- cgit v1.2.3