PyScene 1.1.7__tar.gz → 1.1.8__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.7 → pyscene-1.1.8}/PKG-INFO +2 -2
  2. {pyscene-1.1.7 → pyscene-1.1.8}/README.md +1 -1
  3. {pyscene-1.1.7 → pyscene-1.1.8}/pyproject.toml +1 -1
  4. {pyscene-1.1.7 → pyscene-1.1.8}/src/PyScene/Game.py +2 -27
  5. {pyscene-1.1.7 → pyscene-1.1.8}/src/PyScene/objs/GameObj.py +1 -1
  6. {pyscene-1.1.7 → pyscene-1.1.8}/src/PyScene/objs/Shapes.py +15 -13
  7. {pyscene-1.1.7 → pyscene-1.1.8}/src/PyScene/objs/Text.py +9 -8
  8. {pyscene-1.1.7 → pyscene-1.1.8}/src/PyScene/objs/Timer.py +1 -1
  9. {pyscene-1.1.7 → pyscene-1.1.8}/src/PyScene/objs/animation.py +7 -8
  10. {pyscene-1.1.7 → pyscene-1.1.8}/.gitignore +0 -0
  11. {pyscene-1.1.7 → pyscene-1.1.8}/LICENSE +0 -0
  12. {pyscene-1.1.7 → pyscene-1.1.8}/src/PyScene/Collisions.py +0 -0
  13. {pyscene-1.1.7 → pyscene-1.1.8}/src/PyScene/Keys.py +0 -0
  14. {pyscene-1.1.7 → pyscene-1.1.8}/src/PyScene/Math.py +0 -0
  15. {pyscene-1.1.7 → pyscene-1.1.8}/src/PyScene/Net.py +0 -0
  16. {pyscene-1.1.7 → pyscene-1.1.8}/src/PyScene/__init__.py +0 -0
  17. {pyscene-1.1.7 → pyscene-1.1.8}/src/PyScene/__main__.py +0 -0
  18. {pyscene-1.1.7 → pyscene-1.1.8}/src/PyScene/objs/Collision_shapes.py +0 -0
  19. {pyscene-1.1.7 → pyscene-1.1.8}/src/PyScene/objs/Tilemap.py +0 -0
  20. {pyscene-1.1.7 → pyscene-1.1.8}/src/PyScene/objs/__init__.py +0 -0
  21. {pyscene-1.1.7 → pyscene-1.1.8}/src/PyScene/tools/manager_gui.py +0 -0
  22. {pyscene-1.1.7 → pyscene-1.1.8}/src/PyScene/utils/Assets.py +0 -0
  23. {pyscene-1.1.7 → pyscene-1.1.8}/src/PyScene/utils/Subscreen.py +0 -0
  24. {pyscene-1.1.7 → pyscene-1.1.8}/src/PyScene/utils/__init__.py +0 -0
  25. {pyscene-1.1.7 → pyscene-1.1.8}/test.py +0 -0
  26. {pyscene-1.1.7 → pyscene-1.1.8}/tests/flappy_bird.py +0 -0
  27. {pyscene-1.1.7 → pyscene-1.1.8}/tests/pause.png +0 -0
  28. {pyscene-1.1.7 → pyscene-1.1.8}/tests/testColl.py +0 -0
  29. {pyscene-1.1.7 → pyscene-1.1.8}/tests/tileset.png +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: PyScene
3
- Version: 1.1.7
3
+ Version: 1.1.8
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
@@ -21,7 +21,7 @@ There is also a GUI editor being developed alongside PyScene that can be veiwed
21
21
 
22
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.
23
23
 
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.7
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.8
25
25
 
26
26
  Getting Started Basics:
27
27
 
@@ -6,7 +6,7 @@ There is also a GUI editor being developed alongside PyScene that can be veiwed
6
6
 
7
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.
8
8
 
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.7
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.8
10
10
 
11
11
  Getting Started Basics:
12
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.7"
6
+ version = "1.1.8"
7
7
  authors = [
8
8
  { name="Sam Fertig", email="sfertig007@gmail.com" },
9
9
  ]
