documentation indexreference manualfunction index

layout.imagemap_load_save

Function: layout.imagemap_load_save (ground, idle, hover, selected_idle, selected_hover, hotspots, variant=None):

This layout uses an imagemap to handle loading and saving.

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

idle - The displayable used for unfocused unselected hotspots.

hover - The displayable used for focused unselected hotspots.

selected_idle - The displayable used for unfocused selected hotspots.

selected_hover - The displayable used for focused selected 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 function of this hotspot.

The function of the hotspot should be one of:

variant - Allows us to define only the save or load screens. This can be "save", "load", or None to define the save and load screens at once. If a save screen is defined, a load screen must be defined (perhaps with different parameters), and vice versa.

Screenshots and slot text are placed inside windows that are laid out relative to the slot. Adjusting style.file_picker_ss_window controls the screenshot placement, and adjusting style.file_picker_text_window controls the placement of per-slot test. It will usually be necessary to adjust these styles, as the default places both in the upper left.

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.

Variable: config.disable_thumbnails = False

If True, thumbnails are not shown.

Variable: config.load_save_empty_thumbnail = None

If not None, this should be a displayable that will be shown with empty load/save slots.

Variable: config.time_format = "%b %d, %H:%M"

The format used for file times in the file entry slots.

Variable: config.file_entry_format = "%(time)s\n%(save_name)s"

The format of file entries in the file entry slots.

init -2 python:
    layout.imagemap_load_save(
        "loadsave_ground.png",
        "loadsave_idle.png",
        "loadsave_hover.png",
        "loadsave_selected_idle.png",
        "loadsave_selected_hover.png",
        [
            (58, 26, 140, 103, "previous"),
            (140, 26, 227, 103, "page_auto"),
            (227, 26, 310, 103, "page_1"),
            (310, 26, 391, 103, "page_2"),
            (391, 26, 474, 103, "page_3"),
            (474, 26, 559, 103, "page_4"),
            (559, 26, 640, 103, "page_5"),
            (640, 26, 725, 103, "next"),

            (32, 134, 271, 344, "slot_0"),
            (271, 134, 512, 344, "slot_1"),
            (512, 134, 754, 344, "slot_2"),
            ])


    style.file_picker_ss_window.xalign = 0.5
    style.file_picker_ss_window.yalign = 0.35
    style.file_picker_text_window.xalign = 0.5
    style.file_picker_text_window.yalign = .85
    config.thumbnail_width = 125
    config.thumbnail_height = 93

documentation indexreference manualfunction index