#include #include #include"mino.h" #include"graph.h" #include"input.h" #define SDLBUT(x)SDL_BUTTON(SDL_BUTTON_##x) InputPoint input_point; InputButtons input_buttons; _ U32 map_mouse[][2]={ {SDLBUT(LEFT), IB_1}, {SDLBUT(RIGHT), IB_2}, {SDLBUT(MIDDLE),IB_3}, {SDLBUT(X1), IB_4}}; _ U32 map_keeb[][2]={ {SDL_SCANCODE_LEFT, IB_L}, {SDL_SCANCODE_RIGHT, IB_R}, {SDL_SCANCODE_UP, IB_U}, {SDL_SCANCODE_DOWN, IB_D}, {SDL_SCANCODE_SPACE, IB_S}, {SDL_SCANCODE_Z, IB_Z}, {SDL_SCANCODE_X, IB_X}, {SDL_SCANCODE_C, IB_C}}; #define ip input_point #define ib input_buttons #define mm map_mouse #define mk map_keeb V input_update(V){U32 mb,mm_len,mk_len,i,kb_len;IM U8*kb;InputButtons nb={0,0}; mb=SDL_GetMouseState((S32*)&ip.x,(S32*)&ip.y),ip.y=graph_win_h-ip.y, kb=SDL_GetKeyboardState((S32*)&kb_len), mm_len=(SZ mm)/(SZ mm[0]), mk_len=(SZ mk)/(SZ mk[0]), i=0;WH(i