first commit

This commit is contained in:
Florian Schmitt 2024-10-08 15:38:46 +03:00
commit 2e5df21095
2308 changed files with 453496 additions and 0 deletions

View file

@ -0,0 +1,3 @@
from .sdl2 import * # pylint: disable=wildcard-import; lgtm[py/polluting-import]
from .audio import * # pylint: disable=wildcard-import; lgtm[py/polluting-import]
from .video import * # pylint: disable=wildcard-import; lgtm[py/polluting-import]

View file

@ -0,0 +1,3 @@
from pygame._sdl2.audio import *
from pygame._sdl2.sdl2 import *
from pygame._sdl2.video import *

View file

@ -0,0 +1,54 @@
from typing import Callable, List
AUDIO_U8: int
AUDIO_S8: int
AUDIO_U16LSB: int
AUDIO_S16LSB: int
AUDIO_U16MSB: int
AUDIO_S16MSB: int
AUDIO_U16: int
AUDIO_S16: int
AUDIO_S32LSB: int
AUDIO_S32MSB: int
AUDIO_S32: int
AUDIO_F32LSB: int
AUDIO_F32MSB: int
AUDIO_F32: int
AUDIO_ALLOW_FREQUENCY_CHANGE: int
AUDIO_ALLOW_FORMAT_CHANGE: int
AUDIO_ALLOW_CHANNELS_CHANGE: int
AUDIO_ALLOW_ANY_CHANGE: int
def get_audio_device_names(iscapture: bool = False) -> List[str]: ...
class AudioDevice:
def __init__(
self,
devicename: str,
iscapture: bool,
frequency: int,
audioformat: int,
numchannels: int,
chunksize: int,
allowed_changes: int,
callback: Callable[[AudioDevice, memoryview], None],
) -> None: ...
@property
def iscapture(self) -> bool: ...
@property
def deviceid(self) -> int: ...
@property
def devicename(self) -> str: ...
@property
def callback(self) -> Callable[[AudioDevice, memoryview], None]: ...
@property
def frequency(self) -> int: ...
@property
def audioformat(self) -> int: ...
@property
def numchannels(self) -> int: ...
@property
def chunksize(self) -> int: ...
def pause(self, pause_on: int) -> None: ...
def close(self) -> None: ...

View file

@ -0,0 +1,35 @@
from typing import Dict, Mapping, Optional
from pygame.joystick import JoystickType
def init() -> None: ...
def get_init() -> bool: ...
def quit() -> None: ...
def set_eventstate(state: bool) -> None: ...
def get_eventstate() -> bool: ...
def update() -> None: ...
def get_count() -> int: ...
def is_controller(index: int) -> bool: ...
def name_forindex(index: int) -> Optional[str]: ...
class Controller:
def __init__(self, index: int) -> None: ...
@property
def name(self) -> str: ...
@property
def id(self) -> int: ...
def init(self) -> None: ...
def get_init(self) -> bool: ...
def quit(self) -> None: ...
@staticmethod
def from_joystick(joy: JoystickType) -> Controller: ...
def attached(self) -> bool: ...
def as_joystick(self) -> JoystickType: ...
def get_axis(self, axis: int) -> int: ...
def get_button(self, button: int) -> bool: ...
def get_mapping(self) -> Dict[str, str]: ...
def set_mapping(self, mapping: Mapping[str, str]) -> int: ...
def rumble(
self, low_frequency: float, high_frequency: float, duration: int
) -> bool: ...
def stop_rumble(self) -> None: ...

View file

@ -0,0 +1,16 @@
from typing import Optional
INIT_TIMER: int
INIT_AUDIO: int
INIT_VIDEO: int
INIT_JOYSTICK: int
INIT_HAPTIC: int
INIT_GAMECONTROLLER: int
INIT_EVENTS: int
INIT_NOPARACHUTE: int
INIT_EVERYTHING: int
class error(RuntimeError):
def __init__(self, message: Optional[str] = None) -> None: ...
def init_subsystem(flags: int) -> None: ...

View file

@ -0,0 +1,6 @@
from typing import Dict, Union
def get_num_devices() -> int: ...
def get_device(index: int) -> int: ...
def get_num_fingers(device_id: int) -> int: ...
def get_finger(touchid: int, index: int) -> Dict[str, Union[int, float]]: ...

View file

