Skip to content

Commit

Permalink
Merge pull request #117 from maniek2332/ft/typing
Browse files Browse the repository at this point in the history
Typing stubs
  • Loading branch information
labuzm committed Apr 6, 2021
2 parents 1bf66e3 + 10da630 commit c600a38
Show file tree
Hide file tree
Showing 17 changed files with 2,838 additions and 1 deletion.
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
"Source Code": 'https://github.com/kaaengine/kaa/',
},
cmake_source_dir=KAA_SETUP_CMAKE_SOURCE,
package_data={
'kaa': ['*.pyi', 'py.typed'],
},
include_package_data=True,
cmake_args=[
'-DKAA_INSTALL_KAACORE:BOOL=OFF',
Expand Down
116 changes: 116 additions & 0 deletions src/kaa/audio.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
from __future__ import annotations

from typing import final

import enum


class AudioStatus(enum.IntEnum):
paused: AudioStatus
playing: AudioStatus
stopped: AudioStatus


@final
class Sound:
def __init__(self, sound_filepath: str, volume: float = ...) -> None:
...

@property
def volume(self) -> float:
...

def play(self, volume: float = 1.) -> None:
...

def __eq__(self, other) -> bool:
...

def __hash__(self) -> int:
...


@final
class SoundPlayback:
def __init__(self, sound: Sound, volume: float = ...) -> None:
...

@property
def is_paused(self) -> bool:
...

@property
def is_playing(self) -> bool:
...

@property
def sound(self) -> Sound:
...

@property
def status(self) -> AudioStatus:
...

@property
def volume(self) -> float:
...

@volume.setter
def volume(self, value: float) -> None:
...

def pause(self) -> None:
...

def play(self, loops: int = 1) -> None:
...

def resume(self) -> None:
...

def stop(self) -> None:
...


@final
class Music:
def __init__(self, music_filepath: str, volume: float = ...) -> None:
...

@staticmethod
def get_current() -> Music:
...

@property
def is_paused(self) -> bool:
...

@property
def is_playing(self) -> bool:
...

@property
def status(self) -> AudioStatus:
...

@property
def volume(self) -> float:
...

def pause(self) -> None:
...

def play(self, volume: float = 1.) -> None:
...

def resume(self) -> None:
...

def stop(self) -> None:
...

def __eq__(self, other) -> bool:
...

def __hash__(self) -> int:
...
35 changes: 35 additions & 0 deletions src/kaa/colors.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from __future__ import annotations

from typing import final


@final
class Color:
def __init__(
self, r: float = 0., g: float = 0.,
b: float = 0., a: float = 1.,
) -> None:
...

@classmethod
def from_int(
self, r: int = 0, g: int = 0,
b: int = 0, a: int = 255,
) -> Color:
...

@property
def r(self) -> float:
...

@property
def g(self) -> float:
...

@property
def b(self) -> float:
...

@property
def a(self) -> float:
...
54 changes: 54 additions & 0 deletions src/kaa/easings.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
from __future__ import annotations

import enum
from typing import overload

from .geometry import Vector


class Easing(enum.IntEnum):
none: Easing
back_in: Easing
back_in_out: Easing
back_out: Easing
bounce_in: Easing
bounce_in_out: Easing
bounce_out: Easing
circular_in: Easing
circular_in_out: Easing
circular_out: Easing
cubic_in: Easing
cubic_in_out: Easing
cubic_out: Easing
elastic_in: Easing
elastic_in_out: Easing
elastic_out: Easing
exponential_in: Easing
exponential_in_out: Easing
exponential_out: Easing
quadratic_in: Easing
quadratic_in_out: Easing
quadratic_out: Easing
quartic_in: Easing
quartic_in_out: Easing
quartic_out: Easing
quintic_in: Easing
quintic_in_out: Easing
quintic_out: Easing
sine_in: Easing
sine_in_out: Easing
sine_out: Easing


def ease(easing: Easing, progress: float) -> float:
...


@overload
def ease_between(easing: Easing, progress: float, a: float, b: float) -> float:
...


@overload
def ease_between(easing: Easing, progress: float, a: Vector, b: Vector) -> Vector:
...

0 comments on commit c600a38

Please sign in to comment.