diff options
author | kitty piapiac <kcp@bsd.computer> | 2023-04-18 18:29:03 -0700 |
---|---|---|
committer | kitty piapiac <kcp@bsd.computer> | 2023-04-18 18:29:03 -0700 |
commit | 599cde356b576759475d34dbfadb5548926c089d (patch) | |
tree | 0bb3459c0fe07cc421c4e0e93b197b9373f72487 /input.c | |
parent | f1d602f5dcf862907affd1479eb3b2d132d7d639 (diff) |
input init
Diffstat (limited to 'input.c')
-rw-r--r-- | input.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -0,0 +1,13 @@ +#include<SDL.h> +#include<cglm/cglm.h> +#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;} |