documentation index ◦ reference manual ◦ function index

# layout.imagemap_yesno_prompt

Function: | layout.imagemap_yesno_prompt | (ground, idle, hover, hotspots, prompt_images={}):

This layout uses an imagemap to handle prompting the user with yes/no questions.

ground - The displayable used for disabled buttons, and areas that are not in a hotspot.

idle - The displayable used for unfocused hotspots.

hover - The displayable used for focused hotspots.

hotspots - A list of tuples defining the hotspots. Each tuple consists of

1. The x-coordinate of the left side.
2. The y-coordinate of the top side.
3. The x-coordinate of the right side.
4. The y-coordinate of the bottom side.
5. The button replaced by this hotspot (one of "Yes" or "No").

prompt_images - A map listing prompt images to be used instead of prompt text.

When a prompt is to be shown, it is first looked up in prompt_images. If a message image is found, then it is shown to the user. Otherwise, the default prompt (layout.ARE_YOU_SURE) is looked up, and if it is found, that image is shown to the user. Otherwise, the prompt is rendered as text.

Placement of a prompt image is controlled by style properties associated with the image. Placement of the prompt text can be controlled using style.yesno_prompt, with the style of the text proper being controlled by style.yesno_prompt_text.

Currently-used prompts are:

layout.ARE_YOU_SURE
  u"Are you sure?"
layout.DELETE_SAVE
  u"Are you sure you want to delete this save?"
layout.OVERWRITE_SAVE
  u"Are you sure you want to overwrite your save?"
layout.LOADING
  u"Loading will lose unsaved progress.\nAre you sure you want to do this?"
layout.QUIT
  u"Are you sure you want to quit?"
layout.MAIN_MENU
  u"Are you sure you want to return to the main menu?\nThis will lose unsaved progress."

Hotspot functions may also include the untranslated names of game menu buttons. If at least one such button is defined, the navigation is not shown, and the imagemap is expected to define all relevant game menu buttons.

Despite the name, this function can take arbitrary displayables as well as images. The images or displayables used should be transparent to allow the navigation to show through, unless the game menu buttons are defined here.

    init -2 python:
        layout.imagemap_yesno_prompt(
            "yesno_ground.png",
            "yesno_idle.png",
            "yesno_hover.png",
            [
                (211, 228, 320, 280, "Yes"),
                (490, 228, 575, 280, "No"),
            ],
            {
                layout.ARE_YOU_SURE : "yesno_are_you_sure.png",
                layout.DELETE_SAVE : "yesno_delete_save.png",
                layout.OVERWRITE_SAVE : "yesno_overwrite_save.png",
                layout.LOADING : "yesno_loading.png",
                layout.QUIT : "yesno_quit.png",
                layout.MAIN_MENU : "yesno_main_menu.png",
            }
    )

documentation index ◦ reference manual ◦ function index