view mamba/constants.py @ 601:915de6c7d342 default tip

Add support for making the editor fullscreen too.
author Simon Cross <hodgestar@gmail.com>
date Sat, 14 Jan 2023 19:34:26 +0100
parents 72539d49c426
children
line wrap: on
line source

import pygame
from pygame.locals import K_ESCAPE, K_q, K_BACKSPACE, K_DELETE

# version tuple for maps
# NB: We only compare on the first two elements of the version when loading
# levels - this is so levels saved by later point releases are loadable by
# older versions. So changing the level format (new sprite, etc.) is not
# acceptable in a point release
VERSION = (0, 2, 0)

# Display constants
SCREEN = (800, 600)
EDIT_SCREEN = (1000, 600)
TILE_SIZE = (20, 20)
DISPLAY_FLAGS = pygame.SWSURFACE
FULLSCREEN_FLAGS = pygame.FULLSCREEN | getattr(pygame, "SCALED", 0)

# Miscellaneous constants
NAME = "Mutable Mamba"
WINDOW_ICON = "icons/program/icon_24.png"
FPS = 60
LEVEL_SERVER = "https://mutable-mamba.org/levels/"
# LEVEL_SERVER = "http://localhost:5000/"
LEVEL_SERVER_VERSION = 2

# Sound constants
FREQ = 44100   # same as audio CD
BITSIZE = -16  # unsigned 16 bit
CHANNELS = 2   # 1 == mono, 2 == stereo
BUFFER = 1024  # audio buffer size in no. of samples

# Keyboard constants
ESCAPE_KEYS = (K_ESCAPE, K_q, K_BACKSPACE)
DELETE_KEYS = (K_BACKSPACE, K_DELETE)

# For easy access later
DEFAULT_FONT = 'DejaVuSans.ttf'
FONT_SIZE = 16

# Colours
FOCUS_COLOR = 'red'
COLOR = 'black'

# Special level directory files
RESERVED_NAMES = ['index']

# Directions
UP, DOWN, LEFT, RIGHT = [(0, -1), (0, 1), (-1, 0), (1, 0)]

# Default command-line options
DEFAULTS = {
    'debug': False,
    'sound': True,
    'fullscreen': False,
    'level': None,
    'uncurated': None,
    'list_uncurated': False,
    'edit': False,
    'save_location': None,  # Determined by a function in options
}