Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Controller system update #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions graphics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
struct SDL_Surface;
struct _TTF_Font;


namespace genv
{

Expand Down Expand Up @@ -79,7 +78,6 @@ class groutput : public canvas
public:
static groutput& instance();
virtual ~groutput();

void showmouse(bool toggle);
void movemouse(int x, int y);
bool open(unsigned width, unsigned height, bool fullscreen=false);
Expand Down Expand Up @@ -220,10 +218,19 @@ enum button_t {
btn_left = 1, btn_middle, btn_right, btn_wheelup, btn_wheeldown
};

enum controller_t{
jbutton_a=1, jbutton_b, jbutton_x, jbutton_y, jbutton_lb, jbutton_rb, jbutton_back, jbutton_start, jbutton_left_click, jbutton_right_click
};

enum hat_t{
hat_up=1,hat_right,hat_rup,hat_down,hat_rdown=6,hat_left=8,hat_lup,hat_ldown=12
};

enum event_type {
ev_key = 1, ev_mouse, ev_timer
ev_key = 1, ev_mouse, ev_timer, controller
};


// Event descriptor
struct event
{
Expand All @@ -232,6 +239,10 @@ struct event
int button;
int time;
int type;
int joy_btn;
int move_rx, move_ry, move_lx, move_ly;
int trig_l, trig_r;
int hat;

};

Expand Down Expand Up @@ -261,4 +272,4 @@ inline grinput& operator >> (grinput& inp, event& ev)

}

#endif // GRAPHICS_HPP_INCLUDED
#endif