pygame-3dce 0.0.1__py3-none-any.whl

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 @@
1
+ from .main import Pygame3D
pygame_3dce/main.py ADDED
@@ -0,0 +1,40 @@
1
+ import pygame
2
+ from pygame.locals import *
3
+ from OpenGL.GL import *
4
+ from OpenGL.GLU import *
5
+
6
+ class Pygame3D:
7
+ def __init__(self, width=800, height=600, fov=45):
8
+ """Initializes a pygame-ce window with a 3D OpenGL context."""
9
+ pygame.init()
10
+ self.display = (width, height)
11
+ pygame.display.set_mode(self.display, DOUBLEBUF | OPENGL)
12
+
13
+ glEnable(GL_DEPTH_TEST)
14
+ gluPerspective(fov, (self.display[0] / self.display[1]), 0.1, 100.0)
15
+ glTranslatef(0.0, 0.0, -10.0)
16
+
17
+ def clear(self):
18
+ """Clears the screen and depth buffers for the next frame."""
19
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
20
+
21
+ def update(self):
22
+ """Flips the display buffer to render the new graphics frame."""
23
+ pygame.display.flip()
24
+
25
+ def draw_cube(self, size=1.0):
26
+ """A built-in helper method to draw a simple 3D wireframe cube."""
27
+ s = size
28
+ vertices = (
29
+ (s, -s, -s), (s, s, -s), (-s, s, -s), (-s, -s, -s),
30
+ (s, -s, s), (s, s, s), (-s, -s, s), (-s, s, s)
31
+ )
32
+ edges = (
33
+ (0,1), (0,3), (0,4), (2,1), (2,3), (2,7),
34
+ (6,3), (6,4), (6,7), (5,1), (5,4), (5,7)
35
+ )
36
+ glBegin(GL_LINES)
37
+ for edge in edges:
38
+ for vertex in edge:
39
+ glVertex3fv(vertices[vertex])
40
+ glEnd()
@@ -0,0 +1,31 @@
1
+ Metadata-Version: 2.5
2
+ Name: pygame-3dce
3
+ Version: 0.0.1
4
+ Summary: A clean 3D extension for pygame-ce using PyOpenGL
5
+ Author-email: PeaiiYT <kaelwerkAPPLE@outlook.com>
6
+ Classifier: License :: OSI Approved :: MIT License
7
+ Classifier: Operating System :: OS Independent
8
+ Classifier: Programming Language :: Python :: 3
9
+ Requires-Python: >=3.8
10
+ Requires-Dist: pygame-ce
11
+ Requires-Dist: pyopengl
12
+ Description-Content-Type: text/markdown
13
+
14
+ \# pygame-3dce
15
+
16
+
17
+
18
+ Just a 3d Extension
19
+
20
+
21
+
22
+ \## Installation
23
+
24
+ ```bash
25
+
26
+ pip install pygame-3dce
27
+
28
+ ```
29
+
30
+
31
+
@@ -0,0 +1,5 @@
1
+ pygame_3dce/__init__.py,sha256=8z7VRg9bbbdjN5JtpAoEMGiQ3LEzMXH54k6BjL5nIVY,28
2
+ pygame_3dce/main.py,sha256=Qx3udFUxonTWhhxLg9Gwsx2x5y2hSQ7ZpvcoatvfYiE,1398
3
+ pygame_3dce-0.0.1.dist-info/METADATA,sha256=thMKdBJqZLNXfaXuRA-9JhqwOniqh6F5S5NRGEwfAhM,523
4
+ pygame_3dce-0.0.1.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
5
+ pygame_3dce-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.33.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any