Skip to content

Commit 1d23953

Browse files
committed
cleanup
1 parent 0b637ee commit 1d23953

File tree

6 files changed

+39
-14
lines changed

6 files changed

+39
-14
lines changed

src/test_alpha.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,17 @@
1616
pygame.init()
1717

1818
async def main():
19+
print("""
20+
21+
22+
23+
MOVE MOUSE OVER CANVAS
24+
25+
26+
27+
28+
""")
29+
1930
screen = pygame.display.set_mode((800, 600))
2031
clock = pygame.time.Clock()
2132
BLUE = pygame.Color('dodgerblue4')
@@ -27,7 +38,7 @@ async def main():
2738
pygame.draw.rect(background, BLUE, (x, y, 20, 20), 1)
2839

2940
# This dark gray surface will be blitted above the background surface.
30-
surface = pygame.Surface(screen.get_size(), pygame.SRCALPHA)
41+
surface = pygame.Surface(screen.get_size()).convert_alpha()
3142
surface.fill(pygame.Color('gray11'))
3243

3344
done = False

src/test_anim.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ def fs_decode(fsname, o248):
108108
# fmt:on
109109
del fs_decode
110110

111+
# https://hackmd.io/@E44abSruTB6H51YFxxOomQ/SkNSL9kQ1e
112+
111113

112114
# /// script
113115
# dependencies = [
@@ -116,15 +118,18 @@ def fs_decode(fsname, o248):
116118
# ///
117119

118120

121+
122+
119123
import asyncio
120124
import pygame
121125

126+
pygame.init()
122127

123128
async def main():
129+
screen = pygame.display.set_mode((1024, 600))
124130

125-
pygame.display.set_caption("simple animation")
126131

127-
screen = pygame.display.set_mode((1024, 600))
132+
# pygame.display.set_caption("simple animation")
128133

129134
anim_tiles = pygame.image.load("tiles.png")
130135
anim_frames = 2
@@ -169,9 +174,6 @@ async def main():
169174
pygame.display.update()
170175
await asyncio.sleep(0.016)
171176

172-
173-
174-
175177
asyncio.run(main())
176178

177179

src/test_freetype.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
# ///
1010

1111

12+
# bidi and embedded
13+
# https://github.com/lvgl/lvgl/issues/899
14+
15+
# diacritic print("\u0628\u0650\u0651")
16+
17+
1218
import aio.fetch
1319

1420
aio.fetch.FS("""

src/test_lvgl.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,21 @@ def sw_event_cb(e, label):
6969

7070
diff = 0
7171

72+
73+
await asyncio.sleep(0)
74+
platform.window.window_resize()
75+
76+
77+
7278
while True:
79+
await asyncio.sleep(0)
7380
stop = time.time()
7481
diff = int((stop * 1000) - (start * 1000))
7582
if diff >= 1:
7683
start = stop
7784
lv.tick_inc(diff)
7885
lv.task_handler()
79-
await asyncio.sleep(0)
86+
8087

8188
asyncio.run(main())
8289

src/test_pad.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@ async def main():
5050
# Possible joystick events: JOYAXISMOTION, JOYBALLMOTION, JOYBUTTONDOWN,
5151
# JOYBUTTONUP, JOYHATMOTION, JOYDEVICEADDED, JOYDEVICEREMOVED
5252
for event in pygame.event.get():
53-
if event.type == pygame.QUIT:
54-
done = True # Flag that we are done so we exit this loop.
55-
5653
if event.type == pygame.JOYBUTTONDOWN:
5754
print("Joystick button pressed.")
5855
if event.button == 0:
@@ -64,20 +61,22 @@ async def main():
6461
)
6562
)
6663

67-
if event.type == pygame.JOYBUTTONUP:
64+
elif event.type == pygame.JOYBUTTONUP:
6865
print("Joystick button released.")
6966

7067
# Handle hotplugging
71-
if event.type == pygame.JOYDEVICEADDED:
68+
elif event.type == pygame.JOYDEVICEADDED:
7269
# This event will be generated when the program starts for every
7370
# joystick, filling up the list without needing to create them manually.
7471
joy = pygame.joystick.Joystick(event.device_index)
7572
joysticks[joy.get_instance_id()] = joy
7673
print("Joystick {} connected".format(joy.get_instance_id()))
7774

78-
if event.type == pygame.JOYDEVICEREMOVED:
75+
elif event.type == pygame.JOYDEVICEREMOVED:
7976
del joysticks[event.instance_id]
8077
print("Joystick {} disconnected".format(event.instance_id))
78+
elif event.type == pygame.QUIT:
79+
done = True # Flag that we are done so we exit this loop.
8180

8281
# Drawing step
8382
# First, clear the screen to white. Don't put other drawing commands

src/test_panda3d_cube.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import asyncio
1212
import panda3d
1313

14-
import panda3d.core as p3d
14+
import panda3d.core
1515
import panda3d.direct
1616

1717

0 commit comments

Comments
 (0)