Source code for bacommon.nativeenums
# Released under the MIT License. See LICENSE for details.
#
"""Enums shared with the native layer.
The engine's C++ versions of these are generated from this module, so
nothing but :mod:`enum` may be imported here, and every class must be
an :class:`~enum.Enum` with ascending int values. Values are spelled
out because some are stored or sent places; never renumber existing
ones. These are also available as ``babase.InputType`` and so on.
"""
from __future__ import annotations # Docs-generation hack.
from enum import Enum
[docs]
class QuitType(Enum):
"""Types of quit behavior that can be requested from the app.
'soft' may hide/reset the app but keep the process running, depending
on the platform (generally a thing on mobile).
'back' is a variant of 'soft' which may give 'back-button-pressed'
behavior depending on the platform. (returning to some previous
activity instead of dumping to the home screen, etc.)
'hard' leads to the process exiting. This generally should be avoided
on platforms such as mobile where apps are expected to keep running
until killed by the OS.
"""
SOFT = 0
BACK = 1
HARD = 2
[docs]
class SoundPriority(Enum):
"""How much a sound matters when more sounds want to play than can at
once. When everything is busy, a new sound takes the place of the
oldest playing sound of the lowest priority at or below its own
(sounds that loop are never cut off this way).
Sounds are 'default' unless their asset says otherwise.
"""
LOWER = 0
LOW = 1
DEFAULT = 2
HIGH = 3
HIGHER = 4
[docs]
class UIScale(Enum):
"""The overall scale the UI is being rendered for. Note that this is
independent of pixel resolution. For example, a phone and a desktop PC
might render the game at similar pixel resolutions but the size they
display content at will vary significantly.
'large' is used for devices such as desktop PCs where fine details can
be clearly seen. UI elements are generally smaller on the screen
and more content can be seen at once.
'medium' is used for devices such as tablets, TVs, or VR headsets.
This mode strikes a balance between clean readability and amount of
content visible.
'small' is used primarily for phones or other small devices where
content needs to be presented as large and clear in order to remain
readable from an average distance.
"""
SMALL = 0
MEDIUM = 1
LARGE = 2
[docs]
class Permission(Enum):
"""Permissions that can be requested from the OS."""
STORAGE = 0
# Docs-generation hack; import some stuff that we likely only forward-declared
# in our actual source code so that docs tools can find it.
from typing import (Coroutine, Any, Literal, Callable,
Generator, Awaitable, Sequence, Self, TypeIs)
import asyncio
from concurrent.futures import Future
from pathlib import Path
from enum import Enum