Skip to content

ESC key mapping and the Menu. #2937

Description

@imsys

I’d like to revisit this discussion.

I’m aware this was discussed and decided #1950 back in June 2022. (@blinry) While that solution made sense at the time, it’s starting to become a hindrance in some cases, especially outside of desktop environments.

The main problem today affects non-desktop platforms and controller-based usage.

Note: Edited a bit with AI for clarity, due to non-native English.


Problem: ESC mapped to console in non-desktop environments

Android

On Android, the system back button is mapped to ESC.
Currently, this opens the console, which is not appropriate for a player-focused environment.

This behavior is confusing and disruptive for users who are simply trying to play.

Relevant code:

TIC-80/src/system/sdl/main.c

Lines 1075 to 1077 in 9b79d49

#if defined(__TIC_ANDROID__)
if(keycode == SDLK_AC_BACK)
state[tic_key_escape] = down;

Possible approaches:

  • Change ESC behavior globaly to open the menu instead of the console
  • Decouple the Android back button (SDLK_AC_BACK) from ESC and map it directly to the menu. This probably has the least amount of side effects from future key-mapping changes.

Building without console/studio (BUILD_EDITORS=OFF) is not a complete solution, since Android can also be used as a desktop-like development environment. (casualty @sandio)


Linux handhelds (arm64) and controllers

On the many handheld Linux devices, the Select button (SDL_CONTROLLER_BUTTON_BACK) is mapped to ESC.

This leads to the same issue: pressing a controller button opens the console instead of a menu.

Relevant code:

TIC-80/src/system/sdl/main.c

Lines 1010 to 1017 in 9b79d49

// !TODO: We have to find a better way to handle gamepad MENU button
// atm we show game menu for only Pause Menu button on XBox one controller
// issue #1220
if(getButton(controller, SDL_CONTROLLER_BUTTON_BACK))
{
tic80_input* input = &platform.input;
input->keyboard.keys[0] = tic_key_escape;
}

This likely affects other devices as well (e.g. Steam Deck).

At minimum, mapping SDL_CONTROLLER_BUTTON_BACK to the menu instead of ESC would better match user expectations. Opening a console from a controller is unlikely wanted.


Desktop behavior

Before changing any code, it’s worth confirming whether ESC → console is still the desired default on desktop.

It’s also worth noting that this change has not yet been part of a stable release. The last stable build still used ESC → Menu.

Given that a new stable version could be approaching, this could be a good moment to reassess the default behavior before it becomes more widely established.

Original Inconsistent Function Key availability

Examining the previous behavior, the inconsistency is clear.

Example from the web version:
https://tic80.com/create

  • Starting at the console:

    • ESC → Console/Code
    • Function keys → Studio
  • After running project, it suddently changes to:

    • ESC → Menu
    • Function keys → Disabled

This inconsistency makes the workflow confusing.

The first simple fix, already adopted, is to keep the function keys unlocked. This solves half of the problem.


Core issue: ESC key - console vs menu

The remaining issue is the conflict between using ESC for the console versus the menu.

From a player perspective, ESC opening the menu is more intuitive:

  • It pauses the game
  • It provides access to settings
  • It now includes Surf (local files and remote)

From a developer perspective, ESC currently opens the console, which is useful for:

  • Running commands like load, save, import, export
  • Quick evaluation/debugging (eval, trace)

However, compared to the menu:

  • The console is a more specialized tool
  • Many development workflows don’t depend on opening it frequently during iteration
  • It does not overlap with studio access (which is already handled by function keys)

Possible approaches

  • Move console to another key (e.g. F1, F6, F10, F12)

    • F1 would require shifting existing bindings (breaks muscle memory)
    • F10/F12 are already used by Byte Battle (Feature: Byte Battle #2602), seems too far to the right from the other keys and out of place.
    • F6 (CRT toggle) is a reasonable candidate since that feature also exists in the menu, so this would be my suggestion
  • Make ESC open the menu by default

    • Better aligned with player expectations
  • Introduce configurable key mapping

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions