omnipython-apps 0.1.4.dev8__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.
- apps/__init__.py +5 -0
- apps/about/__init__.py +257 -0
- apps/about/app.json +1 -0
- apps/about/credits.py +12 -0
- apps/about/facts.py +398 -0
- apps/about/fonts/OFL.txt +93 -0
- apps/about/fonts/latin1_14.bin +0 -0
- apps/about/fonts/latin1_16.bin +0 -0
- apps/about/fonts/latin1_24.bin +0 -0
- apps/about/fonts/latin1_32.bin +0 -0
- apps/about/fonts/latin1_40.bin +0 -0
- apps/backline/__init__.py +58 -0
- apps/backline/app.json +1 -0
- apps/backline/app.py +475 -0
- apps/backline/art.py +717 -0
- apps/backline/ask.py +781 -0
- apps/backline/box.py +502 -0
- apps/backline/cast.py +137 -0
- apps/backline/desk/__init__.py +329 -0
- apps/backline/desk/editor.py +331 -0
- apps/backline/desk/grid.py +154 -0
- apps/backline/desk/look.py +169 -0
- apps/backline/desk/pedals.py +102 -0
- apps/backline/desk/perform.py +157 -0
- apps/backline/desk/prompt.py +210 -0
- apps/backline/desk/strip.py +159 -0
- apps/backline/desk_main.py +226 -0
- apps/backline/engine.py +622 -0
- apps/backline/floor.py +509 -0
- apps/backline/footswitch.py +119 -0
- apps/backline/glyphs.py +82 -0
- apps/backline/kits.py +428 -0
- apps/backline/midipedal.py +362 -0
- apps/backline/page_data.py +413 -0
- apps/backline/parts.py +145 -0
- apps/backline/pedal.py +107 -0
- apps/backline/remote.py +134 -0
- apps/backline/songs/ballad_68.json +1 -0
- apps/backline/songs/bossa.json +1 -0
- apps/backline/songs/country_train.json +1 -0
- apps/backline/songs/funk.json +1 -0
- apps/backline/songs/metal.json +1 -0
- apps/backline/songs/pop.json +1 -0
- apps/backline/songs/rock.json +1 -0
- apps/backline/songs/shuffle.json +1 -0
- apps/battery/__init__.py +101 -0
- apps/battery/app.json +1 -0
- apps/bit_world/act_deck.py +683 -0
- apps/bit_world/act_game.py +762 -0
- apps/bit_world/act_pet.py +1032 -0
- apps/bit_world/app.json +1 -0
- apps/bit_world/bit_output.py +45 -0
- apps/bit_world/bit_palette.py +503 -0
- apps/bit_world/bit_sound.py +431 -0
- apps/bit_world/bit_sprites.py +632 -0
- apps/bit_world/bit_world.py +534 -0
- apps/btreceiver/__init__.py +690 -0
- apps/btreceiver/app.json +1 -0
- apps/btreceiver/chime.py +155 -0
- apps/btreceiver/demo.py +529 -0
- apps/btreceiver/screen.py +633 -0
- apps/camera/__init__.py +316 -0
- apps/camera/app.json +1 -0
- apps/card/__init__.py +113 -0
- apps/card/app.json +1 -0
- apps/cast/__init__.py +631 -0
- apps/cast/app.json +1 -0
- apps/cast/receivers.py +193 -0
- apps/chess/__init__.py +18 -0
- apps/chess/app.json +1 -0
- apps/chess/app.py +922 -0
- apps/chess/art.py +323 -0
- apps/chess/ble.py +411 -0
- apps/chess/engine.py +925 -0
- apps/chess/game.py +327 -0
- apps/chess/net.py +261 -0
- apps/clock/__init__.py +38 -0
- apps/clock/app.json +1 -0
- apps/detect/__init__.py +214 -0
- apps/detect/app.json +1 -0
- apps/fmsynth/__init__.py +41 -0
- apps/fmsynth/algorithms.py +61 -0
- apps/fmsynth/app.json +1 -0
- apps/fmsynth/app.py +355 -0
- apps/fmsynth/editor.py +206 -0
- apps/fmsynth/engine.py +257 -0
- apps/fmsynth/meters.py +262 -0
- apps/fmsynth/midi.py +375 -0
- apps/fmsynth/panel_view.py +1071 -0
- apps/fmsynth/patches/fmsynth-01.syx +0 -0
- apps/fmsynth/settings.py +138 -0
- apps/fmsynth/voice.py +398 -0
- apps/gamepad/__init__.py +685 -0
- apps/gamepad/app.json +1 -0
- apps/gamepad/pad.py +94 -0
- apps/gamepad/watch.py +352 -0
- apps/hidden/__init__.py +72 -0
- apps/hidden/app.json +1 -0
- apps/home/__init__.py +483 -0
- apps/home/app.json +1 -0
- apps/home/main.py +36 -0
- apps/homeassistant/__init__.py +213 -0
- apps/homeassistant/api.py +104 -0
- apps/homeassistant/app.json +1 -0
- apps/huey/__init__.py +287 -0
- apps/huey/acting.py +184 -0
- apps/huey/actor.py +194 -0
- apps/huey/app.json +1 -0
- apps/huey/client.py +125 -0
- apps/huey/servers.py +121 -0
- apps/huey/settings.example.json +8 -0
- apps/huey/settings.py +97 -0
- apps/huey/turn.py +504 -0
- apps/huey/voice.py +217 -0
- apps/info/__init__.py +810 -0
- apps/info/app.json +1 -0
- apps/lora/__init__.py +62 -0
- apps/lora/app.json +1 -0
- apps/manifest.py +71 -0
- apps/medialink_baby_monitor/__init__.py +222 -0
- apps/medialink_baby_monitor/app.json +1 -0
- apps/medialink_doorbell/__init__.py +251 -0
- apps/medialink_doorbell/app.json +1 -0
- apps/medialink_hands_free/__init__.py +217 -0
- apps/medialink_hands_free/app.json +1 -0
- apps/medialink_surveillance_camera/__init__.py +258 -0
- apps/medialink_surveillance_camera/app.json +1 -0
- apps/medialink_video_doorbell/__init__.py +289 -0
- apps/medialink_video_doorbell/app.json +1 -0
- apps/medialink_videophone/__init__.py +273 -0
- apps/medialink_videophone/app.json +1 -0
- apps/medialink_walkie_talkie/__init__.py +228 -0
- apps/medialink_walkie_talkie/app.json +1 -0
- apps/midicontroller/__init__.py +774 -0
- apps/midicontroller/app.json +1 -0
- apps/midicontroller/links.py +421 -0
- apps/midicontroller/surface.py +343 -0
- apps/midiengine/__init__.py +977 -0
- apps/midiengine/app.json +1 -0
- apps/midiengine/banks.py +85 -0
- apps/midiengine/midiin.py +165 -0
- apps/midiengine/player.py +392 -0
- apps/midiengine/umidiparser.py +1413 -0
- apps/mp3/__init__.py +240 -0
- apps/mp3/app.json +1 -0
- apps/perch/__init__.py +119 -0
- apps/perch/app.json +1 -0
- apps/perch/huey.py +481 -0
- apps/perch/huey_props.py +386 -0
- apps/perch/huey_shift.py +42 -0
- apps/perch/huey_views.py +296 -0
- apps/perch/scene_bench.py +680 -0
- apps/perch/scene_coast.py +479 -0
- apps/perch/scene_desk.py +492 -0
- apps/perch/stage.py +1274 -0
- apps/perch/vec.py +366 -0
- apps/repl/__init__.py +325 -0
- apps/repl/app.json +1 -0
- apps/roku/__init__.py +156 -0
- apps/roku/app.json +1 -0
- apps/rokucam/__init__.py +362 -0
- apps/rokucam/app.json +1 -0
- apps/security/__init__.py +261 -0
- apps/security/app.json +1 -0
- apps/settings/__init__.py +221 -0
- apps/settings/app.json +1 -0
- apps/shell/__init__.py +33 -0
- apps/shell/app.json +1 -0
- apps/spotify/__init__.py +669 -0
- apps/spotify/app.json +1 -0
- apps/spotify/screen.py +82 -0
- apps/steps/__init__.py +58 -0
- apps/steps/app.json +1 -0
- apps/stompbox/__init__.py +31 -0
- apps/stompbox/app.json +1 -0
- apps/stompbox/app.py +668 -0
- apps/stompbox/boards.json +20 -0
- apps/stompbox/effects.py +241 -0
- apps/stompbox/engine.py +340 -0
- apps/stompbox/footswitch.py +331 -0
- apps/stompbox/inputs.py +449 -0
- apps/stompbox/meter.py +72 -0
- apps/stompbox/outputs.py +135 -0
- apps/stompbox/pedals.txt +45 -0
- apps/stompbox/presets.py +106 -0
- apps/stompbox/styles.py +135 -0
- apps/stompbox/ui.py +817 -0
- apps/stompbox/wavfile.py +73 -0
- apps/synthstation/__init__.py +20 -0
- apps/synthstation/app.json +1 -0
- apps/synthstation/audio.py +397 -0
- apps/synthstation/catalog.py +50 -0
- apps/synthstation/meters.py +136 -0
- apps/synthstation/midi.py +380 -0
- apps/synthstation/pads.py +177 -0
- apps/synthstation/parts.py +128 -0
- apps/synthstation/station.py +1069 -0
- apps/system/__init__.py +11 -0
- apps/system/app.json +1 -0
- apps/touchcal/__init__.py +324 -0
- apps/touchcal/app.json +1 -0
- apps/touchcal/fit.py +262 -0
- apps/wake/__init__.py +268 -0
- apps/wake/app.json +1 -0
- apps/wake/feed.py +155 -0
- apps/watch/__init__.py +355 -0
- apps/watch/app.json +1 -0
- apps/watch/faces.py +35 -0
- apps/watch/wheel.py +157 -0
- apps/weather/__init__.py +278 -0
- apps/weather/app.json +1 -0
- apps/weather/icons.py +172 -0
- apps/weather/sizing.py +71 -0
- apps/weather/zippad.py +172 -0
- omnipython_apps-0.1.4.dev8.dist-info/METADATA +33 -0
- omnipython_apps-0.1.4.dev8.dist-info/RECORD +218 -0
- omnipython_apps-0.1.4.dev8.dist-info/WHEEL +5 -0
- omnipython_apps-0.1.4.dev8.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,632 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2026 Brad Barnett
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
5
|
+
"""Low-allocation pixel-art sprite and alpha-mask bank for Bit World.
|
|
6
|
+
|
|
7
|
+
Stores all multi-shade pixel-art grids and 8-bit radial alpha glow masks inside
|
|
8
|
+
one contiguous bytes literal wrapped in a memoryview (the way the icons
|
|
9
|
+
package keeps its font in frozen flash). At startup, unpacks scaled RGB565
|
|
10
|
+
sprites into a single shared atlas and renders antialiased glows directly from memoryview
|
|
11
|
+
slices via FrameBuffer.blit_alpha.
|
|
12
|
+
|
|
13
|
+
Needs: pygraphics, bit_palette.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
from bit_palette import KEY, PALETTE_LUT, make_canvas, pixel_bytes
|
|
17
|
+
|
|
18
|
+
# Flat tuple of (offset, width, height) descriptors into DATA for each sprite.
|
|
19
|
+
SPRITE_META = (
|
|
20
|
+
(0, 28, 26), # 0: bit_body_0
|
|
21
|
+
(728, 28, 26), # 1: bit_body_1
|
|
22
|
+
(1456, 16, 9), # 2: face_neutral
|
|
23
|
+
(1600, 16, 9), # 3: face_blink
|
|
24
|
+
(1744, 16, 9), # 4: face_happy
|
|
25
|
+
(1888, 16, 9), # 5: face_love
|
|
26
|
+
(2032, 16, 9), # 6: face_sing
|
|
27
|
+
(2176, 16, 9), # 7: face_scan
|
|
28
|
+
(2320, 16, 9), # 8: face_coffee
|
|
29
|
+
(2464, 16, 9), # 9: face_sleep
|
|
30
|
+
(2608, 10, 6), # 10: flame_0
|
|
31
|
+
(2668, 10, 6), # 11: flame_1
|
|
32
|
+
(2728, 10, 6), # 12: flame_2
|
|
33
|
+
(2788, 20, 18), # 13: bit_game_right
|
|
34
|
+
(3148, 16, 20), # 14: terrarium
|
|
35
|
+
(3468, 12, 11), # 15: mug
|
|
36
|
+
(3600, 11, 11), # 16: emote_heart
|
|
37
|
+
(3721, 11, 11), # 17: emote_note
|
|
38
|
+
(3842, 11, 11), # 18: emote_sparkle
|
|
39
|
+
(3963, 11, 11), # 19: emote_bolt
|
|
40
|
+
(4084, 11, 11), # 20: emote_zzz
|
|
41
|
+
(4205, 12, 14), # 21: crystal_0
|
|
42
|
+
(4373, 12, 14), # 22: crystal_1
|
|
43
|
+
(4541, 12, 14), # 23: crystal_2
|
|
44
|
+
(4709, 12, 14), # 24: crystal_3
|
|
45
|
+
(4877, 16, 14), # 25: drone_0
|
|
46
|
+
(5101, 16, 14), # 26: drone_1
|
|
47
|
+
(5325, 10, 5), # 27: bolt
|
|
48
|
+
(5375, 16, 16), # 28: holo_bit
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
FACE_NAMES = ("neutral", "blink", "happy", "love", "sing", "scan", "coffee", "sleep")
|
|
52
|
+
EMOTE_NAMES = ("heart", "note", "sparkle", "bolt", "zzz")
|
|
53
|
+
|
|
54
|
+
GLOW16_OFFSET = 5631
|
|
55
|
+
GLOW16_SIZE = 16
|
|
56
|
+
GLOW24_OFFSET = 5887
|
|
57
|
+
GLOW24_SIZE = 24
|
|
58
|
+
|
|
59
|
+
# Adjacent bytes literals join into one constant in flash when frozen.
|
|
60
|
+
DATA = memoryview(
|
|
61
|
+
# 0: bit_body_0 (28x26)
|
|
62
|
+
b".............kl............."
|
|
63
|
+
b"............jklj............"
|
|
64
|
+
b".............54............."
|
|
65
|
+
b".............54............."
|
|
66
|
+
b"......6777777777777765......"
|
|
67
|
+
b"....67887777777777776654...."
|
|
68
|
+
b"...6787432222222222347654..."
|
|
69
|
+
b"..677420000000000000024653.."
|
|
70
|
+
b".ef7420000000000000000246dc."
|
|
71
|
+
b"efg7300000000000000000036edc"
|
|
72
|
+
b"efg7300000000000000000036edc"
|
|
73
|
+
b"efg7300000000000000000036edc"
|
|
74
|
+
b"efg7300000000000000000036edc"
|
|
75
|
+
b"efg7300000000000000000036edc"
|
|
76
|
+
b"efg7300000000000000000036edc"
|
|
77
|
+
b".cd7300000000000000000036dc."
|
|
78
|
+
b"..574200000000000000002464.."
|
|
79
|
+
b"...6743222222222222223465..."
|
|
80
|
+
b"....567777666fe6667777654..."
|
|
81
|
+
b".....4566543222234566543...."
|
|
82
|
+
b"......3454321jj12345432....."
|
|
83
|
+
b".......34432iklk234432......"
|
|
84
|
+
b"........23432jj234321......."
|
|
85
|
+
b".........2333223332........."
|
|
86
|
+
b"..........12333321.........."
|
|
87
|
+
b"...........122221..........."
|
|
88
|
+
# 1: bit_body_1 (28x26)
|
|
89
|
+
b"............jllj............"
|
|
90
|
+
b"...........ikllki..........."
|
|
91
|
+
b".............65............."
|
|
92
|
+
b".............54............."
|
|
93
|
+
b"......6777777777777765......"
|
|
94
|
+
b"....67887777777777776654...."
|
|
95
|
+
b"...6787432222222222347654..."
|
|
96
|
+
b".ef7742000000000000002465dc."
|
|
97
|
+
b"efg7420000000000000000246edc"
|
|
98
|
+
b"efg7300000000000000000036edc"
|
|
99
|
+
b"efg7300000000000000000036edc"
|
|
100
|
+
b"efg7300000000000000000036edc"
|
|
101
|
+
b"efg7300000000000000000036edc"
|
|
102
|
+
b"efg7300000000000000000036edc"
|
|
103
|
+
b".cd7300000000000000000036dc."
|
|
104
|
+
b"..573000000000000000000364.."
|
|
105
|
+
b"..574200000000000000002464.."
|
|
106
|
+
b"...6743222222222222223465..."
|
|
107
|
+
b"....567777666fg6667777654..."
|
|
108
|
+
b".....4566543222234566543...."
|
|
109
|
+
b"......3454321kk12345432....."
|
|
110
|
+
b".......34432jllk234432......"
|
|
111
|
+
b"........23432kk234321......."
|
|
112
|
+
b".........2333223332........."
|
|
113
|
+
b"..........12333321.........."
|
|
114
|
+
b"...........122221..........."
|
|
115
|
+
# 2: face_neutral (16x9)
|
|
116
|
+
b"................"
|
|
117
|
+
b"..jkkj....jkkj.."
|
|
118
|
+
b".jk88kj..jk88kj."
|
|
119
|
+
b".jk8jkj..jk8jkj."
|
|
120
|
+
b".jkkkkj..jkkkkj."
|
|
121
|
+
b"..jkkj....jkkj.."
|
|
122
|
+
b"................"
|
|
123
|
+
b".....jkkkkj....."
|
|
124
|
+
b"......jjjj......"
|
|
125
|
+
# 3: face_blink (16x9)
|
|
126
|
+
b"................"
|
|
127
|
+
b"................"
|
|
128
|
+
b"..jjjj....jjjj.."
|
|
129
|
+
b".jkkkkj..jkkkkj."
|
|
130
|
+
b".jj..jj..jj..jj."
|
|
131
|
+
b"................"
|
|
132
|
+
b"................"
|
|
133
|
+
b".....jkkkkj....."
|
|
134
|
+
b"......jjjj......"
|
|
135
|
+
# 4: face_happy (16x9)
|
|
136
|
+
b"................"
|
|
137
|
+
b"..jkkj....jkkj.."
|
|
138
|
+
b".jkkkkj..jkkkkj."
|
|
139
|
+
b".kk..kk..kk..kk."
|
|
140
|
+
b"................"
|
|
141
|
+
b"....fggggggf...."
|
|
142
|
+
b"....feeeeeef...."
|
|
143
|
+
b".....feddef....."
|
|
144
|
+
b"......feef......"
|
|
145
|
+
# 5: face_love (16x9)
|
|
146
|
+
b"................"
|
|
147
|
+
b".vwwwv....vwwwv."
|
|
148
|
+
b"vw8wwwv..vw8wwwv"
|
|
149
|
+
b"vwwwwwv..vwwwwwv"
|
|
150
|
+
b".vwwwv....vwwwv."
|
|
151
|
+
b"..vwv......vwv.."
|
|
152
|
+
b"................"
|
|
153
|
+
b"....ukkkkkku...."
|
|
154
|
+
b".....uuuuuu....."
|
|
155
|
+
# 6: face_sing (16x9)
|
|
156
|
+
b"................"
|
|
157
|
+
b"..jkkj....jkkj.."
|
|
158
|
+
b".jkkkkj..jk88kj."
|
|
159
|
+
b".kk..kk..jkkkkj."
|
|
160
|
+
b"..........jkkj.."
|
|
161
|
+
b".....jkkkkj....."
|
|
162
|
+
b"....jk0000kj...."
|
|
163
|
+
b"....jk0ww0kj...."
|
|
164
|
+
b".....jkkkkj....."
|
|
165
|
+
# 7: face_scan (16x9)
|
|
166
|
+
b".qppppppppppppq."
|
|
167
|
+
b"..ppqqqqqqqqpp.."
|
|
168
|
+
b".qpq88qppq88qpq."
|
|
169
|
+
b".qpqqqqppqqqqpq."
|
|
170
|
+
b"..pppppppppppp.."
|
|
171
|
+
b"................"
|
|
172
|
+
b"..pq..pqqp..qp.."
|
|
173
|
+
b".....pqqqqp....."
|
|
174
|
+
b"................"
|
|
175
|
+
# 8: face_coffee (16x9)
|
|
176
|
+
b"................"
|
|
177
|
+
b"..fgge....eggf.."
|
|
178
|
+
b".fg88gf..fg88gf."
|
|
179
|
+
b".fggggf..fggggf."
|
|
180
|
+
b"..feef....feef.."
|
|
181
|
+
b"................"
|
|
182
|
+
b"...fggggggggf..."
|
|
183
|
+
b"....fggggggf...."
|
|
184
|
+
b".....ffffff....."
|
|
185
|
+
# 9: face_sleep (16x9)
|
|
186
|
+
b"................"
|
|
187
|
+
b"................"
|
|
188
|
+
b"................"
|
|
189
|
+
b"..iiii....iiii.."
|
|
190
|
+
b"..hhhh....hhhh.."
|
|
191
|
+
b"................"
|
|
192
|
+
b"......iiii......"
|
|
193
|
+
b"................"
|
|
194
|
+
b"................"
|
|
195
|
+
# 10: flame_0 (10x6)
|
|
196
|
+
b"..jkkkkj.."
|
|
197
|
+
b"..kllllk.."
|
|
198
|
+
b"...kllk..."
|
|
199
|
+
b"...jkkj..."
|
|
200
|
+
b"....jj...."
|
|
201
|
+
b"....ii...."
|
|
202
|
+
# 11: flame_1 (10x6)
|
|
203
|
+
b".ijkkkkji."
|
|
204
|
+
b"..kllllk.."
|
|
205
|
+
b"..jkllkj.."
|
|
206
|
+
b"...jkkj..."
|
|
207
|
+
b"...ijji..."
|
|
208
|
+
b"....ii...."
|
|
209
|
+
# 12: flame_2 (10x6)
|
|
210
|
+
b"..fggggf.."
|
|
211
|
+
b"..kllllk.."
|
|
212
|
+
b"...kllk..."
|
|
213
|
+
b"....kk...."
|
|
214
|
+
b"....jj...."
|
|
215
|
+
b".........."
|
|
216
|
+
# 13: bit_game_right (20x18)
|
|
217
|
+
b"........kl.........."
|
|
218
|
+
b"........54.........."
|
|
219
|
+
b"....67777777765....."
|
|
220
|
+
b"...67874222224765..."
|
|
221
|
+
b"..ef74000000000465.."
|
|
222
|
+
b"..fg7300jk8k0jk836.."
|
|
223
|
+
b"..fg7300jkkj0jkk36.."
|
|
224
|
+
b"..ef73000000000036.."
|
|
225
|
+
b"...5730000jkkj0035.."
|
|
226
|
+
b"...674222222222245.."
|
|
227
|
+
b"....567776fe67765..."
|
|
228
|
+
b"...ef566532235654..."
|
|
229
|
+
b"..efg45431kk13443..."
|
|
230
|
+
b"...cd3432jllj233...."
|
|
231
|
+
b"......232.kk.22....."
|
|
232
|
+
b"..........jj........"
|
|
233
|
+
b"..........ii........"
|
|
234
|
+
b"...................."
|
|
235
|
+
# 14: terrarium (16x20)
|
|
236
|
+
b".....677776....."
|
|
237
|
+
b"...6786ii6776..."
|
|
238
|
+
b"..686ihhhhhi67.."
|
|
239
|
+
b".686h..kllk..h6."
|
|
240
|
+
b".66h..jkllkj..h5"
|
|
241
|
+
b"68h....jkkj...h5"
|
|
242
|
+
b"66h.....pp....h5"
|
|
243
|
+
b"66h...qppppq..h5"
|
|
244
|
+
b"66h..qppooppq.h5"
|
|
245
|
+
b"66h...poooop..h5"
|
|
246
|
+
b"66h....onno...h5"
|
|
247
|
+
b"66h.kl..nn.fg.h5"
|
|
248
|
+
b"66h.jj..nn.ee.h5"
|
|
249
|
+
b"66h..oopppooo.h5"
|
|
250
|
+
b".66hmmmmmmmmmh5."
|
|
251
|
+
b".efggggggggggfe."
|
|
252
|
+
b"efeeeeeeeeeeeefd"
|
|
253
|
+
b"edccccccccccccdc"
|
|
254
|
+
b".dcbbbbbbbbbbcd."
|
|
255
|
+
b"..aaaaaaaaaaaa.."
|
|
256
|
+
# 15: mug (12x11)
|
|
257
|
+
b".ffffffff..."
|
|
258
|
+
b"fggggggggf.."
|
|
259
|
+
b"feeeeeeeefdd"
|
|
260
|
+
b"feddddddef.d"
|
|
261
|
+
b"feddggddef.d"
|
|
262
|
+
b"fedgllgdef.d"
|
|
263
|
+
b"feddggddefdd"
|
|
264
|
+
b"feddddddef.."
|
|
265
|
+
b"fecccccccf.."
|
|
266
|
+
b".dcbbbbcd..."
|
|
267
|
+
b"..aaaaaa...."
|
|
268
|
+
# 16: emote_heart (11x11)
|
|
269
|
+
b"..........."
|
|
270
|
+
b".vwwv.vwwv."
|
|
271
|
+
b"vw88wvw88wv"
|
|
272
|
+
b"vw8wwwww8wv"
|
|
273
|
+
b"vwwwwwwwwwv"
|
|
274
|
+
b".vwwwwwwwv."
|
|
275
|
+
b"..vwwwwwv.."
|
|
276
|
+
b"...vwwwv..."
|
|
277
|
+
b"....vwv...."
|
|
278
|
+
b".....v....."
|
|
279
|
+
b"..........."
|
|
280
|
+
# 17: emote_note (11x11)
|
|
281
|
+
b"....kkkkkk."
|
|
282
|
+
b"....kllllk."
|
|
283
|
+
b"....kk..kk."
|
|
284
|
+
b"....kk..kk."
|
|
285
|
+
b"....kk..kk."
|
|
286
|
+
b"..kkkk..kk."
|
|
287
|
+
b".kllkkikk.."
|
|
288
|
+
b".kllk.kllk."
|
|
289
|
+
b"..kk...kk.."
|
|
290
|
+
b"..........."
|
|
291
|
+
b"..........."
|
|
292
|
+
# 18: emote_sparkle (11x11)
|
|
293
|
+
b".....g....."
|
|
294
|
+
b".....g....."
|
|
295
|
+
b"...fgggf..."
|
|
296
|
+
b"....ggg...."
|
|
297
|
+
b"ggfgg8ggfgg"
|
|
298
|
+
b".gggg8gggg."
|
|
299
|
+
b"ggfgg8ggfgg"
|
|
300
|
+
b"....ggg...."
|
|
301
|
+
b"...fgggf..."
|
|
302
|
+
b".....g....."
|
|
303
|
+
b".....g....."
|
|
304
|
+
# 19: emote_bolt (11x11)
|
|
305
|
+
b".....gggg.."
|
|
306
|
+
b"....ggff..."
|
|
307
|
+
b"...ggff...."
|
|
308
|
+
b"..gggggg..."
|
|
309
|
+
b".ggggff...."
|
|
310
|
+
b"....ggff..."
|
|
311
|
+
b"...ggff...."
|
|
312
|
+
b"..ggf......"
|
|
313
|
+
b".gg........"
|
|
314
|
+
b"..........."
|
|
315
|
+
b"..........."
|
|
316
|
+
# 20: emote_zzz (11x11)
|
|
317
|
+
b"llllll....."
|
|
318
|
+
b"...ll......"
|
|
319
|
+
b"..ll......."
|
|
320
|
+
b".llllll...."
|
|
321
|
+
b"..........."
|
|
322
|
+
b".....kkkkk."
|
|
323
|
+
b".......kk.."
|
|
324
|
+
b"......kk..."
|
|
325
|
+
b".....kkkkk."
|
|
326
|
+
b"..........."
|
|
327
|
+
b"..........."
|
|
328
|
+
# 21: crystal_0 (12x14)
|
|
329
|
+
b".....ll....."
|
|
330
|
+
b"....kllk...."
|
|
331
|
+
b"...jk88kj..."
|
|
332
|
+
b"..ijk88kji.."
|
|
333
|
+
b".ijjkllkjji."
|
|
334
|
+
b".ijkkllkkji."
|
|
335
|
+
b".ijjkkkkjji."
|
|
336
|
+
b"..ijkkkkji.."
|
|
337
|
+
b"..ijjkkjji.."
|
|
338
|
+
b"...ijjjji..."
|
|
339
|
+
b"....ijji...."
|
|
340
|
+
b".....ii....."
|
|
341
|
+
b".....hh....."
|
|
342
|
+
b"............"
|
|
343
|
+
# 22: crystal_1 (12x14)
|
|
344
|
+
b".....ll....."
|
|
345
|
+
b"....kllk...."
|
|
346
|
+
b"...tk88kt..."
|
|
347
|
+
b"..stk88kts.."
|
|
348
|
+
b"..stkllkts.."
|
|
349
|
+
b"..stkkkkts.."
|
|
350
|
+
b"..stjkkjts.."
|
|
351
|
+
b"...sjkkjs..."
|
|
352
|
+
b"...sjjjjs..."
|
|
353
|
+
b"....sjjs...."
|
|
354
|
+
b".....ss....."
|
|
355
|
+
b".....rr....."
|
|
356
|
+
b"............"
|
|
357
|
+
b"............"
|
|
358
|
+
# 23: crystal_2 (12x14)
|
|
359
|
+
b".....ll....."
|
|
360
|
+
b"....ukku...."
|
|
361
|
+
b"...uk88ku..."
|
|
362
|
+
b"...tk88kt..."
|
|
363
|
+
b"...tkllkt..."
|
|
364
|
+
b"...tkkkkt..."
|
|
365
|
+
b"...tjkkjt..."
|
|
366
|
+
b"....tkkt...."
|
|
367
|
+
b"....tjjt...."
|
|
368
|
+
b".....tt....."
|
|
369
|
+
b".....ss....."
|
|
370
|
+
b"............"
|
|
371
|
+
b"............"
|
|
372
|
+
b"............"
|
|
373
|
+
# 24: crystal_3 (12x14)
|
|
374
|
+
b".....ll....."
|
|
375
|
+
b"....kllk...."
|
|
376
|
+
b"...jk88kj..."
|
|
377
|
+
b"..qjk88kjq.."
|
|
378
|
+
b"..pjkllkjp.."
|
|
379
|
+
b"..pjkkkkjp.."
|
|
380
|
+
b"..pjjkkjjp.."
|
|
381
|
+
b"...pjkkjp..."
|
|
382
|
+
b"...pjjjjp..."
|
|
383
|
+
b"....pjjp...."
|
|
384
|
+
b".....pp....."
|
|
385
|
+
b".....oo....."
|
|
386
|
+
b"............"
|
|
387
|
+
b"............"
|
|
388
|
+
# 25: drone_0 (16x14)
|
|
389
|
+
b".7777......7777."
|
|
390
|
+
b"...4567777654..."
|
|
391
|
+
b"..457777777754.."
|
|
392
|
+
b".34674322347643."
|
|
393
|
+
b"3464200vv0024643"
|
|
394
|
+
b"356200vw8w002653"
|
|
395
|
+
b"356200vwww002653"
|
|
396
|
+
b"3464200vv0024643"
|
|
397
|
+
b".34674322347643."
|
|
398
|
+
b"..345666666543.."
|
|
399
|
+
b"...2344554432..."
|
|
400
|
+
b"....w..22..w...."
|
|
401
|
+
b"...x........x..."
|
|
402
|
+
b"................"
|
|
403
|
+
# 26: drone_1 (16x14)
|
|
404
|
+
b"...7777..7777..."
|
|
405
|
+
b"...4567777654..."
|
|
406
|
+
b"..457777777754.."
|
|
407
|
+
b".34674322347643."
|
|
408
|
+
b"3464200ww0024643"
|
|
409
|
+
b"356200wx8x002653"
|
|
410
|
+
b"356200wxxx002653"
|
|
411
|
+
b"3464200ww0024643"
|
|
412
|
+
b".34674322347643."
|
|
413
|
+
b"..345666666543.."
|
|
414
|
+
b"...2344554432..."
|
|
415
|
+
b"....x..22..x...."
|
|
416
|
+
b"................"
|
|
417
|
+
b"................"
|
|
418
|
+
# 27: bolt (10x5)
|
|
419
|
+
b"..jkkkkj.."
|
|
420
|
+
b".jk8888kl."
|
|
421
|
+
b"ijk88888ll"
|
|
422
|
+
b".jk8888kl."
|
|
423
|
+
b"..jkkkkj.."
|
|
424
|
+
# 28: holo_bit (16x16)
|
|
425
|
+
b".......kl......."
|
|
426
|
+
b".......jj......."
|
|
427
|
+
b"...ijkkkkkkji..."
|
|
428
|
+
b"..jkiiiiiiiiikj."
|
|
429
|
+
b".jki00000000ikj."
|
|
430
|
+
b"jki00ll00ll00ikj"
|
|
431
|
+
b"jki00ll00ll00ikj"
|
|
432
|
+
b"jki0000000000ikj"
|
|
433
|
+
b"jki000kkkk000ikj"
|
|
434
|
+
b".jki00000000ikj."
|
|
435
|
+
b"..jkiiiiiiiiikj."
|
|
436
|
+
b"...ijkkkkkkji..."
|
|
437
|
+
b".....ijjjji....."
|
|
438
|
+
b"......jllj......"
|
|
439
|
+
b".......kk......."
|
|
440
|
+
b".......ii......."
|
|
441
|
+
# glow_16: 16x16 8-bit radial alpha mask (256 bytes at offset 5631)
|
|
442
|
+
b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x03\x05\x07\x07\x05\x03\x01\x00\x00\x00\x00"
|
|
443
|
+
b"\x00\x00\x00\x02\x07\x0b\x0f\x12\x12\x0f\x0b\x07\x02\x00\x00\x00\x00\x00\x02\x08\x0f\x17\x1d\x21\x21\x1d\x17\x0f\x08\x02\x00\x00"
|
|
444
|
+
b"\x00\x01\x07\x0f\x1a\x25\x2e\x34\x34\x2e\x25\x1a\x0f\x07\x01\x00\x00\x03\x0b\x17\x25\x34\x42\x4b\x4b\x42\x34\x25\x17\x0b\x03\x00"
|
|
445
|
+
b"\x00\x05\x0f\x1d\x2e\x42\x56\x64\x64\x56\x42\x2e\x1d\x0f\x05\x00\x00\x07\x12\x21\x34\x4b\x64\x7e\x7e\x64\x4b\x34\x21\x12\x07\x00"
|
|
446
|
+
b"\x00\x07\x12\x21\x34\x4b\x64\x7e\x7e\x64\x4b\x34\x21\x12\x07\x00\x00\x05\x0f\x1d\x2e\x42\x56\x64\x64\x56\x42\x2e\x1d\x0f\x05\x00"
|
|
447
|
+
b"\x00\x03\x0b\x17\x25\x34\x42\x4b\x4b\x42\x34\x25\x17\x0b\x03\x00\x00\x01\x07\x0f\x1a\x25\x2e\x34\x34\x2e\x25\x1a\x0f\x07\x01\x00"
|
|
448
|
+
b"\x00\x00\x02\x08\x0f\x17\x1d\x21\x21\x1d\x17\x0f\x08\x02\x00\x00\x00\x00\x00\x02\x07\x0b\x0f\x12\x12\x0f\x0b\x07\x02\x00\x00\x00"
|
|
449
|
+
b"\x00\x00\x00\x00\x01\x03\x05\x07\x07\x05\x03\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
|
|
450
|
+
# glow_24: 24x24 8-bit radial alpha mask (576 bytes at offset 5887)
|
|
451
|
+
b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x02\x03\x03\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00"
|
|
452
|
+
b"\x00\x00\x00\x00\x00\x00\x01\x03\x04\x06\x07\x08\x08\x07\x06\x04\x03\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x04\x07\x0a\x0c\x0e\x0f\x0f\x0e\x0c\x0a\x07\x04\x02\x00\x00\x00\x00\x00"
|
|
453
|
+
b"\x00\x00\x00\x00\x02\x05\x09\x0d\x11\x14\x16\x17\x17\x16\x14\x11\x0d\x09\x05\x02\x00\x00\x00\x00\x00\x00\x00\x02\x05\x0a\x0f\x14\x19\x1d\x20\x22\x22\x20\x1d\x19\x14\x0f\x0a\x05\x02\x00\x00\x00"
|
|
454
|
+
b"\x00\x00\x01\x04\x09\x0f\x15\x1b\x22\x27\x2b\x2e\x2e\x2b\x27\x22\x1b\x15\x0f\x09\x04\x01\x00\x00\x00\x00\x03\x07\x0d\x14\x1b\x23\x2b\x33\x38\x3b\x3b\x38\x33\x2b\x23\x1b\x14\x0d\x07\x03\x00\x00"
|
|
455
|
+
b"\x00\x01\x04\x0a\x11\x19\x22\x2b\x35\x3e\x46\x4a\x4a\x46\x3e\x35\x2b\x22\x19\x11\x0a\x04\x01\x00\x00\x02\x06\x0c\x14\x1d\x27\x33\x3e\x4a\x54\x5b\x5b\x54\x4a\x3e\x33\x27\x1d\x14\x0c\x06\x02\x00"
|
|
456
|
+
b"\x00\x02\x07\x0e\x16\x20\x2b\x38\x46\x54\x62\x6c\x6c\x62\x54\x46\x38\x2b\x20\x16\x0e\x07\x02\x00\x00\x03\x08\x0f\x17\x22\x2e\x3b\x4a\x5b\x6c\x7d\x7d\x6c\x5b\x4a\x3b\x2e\x22\x17\x0f\x08\x03\x00"
|
|
457
|
+
b"\x00\x03\x08\x0f\x17\x22\x2e\x3b\x4a\x5b\x6c\x7d\x7d\x6c\x5b\x4a\x3b\x2e\x22\x17\x0f\x08\x03\x00\x00\x02\x07\x0e\x16\x20\x2b\x38\x46\x54\x62\x6c\x6c\x62\x54\x46\x38\x2b\x20\x16\x0e\x07\x02\x00"
|
|
458
|
+
b"\x00\x02\x06\x0c\x14\x1d\x27\x33\x3e\x4a\x54\x5b\x5b\x54\x4a\x3e\x33\x27\x1d\x14\x0c\x06\x02\x00\x00\x01\x04\x0a\x11\x19\x22\x2b\x35\x3e\x46\x4a\x4a\x46\x3e\x35\x2b\x22\x19\x11\x0a\x04\x01\x00"
|
|
459
|
+
b"\x00\x00\x03\x07\x0d\x14\x1b\x23\x2b\x33\x38\x3b\x3b\x38\x33\x2b\x23\x1b\x14\x0d\x07\x03\x00\x00\x00\x00\x01\x04\x09\x0f\x15\x1b\x22\x27\x2b\x2e\x2e\x2b\x27\x22\x1b\x15\x0f\x09\x04\x01\x00\x00"
|
|
460
|
+
b"\x00\x00\x00\x02\x05\x0a\x0f\x14\x19\x1d\x20\x22\x22\x20\x1d\x19\x14\x0f\x0a\x05\x02\x00\x00\x00\x00\x00\x00\x00\x02\x05\x09\x0d\x11\x14\x16\x17\x17\x16\x14\x11\x0d\x09\x05\x02\x00\x00\x00\x00"
|
|
461
|
+
b"\x00\x00\x00\x00\x00\x02\x04\x07\x0a\x0c\x0e\x0f\x0f\x0e\x0c\x0a\x07\x04\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x03\x04\x06\x07\x08\x08\x07\x06\x04\x03\x01\x00\x00\x00\x00\x00\x00"
|
|
462
|
+
b"\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x02\x03\x03\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
|
|
463
|
+
)
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
class Sprite:
|
|
467
|
+
"""Wrap an RGB565 FrameBuffer view into the shared atlas with safe blit helpers."""
|
|
468
|
+
|
|
469
|
+
def __init__(self, fb, w, h):
|
|
470
|
+
self.fb = fb
|
|
471
|
+
self.w = w
|
|
472
|
+
self.h = h
|
|
473
|
+
|
|
474
|
+
# Blit this sprite with color-key transparency at top-left (x, y).
|
|
475
|
+
def draw(self, target_fb, x, y):
|
|
476
|
+
target_fb.blit(self.fb, int(x), int(y), KEY)
|
|
477
|
+
|
|
478
|
+
# Blit this sprite centered around (cx, cy).
|
|
479
|
+
def draw_center(self, target_fb, cx, cy):
|
|
480
|
+
target_fb.blit(self.fb, int(cx) - (self.w >> 1), int(cy) - (self.h >> 1), KEY)
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
# Unpack sprite idx from DATA into the provided memoryview slice at scale s.
|
|
484
|
+
def _unpack_into(meta_idx, scale, flip_x, view_slice):
|
|
485
|
+
offs, src_w, src_h = SPRITE_META[meta_idx]
|
|
486
|
+
s = max(1, int(scale))
|
|
487
|
+
w = src_w * s
|
|
488
|
+
h = src_h * s
|
|
489
|
+
fb = make_canvas(view_slice, w, h)
|
|
490
|
+
fb.fill(KEY)
|
|
491
|
+
lut = PALETTE_LUT
|
|
492
|
+
src = DATA
|
|
493
|
+
for ry in range(src_h):
|
|
494
|
+
row_start = offs + ry * src_w
|
|
495
|
+
y0 = ry * s
|
|
496
|
+
rx = 0
|
|
497
|
+
while rx < src_w:
|
|
498
|
+
ch_byte = src[row_start + rx]
|
|
499
|
+
run = 1
|
|
500
|
+
while rx + run < src_w and src[row_start + rx + run] == ch_byte:
|
|
501
|
+
run += 1
|
|
502
|
+
if ch_byte != 46: # 46 is ord('.')
|
|
503
|
+
col = lut[ch_byte - 46]
|
|
504
|
+
if col != KEY:
|
|
505
|
+
px_x = (src_w - rx - run) * s if flip_x else rx * s
|
|
506
|
+
fb.fill_rect(px_x, y0, run * s, s, col)
|
|
507
|
+
rx += run
|
|
508
|
+
return Sprite(fb, w, h)
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
class SpriteBank:
|
|
512
|
+
"""Unpack all scaled sprites into one shared atlas and expose glows."""
|
|
513
|
+
|
|
514
|
+
def __init__(self, layout):
|
|
515
|
+
self.layout = layout
|
|
516
|
+
self.pet_px = 3 if layout.compact else 4
|
|
517
|
+
self.prop_px = 2 if layout.compact else 3
|
|
518
|
+
self.game_px = 2 if layout.compact else 3
|
|
519
|
+
emote_px = 2
|
|
520
|
+
|
|
521
|
+
# Build the schedule of (meta_idx, scale, flip_x) to pack into one atlas.
|
|
522
|
+
specs = []
|
|
523
|
+
# 0..1: bit_body
|
|
524
|
+
specs.append((0, self.pet_px, False))
|
|
525
|
+
specs.append((1, self.pet_px, False))
|
|
526
|
+
# 2..9: bit_faces
|
|
527
|
+
for i in range(2, 10):
|
|
528
|
+
specs.append((i, self.pet_px, False))
|
|
529
|
+
# 10..12: thruster flames
|
|
530
|
+
for i in range(10, 13):
|
|
531
|
+
specs.append((i, self.pet_px, False))
|
|
532
|
+
# 13..14: bit_game_r and bit_game_l
|
|
533
|
+
specs.append((13, self.game_px, False))
|
|
534
|
+
specs.append((13, self.game_px, True))
|
|
535
|
+
# 15..16: terrarium and mug
|
|
536
|
+
specs.append((14, self.prop_px, False))
|
|
537
|
+
specs.append((15, self.prop_px, False))
|
|
538
|
+
# 17..21: 5 emotes
|
|
539
|
+
for i in range(16, 21):
|
|
540
|
+
specs.append((i, emote_px, False))
|
|
541
|
+
# 22..25: 4 crystal frames
|
|
542
|
+
for i in range(21, 25):
|
|
543
|
+
specs.append((i, self.game_px, False))
|
|
544
|
+
# 26..27: 2 drone frames
|
|
545
|
+
for i in range(25, 27):
|
|
546
|
+
specs.append((i, self.game_px, False))
|
|
547
|
+
# 28..29: bolt and holo_bit
|
|
548
|
+
specs.append((27, self.game_px, False))
|
|
549
|
+
specs.append((28, self.prop_px, False))
|
|
550
|
+
|
|
551
|
+
# Compute total atlas bytes so we make only a single allocation.
|
|
552
|
+
total_bytes = 0
|
|
553
|
+
for meta_idx, sc, _ in specs:
|
|
554
|
+
_, sw, sh = SPRITE_META[meta_idx]
|
|
555
|
+
total_bytes += (sw * sc) * (sh * sc) * 2
|
|
556
|
+
|
|
557
|
+
self.atlas_buf = pixel_bytes(total_bytes)
|
|
558
|
+
self.atlas_mv = memoryview(self.atlas_buf)
|
|
559
|
+
|
|
560
|
+
unpacked = []
|
|
561
|
+
cursor = 0
|
|
562
|
+
for meta_idx, sc, flip in specs:
|
|
563
|
+
_, sw, sh = SPRITE_META[meta_idx]
|
|
564
|
+
nbytes = (sw * sc) * (sh * sc) * 2
|
|
565
|
+
sub_mv = self.atlas_mv[cursor : cursor + nbytes]
|
|
566
|
+
unpacked.append(_unpack_into(meta_idx, sc, flip, sub_mv))
|
|
567
|
+
cursor += nbytes
|
|
568
|
+
|
|
569
|
+
self.bit_body = (unpacked[0], unpacked[1])
|
|
570
|
+
self.bit_faces = {}
|
|
571
|
+
for idx, name in enumerate(FACE_NAMES):
|
|
572
|
+
self.bit_faces[name] = unpacked[2 + idx]
|
|
573
|
+
self.flames = (unpacked[10], unpacked[11], unpacked[12])
|
|
574
|
+
self.bit_game_r = unpacked[13]
|
|
575
|
+
self.bit_game_l = unpacked[14]
|
|
576
|
+
self.terrarium = unpacked[15]
|
|
577
|
+
self.mug = unpacked[16]
|
|
578
|
+
|
|
579
|
+
self.emotes = {}
|
|
580
|
+
for idx, name in enumerate(EMOTE_NAMES):
|
|
581
|
+
self.emotes[name] = unpacked[17 + idx]
|
|
582
|
+
|
|
583
|
+
self.crystals = (unpacked[22], unpacked[23], unpacked[24], unpacked[25])
|
|
584
|
+
self.drones = (unpacked[26], unpacked[27])
|
|
585
|
+
self.bolt = unpacked[28]
|
|
586
|
+
self.holo_bit = unpacked[29]
|
|
587
|
+
|
|
588
|
+
# Zero-copy memoryview slices for 8-bit radial alpha glow masks.
|
|
589
|
+
self.glow16 = DATA[GLOW16_OFFSET : GLOW16_OFFSET + GLOW16_SIZE * GLOW16_SIZE]
|
|
590
|
+
self.glow24 = DATA[GLOW24_OFFSET : GLOW24_OFFSET + GLOW24_SIZE * GLOW24_SIZE]
|
|
591
|
+
|
|
592
|
+
# Blend a soft 8-bit radial glow centered at (cx, cy) via FrameBuffer.blit_alpha.
|
|
593
|
+
def draw_glow(self, fb, cx, cy, color, large=True):
|
|
594
|
+
if large:
|
|
595
|
+
fb.blit_alpha(
|
|
596
|
+
self.glow24,
|
|
597
|
+
int(cx) - (GLOW24_SIZE >> 1),
|
|
598
|
+
int(cy) - (GLOW24_SIZE >> 1),
|
|
599
|
+
GLOW24_SIZE,
|
|
600
|
+
GLOW24_SIZE,
|
|
601
|
+
color,
|
|
602
|
+
)
|
|
603
|
+
else:
|
|
604
|
+
fb.blit_alpha(
|
|
605
|
+
self.glow16,
|
|
606
|
+
int(cx) - (GLOW16_SIZE >> 1),
|
|
607
|
+
int(cy) - (GLOW16_SIZE >> 1),
|
|
608
|
+
GLOW16_SIZE,
|
|
609
|
+
GLOW16_SIZE,
|
|
610
|
+
color,
|
|
611
|
+
)
|
|
612
|
+
|
|
613
|
+
# Render the full Workshop Bit character with soft thruster glow and eye tracking.
|
|
614
|
+
def draw_workshop_bit(self, fb, cx, cy, frame_idx, mood="neutral", look_dx=0, look_dy=0, glow_col=None):
|
|
615
|
+
body = self.bit_body[frame_idx & 1]
|
|
616
|
+
bx = int(cx) - (body.w >> 1)
|
|
617
|
+
by = int(cy) - (body.h >> 1)
|
|
618
|
+
flame = self.flames[frame_idx % len(self.flames)]
|
|
619
|
+
flame_cy = by + body.h - self.pet_px + (flame.h >> 1)
|
|
620
|
+
if glow_col is not None:
|
|
621
|
+
self.draw_glow(fb, cx, flame_cy, glow_col, large=True)
|
|
622
|
+
self.draw_glow(fb, cx, by + 2 * self.pet_px, glow_col, large=False)
|
|
623
|
+
flame.draw(fb, int(cx) - (flame.w >> 1), by + body.h - self.pet_px)
|
|
624
|
+
body.draw(fb, bx, by)
|
|
625
|
+
face = self.bit_faces.get(mood, self.bit_faces["neutral"])
|
|
626
|
+
max_dx = self.pet_px * 2
|
|
627
|
+
max_dy = self.pet_px
|
|
628
|
+
fdx = max(-max_dx, min(max_dx, int(look_dx)))
|
|
629
|
+
fdy = max(-max_dy, min(max_dy, int(look_dy)))
|
|
630
|
+
fx = bx + 6 * self.pet_px + fdx
|
|
631
|
+
fy = by + 8 * self.pet_px + fdy
|
|
632
|
+
face.draw(fb, fx, fy)
|