crystalwindow 3.6.post3__tar.gz → 3.6.post4__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 (43) hide show
  1. {crystalwindow-3.6.post3/crystalwindow.egg-info → crystalwindow-3.6.post4}/PKG-INFO +1 -1
  2. crystalwindow-3.6.post4/crystalwindow/camera.py +19 -0
  3. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/crystalwindow/sprites.py +8 -3
  4. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4/crystalwindow.egg-info}/PKG-INFO +1 -1
  5. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/crystalwindow.egg-info/SOURCES.txt +1 -0
  6. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/setup.py +1 -1
  7. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/LICENSE +0 -0
  8. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/MANIFEST.in +0 -0
  9. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/README.md +0 -0
  10. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/crystalwindow/FileHelper.py +0 -0
  11. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/crystalwindow/Icons/default_icon.png +0 -0
  12. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/crystalwindow/__init__.py +0 -0
  13. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/crystalwindow/animation.py +0 -0
  14. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/crystalwindow/assets.py +0 -0
  15. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/crystalwindow/clock.py +0 -0
  16. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/crystalwindow/collision.py +0 -0
  17. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/crystalwindow/crystal3d.py +0 -0
  18. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/crystalwindow/docs/getting_started.md +0 -0
  19. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/crystalwindow/docs/index.md +0 -0
  20. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/crystalwindow/draw_helpers.py +0 -0
  21. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/crystalwindow/draw_rects.py +0 -0
  22. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/crystalwindow/draw_text_helper.py +0 -0
  23. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/crystalwindow/draw_tool.py +0 -0
  24. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/crystalwindow/fun_helpers.py +0 -0
  25. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/crystalwindow/gametests/3dsquare.py +0 -0
  26. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/crystalwindow/gametests/__init__.py +0 -0
  27. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/crystalwindow/gametests/__main__.py +0 -0
  28. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/crystalwindow/gametests/gravitytest.py +0 -0
  29. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/crystalwindow/gametests/guitesting.py +0 -0
  30. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/crystalwindow/gametests/sandbox.py +0 -0
  31. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/crystalwindow/gametests/squaremove.py +0 -0
  32. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/crystalwindow/gametests/windowtesting.py +0 -0
  33. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/crystalwindow/gravity.py +0 -0
  34. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/crystalwindow/gui.py +0 -0
  35. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/crystalwindow/gui_ext.py +0 -0
  36. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/crystalwindow/math.py +0 -0
  37. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/crystalwindow/player.py +0 -0
  38. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/crystalwindow/tilemap.py +0 -0
  39. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/crystalwindow/ver_warner.py +0 -0
  40. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/crystalwindow/window.py +0 -0
  41. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/crystalwindow.egg-info/dependency_links.txt +0 -0
  42. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/crystalwindow.egg-info/top_level.txt +0 -0
  43. {crystalwindow-3.6.post3 → crystalwindow-3.6.post4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: crystalwindow
3
- Version: 3.6.post3
3
+ Version: 3.6.post4
4
4
  Summary: A Tkinter powered window + GUI toolkit made by Crystal (MEEEEEE)! Easier apps, smoother UI and all-in-one helpers!
5
5
  Home-page: https://pypi.org/project/crystalwindow/
6
6
  Author: CrystalBallyHereXD
@@ -0,0 +1,19 @@
1
+ class Camera:
2
+ def __init__(self, target, speed=0.1):
3
+ self.target = target # sprite or obj w/ x,y
4
+ self.offset_x = 0
5
+ self.offset_y = 0
6
+ self.speed = speed # smoothness
7
+
8
+ def update(self, win_width, win_height):
9
+ # camera aims for target center
10
+ target_x = self.target.x - win_width // 2
11
+ target_y = self.target.y - win_height // 2
12
+
13
+ # smooth lerp follow
14
+ self.offset_x += (target_x - self.offset_x) * self.speed
15
+ self.offset_y += (target_y - self.offset_y) * self.speed
16
+
17
+ def apply(self, obj):
18
+ # shift object's draw position by camera offset
19
+ return obj.x - self.offset_x, obj.y - self.offset_y
@@ -39,12 +39,17 @@ class Sprite:
39
39
  return cls(pos, size=(w, h), color=color)
40
40
 
41
41
  # === METHODS ===
42
- def draw(self, win):
42
+ def draw(self, win, cam=None):
43
43
  """Draw sprite on a CrystalWindow or Tkinter canvas"""
44
+ if cam:
45
+ draw_x, draw_y = cam.apply(self)
46
+ else:
47
+ draw_x, draw_y = self.x, self.y
48
+
44
49
  if self.image:
45
- win.canvas.create_image(self.x, self.y, anchor="nw", image=self.image)
50
+ win.canvas.create_image(draw_x, draw_y, anchor="nw", image=self.image)
46
51
  else:
47
- win.draw_rect(self.color, (self.x, self.y, self.width, self.height))
52
+ win.draw_rect(self.color, (draw_x, draw_y, self.width, self.height))
48
53
 
49
54
  def move(self, dx, dy):
50
55
  """Move sprite by dx/dy"""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: crystalwindow
3
- Version: 3.6.post3
3
+ Version: 3.6.post4
4
4
  Summary: A Tkinter powered window + GUI toolkit made by Crystal (MEEEEEE)! Easier apps, smoother UI and all-in-one helpers!
5
5
  Home-page: https://pypi.org/project/crystalwindow/
6
6
  Author: CrystalBallyHereXD
@@ -6,6 +6,7 @@ crystalwindow/FileHelper.py
6
6
  crystalwindow/__init__.py
7
7
  crystalwindow/animation.py
8
8
  crystalwindow/assets.py
9
+ crystalwindow/camera.py
9
10
  crystalwindow/clock.py
10
11
  crystalwindow/collision.py
11
12
  crystalwindow/crystal3d.py
@@ -7,7 +7,7 @@ with open("README.md", encoding="utf-8") as f:
7
7
 
8
8
  setup(
9
9
  name="crystalwindow",
10
- version="3.6.post3", # Force metadata refresh
10
+ version="3.6.post4", # Force metadata refresh
11
11
  packages=find_packages(include=["crystalwindow", "crystalwindow.*"]),
12
12
 
13
13
  include_package_data=True, # include package_data files