static boolean bitmaps_initialized = FALSE;
boolean screen_initialized = FALSE;
static Bitmap *controller, *button, *axis_x, *axis_y;
- Bitmap *marker;
char *name;
boolean success = TRUE;
boolean done = FALSE, next = FALSE;
/* loop through all steps (buttons and axes), getting joystick events */
for (i = 0; i < SDL_arraysize(steps) && !done;)
{
+ Bitmap *marker = button; /* initialize with reliable default value */
+
step = &steps[i];
strcpy(step->mapping, mapping);
step->axis = -1;
if (event.key.keysym.sym == KSYM_BackSpace ||
event.key.keysym.sym == KSYM_Back)
{
- /* undo this step */
- if (i > 0)
+ if (i == 0)
{
- prev_step = &steps[--i];
- strcpy(mapping, prev_step->mapping);
- next = TRUE;
+ /* leave screen */
+ success = FALSE;
+ done = TRUE;
}
+ /* undo this step */
+ prev_step = &steps[i - 1];
+ strcpy(mapping, prev_step->mapping);
+ i--;
+ next = TRUE;
+
break;
}
if (event.key.keysym.sym == KSYM_Escape)
{
+ /* leave screen */
success = FALSE;
done = TRUE;
}