mini_arcade_core.runtime.input_frame ==================================== .. py:module:: mini_arcade_core.runtime.input_frame .. autoapi-nested-parse:: Input frame data structure for capturing input state per frame. Classes ------- .. autoapisummary:: mini_arcade_core.runtime.input_frame.ButtonState mini_arcade_core.runtime.input_frame.InputFrame Module Contents --------------- .. py:class:: ButtonState State of a single action button. :ivar down (bool): Whether the button is currently held down. :ivar pressed (bool): Whether the button was pressed this frame. :ivar released (bool): Whether the button was released this frame. .. py:attribute:: down :type: bool .. py:attribute:: pressed :type: bool .. py:attribute:: released :type: bool .. py:method:: to_dict() -> Dict[str, bool] Convert the ButtonState to a dictionary. :return: Dictionary representation of the ButtonState. :rtype: Dict[str, bool] .. py:method:: from_dict(data: Dict[str, bool]) -> ButtonState :classmethod: Create a ButtonState from a dictionary. :param data: Dictionary containing button state data. :type data: Dict[str, bool] :return: ButtonState instance. :rtype: ButtonState .. py:class:: InputFrame Snapshot of input state for a single frame. :ivar frame_index (int): Sequential index of the frame. :ivar dt (float): Delta time since the last frame in seconds. :ivar keys_down (FrozenSet[Key]): Set of currently held down keys. :ivar keys_pressed (FrozenSet[Key]): Set of keys pressed this frame. :ivar keys_released (FrozenSet[Key]): Set of keys released this frame. :ivar buttons (Dict[str, ButtonState]): Mapping of action button names to their states. :ivar axes (Dict[str, float]): Mapping of axis names to their float values. :ivar mouse_pos (Tuple[int, int]): Current mouse position (x, y). :ivar mouse_delta (Tuple[int, int]): Mouse movement delta (dx, dy) :ivar text_input (str): Text input entered this frame. :ivar quit (bool): Whether a quit request was made this frame. .. py:attribute:: frame_index :type: int .. py:attribute:: dt :type: float .. py:attribute:: keys_down :type: FrozenSet[mini_arcade_core.backend.keys.Key] .. py:attribute:: keys_pressed :type: FrozenSet[mini_arcade_core.backend.keys.Key] .. py:attribute:: keys_released :type: FrozenSet[mini_arcade_core.backend.keys.Key] .. py:attribute:: buttons :type: Dict[str, ButtonState] .. py:attribute:: axes :type: Dict[str, float] .. py:attribute:: mouse_pos :type: Tuple[int, int] :value: (0, 0) .. py:attribute:: mouse_delta :type: Tuple[int, int] :value: (0, 0) .. py:attribute:: text_input :type: str :value: '' .. py:attribute:: quit :type: bool :value: False .. py:method:: to_dict() -> Dict[str, object] Convert the InputFrame to a dictionary. :return: Dictionary representation of the InputFrame. :rtype: Dict[str, object] .. py:method:: from_dict(data: Dict[str, object]) -> InputFrame :classmethod: Create an InputFrame from a dictionary. :param data: Dictionary containing input frame data. :type data: Dict[str, object] :return: InputFrame instance. :rtype: InputFrame