DrawLevelText(0, 0, 0, TEXT_BACKSPACE);
else if (key == KSYM_Return)
DrawLevelText(0, 0, 0, TEXT_NEWLINE);
+ else if (key == KSYM_Escape)
+ DrawLevelText(0, 0, 0, TEXT_END);
}
else if (button_status == MB_RELEASED)
{
- int i, id;
+ int i, id = GADGET_ID_NONE;
switch (key)
{
button = MB_RIGHTBUTTON;
break;
+ case KSYM_Escape:
+ if (edit_mode == ED_MODE_DRAWING)
+ {
+ game_status = MAINMENU;
+ DrawMainMenu();
+ }
+ else
+ {
+ DrawDrawingWindow();
+ edit_mode = ED_MODE_DRAWING;
+ }
+ break;
+
default:
- id = GADGET_ID_NONE;
break;
}
ClearEditorGadgetInfoText();
+ if (gi->event.type == GD_EVENT_INFO_LEAVING)
+ return;
+
/* misuse this function to delete brush cursor, if needed */
if (edit_mode == ED_MODE_DRAWING && draw_with_brush)
DeleteBrushFromCursor();
ClearEditorGadgetInfoText();
+ if (gi->event.type == GD_EVENT_INFO_LEAVING)
+ return;
+
/* make sure to stay inside drawing area boundaries */
sx = (sx < min_sx ? min_sx : sx > max_sx ? max_sx : sx);
sy = (sy < min_sy ? min_sy : sy > max_sy ? max_sy : sy);