crystalwindow 4.7__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.
- crystalwindow-4.7/LICENSE +21 -0
- crystalwindow-4.7/MANIFEST.in +2 -0
- crystalwindow-4.7/PKG-INFO +276 -0
- crystalwindow-4.7/README.md +242 -0
- crystalwindow-4.7/crystalwindow/FileHelper.py +263 -0
- crystalwindow-4.7/crystalwindow/Icons/default_icon.png +0 -0
- crystalwindow-4.7/crystalwindow/Icons/file_icons.png +0 -0
- crystalwindow-4.7/crystalwindow/__init__.py +96 -0
- crystalwindow-4.7/crystalwindow/ai.py +314 -0
- crystalwindow-4.7/crystalwindow/animation.py +15 -0
- crystalwindow-4.7/crystalwindow/assets.py +382 -0
- crystalwindow-4.7/crystalwindow/camera.py +19 -0
- crystalwindow-4.7/crystalwindow/clock.py +147 -0
- crystalwindow-4.7/crystalwindow/collision.py +15 -0
- crystalwindow-4.7/crystalwindow/color_handler.py +105 -0
- crystalwindow-4.7/crystalwindow/crystal3d.py +140 -0
- crystalwindow-4.7/crystalwindow/docs/getting_started.md +209 -0
- crystalwindow-4.7/crystalwindow/docs/index.md +27 -0
- crystalwindow-4.7/crystalwindow/draw_helpers.py +23 -0
- crystalwindow-4.7/crystalwindow/draw_rects.py +36 -0
- crystalwindow-4.7/crystalwindow/draw_text_helper.py +46 -0
- crystalwindow-4.7/crystalwindow/draw_tool.py +49 -0
- crystalwindow-4.7/crystalwindow/fun_helpers.py +32 -0
- crystalwindow-4.7/crystalwindow/gametests/3dsquare.py +36 -0
- crystalwindow-4.7/crystalwindow/gametests/__init__.py +9 -0
- crystalwindow-4.7/crystalwindow/gametests/__main__.py +25 -0
- crystalwindow-4.7/crystalwindow/gametests/gravitytest.py +120 -0
- crystalwindow-4.7/crystalwindow/gametests/guitesting.py +58 -0
- crystalwindow-4.7/crystalwindow/gametests/sandbox.py +49 -0
- crystalwindow-4.7/crystalwindow/gametests/squaremove.py +24 -0
- crystalwindow-4.7/crystalwindow/gametests/testtttagain.py +17 -0
- crystalwindow-4.7/crystalwindow/gametests/windowtesting.py +5 -0
- crystalwindow-4.7/crystalwindow/gravity.py +86 -0
- crystalwindow-4.7/crystalwindow/gui.py +184 -0
- crystalwindow-4.7/crystalwindow/gui_ext.py +110 -0
- crystalwindow-4.7/crystalwindow/math.py +40 -0
- crystalwindow-4.7/crystalwindow/objects.py +171 -0
- crystalwindow-4.7/crystalwindow/sprites.py +257 -0
- crystalwindow-4.7/crystalwindow/tilemap.py +13 -0
- crystalwindow-4.7/crystalwindow/ver_warner.py +101 -0
- crystalwindow-4.7/crystalwindow/websearch.py +159 -0
- crystalwindow-4.7/crystalwindow/window.py +652 -0
- crystalwindow-4.7/crystalwindow.egg-info/PKG-INFO +276 -0
- crystalwindow-4.7/crystalwindow.egg-info/SOURCES.txt +47 -0
- crystalwindow-4.7/crystalwindow.egg-info/dependency_links.txt +1 -0
- crystalwindow-4.7/crystalwindow.egg-info/requires.txt +3 -0
- crystalwindow-4.7/crystalwindow.egg-info/top_level.txt +1 -0
- crystalwindow-4.7/setup.cfg +4 -0
- crystalwindow-4.7/setup.py +52 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 CrystalBallyHereXD
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: crystalwindow
|
|
3
|
+
Version: 4.7
|
|
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
|
+
Home-page: https://pypi.org/project/crystalwindow/
|
|
6
|
+
Author: CrystalBallyHereXD
|
|
7
|
+
Author-email: mavilla.519@gmail.com
|
|
8
|
+
Project-URL: Homepage, https://github.com/yourusername/crystalwindow
|
|
9
|
+
Project-URL: YouTube, https://www.Youtube.com/@CrystalBallyHereXD
|
|
10
|
+
Project-URL: PiWheels, https://www.piwheels.org/project/crystalwindow/
|
|
11
|
+
Keywords: tkinter gui window toolkit easy crystalwindow crystal cw player moveable easygui python py file math gravity hex color
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Topic :: Software Development :: User Interfaces
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Requires-Python: >=3.6
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Requires-Dist: requests
|
|
20
|
+
Requires-Dist: packaging
|
|
21
|
+
Requires-Dist: pillow
|
|
22
|
+
Dynamic: author
|
|
23
|
+
Dynamic: author-email
|
|
24
|
+
Dynamic: classifier
|
|
25
|
+
Dynamic: description
|
|
26
|
+
Dynamic: description-content-type
|
|
27
|
+
Dynamic: home-page
|
|
28
|
+
Dynamic: keywords
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
Dynamic: project-url
|
|
31
|
+
Dynamic: requires-dist
|
|
32
|
+
Dynamic: requires-python
|
|
33
|
+
Dynamic: summary
|
|
34
|
+
|
|
35
|
+
# CRYSTALWINDOW!!!
|
|
36
|
+
|
|
37
|
+
A tiny but mighty Tkinter framework that gives u a full window system, GUI magic, physics, and file power — all packed into one clean lil module. made by crystal
|
|
38
|
+
|
|
39
|
+
No setup pain. No folder chaos.
|
|
40
|
+
Just import it. Boom. Instant game window. 🎮
|
|
41
|
+
|
|
42
|
+
# Quick Start
|
|
43
|
+
pip install crystalwindow
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
then make a new .py file:
|
|
47
|
+
|
|
48
|
+
from crystalwindow import Window # imports everything from crystalwindow (in this case its Window)
|
|
49
|
+
|
|
50
|
+
win = Window(800, 600, "Crystal Demo") # setup: Window(width, height, name, icon=MyIcon.ico)
|
|
51
|
+
win.run() # runs the window loop
|
|
52
|
+
win.quit() # closes it (for RAM n CPU)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
Run it. and boom, instant working window.
|
|
56
|
+
Yes, THAT easy.
|
|
57
|
+
|
|
58
|
+
# Easy crystalwindow window + Gui + Text file:
|
|
59
|
+
from crystalwindow import *
|
|
60
|
+
|
|
61
|
+
win = Window(800, 600, "CrystalWindowLib Mega Sandbox")
|
|
62
|
+
|
|
63
|
+
gui = GUIManager()
|
|
64
|
+
toggle1 = Toggle((50, 50, 100, 40), value=False)
|
|
65
|
+
slider1 = Slider((50, 120, 200, 30), min_val=0, max_val=100, value=50)
|
|
66
|
+
|
|
67
|
+
btn1 = Button(rect=(50, 200, 150, 50), text="Click Me!", color=random_color(),
|
|
68
|
+
hover_color=random_color(), callback=lambda: print("Button clicked!"))
|
|
69
|
+
lbl1 = Label((250, 50), "Hello GUI!", color=random_color(), size=24)
|
|
70
|
+
|
|
71
|
+
gui.add(toggle1)
|
|
72
|
+
gui.add(slider1)
|
|
73
|
+
gui.add(btn1)
|
|
74
|
+
gui.add(lbl1)
|
|
75
|
+
|
|
76
|
+
# --- Debug Overlay ---
|
|
77
|
+
debug = DebugOverlay()
|
|
78
|
+
|
|
79
|
+
# --- Camera Shake ---
|
|
80
|
+
shake = CameraShake(intensity=20)
|
|
81
|
+
|
|
82
|
+
# --- Main loop ---
|
|
83
|
+
def update(win):
|
|
84
|
+
gui.update(win)
|
|
85
|
+
gui.draw(win)
|
|
86
|
+
|
|
87
|
+
# --- draw text examples ---
|
|
88
|
+
win.draw_text_later("Normal Text", pos=(400, 50), size=18, color=random_color())
|
|
89
|
+
win.draw_text_later("Bold Text", pos=(400, 80), size=20, color=random_color(), bold=True)
|
|
90
|
+
win.draw_text_later("Italic Text", pos=(400, 110), size=20, color=random_color(), italic=True)
|
|
91
|
+
win.draw_text_later("Bold + Italic", pos=(400, 140), size=22, color=random_color(), bold=True, italic=True)
|
|
92
|
+
|
|
93
|
+
# --- draw toggle/slider values ---
|
|
94
|
+
win.draw_text_later(f"Toggle: {toggle1.value}", pos=(50, 90), size=18)
|
|
95
|
+
win.draw_text_later(f"Slider: {int(slider1.value)}", pos=(50, 160), size=18)
|
|
96
|
+
|
|
97
|
+
# --- draw gradient ---
|
|
98
|
+
gradient_rect(win, (50, 300, 200, 100), (255,0,0), (0,0,255))
|
|
99
|
+
|
|
100
|
+
# --- screen shake example (move a rectangle with shake) ---
|
|
101
|
+
shake.update()
|
|
102
|
+
x_off, y_off = shake.offset
|
|
103
|
+
win.draw_rect((0,255,0), (500+x_off, 300+y_off, 100, 50))
|
|
104
|
+
|
|
105
|
+
# --- draw random name + color ---
|
|
106
|
+
win.draw_text_later(f"Random Name: {random_name()}", pos=(50, 420), size=20, color=random_color())
|
|
107
|
+
|
|
108
|
+
# --- debug overlay ---
|
|
109
|
+
debug.draw(win, fps=int(win.clock.get_fps()))
|
|
110
|
+
|
|
111
|
+
win.run(update)
|
|
112
|
+
win.quit()
|
|
113
|
+
|
|
114
|
+
And now thats how you use it!
|
|
115
|
+
|
|
116
|
+
# Current Variables.
|
|
117
|
+
|
|
118
|
+
# Whats Inside
|
|
119
|
+
|
|
120
|
+
Built-in window manager
|
|
121
|
+
|
|
122
|
+
Built-in GUI (buttons, sliders, toggles, labels)
|
|
123
|
+
|
|
124
|
+
Built-in gravity + physics engine
|
|
125
|
+
|
|
126
|
+
Tilemap system (place & save blocks!)
|
|
127
|
+
|
|
128
|
+
Image loader (with default base64 logo)
|
|
129
|
+
|
|
130
|
+
Safe startup (works even inside PyInstaller)
|
|
131
|
+
|
|
132
|
+
Mathematics Handler
|
|
133
|
+
|
|
134
|
+
Works offline
|
|
135
|
+
|
|
136
|
+
Minimal syntax
|
|
137
|
+
|
|
138
|
+
Full debug overlay
|
|
139
|
+
|
|
140
|
+
# Window System
|
|
141
|
+
from crystalwindow import *
|
|
142
|
+
|
|
143
|
+
win = Window(800, 600, "My Game", icon="MyIcon.png")
|
|
144
|
+
|
|
145
|
+
def loop(win):
|
|
146
|
+
win.fill((10, 10, 30))
|
|
147
|
+
# draw or update stuff here
|
|
148
|
+
|
|
149
|
+
win.run(loop)
|
|
150
|
+
win.quit()
|
|
151
|
+
|
|
152
|
+
# Features
|
|
153
|
+
* handles events
|
|
154
|
+
* tracks keys + mouse
|
|
155
|
+
* supports fullscreen
|
|
156
|
+
* safe to close anytime
|
|
157
|
+
|
|
158
|
+
# Player Example
|
|
159
|
+
player = Player(100, 100)
|
|
160
|
+
|
|
161
|
+
def loop(win):
|
|
162
|
+
player.update(win.keys)
|
|
163
|
+
player.draw(win.screen)
|
|
164
|
+
move(dx, dy) -> moves player
|
|
165
|
+
take_damage(x) -> takes damage
|
|
166
|
+
heal(x) -> heals
|
|
167
|
+
draw(surface) -> renders sprite
|
|
168
|
+
|
|
169
|
+
# TileMap
|
|
170
|
+
tilemap = TileMap(32)
|
|
171
|
+
tilemap.add_tile(5, 5, "grass")
|
|
172
|
+
tilemap.save("level.json")
|
|
173
|
+
add_tile(x, y, type)
|
|
174
|
+
remove_tile(x, y)
|
|
175
|
+
draw(surface)
|
|
176
|
+
save(file) / load(file)
|
|
177
|
+
|
|
178
|
+
# GUI System
|
|
179
|
+
btn = Button(20, 20, 120, 40, "Click Me!", lambda: print("yo"))
|
|
180
|
+
gui = GUIManager()
|
|
181
|
+
gui.add(btn)
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
Use built-in stuff like:
|
|
185
|
+
|
|
186
|
+
Button(x, y, w, h, text, onclick)
|
|
187
|
+
Label(x, y, text)
|
|
188
|
+
Toggle(x, y, w, h, text, default=False)
|
|
189
|
+
Slider(x, y, w, min, max, default)
|
|
190
|
+
|
|
191
|
+
# Gravity
|
|
192
|
+
g = Gravity(0.5)
|
|
193
|
+
g.update(player)
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
makes objects fall realistically. ez.
|
|
197
|
+
|
|
198
|
+
# FileHelper
|
|
199
|
+
save_json("data.json", {"coins": 99})
|
|
200
|
+
data = load_json("data.json")
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
Also supports:
|
|
204
|
+
|
|
205
|
+
save_pickle / load_pickle
|
|
206
|
+
|
|
207
|
+
FileDialog("save") (tkinter dialog popup)
|
|
208
|
+
|
|
209
|
+
# DrawHelper
|
|
210
|
+
DrawHelper.text(win.screen, "Hello!", (10,10), (255,255,255), 24)
|
|
211
|
+
DrawHelper.rect(win.screen, (100,0,200), (50,50,100,60))
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
perfect for ui & quick visuals
|
|
215
|
+
|
|
216
|
+
# Debug Tools
|
|
217
|
+
debug = DebugOverlay()
|
|
218
|
+
debug.toggle() # show or hide FPS
|
|
219
|
+
debug.draw(win.screen, {"hp": 100, "fps": win.clock.get_fps()})
|
|
220
|
+
|
|
221
|
+
# Mathematics
|
|
222
|
+
math = Mathematics()
|
|
223
|
+
* Current Variables
|
|
224
|
+
math.add(num1, num2)
|
|
225
|
+
math.subtract(num1, num2)
|
|
226
|
+
math.multiply(num1, num2)
|
|
227
|
+
math.divide(num1, num2)
|
|
228
|
+
|
|
229
|
+
# Example Game
|
|
230
|
+
from crystalwindow import *
|
|
231
|
+
|
|
232
|
+
win = Window(800, 600, "My Cool Game")
|
|
233
|
+
player = Player(100, 100)
|
|
234
|
+
gravity = Gravity()
|
|
235
|
+
|
|
236
|
+
def update(win):
|
|
237
|
+
win.fill((25, 25, 40))
|
|
238
|
+
player.update(win.keys)
|
|
239
|
+
gravity.update(player)
|
|
240
|
+
player.draw(win.screen)
|
|
241
|
+
|
|
242
|
+
win.run(update)
|
|
243
|
+
win.quit()
|
|
244
|
+
|
|
245
|
+
# Default Logo
|
|
246
|
+
|
|
247
|
+
There is a lil encoded PNG inside the file called:
|
|
248
|
+
|
|
249
|
+
DEFAULT_LOGO_BASE64
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
Its used when no icon is given.
|
|
253
|
+
Set ur own like:
|
|
254
|
+
|
|
255
|
+
Window(800, 600, "My Window", icon="MyIcon.png")
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
or do whatever you want.. i guess.
|
|
259
|
+
|
|
260
|
+
# Example Integration
|
|
261
|
+
from crystalwindow import Window
|
|
262
|
+
|
|
263
|
+
win = Window(800, 600, "My Window", icon="MyIcon.png")
|
|
264
|
+
|
|
265
|
+
while win.running:
|
|
266
|
+
win.check_events()
|
|
267
|
+
win.fill((10, 10, 20))
|
|
268
|
+
win.run()
|
|
269
|
+
win.quit()
|
|
270
|
+
|
|
271
|
+
# Credits
|
|
272
|
+
|
|
273
|
+
Made by: CrystalBallyHereXD
|
|
274
|
+
Framework: CrystalWindow
|
|
275
|
+
Powered by: Tkinter and Python
|
|
276
|
+
License: Free to use, modify, and vibe with it!
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
# CRYSTALWINDOW!!!
|
|
2
|
+
|
|
3
|
+
A tiny but mighty Tkinter framework that gives u a full window system, GUI magic, physics, and file power — all packed into one clean lil module. made by crystal
|
|
4
|
+
|
|
5
|
+
No setup pain. No folder chaos.
|
|
6
|
+
Just import it. Boom. Instant game window. 🎮
|
|
7
|
+
|
|
8
|
+
# Quick Start
|
|
9
|
+
pip install crystalwindow
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
then make a new .py file:
|
|
13
|
+
|
|
14
|
+
from crystalwindow import Window # imports everything from crystalwindow (in this case its Window)
|
|
15
|
+
|
|
16
|
+
win = Window(800, 600, "Crystal Demo") # setup: Window(width, height, name, icon=MyIcon.ico)
|
|
17
|
+
win.run() # runs the window loop
|
|
18
|
+
win.quit() # closes it (for RAM n CPU)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
Run it. and boom, instant working window.
|
|
22
|
+
Yes, THAT easy.
|
|
23
|
+
|
|
24
|
+
# Easy crystalwindow window + Gui + Text file:
|
|
25
|
+
from crystalwindow import *
|
|
26
|
+
|
|
27
|
+
win = Window(800, 600, "CrystalWindowLib Mega Sandbox")
|
|
28
|
+
|
|
29
|
+
gui = GUIManager()
|
|
30
|
+
toggle1 = Toggle((50, 50, 100, 40), value=False)
|
|
31
|
+
slider1 = Slider((50, 120, 200, 30), min_val=0, max_val=100, value=50)
|
|
32
|
+
|
|
33
|
+
btn1 = Button(rect=(50, 200, 150, 50), text="Click Me!", color=random_color(),
|
|
34
|
+
hover_color=random_color(), callback=lambda: print("Button clicked!"))
|
|
35
|
+
lbl1 = Label((250, 50), "Hello GUI!", color=random_color(), size=24)
|
|
36
|
+
|
|
37
|
+
gui.add(toggle1)
|
|
38
|
+
gui.add(slider1)
|
|
39
|
+
gui.add(btn1)
|
|
40
|
+
gui.add(lbl1)
|
|
41
|
+
|
|
42
|
+
# --- Debug Overlay ---
|
|
43
|
+
debug = DebugOverlay()
|
|
44
|
+
|
|
45
|
+
# --- Camera Shake ---
|
|
46
|
+
shake = CameraShake(intensity=20)
|
|
47
|
+
|
|
48
|
+
# --- Main loop ---
|
|
49
|
+
def update(win):
|
|
50
|
+
gui.update(win)
|
|
51
|
+
gui.draw(win)
|
|
52
|
+
|
|
53
|
+
# --- draw text examples ---
|
|
54
|
+
win.draw_text_later("Normal Text", pos=(400, 50), size=18, color=random_color())
|
|
55
|
+
win.draw_text_later("Bold Text", pos=(400, 80), size=20, color=random_color(), bold=True)
|
|
56
|
+
win.draw_text_later("Italic Text", pos=(400, 110), size=20, color=random_color(), italic=True)
|
|
57
|
+
win.draw_text_later("Bold + Italic", pos=(400, 140), size=22, color=random_color(), bold=True, italic=True)
|
|
58
|
+
|
|
59
|
+
# --- draw toggle/slider values ---
|
|
60
|
+
win.draw_text_later(f"Toggle: {toggle1.value}", pos=(50, 90), size=18)
|
|
61
|
+
win.draw_text_later(f"Slider: {int(slider1.value)}", pos=(50, 160), size=18)
|
|
62
|
+
|
|
63
|
+
# --- draw gradient ---
|
|
64
|
+
gradient_rect(win, (50, 300, 200, 100), (255,0,0), (0,0,255))
|
|
65
|
+
|
|
66
|
+
# --- screen shake example (move a rectangle with shake) ---
|
|
67
|
+
shake.update()
|
|
68
|
+
x_off, y_off = shake.offset
|
|
69
|
+
win.draw_rect((0,255,0), (500+x_off, 300+y_off, 100, 50))
|
|
70
|
+
|
|
71
|
+
# --- draw random name + color ---
|
|
72
|
+
win.draw_text_later(f"Random Name: {random_name()}", pos=(50, 420), size=20, color=random_color())
|
|
73
|
+
|
|
74
|
+
# --- debug overlay ---
|
|
75
|
+
debug.draw(win, fps=int(win.clock.get_fps()))
|
|
76
|
+
|
|
77
|
+
win.run(update)
|
|
78
|
+
win.quit()
|
|
79
|
+
|
|
80
|
+
And now thats how you use it!
|
|
81
|
+
|
|
82
|
+
# Current Variables.
|
|
83
|
+
|
|
84
|
+
# Whats Inside
|
|
85
|
+
|
|
86
|
+
Built-in window manager
|
|
87
|
+
|
|
88
|
+
Built-in GUI (buttons, sliders, toggles, labels)
|
|
89
|
+
|
|
90
|
+
Built-in gravity + physics engine
|
|
91
|
+
|
|
92
|
+
Tilemap system (place & save blocks!)
|
|
93
|
+
|
|
94
|
+
Image loader (with default base64 logo)
|
|
95
|
+
|
|
96
|
+
Safe startup (works even inside PyInstaller)
|
|
97
|
+
|
|
98
|
+
Mathematics Handler
|
|
99
|
+
|
|
100
|
+
Works offline
|
|
101
|
+
|
|
102
|
+
Minimal syntax
|
|
103
|
+
|
|
104
|
+
Full debug overlay
|
|
105
|
+
|
|
106
|
+
# Window System
|
|
107
|
+
from crystalwindow import *
|
|
108
|
+
|
|
109
|
+
win = Window(800, 600, "My Game", icon="MyIcon.png")
|
|
110
|
+
|
|
111
|
+
def loop(win):
|
|
112
|
+
win.fill((10, 10, 30))
|
|
113
|
+
# draw or update stuff here
|
|
114
|
+
|
|
115
|
+
win.run(loop)
|
|
116
|
+
win.quit()
|
|
117
|
+
|
|
118
|
+
# Features
|
|
119
|
+
* handles events
|
|
120
|
+
* tracks keys + mouse
|
|
121
|
+
* supports fullscreen
|
|
122
|
+
* safe to close anytime
|
|
123
|
+
|
|
124
|
+
# Player Example
|
|
125
|
+
player = Player(100, 100)
|
|
126
|
+
|
|
127
|
+
def loop(win):
|
|
128
|
+
player.update(win.keys)
|
|
129
|
+
player.draw(win.screen)
|
|
130
|
+
move(dx, dy) -> moves player
|
|
131
|
+
take_damage(x) -> takes damage
|
|
132
|
+
heal(x) -> heals
|
|
133
|
+
draw(surface) -> renders sprite
|
|
134
|
+
|
|
135
|
+
# TileMap
|
|
136
|
+
tilemap = TileMap(32)
|
|
137
|
+
tilemap.add_tile(5, 5, "grass")
|
|
138
|
+
tilemap.save("level.json")
|
|
139
|
+
add_tile(x, y, type)
|
|
140
|
+
remove_tile(x, y)
|
|
141
|
+
draw(surface)
|
|
142
|
+
save(file) / load(file)
|
|
143
|
+
|
|
144
|
+
# GUI System
|
|
145
|
+
btn = Button(20, 20, 120, 40, "Click Me!", lambda: print("yo"))
|
|
146
|
+
gui = GUIManager()
|
|
147
|
+
gui.add(btn)
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
Use built-in stuff like:
|
|
151
|
+
|
|
152
|
+
Button(x, y, w, h, text, onclick)
|
|
153
|
+
Label(x, y, text)
|
|
154
|
+
Toggle(x, y, w, h, text, default=False)
|
|
155
|
+
Slider(x, y, w, min, max, default)
|
|
156
|
+
|
|
157
|
+
# Gravity
|
|
158
|
+
g = Gravity(0.5)
|
|
159
|
+
g.update(player)
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
makes objects fall realistically. ez.
|
|
163
|
+
|
|
164
|
+
# FileHelper
|
|
165
|
+
save_json("data.json", {"coins": 99})
|
|
166
|
+
data = load_json("data.json")
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
Also supports:
|
|
170
|
+
|
|
171
|
+
save_pickle / load_pickle
|
|
172
|
+
|
|
173
|
+
FileDialog("save") (tkinter dialog popup)
|
|
174
|
+
|
|
175
|
+
# DrawHelper
|
|
176
|
+
DrawHelper.text(win.screen, "Hello!", (10,10), (255,255,255), 24)
|
|
177
|
+
DrawHelper.rect(win.screen, (100,0,200), (50,50,100,60))
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
perfect for ui & quick visuals
|
|
181
|
+
|
|
182
|
+
# Debug Tools
|
|
183
|
+
debug = DebugOverlay()
|
|
184
|
+
debug.toggle() # show or hide FPS
|
|
185
|
+
debug.draw(win.screen, {"hp": 100, "fps": win.clock.get_fps()})
|
|
186
|
+
|
|
187
|
+
# Mathematics
|
|
188
|
+
math = Mathematics()
|
|
189
|
+
* Current Variables
|
|
190
|
+
math.add(num1, num2)
|
|
191
|
+
math.subtract(num1, num2)
|
|
192
|
+
math.multiply(num1, num2)
|
|
193
|
+
math.divide(num1, num2)
|
|
194
|
+
|
|
195
|
+
# Example Game
|
|
196
|
+
from crystalwindow import *
|
|
197
|
+
|
|
198
|
+
win = Window(800, 600, "My Cool Game")
|
|
199
|
+
player = Player(100, 100)
|
|
200
|
+
gravity = Gravity()
|
|
201
|
+
|
|
202
|
+
def update(win):
|
|
203
|
+
win.fill((25, 25, 40))
|
|
204
|
+
player.update(win.keys)
|
|
205
|
+
gravity.update(player)
|
|
206
|
+
player.draw(win.screen)
|
|
207
|
+
|
|
208
|
+
win.run(update)
|
|
209
|
+
win.quit()
|
|
210
|
+
|
|
211
|
+
# Default Logo
|
|
212
|
+
|
|
213
|
+
There is a lil encoded PNG inside the file called:
|
|
214
|
+
|
|
215
|
+
DEFAULT_LOGO_BASE64
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
Its used when no icon is given.
|
|
219
|
+
Set ur own like:
|
|
220
|
+
|
|
221
|
+
Window(800, 600, "My Window", icon="MyIcon.png")
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
or do whatever you want.. i guess.
|
|
225
|
+
|
|
226
|
+
# Example Integration
|
|
227
|
+
from crystalwindow import Window
|
|
228
|
+
|
|
229
|
+
win = Window(800, 600, "My Window", icon="MyIcon.png")
|
|
230
|
+
|
|
231
|
+
while win.running:
|
|
232
|
+
win.check_events()
|
|
233
|
+
win.fill((10, 10, 20))
|
|
234
|
+
win.run()
|
|
235
|
+
win.quit()
|
|
236
|
+
|
|
237
|
+
# Credits
|
|
238
|
+
|
|
239
|
+
Made by: CrystalBallyHereXD
|
|
240
|
+
Framework: CrystalWindow
|
|
241
|
+
Powered by: Tkinter and Python
|
|
242
|
+
License: Free to use, modify, and vibe with it!
|