-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquick_start.py
More file actions
45 lines (35 loc) · 911 Bytes
/
quick_start.py
File metadata and controls
45 lines (35 loc) · 911 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import spritePro as s
import pygame
def on_click():
text.set_text("Welcome! :)")
button.set_active(False)
# Initialize the library
s.init()
# Create a window
s.get_screen((800, 600), "My Game")
# text
text = s.TextSprite("Hello World", 74, (255, 50, 255), s.WH_C)
button = s.Button(
"",
(300, 100),
s.WH_C,
"Click Me",
36,
on_click=on_click,
).set_rect_shape(border_radius=10)
button.DoScale(1.5, 2).OnComplete(lambda: button.DoRotate(180, 1))
exit_button = s.Button(
"", (300, 100), text="Exit", text_size=36, on_click=pygame.quit
).set_rect_shape(border_radius=10)
layout = (
s.layout_flex_column(
None, [text, button, exit_button], align_main=s.LayoutAlignMain.SPACE_EVENLY
)
.set_debug_borders(True)
.set_position(s.WH_C)
.set_size((400, 550))
)
button.rect.y += 200
# Main game loop
while True:
s.update(fill_color=(0, 0, 100))