Skip to content

Port Texture to C code #3330

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 37 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
5a8d38a
Add interface for _sdl2.video classes
MightyJosip Jan 28, 2025
1d2b186
Add interface for _sdl2.video classes
MightyJosip Jan 28, 2025
7898184
Add interface for _sdl2.video classes
MightyJosip Jan 28, 2025
3d2baa6
Add interface for _sdl2.video classes
MightyJosip Jan 28, 2025
a3cb1f9
Add interface for _sdl2.video classes
MightyJosip Jan 28, 2025
b15938e
Add interface for _sdl2.video classes
MightyJosip Jan 29, 2025
ef1c27d
Add interface for _sdl2.video classes
MightyJosip Jan 29, 2025
363a193
Add interface for _sdl2.video classes
MightyJosip Jan 29, 2025
363fa59
Add interface for _sdl2.video classes
MightyJosip Jan 29, 2025
afccd4b
Add interface for _sdl2.video classes
MightyJosip Feb 3, 2025
c6ba34d
Squashed commit of the following:
MightyJosip Jan 29, 2025
8bc95e5
Port Renderer to C code
MightyJosip Jan 30, 2025
9710ba9
Port Renderer to C code
MightyJosip Feb 3, 2025
844f787
Squashed commit of the following:
MightyJosip Jan 29, 2025
7354bfc
Port Texture to C code
MightyJosip Feb 7, 2025
98abc4a
Port Texture to C code
MightyJosip Feb 7, 2025
ca8db22
Merge remote-tracking branch 'upstream/main' into NewTexture
MightyJosip May 12, 2025
f83daad
Port Texture to C code
MightyJosip May 15, 2025
dbab0bc
Port Texture to C code
MightyJosip May 15, 2025
a3e7a92
Port Texture to C code
MightyJosip May 15, 2025
f564f75
Port Texture to C code
MightyJosip May 15, 2025
e9cdace
Port Texture to C code
MightyJosip May 15, 2025
904135e
Port Texture to C code
MightyJosip May 16, 2025
909bd1d
Port Texture to C code
MightyJosip May 16, 2025
74e9b88
Port Texture to C code
MightyJosip May 16, 2025
b9a2be0
Port Texture to C code
MightyJosip May 17, 2025
11b98b3
Port Texture to C code
MightyJosip May 17, 2025
b81e0d8
Port Texture to C code
MightyJosip May 17, 2025
3e19bb6
Port Texture to C code
MightyJosip May 17, 2025
88d28da
Port Texture to C code
MightyJosip May 17, 2025
04d08b0
Port Texture to C code
MightyJosip May 17, 2025
090106a
Port Texture to C code
MightyJosip May 17, 2025
c902537
Port Texture to C code
MightyJosip May 17, 2025
1e6c33c
Port Texture to C code
MightyJosip May 17, 2025
f0b8b32
Port Texture to C code
MightyJosip May 19, 2025
d6a39d5
Port Texture to C code
MightyJosip May 19, 2025
503b4bf
Port Texture to C code
MightyJosip May 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions buildconfig/stubs/pygame/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ from .constants import (
FLASH_BRIEFLY as FLASH_BRIEFLY,
FLASH_CANCEL as FLASH_CANCEL,
FLASH_UNTIL_FOCUSED as FLASH_UNTIL_FOCUSED,
FLIP_HORIZONTAL as FLIP_HORIZONTAL,
FLIP_NONE as FLIP_NONE,
FLIP_VERTICAL as FLIP_VERTICAL,
FONT_CENTER as FONT_CENTER,
FONT_LEFT as FONT_LEFT,
FONT_RIGHT as FONT_RIGHT,
Expand Down Expand Up @@ -643,6 +646,9 @@ from .constants import (
SYSWMEVENT as SYSWMEVENT,
TEXTEDITING as TEXTEDITING,
TEXTINPUT as TEXTINPUT,
TEXTUREACCESS_STATIC as TEXTUREACCESS_STATIC,
TEXTUREACCESS_STREAMING as TEXTUREACCESS_STREAMING,
TEXTUREACCESS_TARGET as TEXTUREACCESS_TARGET,
TIMER_RESOLUTION as TIMER_RESOLUTION,
USEREVENT as USEREVENT,
USEREVENT_DROPFILE as USEREVENT_DROPFILE,
Expand Down
73 changes: 70 additions & 3 deletions buildconfig/stubs/pygame/_render.pyi
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from typing import Optional, Protocol, Union, final
from collections.abc import Iterable
from typing import Any, Optional, Protocol, Union, final

from pygame.color import Color
from pygame.rect import Rect
from pygame.surface import Surface
from pygame.typing import ColorLike, IntPoint, Point, RectLike, SequenceLike
from pygame.window import Window
from typing_extensions import deprecated # added in 3.13

class _DrawableClass(Protocol):
# Object that has the draw method that accepts area and dest arguments
Expand Down Expand Up @@ -74,7 +74,74 @@ class Renderer:

@final
class Texture:
pass
def __init__(
self,
renderer: Renderer,
size: Iterable[int],
depth: int = 0,
static: bool = False,
streaming: bool = False,
target: bool = False,
scale_quality: Optional[int] = None,
) -> None: ...
@property
def alpha(self) -> int: ...
@alpha.setter
def alpha(self, value: int) -> None: ...
@property
def blend_mode(self) -> int: ...
@blend_mode.setter
def blend_mode(self, value: int) -> None: ...
@property
def color(self) -> Color: ...
@color.setter
def color(self, value: ColorLike) -> None: ...
@property
def width(self) -> int: ...
@property
def height(self) -> int: ...
@property
def renderer(self) -> Renderer: ...
@classmethod
def from_surface(cls, renderer: Renderer, surface: Surface) -> Texture: ...
def draw(
self,
srcrect: Optional[RectLike] = None,
dstrect: Optional[RectLike] = None,
angle: float = 0.0,
origin: Optional[Iterable[int]] = None,
flip_x: bool = False,
flip_y: bool = False,
) -> None: ...
def draw_triangle(
self,
p1_xy: Point,
p2_xy: Point,
p3_xy: Point,
p1_uv: Point = (0.0, 0.0),
p2_uv: Point = (1.0, 1.0),
p3_uv: Point = (0.0, 1.0),
p1_mod: Iterable[int] = (255, 255, 255, 255),
p2_mod: Iterable[int] = (255, 255, 255, 255),
p3_mod: Iterable[int] = (255, 255, 255, 255),
) -> None: ...
def draw_quad(
self,
p1_xy: Point,
p2_xy: Point,
p3_xy: Point,
p4_xy: Point,
p1_uv: Point = (0.0, 0.0),
p2_uv: Point = (1.0, 0.0),
p3_uv: Point = (1.0, 1.0),
p4_uv: Point = (0.0, 1.0),
p1_mod: Iterable[int] = (255, 255, 255, 255),
p2_mod: Iterable[int] = (255, 255, 255, 255),
p3_mod: Iterable[int] = (255, 255, 255, 255),
p4_mod: Iterable[int] = (255, 255, 255, 255),
) -> None: ...
def get_rect(self, **kwargs: Any) -> Rect: ...
def update(self, surface: Surface, area: Optional[RectLike] = None) -> None: ...

@final
class Image:
Expand Down
6 changes: 6 additions & 0 deletions buildconfig/stubs/pygame/constants.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ FINGERUP: int
FLASH_BRIEFLY: int
FLASH_CANCEL: int
FLASH_UNTIL_FOCUSED: int
FLIP_HORIZONTAL: int
FLIP_NONE: int
FLIP_VERTICAL: int
FONT_CENTER: int
FONT_LEFT: int
FONT_RIGHT: int
Expand Down Expand Up @@ -565,6 +568,9 @@ SYSTEM_CURSOR_WAITARROW: int
SYSWMEVENT: int
TEXTEDITING: int
TEXTINPUT: int
TEXTUREACCESS_STATIC: int
TEXTUREACCESS_STREAMING: int
TEXTUREACCESS_TARGET: int
TIMER_RESOLUTION: int
USEREVENT: int
USEREVENT_DROPFILE: int
Expand Down
6 changes: 6 additions & 0 deletions buildconfig/stubs/pygame/locals.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ FINGERUP: int
FLASH_BRIEFLY: int
FLASH_CANCEL: int
FLASH_UNTIL_FOCUSED: int
FLIP_HORIZONTAL: int
FLIP_NONE: int
FLIP_VERTICAL: int
FONT_CENTER: int
FONT_LEFT: int
FONT_RIGHT: int
Expand Down Expand Up @@ -567,6 +570,9 @@ SYSTEM_CURSOR_WAITARROW: int
SYSWMEVENT: int
TEXTEDITING: int
TEXTINPUT: int
TEXTUREACCESS_STATIC: int
TEXTUREACCESS_STREAMING: int
TEXTUREACCESS_TARGET: int
TIMER_RESOLUTION: int
USEREVENT: int
USEREVENT_DROPFILE: int
Expand Down
7 changes: 7 additions & 0 deletions src_c/constants.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,13 @@ MODINIT_DEFINE(constants)
DEC_CONSTS(WINDOWICCPROFCHANGED, PGE_WINDOWICCPROFCHANGED);
DEC_CONSTS(WINDOWDISPLAYCHANGED, PGE_WINDOWDISPLAYCHANGED);

DEC_CONST(TEXTUREACCESS_STATIC);
DEC_CONST(TEXTUREACCESS_STREAMING);
DEC_CONST(TEXTUREACCESS_TARGET);
DEC_CONST(FLIP_NONE);
DEC_CONST(FLIP_HORIZONTAL);
DEC_CONST(FLIP_VERTICAL);

DEC_CONST(CONTROLLERAXISMOTION);
DEC_CONST(CONTROLLERBUTTONDOWN);
DEC_CONST(CONTROLLERBUTTONUP);
Expand Down
Loading
Loading