PyScene 1.1.3__tar.gz → 1.1.4__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.
Files changed (29) hide show
  1. {pyscene-1.1.3 → pyscene-1.1.4}/PKG-INFO +4 -2
  2. {pyscene-1.1.3 → pyscene-1.1.4}/README.md +2 -1
  3. {pyscene-1.1.3 → pyscene-1.1.4}/pyproject.toml +3 -2
  4. {pyscene-1.1.3 → pyscene-1.1.4}/src/PyScene/Game.py +1 -1
  5. {pyscene-1.1.3 → pyscene-1.1.4}/src/PyScene/objs/GameObj.py +1 -0
  6. {pyscene-1.1.3 → pyscene-1.1.4}/src/PyScene/objs/Text.py +25 -4
  7. {pyscene-1.1.3 → pyscene-1.1.4}/.gitignore +0 -0
  8. {pyscene-1.1.3 → pyscene-1.1.4}/LICENSE +0 -0
  9. {pyscene-1.1.3 → pyscene-1.1.4}/src/PyScene/Collisions.py +0 -0
  10. {pyscene-1.1.3 → pyscene-1.1.4}/src/PyScene/Keys.py +0 -0
  11. {pyscene-1.1.3 → pyscene-1.1.4}/src/PyScene/Math.py +0 -0
  12. {pyscene-1.1.3 → pyscene-1.1.4}/src/PyScene/Net.py +0 -0
  13. {pyscene-1.1.3 → pyscene-1.1.4}/src/PyScene/__init__.py +0 -0
  14. {pyscene-1.1.3 → pyscene-1.1.4}/src/PyScene/__main__.py +0 -0
  15. {pyscene-1.1.3 → pyscene-1.1.4}/src/PyScene/objs/Collision_shapes.py +0 -0
  16. {pyscene-1.1.3 → pyscene-1.1.4}/src/PyScene/objs/Shapes.py +0 -0
  17. {pyscene-1.1.3 → pyscene-1.1.4}/src/PyScene/objs/Tilemap.py +0 -0
  18. {pyscene-1.1.3 → pyscene-1.1.4}/src/PyScene/objs/Timer.py +0 -0
  19. {pyscene-1.1.3 → pyscene-1.1.4}/src/PyScene/objs/__init__.py +0 -0
  20. {pyscene-1.1.3 → pyscene-1.1.4}/src/PyScene/objs/animation.py +0 -0
  21. {pyscene-1.1.3 → pyscene-1.1.4}/src/PyScene/tools/manager_gui.py +0 -0
  22. {pyscene-1.1.3 → pyscene-1.1.4}/src/PyScene/utils/Assets.py +0 -0
  23. {pyscene-1.1.3 → pyscene-1.1.4}/src/PyScene/utils/Subscreen.py +0 -0
  24. {pyscene-1.1.3 → pyscene-1.1.4}/src/PyScene/utils/__init__.py +0 -0
  25. {pyscene-1.1.3 → pyscene-1.1.4}/test.py +0 -0
  26. {pyscene-1.1.3 → pyscene-1.1.4}/tests/flappy_bird.py +0 -0
  27. {pyscene-1.1.3 → pyscene-1.1.4}/tests/pause.png +0 -0
  28. {pyscene-1.1.3 → pyscene-1.1.4}/tests/testColl.py +0 -0
  29. {pyscene-1.1.3 → pyscene-1.1.4}/tests/tileset.png +0 -0
@@ -1,9 +1,10 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: PyScene
3
- Version: 1.1.3
3
+ Version: 1.1.4
4
4
  Summary: A python and pygame Game Engine
5
5
  Project-URL: Homepage, https://github.com/sfertig/PyScene
6
6
  Project-URL: Issues, https://github.com/sfertig/PyScene/issues
7
+ Project-URL: GUI-editor, https://github.com/sfertig/PyScene-Studio
7
8
  Author-email: Sam Fertig <sfertig007@gmail.com>
8
9
  License-Expression: MIT
9
10
  License-File: LICENSE
@@ -16,10 +17,11 @@ Description-Content-Type: text/markdown
16
17
 
17
18
  PyScene is a custom python + pygame framework / engine developed to streamline 2d game development.
18
19
  This is not a pygame wrapper, as it goed beyons the basic helper features and dives into a mini engine / framework.
20
+ There is also a GUI editor being developed alongside PyScene that can be veiwed at: https://github.com/sfertig/PyScene-Studio
19
21
 
20
22
  Please Note: This engine is still in development and many features, like tilemaps and audio, are a work in progress. It also lack any form of documentation, I ask for patience as docs will be rolled out once the core features are more solidified.
21
23
 
22
- PyScene is in developement and API's may change offten, a fully stable version should come with v2.0.0, currently on v1.1.3
24
+ PyScene is in developement and API's may change offten, a fully stable version should come with v2.0.0, currently on v1.1.4
23
25
 
24
26
  Getting Started Basics:
25
27
 
@@ -2,10 +2,11 @@
2
2
 
