Allow widget select using player controls.
This commit is contained in:
parent
8ab5ebe819
commit
344460fdf5
|
@ -44,33 +44,38 @@ void initWidgets(void)
|
||||||
|
|
||||||
void doWidgets(void)
|
void doWidgets(void)
|
||||||
{
|
{
|
||||||
if (app.keyboard[SDL_SCANCODE_UP])
|
if (isControl(CONTROL_UP) || app.keyboard[SDL_SCANCODE_UP])
|
||||||
{
|
{
|
||||||
selectWidget(-1);
|
selectWidget(-1);
|
||||||
|
|
||||||
app.keyboard[SDL_SCANCODE_UP] = 0;
|
app.keyboard[SDL_SCANCODE_UP] = 0;
|
||||||
|
clearControl(CONTROL_UP);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (app.keyboard[SDL_SCANCODE_DOWN])
|
if (isControl(CONTROL_DOWN) || app.keyboard[SDL_SCANCODE_DOWN])
|
||||||
{
|
{
|
||||||
selectWidget(1);
|
selectWidget(1);
|
||||||
|
|
||||||
app.keyboard[SDL_SCANCODE_DOWN] = 0;
|
app.keyboard[SDL_SCANCODE_DOWN] = 0;
|
||||||
|
clearControl(CONTROL_DOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (app.keyboard[SDL_SCANCODE_LEFT])
|
if (isControl(CONTROL_LEFT) || app.keyboard[SDL_SCANCODE_LEFT])
|
||||||
{
|
{
|
||||||
updateWidgetValue(-1);
|
updateWidgetValue(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (app.keyboard[SDL_SCANCODE_RIGHT])
|
if (isControl(CONTROL_RIGHT) || app.keyboard[SDL_SCANCODE_RIGHT])
|
||||||
{
|
{
|
||||||
updateWidgetValue(1);
|
updateWidgetValue(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (app.keyboard[SDL_SCANCODE_RETURN])
|
if (isControl(CONTROL_FIRE) || app.keyboard[SDL_SCANCODE_RETURN])
|
||||||
{
|
{
|
||||||
selectedWidget->action();
|
selectedWidget->action();
|
||||||
|
|
||||||
|
app.keyboard[SDL_SCANCODE_RETURN] = 0;
|
||||||
|
clearControl(CONTROL_FIRE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,8 @@ extern void drawRect(int x, int y, int w, int h, int r, int g, int b, int a);
|
||||||
extern void drawOutlineRect(int x, int y, int w, int h, int r, int g, int b, int a);
|
extern void drawOutlineRect(int x, int y, int w, int h, int r, int g, int b, int a);
|
||||||
extern float limit(float i, float a, float b);
|
extern float limit(float i, float a, float b);
|
||||||
extern void playSound(int snd, int ch);
|
extern void playSound(int snd, int ch);
|
||||||
|
extern int isControl(int type);
|
||||||
|
extern void clearControl(int type);
|
||||||
|
|
||||||
extern App app;
|
extern App app;
|
||||||
extern Colors colors;
|
extern Colors colors;
|
||||||
|
|
Loading…
Reference in New Issue