@@ -150,7 +150,7 @@ class _game:
150
150
  #render call
151
151
  if self.active_scene is None:
152
152
  for obj in self.render_queue:
153
- if obj.visible: obj.render()
153
+ if obj.visible: obj.render(self.screen)
154
154
  #render scene
155
155
  else:
156
156
  self.active_scene.render()
@@ -239,7 +239,7 @@ class Scene:
239
239
  if _length != len(self._render_queue): self.__update_render_queue()
240
240
  #render
241
241
  for obj in self._render_queue:
242
- if obj.visible: obj.render()
242
+ if obj.visible: obj.render(Game.screen)
243
243
 
244
244
  def _queue_add(self, obj): self.queue_creation.append(obj)
245
245
  def _queue_remove(self, obj): self.queue_del.append(obj)
@@ -267,31 +267,6 @@ class Camera:
267
267
  self.pos = Vector2D(0, 0)
268
268
  self.game = game
269
269
 
270
- #rendering helpers
271
- def draw_rect(self, rect, color, width=0, offset=True):
272
- r = rect.copy()
273
- if offset: r.topleft = (r.x - self.pos.x, r.y - self.pos.y)
274
- pygame.draw.rect(self.game.screen, color, r, width)
275
- def draw_circle(self, pos, r, color, width=0, offset=True):
276
- p = pos.copy()
277
- if offset: p -= self.pos
278
- pygame.draw.circle(self.game.screen, color, p.to_int(), r, width)
279
- def draw_line(self, start, end, color, width=1, offset=True):
280
- s = start.copy()
281
- e = end.copy()
282
- if offset:
283
- s -= self.pos
284
- e -= self.pos
285
- pygame.draw.line(self.game.screen, color, s.to_int(), e.to_int(), width)
286
- def draw_text(self, surface, rect, offset=True):
287
- r = rect.copy()
288
- if offset: r.topleft = (r.x - self.pos.x, r.y - self.pos.y)
289
- self.game.screen.blit(surface, r)
290
- def draw_image(self, image, pos, offset=True):
291
- p = pos.copy()
292
- if offset: p -= self.pos
293
- self.game.screen.blit(image, p.to_int())
294
-
295
270
  def handle_collision(self, dim: Vector2D, Rect=None, ignore_self=True) -> dict:
296
271
  returns = {"on_floor": False, "on_wall": False}
297
272
 
@@ -37,7 +37,7 @@ class GameObj: #this will be the base class of every game obj
37
37
  self._parent = obj
38
38
 
39
39
  def update(self): pass
40
- def render(self): pass
40
+ def render(self, screen): pass
41
41
  def destroy(self):
42
42
  Game._queue_remove(self)
43
43
  for i in self._children:
@@ -16,11 +16,11 @@ class Rect(GameObj):
16
16
  def update(self):
17
17
  if self.pos.to_int() != self.rect.topleft: self.rect.topleft = self.pos.to_int()
18
18
 
19
- def render(self):
20
- Game.cam.draw_rect(self.rect, self.color, self.width, self.offset)
19
+ def render(self, screen):
20
+ r = self.rect.copy()
21
+ if self.offset: r.topleft = (r.x - self.pos.x, r.y - self.pos.y)
22
+ pygame.draw.rect(screen, self.color, r, self.width)
21
23
 
22
- def render_to(self, screen):
23
- pygame.draw.rect(screen, self.color, self.rect, self.width)
24
24
 
25
25
  class Circle(GameObj):
26
26
  def __init__(self, x, y, r, color, width=0, z_index=0, active=True, visible=True, offset=True, Global=False):
@@ -30,11 +30,10 @@ class Circle(GameObj):
30
30
  self.width = width
31
31
  self.offset = offset
32
32
 
