- Crec que estaba en lo de que els axis pogueren funcioanr com a botons de pad
This commit is contained in:
@@ -204,6 +204,9 @@ int main(int argc, char *argv[])
|
||||
if (e.type == SDL_CONTROLLERBUTTONUP) {
|
||||
gamepad::buttonUp(e.jbutton.which, e.jbutton.button);
|
||||
}
|
||||
if (e.type == SDL_CONTROLLERAXISMOTION) {
|
||||
//if (e.jaxis.value>16000) printf("%i\n", e.jaxis.value);
|
||||
}
|
||||
if (e.type == SDL_MOUSEBUTTONDOWN) result = ui::window::sendEvent(e.button.windowID, &e);
|
||||
if (e.type == SDL_MOUSEBUTTONUP) result = ui::window::sendEvent(e.button.windowID, &e);
|
||||
if (e.type == SDL_MOUSEMOTION) result = ui::window::sendEvent(e.motion.windowID, &e);
|
||||
|
||||
+6
-6
@@ -41,11 +41,11 @@ namespace ui
|
||||
void show()
|
||||
{
|
||||
ui::setoffset(0,0);
|
||||
int mx, my;
|
||||
int mx=-1, my=-1;
|
||||
Uint32 mb = SDL_GetMouseState(&mx, &my);
|
||||
mx=mx/CHR_W; my=my/CHR_H;
|
||||
int w;
|
||||
ui::printrect(0, 0, 320, 1, COLOR_BLACK);
|
||||
ui::printrect(0, 0, 320, 1, COLOR_DARK);
|
||||
int opt_pos=1;
|
||||
int index=0;
|
||||
for (auto &menu : menus)
|
||||
@@ -55,7 +55,7 @@ namespace ui
|
||||
if (my<1 && mx>=opt_pos && mx<opt_pos+text_size)
|
||||
{
|
||||
ui::printrect(opt_pos-1, 0, text_size, 1, COLOR_WHITE);
|
||||
text_color = COLOR_BLACK;
|
||||
text_color = COLOR_DARK;
|
||||
visible_menu = index;
|
||||
menu_x = opt_pos-1;
|
||||
}
|
||||
@@ -67,8 +67,8 @@ namespace ui
|
||||
{
|
||||
opt_pos=2;
|
||||
menu_t &m = menus[visible_menu];
|
||||
ui::printrect(menu_x, 1, 22, m.options.size()+2, COLOR_BLACK);
|
||||
ui::box(menu_x, 1, 22, m.options.size()+2, COLOR_WHITE);
|
||||
ui::printrect(menu_x, 1, 22, m.options.size()+2, COLOR_DARK);
|
||||
ui::box(menu_x, 1, 22, m.options.size()+2, COLOR_GRAY);
|
||||
for (auto &option : m.options)
|
||||
{
|
||||
if (option.type!=OPTION_TYPE_SEPARATOR)
|
||||
@@ -78,7 +78,7 @@ namespace ui
|
||||
if (my==opt_pos && mx>=menu_x && mx<menu_x+20)
|
||||
{
|
||||
ui::printrect(menu_x+1, opt_pos, 20, 1, COLOR_WHITE);
|
||||
text_color = COLOR_BLACK;
|
||||
text_color = COLOR_DARK;
|
||||
if (ui::getClicked())
|
||||
{
|
||||
if (option.callback) option.value = option.callback(option.value);
|
||||
|
||||
Reference in New Issue
Block a user