dan-pyda 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,65 @@
1
+ Metadata-Version: 2.4
2
+ Name: dan-pyda
3
+ Version: 1.0.0
4
+ Summary: High-performance custom game engine (C + SDL2, zero Pygame)
5
+ Author: pyda contributors
6
+ License: MIT
7
+ Keywords: game,engine,sdl2,c-extension,2d
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: C
12
+ Classifier: Topic :: Games/Entertainment
13
+ Classifier: Topic :: Software Development :: Libraries
14
+ Requires-Python: >=3.8
15
+ Description-Content-Type: text/markdown
16
+
17
+ # pyda
18
+
19
+ A custom, high-performance 2D game engine built with C (SDL2 backend) and Python. Zero Pygame dependency—pure raw speed and modular flexibility.
20
+
21
+ ## Requirements
22
+
23
+ - Python >= 3.8
24
+ - SDL2 development libraries (headers + lib)
25
+ - Linux/Debian/Ubuntu/Termux: `libsdl2-dev`
26
+ - macOS (Homebrew): `brew install sdl2`
27
+ - Windows: install SDL2 and set include/lib paths or use vcpkg
28
+
29
+ ## Installation (Editable Mode)
30
+
31
+ ```bash
32
+ pip install --editable .
33
+ ```
34
+
35
+ Or from source:
36
+
37
+ ```bash
38
+ python setup.py build_ext --inplace
39
+ pip install .
40
+ ```
41
+
42
+ ## Quick usage
43
+
44
+ ```python
45
+ import pyda
46
+
47
+ pyda.init()
48
+ # ... use pyda._core, pyda.gameplay, pyda.physics_engine, etc.
49
+ pyda.quit()
50
+ ```
51
+
52
+ Core entry points live in `pyda._core` (re-exported from the top-level package). Other modules are available as:
53
+
54
+ - `pyda._draw`, `pyda._font`, `pyda._image`, `pyda._mixer`, `pyda._mouse`, `pyda._key`
55
+ - `pyda._rect`, `pyda._sprite`, `pyda._time`, `pyda._transform`
56
+ - `pyda.gameplay`, `pyda.physics_engine`, `pyda.geometry_engine`, `pyda.collision_engine`, `pyda.game_utils`
57
+ - Helpers: `pyda._math`, `pyda._text`, `pyda._bytes`, `pyda._datastruct`
58
+
59
+ ## Build notes
60
+
61
+ The C extensions must match the `PyInit_*` / module names defined in the `.c` sources. SDL2-dependent modules are linked with `-lSDL2`.
62
+
63
+ ## License
64
+
65
+ See repository for license information.
@@ -0,0 +1,49 @@
1
+ # pyda
2
+
3
+ A custom, high-performance 2D game engine built with C (SDL2 backend) and Python. Zero Pygame dependency—pure raw speed and modular flexibility.
4
+
5
+ ## Requirements
6
+
7
+ - Python >= 3.8
8
+ - SDL2 development libraries (headers + lib)
9
+ - Linux/Debian/Ubuntu/Termux: `libsdl2-dev`
10
+ - macOS (Homebrew): `brew install sdl2`
11
+ - Windows: install SDL2 and set include/lib paths or use vcpkg
12
+
13
+ ## Installation (Editable Mode)
14
+
15
+ ```bash
16
+ pip install --editable .
17
+ ```
18
+
19
+ Or from source:
20
+
21
+ ```bash
22
+ python setup.py build_ext --inplace
23
+ pip install .
24
+ ```
25
+
26
+ ## Quick usage
27
+
28
+ ```python
29
+ import pyda
30
+
31
+ pyda.init()
32
+ # ... use pyda._core, pyda.gameplay, pyda.physics_engine, etc.
33
+ pyda.quit()
34
+ ```
35
+
36
+ Core entry points live in `pyda._core` (re-exported from the top-level package). Other modules are available as:
37
+
38
+ - `pyda._draw`, `pyda._font`, `pyda._image`, `pyda._mixer`, `pyda._mouse`, `pyda._key`
39
+ - `pyda._rect`, `pyda._sprite`, `pyda._time`, `pyda._transform`
40
+ - `pyda.gameplay`, `pyda.physics_engine`, `pyda.geometry_engine`, `pyda.collision_engine`, `pyda.game_utils`
41
+ - Helpers: `pyda._math`, `pyda._text`, `pyda._bytes`, `pyda._datastruct`
42
+
43
+ ## Build notes
44
+
45
+ The C extensions must match the `PyInit_*` / module names defined in the `.c` sources. SDL2-dependent modules are linked with `-lSDL2`.
46
+
47
+ ## License
48
+
49
+ See repository for license information.
@@ -0,0 +1,65 @@
1
+ Metadata-Version: 2.4
2
+ Name: dan-pyda
3
+ Version: 1.0.0
4
+ Summary: High-performance custom game engine (C + SDL2, zero Pygame)
5
+ Author: pyda contributors
6
+ License: MIT
7
+ Keywords: game,engine,sdl2,c-extension,2d
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: C
12
+ Classifier: Topic :: Games/Entertainment
13
+ Classifier: Topic :: Software Development :: Libraries
14
+ Requires-Python: >=3.8
15
+ Description-Content-Type: text/markdown
16
+
17
+ # pyda
18
+
19
+ A custom, high-performance 2D game engine built with C (SDL2 backend) and Python. Zero Pygame dependency—pure raw speed and modular flexibility.
20
+
21
+ ## Requirements
22
+
23
+ - Python >= 3.8
24
+ - SDL2 development libraries (headers + lib)
25
+ - Linux/Debian/Ubuntu/Termux: `libsdl2-dev`
26
+ - macOS (Homebrew): `brew install sdl2`
27
+ - Windows: install SDL2 and set include/lib paths or use vcpkg
28
+
29
+ ## Installation (Editable Mode)
30
+
31
+ ```bash
32
+ pip install --editable .
33
+ ```
34
+
35
+ Or from source:
36
+
37
+ ```bash
38
+ python setup.py build_ext --inplace
39
+ pip install .
40
+ ```
41
+
42
+ ## Quick usage
43
+
44
+ ```python
45
+ import pyda
46
+
47
+ pyda.init()
48
+ # ... use pyda._core, pyda.gameplay, pyda.physics_engine, etc.
49
+ pyda.quit()
50
+ ```
51
+
52
+ Core entry points live in `pyda._core` (re-exported from the top-level package). Other modules are available as:
53
+
54
+ - `pyda._draw`, `pyda._font`, `pyda._image`, `pyda._mixer`, `pyda._mouse`, `pyda._key`
55
+ - `pyda._rect`, `pyda._sprite`, `pyda._time`, `pyda._transform`
56
+ - `pyda.gameplay`, `pyda.physics_engine`, `pyda.geometry_engine`, `pyda.collision_engine`, `pyda.game_utils`
57
+ - Helpers: `pyda._math`, `pyda._text`, `pyda._bytes`, `pyda._datastruct`
58
+
59
+ ## Build notes
60
+
61
+ The C extensions must match the `PyInit_*` / module names defined in the `.c` sources. SDL2-dependent modules are linked with `-lSDL2`.
62
+
63
+ ## License
64
+
65
+ See repository for license information.
@@ -0,0 +1,29 @@
1
+ README.md
2
+ pyproject.toml
3
+ setup.py
4
+ dan_pyda.egg-info/PKG-INFO
5
+ dan_pyda.egg-info/SOURCES.txt
6
+ dan_pyda.egg-info/dependency_links.txt
7
+ dan_pyda.egg-info/not-zip-safe
8
+ dan_pyda.egg-info/top_level.txt
9
+ pyda/__init__.py
10
+ pyda/_bytes.c
11
+ pyda/_datastruct.c
12
+ pyda/_math.c
13
+ pyda/_text.c
14
+ pyda/collision_engine.c
15
+ pyda/core.c
16
+ pyda/draw.c
17
+ pyda/font.c
18
+ pyda/game_utils.c
19
+ pyda/gameplay.c
20
+ pyda/geometry_engine.c
21
+ pyda/image.c
22
+ pyda/key.c
23
+ pyda/mixer.c
24
+ pyda/mouse.c
25
+ pyda/physics_engine.c
26
+ pyda/rect.c
27
+ pyda/sprite.c
28
+ pyda/time.c
29
+ pyda/transform.c
@@ -0,0 +1 @@
1
+ pyda
@@ -0,0 +1,27 @@
1
+ """
2
+ pyda: Pure C-accelerated native game engine (SDL2 backend).
3
+ """
4
+ from ._core import (
5
+ init,
6
+ quit,
7
+ set_mode,
8
+ flip,
9
+ pump_events,
10
+ get_ticks,
11
+ delay
12
+ )
13
+
14
+ # Event constants matching standard Pygame/SDL
15
+ QUIT = 256
16
+ KEYDOWN = 768
17
+ KEYUP = 769
18
+ MOUSEBUTTONDOWN = 1025
19
+ MOUSEBUTTONUP = 1026
20
+ MOUSEMOTION = 1024
21
+
22
+ __all__ = [
23
+ "init", "quit", "set_mode", "flip", "pump_events", "get_ticks", "delay",
24
+ "QUIT", "KEYDOWN", "KEYUP", "MOUSEBUTTONDOWN", "MOUSEBUTTONUP", "MOUSEMOTION"
25
+ ]
26
+
27
+ __version__ = "1.0.0"
@@ -0,0 +1,47 @@
1
+ #define PY_SSIZE_T_CLEAN
2
+ #include <Python.h>
3
+ #include <stdlib.h>
4
+
5
+ // Fast XOR encryption/decryption key application on byte buffers
6
+ static PyObject* bytes_xor_cipher(PyObject* self, PyObject* args) {
7
+ const char *data;
8
+ Py_ssize_t len;
9
+ unsigned char key;
10
+ if (!PyArg_ParseTuple(args, "s#b", &data, &len, &key)) return NULL;
11
+
12
+ char *result = (char*)malloc(len);
13
+ if (!result) return PyErr_NoMemory();
14
+
15
+ for (Py_ssize_t i = 0; i < len; i++) {
16
+ result[i] = data[i] ^ key;
17
+ }
18
+
19
+ PyObject *py_res = PyBytes_FromStringAndSize(result, len);
20
+ free(result);
21
+ return py_res;
22
+ }
23
+
24
+ // Fast calculation of simple checksum for data verification
25
+ static PyObject* bytes_simple_checksum(PyObject* self, PyObject* args) {
26
+ const char *data;
27
+ Py_ssize_t len;
28
+ if (!PyArg_ParseTuple(args, "s#", &data, &len)) return NULL;
29
+
30
+ unsigned int sum = 0;
31
+ for (Py_ssize_t i = 0; i < len; i++) {
32
+ sum += (unsigned char)data[i];
33
+ }
34
+ return PyLong_FromUnsignedLong(sum % 256);
35
+ }
36
+
37
+ static PyMethodDef BytesMethods[] = {
38
+ {"xor_cipher", bytes_xor_cipher, METH_VARARGS, "Blazing-fast byte array XOR cipher"},
39
+ {"simple_checksum", bytes_simple_checksum, METH_VARARGS, "Compute fast 8-bit data checksum"},
40
+ {NULL, NULL, 0, NULL}
41
+ };
42
+
43
+ static struct PyModuleDef bytes_module = {
44
+ PyModuleDef_HEAD_INIT, "_bytes", "Fast binary data manipulation", -1, BytesMethods
45
+ };
46
+
47
+ PyMODINIT_FUNC PyInit__bytes(void) { return PyModule_Create(&bytes_module); }
@@ -0,0 +1,56 @@
1
+ #define PY_SSIZE_T_CLEAN
2
+ #include <Python.h>
3
+
4
+ // Fast in-place integer array summing (simulating raw C arrays)
5
+ static PyObject* ds_fast_sum(PyObject* self, PyObject* args) {
6
+ PyObject *list_obj;
7
+ if (!PyArg_ParseTuple(args, "O", &list_obj)) return NULL;
8
+
9
+ if (!PyList_Check(list_obj)) {
10
+ PyErr_SetString(PyExc_TypeError, "Expected a Python list");
11
+ return NULL;
12
+ }
13
+
14
+ Py_ssize_t size = PyList_Size(list_obj);
15
+ double total = 0.0;
16
+
17
+ for (Py_ssize_t i = 0; i < size; i++) {
18
+ PyObject *item = PyList_GetItem(list_obj, i);
19
+ total += PyFloat_AsDouble(item); // Handles ints and floats automatically
20
+ }
21
+
22
+ return PyFloat_FromDouble(total);
23
+ }
24
+
25
+ // Fast finding of min and max in a list in a single pass
26
+ static PyObject* ds_min_max(PyObject* self, PyObject* args) {
27
+ PyObject *list_obj;
28
+ if (!PyArg_ParseTuple(args, "O", &list_obj)) return NULL;
29
+ if (!PyList_Check(list_obj)) return NULL;
30
+
31
+ Py_ssize_t size = PyList_Size(list_obj);
32
+ if (size == 0) return Py_BuildValue("(dd)", 0.0, 0.0);
33
+
34
+ double min_val = PyFloat_AsDouble(PyList_GetItem(list_obj, 0));
35
+ double max_val = min_val;
36
+
37
+ for (Py_ssize_t i = 1; i < size; i++) {
38
+ double val = PyFloat_AsDouble(PyList_GetItem(list_obj, i));
39
+ if (val < min_val) min_val = val;
40
+ if (val > max_val) max_val = val;
41
+ }
42
+
43
+ return Py_BuildValue("(dd)", min_val, max_val);
44
+ }
45
+
46
+ static PyMethodDef DSMethods[] = {
47
+ {"fast_sum", ds_fast_sum, METH_VARARGS, "Lightning-fast C-level list sum"},
48
+ {"min_max", ds_min_max, METH_VARARGS, "Find min and max in one pass"},
49
+ {NULL, NULL, 0, NULL}
50
+ };
51
+
52
+ static struct PyModuleDef ds_module = {
53
+ PyModuleDef_HEAD_INIT, "_datastruct", "Fast data structure helpers", -1, DSMethods
54
+ };
55
+
56
+ PyMODINIT_FUNC PyInit__datastruct(void) { return PyModule_Create(&ds_module); }