33
- def render(self):
34
- Game.cam.draw_circle(self.pos, self.radius, self.color, self.width, self.offset)
35
-
36
- def render_to(self, screen):
37
- pygame.draw.circle(screen, self.color, self.pos.to_int(), self.radius, self.width)
33
+ def render(self, screen):
34
+ p = self.pos.copy()
35
+ if self.offset: p -= self.pos
36
+ pygame.draw.circle(screen, self.color, p.to_int(), self.r, self.width)
38
37
 
39
38
  class Line(GameObj):
40
39
  def __init__(self, x1, y1, x2, y2, color, width=1, z_index=0, active=True, visible=True, offset=True, Global=False):
@@ -44,7 +43,10 @@ class Line(GameObj):
44
43
  self.width = width
45
44
  self.offset = offset
46
45
 
47
- def render(self):
48
- Game.cam.draw_line(self.pos, self.end, self.color, self.width, self.offset)
49
- def render_to(self, screen):
50
- pygame.draw.line(screen, self.color, self.pos.to_int(), self.end.to_int(), self.width)
46
+ def render(self, screen):
47
+ s = self.pos.copy()
48
+ e = self.end.copy()
49
+ if self.offset:
50
+ s -= self.pos
51
+ e -= self.pos
52
+ pygame.draw.line(screen, self.color, s.to_int(), e.to_int(), self.width)
@@ -53,11 +53,11 @@ class Text(GameObj):
53
53
  self.pos = new_pos
54
54
  self._apply_alignment()
55
55
 
56
- def render(self):
57
- Game.cam.draw_text(self.surface, self.rect, self.offset)
56
+ def render(self, screen):
57
+ r = self.rect.copy()
58
+ if self.offset: r.topleft = (r.x - self.pos.x, r.y - self.pos.y)
59
+ screen.blit(self.surface, r)
58
60
 
59
- def render_to(self, surface):
60
- surface.blit(self.surface, self.rect)
61
61
 
62
62
 
63
63
  class Image(GameObj):
@@ -66,8 +66,9 @@ class Image(GameObj):
66
66
  self.image = image
67
67
  self.offset = offset
68
68
 
69
- def render(self):
70
- Game.cam.draw_image(self.image, self.pos, self.offset)
71
- def render_to(self, surface):
72
- surface.blit(self.image, self.pos.to_int())
69
+ def render(self, screen):
70
+ p = self.pos.copy()
71
+ if self.offset: p -= self.pos
72
+ screen.blit(self.image, p.to_int())
73
+
73
74
 
@@ -3,7 +3,7 @@ from ..Game import Game
3
3
  from ..Math import Vector2D
4
4
 
5
5
  class Timer(GameObj):
6
- def __init__(self, duration, z_index=0, active=True, visible=True, offset=True, Global=False):
6
+ def __init__(self, duration, active=True, Global=False):
7
7
  super().__init__(Vector2D(0, 0), 0, active, True, Global)
8
8
  self.duration = duration
9
9
  self.elapsed = 0.0
@@ -66,10 +66,11 @@ class Animation(GameObj):
66
66
 
67
67
  def copy(self):
68
68
  return Animation(self.image, self.size, self.fps, self.loop, self.pos, self.z_index, self._active, self.visible, self.offset, self._global)
69
- def render(self):
70
- Game.cam.draw_image(self.get_image(), self.pos, self.offset)
71
- def render_to(self, screen):
72
- screen.blit(self.get_image(), self.pos.to_int())
69
+ def render(self, screen):
70
+ p = self.pos.copy()
71
+ if self.offset: p -= self.pos
72
+ screen.blit(self.get_image(), p.to_int())
73
+
73
74
 
74
75
  class AnimationManager(GameObj):
75
76
  def __init__(self, animations: dict[str, Animation], current_anim=None, z_index=0, active=True, visible=True, offset=True, Global=False):
@@ -114,7 +115,5 @@ class AnimationManager(GameObj):
114
115
  return
115
116
  return self.animations[self.current_anim]
116
117
 
117
- def render(self):
118
- self.get_animation().render()
119
- def render_to(self, screen):
120
- self.get_animation().render_to(screen)
118
+ def render(self, screen):
119
+ self.get_animation().render(screen)
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