@ -0,0 +1,159 @@
from typing import Any, Generator, Iterable, Optional, Tuple, Union
from pygame.rect import Rect
from pygame.surface import Surface
from .._common import RectValue, Literal, ColorValue
WINDOWPOS_UNDEFINED: int
WINDOWPOS_CENTERED: int
MESSAGEBOX_ERROR: int
MESSAGEBOX_WARNING: int
MESSAGEBOX_INFORMATION: int
class RendererDriverInfo:
name: str
flags: int
num_texture_formats: int
max_texture_width: int
max_texture_height: int
def get_drivers() -> Generator[RendererDriverInfo, None, None]: ...
def get_grabbed_window() -> Optional[Window]: ...
def messagebox(
title: str,
message: str,
window: Optional[Window] = None,
info: bool = False,
warn: bool = False,
error: bool = False,
buttons: Tuple[str, ...] = ("OK",),
return_button: int = 0,
escape_button: int = 0,
) -> int: ...
class Window:
DEFAULT_SIZE: Tuple[Literal[640], Literal[480]]
def __init__(
self,
title: str = "pygame",
size: Iterable[int] = (640, 480),
position: Optional[Iterable[int]] = None,
fullscreen: bool = False,
fullscreen_desktop: bool = False,
**kwargs: bool
) -> None: ...
@classmethod
def from_display_module(cls) -> Window: ...
@classmethod
def from_window(cls, other: int) -> Window: ...
grab: bool
relative_mouse: bool
def set_windowed(self) -> None: ...
def set_fullscreen(self, desktop: bool = False) -> None: ...
title: str
def destroy(self) -> None: ...
def hide(self) -> None: ...
def show(self) -> None: ...
def focus(self, input_only: bool = False) -> None: ...
def restore(self) -> None: ...
def maximize(self) -> None: ...
def minimize(self) -> None: ...
resizable: bool
borderless: bool
def set_icon(self, surface: Surface) -> None: ...
id: int
size: Iterable[int]
position: Union[int, Iterable[int]]
opacity: float
display_index: int
def set_modal_for(self, parent: Window) -> None: ...
class Texture:
def __init__(
self,
renderer: Renderer,
size: Iterable[int],
static: bool = False,
streaming: bool = False,
target: bool = False,
) -> None: ...
@staticmethod
def from_surface(renderer: Renderer, surface: Surface) -> Texture: ...
renderer: Renderer
width: int
height: int
alpha: int
blend_mode: int
color: ColorValue
def get_rect(self, **kwargs: Any) -> Rect: ...
def draw(
self,
srcrect: Optional[RectValue] = None,
dstrect: Optional[RectValue] = None,
angle: float = 0.0,
origin: Optional[Iterable[int]] = None,
flip_x: bool = False,
flip_y: bool = False,
) -> None: ...
def update(self, surface: Surface, area: Optional[RectValue] = None) -> None: ...
class Image:
def __init__(
self,
textureOrImage: Union[Texture, Image],
srcrect: Optional[RectValue] = None,
) -> None: ...
def get_rect(self, **kwargs: Any) -> Rect: ...
def draw(
self, srcrect: Optional[RectValue] = None, dstrect: Optional[RectValue] = None
) -> None: ...
angle: float
origin: Optional[Iterable[float]]
flip_x: bool
flip_y: bool
color: ColorValue
alpha: float
blend_mode: int
texture: Texture
srcrect: Rect
class Renderer:
def __init__(
self,
window: Window,
index: int = -1,
accelerated: int = -1,
vsync: bool = False,
target_texture: bool = False,
) -> None: ...
@classmethod
def from_window(cls, window: Window) -> Renderer: ...
draw_blend_mode: int
draw_color: ColorValue
def clear(self) -> None: ...
def present(self) -> None: ...
def get_viewport(self) -> Rect: ...
def set_viewport(self, area: Optional[RectValue]) -> None: ...
logical_size: Iterable[int]
scale: Iterable[float]
target: Optional[Texture]
def blit(
self,
source: Union[Texture, Image],
dest: Optional[RectValue] = None,
area: Optional[RectValue] = None,
special_flags: int = 0,
) -> Rect: ...
def draw_line(self, p1: Iterable[int], p2: Iterable[int]) -> None: ...
def draw_point(self, point: Iterable[int]) -> None: ...
def draw_rect(self, rect: RectValue) -> None: ...
def fill_rect(self, rect: RectValue) -> None: ...
def to_surface(
self, surface: Optional[Surface] = None, area: Optional[RectValue] = None
) -> Surface: ...
@staticmethod
def compose_custom_blend_mode(
color_mode: Tuple[int, int, int], alpha_mode: Tuple[int, int, int]
) -> int: ...