Skip to content

Commit

Permalink
Add interface for _sdl2.video classes
Browse files Browse the repository at this point in the history
  • Loading branch information
MightyJosip committed Jan 29, 2025
1 parent 081b032 commit 702958c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 26 deletions.
3 changes: 1 addition & 2 deletions src_c/include/_pygame.h
Original file line number Diff line number Diff line change
Expand Up @@ -559,8 +559,7 @@ typedef struct {
(PyObject_IsInstance((x), (PyObject *)&pgRenderer_Type))
#define pgTexture_Check(x) \
(PyObject_IsInstance((x), (PyObject *)&pgTexture_Type))
#define pgImage_Check(x) \
(PyObject_IsInstance((x), (PyObject *)&pgImage_Type))
#define pgImage_Check(x) (PyObject_IsInstance((x), (PyObject *)&pgImage_Type))
#define import_pygame_renderer() IMPORT_PYGAME_MODULE(_renderer)
#endif

Expand Down
13 changes: 5 additions & 8 deletions src_c/renderer.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,11 @@ static PyGetSetDef renderer_getset[] = {{NULL, 0, NULL, NULL, NULL}};

static PyTypeObject pgRenderer_Type = {
PyVarObject_HEAD_INIT(NULL, 0).tp_name = "pygame._renderer.Renderer",
.tp_basicsize = sizeof(pgRendererObject),
//.tp_dealloc = (destructor)renderer_dealloc,
.tp_doc = DOC_SDL2_VIDEO_RENDERER,
.tp_methods = renderer_methods,
//.tp_init = (initproc)renderer_init,
.tp_new = PyType_GenericNew,
.tp_getset = renderer_getset
};
.tp_basicsize = sizeof(pgRendererObject),
//.tp_dealloc = (destructor)renderer_dealloc,
.tp_doc = DOC_SDL2_VIDEO_RENDERER, .tp_methods = renderer_methods,
//.tp_init = (initproc)renderer_init,
.tp_new = PyType_GenericNew, .tp_getset = renderer_getset};

static PyMethodDef _renderer_methods[] = {{NULL, NULL, 0, NULL}};

Expand Down
13 changes: 5 additions & 8 deletions src_c/renderer_image.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,10 @@ static PyGetSetDef image_getset[] = {{NULL, 0, NULL, NULL, NULL}};

static PyTypeObject pgImage_Type = {
PyVarObject_HEAD_INIT(NULL, 0).tp_name = "pygame._renderer.Image",
.tp_basicsize = sizeof(pgImageObject),
//.tp_dealloc = (destructor)image_dealloc,
.tp_doc = DOC_SDL2_VIDEO_IMAGE,
.tp_methods = image_methods,
//.tp_init = (initproc)image_init,
.tp_new = PyType_GenericNew,
.tp_getset = image_getset
};
.tp_basicsize = sizeof(pgImageObject),
//.tp_dealloc = (destructor)image_dealloc,
.tp_doc = DOC_SDL2_VIDEO_IMAGE, .tp_methods = image_methods,
//.tp_init = (initproc)image_init,
.tp_new = PyType_GenericNew, .tp_getset = image_getset};

static PyMethodDef _image_methods[] = {{NULL, NULL, 0, NULL}};
13 changes: 5 additions & 8 deletions src_c/texture.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,10 @@ static PyGetSetDef texture_getset[] = {{NULL, 0, NULL, NULL, NULL}};

static PyTypeObject pgTexture_Type = {
PyVarObject_HEAD_INIT(NULL, 0).tp_name = "pygame._renderer.Texture",
.tp_basicsize = sizeof(pgTextureObject),
//.tp_dealloc = (destructor)texture_dealloc,
.tp_doc = DOC_SDL2_VIDEO_TEXTURE,
.tp_methods = texture_methods,
//.tp_init = (initproc)texture_init,
.tp_new = PyType_GenericNew,
.tp_getset = texture_getset
};
.tp_basicsize = sizeof(pgTextureObject),
//.tp_dealloc = (destructor)texture_dealloc,
.tp_doc = DOC_SDL2_VIDEO_TEXTURE, .tp_methods = texture_methods,
//.tp_init = (initproc)texture_init,
.tp_new = PyType_GenericNew, .tp_getset = texture_getset};

static PyMethodDef _texture_methods[] = {{NULL, NULL, 0, NULL}};

0 comments on commit 702958c

Please sign in to comment.