crystalwindow 5.0__py3-none-any.whl → 5.2__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.
crystalwindow/camera.py CHANGED
@@ -6,13 +6,14 @@ class Camera:
6
6
  self.speed = speed # smoothness
7
7
 
8
8
  def update(self, win_width, win_height, dt):
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
9
+ # camera aims for target selected
10
+ if self.target is not None:
11
+ target_x = self.target.x - win_width // 2
12
+ target_y = self.target.y - win_height // 2
13
+
14
+ # smooth lerp follow
15
+ self.offset_x += (target_x - self.offset_x) * self.speed
16
+ self.offset_y += (target_y - self.offset_y) * self.speed
16
17
 
17
18
  if hasattr(self, "shake"):
18
19
  self.shake.update(dt)
crystalwindow/gui.py CHANGED
@@ -16,13 +16,14 @@ def lerp_color(c1, c2, t):
16
16
 
17
17
  # ----------------- GUI Elements -----------------
18
18
  class Button:
19
- def __init__(self, rect, text,
19
+ def __init__(self, pos, size, text,
20
20
  color=(200,200,200),
21
21
  hover_color=(255,255,255),
22
22
  press_color=(180,180,180),
23
23
  text_color=(0,0,0)):
24
24
 
25
- self.rect = rect
25
+ self.pos = pos
26
+ self.size = size
26
27
  self.text = text
27
28
 
28
29
  self.color = color
@@ -45,7 +46,8 @@ class Button:
45
46
  # ======================================
46
47
  def update(self, win):
47
48
  mx, my = win.mouse_pos
48
- x, y, w, h = self.rect
49
+ x, y = self.pos
50
+ w, h = self.size
49
51
 
50
52
  # Reset transient states
51
53
  self._clicked = False
@@ -94,7 +96,8 @@ class Button:
94
96
  # DRAW
95
97
  # ======================================
96
98
  def draw(self, win):
97
- x, y, w, h = self.rect
99
+ x, y = self.pos
100
+ w, h = self.size
98
101
 
99
102
  # choose color by state
100
103
  if self._held:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: crystalwindow
3
- Version: 5.0
3
+ Version: 5.2
4
4
  Summary: A Tkinter powered window + GUI toolkit made by Crystal (ME)! Easier apps, smoother UI and all-in-one helpers!, Gui, Buttons, FileHelper, Sprites, Animations, Colors, Math, Gravity, Camera, 3D and more!
5
5
  Home-page: https://pypi.org/project/crystalwindow/
6
6
  Author: CrystalBallyHereXD
@@ -3,7 +3,7 @@ crystalwindow/__init__.py,sha256=dqow94sID2DEnUwiIFtmz38RrVGautAVMz1c4Wrt6BU,295
3
3
  crystalwindow/ai.py,sha256=YIt6dNe1QljSAlNECCVa3DMUSIqQEJRIAAbQpYqFNNo,11525
4
4
  crystalwindow/animation.py,sha256=zHjrdBXQeyNaLAuaGPldJueX05OZ5j31YR8NizmR0uQ,427
5
5
  crystalwindow/assets.py,sha256=8MxPSk7W5YcBnKDh6KcLdg34uxmACf_m6feSYFCWHqA,11405
6
- crystalwindow/camera.py,sha256=1PGGzCCelI6a7aWOuiqqM2OgmrHOBeyobAnSbX-tWgw,1338
6
+ crystalwindow/camera.py,sha256=sjaC7g_9TstypLQ99MacSlIKm2wky0OrBOiMDcngL-I,1397
7
7
  crystalwindow/chatvpn.py,sha256=Ij3wRNrMbPINO-SX9vx8xlrKRLvG7zJgzAN2T0jzSz8,2477
8
8
  crystalwindow/clock.py,sha256=M7oMjnGNkFOcchqtQn_voWao4kFtxXpTJe2VUjqvGKQ,5041
9
9
  crystalwindow/collision.py,sha256=hpkHTp_KparghVK-itp_rxuYdd2GbQMxICHlUBv0rSw,472
@@ -15,7 +15,7 @@ crystalwindow/draw_text_helper.py,sha256=qv5fFCuTCKWeGDk9Z_ZpOzrTFP8YYwlgQrrorwr
15
15
  crystalwindow/draw_tool.py,sha256=1YYEqjmgt4HpV3S15sTjCSmcqgHup4fD8gskTkxU0t4,1638
16
16
  crystalwindow/fun_helpers.py,sha256=UHfveBTJ3NlgFd8ZbEJpHtQL-YUWiG7Hl9CWhT06VmQ,5144
17
17
  crystalwindow/gravity.py,sha256=pZJykZzO-mKVBPsZRP55nnlvUoYQfR29wPgJcI4IbBs,2904
18
- crystalwindow/gui.py,sha256=_T4diMardg50gk0_OBpFHfJo5Coo-D3aZt3Vl6PJjxQ,5287
18
+ crystalwindow/gui.py,sha256=9JA25IztgqSYN1NnWVKK99G0rlEosXf2ATWww2rUZIQ,5353
19
19
  crystalwindow/gui_ext.py,sha256=JctpNPr7gtGdro3csyUo9ft3FFArj3JhkVlgKF0lyME,3407
20
20
  crystalwindow/math.py,sha256=slOY3KQZ99VDMUMxsSJabMyRtJcwVzEyxR2RoXspHho,963
21
21
  crystalwindow/messagebus.py,sha256=9K2P_TkdQ1rt-oouIkRg_XHwMTwykttBt-9gFYaItyI,696
@@ -38,8 +38,8 @@ crystalwindow/gametests/sandbox.py,sha256=Oo2tU2N0y3BPVa6T5vs_h9N6islhQrjSrr_78X
38
38
  crystalwindow/gametests/squaremove.py,sha256=ei6DMnvcgpOhmxbGv-Yqmx5EqiZjKbVlZhI7YbT2hY8,643
39
39
  crystalwindow/gametests/testtttagain.py,sha256=oIhK9MGgMVly_W2lRwD9Hn9WyPdd8JnX2HGrLTGZdxY,373
40
40
  crystalwindow/gametests/windowtesting.py,sha256=_9X6wnV1-_X_PtNS-0zu-k209NtFIwAc4vpxLPp7V2o,97
41
- crystalwindow-5.0.dist-info/licenses/LICENSE,sha256=Gt5cJRchdNt0guxyQMHKsATN5PM5mjuDhdO6Gzs9qQc,1096
42
- crystalwindow-5.0.dist-info/METADATA,sha256=f8EeXFbNXNJFSHd_ly89rr0dUXLDMcF7G8X5Ti61J9g,7523
43
- crystalwindow-5.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
44
- crystalwindow-5.0.dist-info/top_level.txt,sha256=PeQSld4b19XWT-zvbYkvE2Xg8sakIMbDzSzSdOSRN8o,14
45
- crystalwindow-5.0.dist-info/RECORD,,
41
+ crystalwindow-5.2.dist-info/licenses/LICENSE,sha256=Gt5cJRchdNt0guxyQMHKsATN5PM5mjuDhdO6Gzs9qQc,1096
42
+ crystalwindow-5.2.dist-info/METADATA,sha256=6XkDWa8OTbQC4aeAaceeydLDAxPhAVl022ogenpVTII,7523
43
+ crystalwindow-5.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
44
+ crystalwindow-5.2.dist-info/top_level.txt,sha256=PeQSld4b19XWT-zvbYkvE2Xg8sakIMbDzSzSdOSRN8o,14
45
+ crystalwindow-5.2.dist-info/RECORD,,