3
3
  PyScene is a custom python + pygame framework / engine developed to streamline 2d game development.
4
4
  This is not a pygame wrapper, as it goed beyons the basic helper features and dives into a mini engine / framework.
5
+ There is also a GUI editor being developed alongside PyScene that can be veiwed at: https://github.com/sfertig/PyScene-Studio
5
6
 
6
7
  Please Note: This engine is still in development and many features, like tilemaps and audio, are a work in progress. It also lack any form of documentation, I ask for patience as docs will be rolled out once the core features are more solidified.
7
8
 
8
- PyScene is in developement and API's may change offten, a fully stable version should come with v2.0.0, currently on v1.1.3
9
+ PyScene is in developement and API's may change offten, a fully stable version should come with v2.0.0, currently on v1.1.4
9
10
 
10
11
  Getting Started Basics:
11
12
 
@@ -3,7 +3,7 @@ requires = ["hatchling >= 1.26"]
3
3
  build-backend = "hatchling.build"
4
4
  [project]
5
5
  name = "PyScene"
6
- version = "1.1.3"
6
+ version = "1.1.4"
7
7
  authors = [
8
8
  { name="Sam Fertig", email="sfertig007@gmail.com" },
9
9
  ]
@@ -19,4 +19,5 @@ license-files = ["LICEN[CS]E*"]
19
19
 
20
20
  [project.urls]
21
21
  Homepage = "https://github.com/sfertig/PyScene"
22
- Issues = "https://github.com/sfertig/PyScene/issues"
22
+ Issues = "https://github.com/sfertig/PyScene/issues"
23
+ GUI-editor = "https://github.com/sfertig/PyScene-Studio"
@@ -72,7 +72,7 @@ class _game:
72
72
  if self.active_scene is None: self.queue_creation.append(obj)
73
73
  else: self.active_scene._queue_add(obj)
74
74
  def _queue_remove(self, obj):
75
- if obj in self.objects: self.objects.remove(obj)
75
+ if obj in self.objects: self.queue_del.remove(obj)
76
76
  else: self.active_scene._queue_remove(obj)
77
77
  def _get_id(self):
78
78
  self.id += 1
@@ -24,6 +24,7 @@ class GameObj: #this will be the base class of every game obj
24
24
  def child(self, obj): #obj is a game object
25
25
  self.__children.append(obj)
26
26
  obj.parent(self)
27
+ return obj #QOF
27
28
 
28
29
  def parent(self, obj):
29
30
  # If we already have a parent, remove ourselves from its list first
@@ -18,9 +18,28 @@ class Text(GameObj):
18
18
 
19
19
  def _update_surface(self):
20
20
  """Internal method to re-render surface only when text changes."""
21
- self.surface = self.font.render(str(self.text), False, self.color) # False for sharp pixel fonts!
22
- # Dynamically set rect based on alignment (topleft, center, topright, etc.)
23
- self.rect = self.surface.get_rect(**{self.align: self.pos.to_int()})
21
+ self.surface = self.font.render(str(self.text), False, self.color)
22
+ self._apply_alignment()
23
+
24
+ def _apply_alignment(self):
25
+ """Safely positions the rect based on single or multi-coordinate alignment."""
26
+ xy = self.pos.to_int() # Assuming this returns (x, y)
27
+
28
+ # Group single-coordinate attributes by which axis they care about
29
+ x_aligns = {"left", "right", "centerx", "x"}
30
+ y_aligns = {"top", "bottom", "centery", "y"}
31
+
32
+ if self.align in x_aligns:
33
+ # Create a default rect at (0,0), then assign the specific X coordinate
34
+ self.rect = self.surface.get_rect()
35
+ setattr(self.rect, self.align, xy[0])
36
+ elif self.align in y_aligns:
37
+ # Create a default rect at (0,0), then assign the specific Y coordinate
38
+ self.rect = self.surface.get_rect()
39
+ setattr(self.rect, self.align, xy[1])
40
+ else:
41
+ # Multi-coordinate alignments (center, topleft, etc.) safely accept the full tuple
42
+ self.rect = self.surface.get_rect(**{self.align: xy})
24
43
 
25
44
  def set_text(self, new_text, color=None):
26
45
  """Only call this when the string actually changes!"""
@@ -32,13 +51,15 @@ class Text(GameObj):
32
51
 
33
52
  def set_pos(self, new_pos: Vector2D):
34
53
  self.pos = new_pos
35
- self.rect = self.surface.get_rect(**{self.align: self.pos.to_int()})
54
+ self._apply_alignment()
36
55
 
37
56
  def render(self):
38
57
  Game.cam.draw_text(self.surface, self.rect, self.offset)
58
+
39
59
  def render_to(self, surface):
40
60
  surface.blit(self.surface, self.rect)
41
61
 
62
+
42
63
  class Image(GameObj):
43
64
  def __init__(self, image, pos=Vector2D(0, 0), z_index=0, active=True, visible=True, offset=True, Global=False):
44
65
  super().__init__(pos, z_index, active, visible, Global)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes