-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain - Copy.py
538 lines (451 loc) · 22.8 KB
/
main - Copy.py
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
import sys
import pygame
import moderngl
import spritesheet
from array import array
pygame.init()
# When we do the actual Pip Boy, I'm pretty sure we can just get the window's scale instead
SCREEN_WIDTH = 800
SCREEN_HEIGHT = 480
widthX = SCREEN_WIDTH / 2
heightY = SCREEN_HEIGHT / 2
# These are horrible, no good, very bad
selectedTabTop = [
[0, " ┌ ┐ "],
[1, " ┌ ┐ "],
[2, " ┌ ┐ "],
[3, " ┌ ┐ "],
[4, " ┌ ┐ "],
]
selectedTabBtm = [
[0, "┌─────┘ └────────────────────────────────────────────┐"],
[1, "┌───────────────┘ └───────────────────────────────────┐"],
[2, "┌────────────────────────┘ └──────────────────────────┐"],
[3, "┌──────────────────────────────────┘ └────────────────┐"],
[4, "┌─────────────────────────────────────────────┘ └───┐"],
]
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT), pygame.OPENGL | pygame.DOUBLEBUF)
display = pygame.Surface((SCREEN_WIDTH, SCREEN_HEIGHT))
pygame.display.set_caption("PipOS")
pygame.display.set_icon(display)
# Flicker start up, self-evident by the name. make this 'False' if you don't want it to appear on startup
startUpFlicker = False
# ModernGL context, it's for the actual rendering
ctx = moderngl.create_context()
# Clock value, dictates the speed of the game
clock = pygame.time.Clock()
# Indexes for different tabs/submenus in the Pip Boy
indexOfTab = 0
indexOfSubmenu = 0
# Sprite sheet stuff for the Vault Boy
sprite_sheet_image = pygame.image.load('assets/vault_boy/vault_boy_sequence.png').convert_alpha()
sprite_sheet = spritesheet.SpriteSheet(sprite_sheet_image)
# Frames for Vault Boy
animation_list = []
animation_steps = 6
last_update = pygame.time.get_ticks()
animation_cooldown = 200
frame = 0
# For loop iterating through the animations
for x in range(animation_steps):
animation_list.append(sprite_sheet.get_image(x, 268, 268, 1, (255, 255, 255)))
# For the submenus. @TODO I REFUSE TO ORGANIZE I'LL DO IT LATER
defaultStatusPos = (100, 40)
defaultSpecialPos = (196, 40)
defaultPerksPos = (300, 40)
defaultWeaponsPos = (100, 40)
defaultArmorPos = (196, 40)
defaultAidPos = (100, 40)
statusPos = defaultStatusPos
specialPos = defaultSpecialPos
perksPos = defaultPerksPos
weaponsPos = defaultWeaponsPos
armorPos = defaultArmorPos
aidPos = defaultAidPos
font = pygame.font.Font('fonts/monofonto rg.ttf', 26)
font_smaller = pygame.font.Font('fonts/monofonto rg.ttf', 24)
font_scaled = pygame.font.Font('fonts/monofonto rg.ttf', 22)
font_for_bars = pygame.font.Font('fonts/monofonto rg.ttf', 18)
font2 = pygame.font.Font('fonts/RobotoCondensed-Regular.ttf', 26)
background = pygame.image.load('assets/base.png').convert_alpha()
quad_buffer = ctx.buffer(data=array('f', [
# position (x, y), uv co-ords (x, y)
-1.0, 1.0, 0.0, 0.0, # top left
1.0, 1.0, 1.0, 0.0, # top right
-1.0, -1.0, 0.0, 1.0, # bottom left
1.0, -1.0, 1.0, 1.0, # bottom right
]))
vert_shader = open('shaders/vertex_shader.glsl').read()
frag_shader = open('shaders/fragment_shader.glsl').read()
program = ctx.program(vertex_shader=vert_shader, fragment_shader=frag_shader)
render_object = ctx.vertex_array(program, [(quad_buffer, '4f', 'Position')])
def surf_to_texture(surf):
tex = ctx.texture(surf.get_size(), 4)
tex.filter = (moderngl.BLEND, moderngl.BLEND)
tex.swizzle = 'BGRA'
tex.write(surf.get_view('1'))
return tex
# BUTTONS
STATButton = pygame.Surface((100, 26), pygame.SRCALPHA).convert_alpha()
INVButton = pygame.Surface((100, 26), pygame.SRCALPHA).convert_alpha()
DATAButton = pygame.Surface((100, 26), pygame.SRCALPHA).convert_alpha()
MAPButton = pygame.Surface((100, 26), pygame.SRCALPHA).convert_alpha()
RADIOButton = pygame.Surface((100, 26), pygame.SRCALPHA).convert_alpha()
NameLabel = pygame.Surface((800, 26), pygame.SRCALPHA).convert_alpha()
HighlightedTextButton = pygame.Surface((338, 32), pygame.SRCALPHA).convert_alpha()
# Stats Screen Specific Buttons
STATUSButton = pygame.Surface((100, 24), pygame.SRCALPHA).convert_alpha()
SPECIALButton = pygame.Surface((100, 24), pygame.SRCALPHA).convert_alpha()
PERKSButton = pygame.Surface((60, 24), pygame.SRCALPHA).convert_alpha()
# Stats Screen Specific Rectangles
STATUSButtonRect = pygame.Rect(statusPos[0], statusPos[1], 100, 50) # 110 40 100 50
SPECIALButtonRect = pygame.Rect(specialPos[0], specialPos[1], 100, 50) # 192 40 100 50
PERKSButtonRect = pygame.Rect(perksPos[0], perksPos[1], 100, 50) # 286 40 100 50
# Inv Screen Specific Buttons
WEAPONSButton = pygame.Surface((100, 24), pygame.SRCALPHA).convert_alpha()
ARMORButton = pygame.Surface((100, 24), pygame.SRCALPHA).convert_alpha()
AIDButton = pygame.Surface((60, 24), pygame.SRCALPHA).convert_alpha()
# Inv Screen Specific Rectangles
WEAPONSButtonRect = pygame.Rect(statusPos[0], statusPos[1], 100, 50) # 110 40 100 50
ARMORButtonRect = pygame.Rect(specialPos[0], specialPos[1], 100, 50) # 192 40 100 50
AIDButtonRect = pygame.Rect(perksPos[0], perksPos[1], 100, 50) # 286 40 100 50
STATButtonRect = pygame.Rect(97, heightY - 234, 100, 26)
INVButtonRect = pygame.Rect(219, heightY - 234, 100, 26)
DATAButtonRect = pygame.Rect(widthX - 62, heightY - 234, 100, 26)
MAPButtonRect = pygame.Rect(widthX + 67, heightY - 234, 100, 26)
RADIOButtonRect = pygame.Rect(widthX + 223, heightY - 234, 100, 26)
LabelOfName = pygame.Rect((display.get_width() / 2) - (NameLabel.get_width() / 2), display.get_height() / 2 + 150, 286,
26)
HighlightedTextRect = pygame.Rect(53, heightY - 120, 338, 32)
t = 0
statColor = (120, 120, 120)
invColor = (120, 120, 120)
dataColor = (120, 120, 120)
mapColor = (120, 120, 120)
radioColor = (120, 120, 120)
selectedColor = (174, 174, 174)
statusColor = (91, 91, 91)
specialColor = (50, 50, 50)
perksColor = (10, 10, 10)
weaponColor = (91, 91, 91)
armorColor = (50, 50, 50)
aidColor = (10, 10, 10)
lerp_speed = t * 0.2 # Higher values make the transition faster
def lerp(a, b, t):
return a + (b - a) * t
def translate_submenu_rects(index):
global STATUSButtonRect, SPECIALButtonRect, PERKSButtonRect
if index == 0:
# Transition to Stats
STATUSButtonRect.x = lerp(STATUSButtonRect.x, defaultStatusPos[0], lerp_speed)
SPECIALButtonRect.x = lerp(SPECIALButtonRect.x, defaultSpecialPos[0], lerp_speed)
PERKSButtonRect.x = lerp(PERKSButtonRect.x, defaultPerksPos[0], lerp_speed)
elif index == 1:
# Transition to Special
STATUSButtonRect.x = lerp(STATUSButtonRect.x, defaultStatusPos[0] - (defaultSpecialPos[0] - defaultStatusPos[0]), lerp_speed)
SPECIALButtonRect.x = lerp(SPECIALButtonRect.x, defaultSpecialPos[0], lerp_speed)
PERKSButtonRect.x = lerp(PERKSButtonRect.x, defaultPerksPos[0] + (defaultStatusPos[0] - defaultSpecialPos[0]), lerp_speed)
elif index == 2:
# Transition to Perks
STATUSButtonRect.x = lerp(STATUSButtonRect.x, defaultStatusPos[0] - (defaultPerksPos[0] - defaultStatusPos[0]), lerp_speed)
SPECIALButtonRect.x = lerp(SPECIALButtonRect.x, defaultSpecialPos[0] - (defaultPerksPos[0] - defaultSpecialPos[0]), lerp_speed)
PERKSButtonRect.x = lerp(PERKSButtonRect.x, defaultPerksPos[0], lerp_speed)
elif index == 3:
# transition to Weapons
WEAPONSButtonRect.x = lerp(WEAPONSButtonRect.x, defaultWeaponsPos[0], lerp_speed)
ARMORButtonRect.x = lerp(ARMORButtonRect.x, defaultArmorPos[0], lerp_speed)
AIDButtonRect.x = lerp(AIDButtonRect.x, defaultAidPos[0], lerp_speed)
elif index == 4:
# transition to Armor
WEAPONSButtonRect.x =lerp(WEAPONSButtonRect.x, defaultWeaponsPos[0] - (defaultPerksPos[0] - defaultWeaponsPos[0]), lerp_speed)
SPECIALButtonRect.x = lerp(ARMORButtonRect.x, defaultArmorPos[0], lerp_speed)
AIDButtonRect.x = lerp(AIDButtonRect.x, defaultAidPos[0] + (defaultWeaponsPos[0] - defaultArmorPos[0]), lerp_speed)
elif index == 2:
# Transition to AID
WEAPONSButtonRect.x = lerp(WEAPONSButtonRect.x, defaultWeaponsPos[0] - (defaultAidPos[0] - defaultWeaponsPos[0]), lerp_speed)
ARMORButtonRect.x = lerp(ARMORButtonRect.x, defaultArmorPos[0] - (defaultAidPos[0] - defaultArmorPos[0]), lerp_speed)
AIDButtonRect.x = lerp(AIDButtonRect.x, defaultAidPos[0], lerp_speed)
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
if event.type == pygame.MOUSEBUTTONDOWN and not startUpFlicker and event.button == 1:
if STATButtonRect.collidepoint(event.pos):
indexOfTab = 0
if STATUSButtonRect.collidepoint(pygame.mouse.get_pos()):
indexOfSubmenu = 0
translate_submenu_rects(indexOfSubmenu)
statusColor = (91, 91, 91)
specialColor = (50, 50, 50)
perksColor = (10, 10, 10)
if SPECIALButtonRect.collidepoint(pygame.mouse.get_pos()):
indexOfSubmenu = 1
translate_submenu_rects(indexOfSubmenu)
statusColor = (50, 50, 50)
specialColor = (91, 91, 91)
perksColor = (50, 50, 50)
if PERKSButtonRect.collidepoint(pygame.mouse.get_pos()):
indexOfSubmenu = 2
translate_submenu_rects(indexOfSubmenu)
statusColor = (10, 10, 10)
specialColor = (50, 50, 50)
perksColor = (91, 91, 91)
if INVButtonRect.collidepoint(event.pos):
indexOfTab = 1
if WEAPONSButtonRect.collidepoint(pygame.mouse.get_pos()):
indexOfSubmenu = 3
translate_submenu_rects(indexOfSubmenu)
weaponColor = (91, 91, 91)
armorColor = (50, 50, 50)
aidColor = (10, 10, 10)
if ARMORButtonRect.collidepoint(pygame.mouse.get_pos()):
indexOfSubmenu = 4
translate_submenu_rects(indexOfSubmenu)
weaponColor = (50, 50, 50)
armorColor = (91, 91, 91)
aidColor = (50, 50, 50)
if AIDButtonRect.collidepoint(pygame.mouse.get_pos()):
indexOfSubmenu = 5
translate_submenu_rects(indexOfSubmenu)
weaponColor = (10, 10, 10)
armorColor = (50, 50, 50)
aidColor = (91, 91, 91)
if DATAButtonRect.collidepoint(event.pos):
indexOfTab = 2
if MAPButtonRect.collidepoint(event.pos):
indexOfTab = 3
if RADIOButtonRect.collidepoint(event.pos):
indexOfTab = 4
if STATButtonRect.collidepoint(pygame.mouse.get_pos()):
statColor = (174, 174, 174)
else:
statColor = (91, 91, 91)
if INVButtonRect.collidepoint(pygame.mouse.get_pos()):
invColor = (174, 174, 174)
else:
invColor = (91, 91, 91)
if DATAButtonRect.collidepoint(pygame.mouse.get_pos()):
dataColor = (174, 174, 174)
else:
dataColor = (91, 91, 91)
if MAPButtonRect.collidepoint(pygame.mouse.get_pos()):
mapColor = (174, 174, 174)
else:
mapColor = (91, 91, 91)
if RADIOButtonRect.collidepoint(pygame.mouse.get_pos()):
radioColor = (174, 174, 174)
else:
radioColor = (91, 91, 91)
if STATUSButtonRect.collidepoint(pygame.mouse.get_pos()):
statusColor = selectedColor
else:
statusColor = (91, 91, 91)
if SPECIALButtonRect.collidepoint(pygame.mouse.get_pos()):
specialColor = selectedColor
else:
specialColor = (50, 50, 50)
if PERKSButtonRect.collidepoint(pygame.mouse.get_pos()):
perksColor = selectedColor
else:
perksColor = (10, 10, 10)
stats = font.render("STAT", True, statColor)
statsRect = stats.get_rect(center=(STATButton.get_width() / 2, STATButton.get_height() / 2))
inv = font.render("INV", True, invColor)
invRect = inv.get_rect(center=(INVButton.get_width() / 2, INVButton.get_height() / 2))
data = font.render("DATA", True, dataColor)
dataRect = data.get_rect(center=(DATAButton.get_width() / 2, DATAButton.get_height() / 2))
maps = font.render("MAP", True, mapColor)
mapRect = maps.get_rect(center=(MAPButton.get_width() / 2, MAPButton.get_height() / 2))
radio = font.render("RADIO", True, radioColor)
radioRect = radio.get_rect(center=(RADIOButton.get_width() / 2, RADIOButton.get_height() / 2))
# Submenus for Stats
status = font_smaller.render("STATUS", True, statusColor)
status_rect = status.get_rect(center=(STATUSButton.get_width() / 2, STATUSButton.get_height() / 2))
special = font_smaller.render("SPECIAL", True, specialColor)
special_rect = special.get_rect(center=(SPECIALButton.get_width() / 2, SPECIALButton.get_height() / 2))
perks = font_smaller.render("PERKS", True, perksColor)
perks_rect = perks.get_rect(center=(PERKSButton.get_width() / 2, PERKSButton.get_height() / 2))
# Submenus for Inv
weapon = font_smaller.render("WEAPONS", True, weaponColor)
weapon_rect = weapon.get_rect(center=(WEAPONSButton.get_width() / 2, WEAPONSButton.get_height() / 2))
special = font_smaller.render("ARMOR", True, armorColor)
special_rect = special.get_rect(center=(SPECIALButton.get_width() / 2, SPECIALButton.get_height() / 2))
perks = font_smaller.render("AID", True, perksColor)
perks_rect = perks.get_rect(center=(PERKSButton.get_width() / 2, PERKSButton.get_height() / 2))
# Name
name = font2.render("Loqor", True, (174, 174, 174))
rectOfName = name.get_rect(center=(NameLabel.get_width() / 2, NameLabel.get_height() / 2))
STATButton.blit(stats, statsRect)
INVButton.blit(inv, invRect)
DATAButton.blit(data, dataRect)
MAPButton.blit(maps, mapRect)
RADIOButton.blit(radio, radioRect)
NameLabel.blit(name, rectOfName)
# Rendering code, ANIME DO NOT TOUCH OR I WILL SMITE YOU WITH A FUCKING NUCLEAR BOMB
t += 1
def get_tab_representation(index, tablist):
for item in tablist:
if item[0] == index:
return item[1]
return None # Return None if no matching index is found
display.fill((0, 0, 0))
# Display each button
display.blit(STATButton, (STATButtonRect.x, STATButtonRect.y))
display.blit(INVButton, (INVButtonRect.x, INVButtonRect.y))
display.blit(DATAButton, (DATAButtonRect.x, DATAButtonRect.y))
display.blit(MAPButton, (MAPButtonRect.x, MAPButtonRect.y))
display.blit(RADIOButton, (RADIOButtonRect.x, RADIOButtonRect.y))
# Display tab selections
display.blit(font.render(get_tab_representation(indexOfTab, selectedTabTop), True, (91, 91, 91)), (24, 0))
display.blit(font.render(get_tab_representation(indexOfTab, selectedTabBtm), True, (91, 91, 91)), (24, 24))
if indexOfTab == 0:
# Display different submenus
STATUSButton.blit(status, status_rect)
SPECIALButton.blit(special, special_rect)
PERKSButton.blit(perks, perks_rect)
# display stats buttons
display.blit(STATUSButton, (STATUSButtonRect.x, STATUSButtonRect.y))
display.blit(SPECIALButton, (SPECIALButtonRect.x, SPECIALButtonRect.y))
display.blit(PERKSButton, (PERKSButtonRect.x, PERKSButtonRect.y))
# Display lower bar of Stats screen
display.blit(font.render("██████████▌██████████████████████████████████▌███████████", True, (25, 25, 25)),
(34, heightY + 200))
display.blit(
font_scaled.render(" ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ", True, (174, 174, 174)),
(34, heightY + 209))
display.blit(font_scaled.render("HP 380/380 LEVEL 125 AP 150/150", True,
(174, 174, 174)), (34, heightY + 202))
# Display Limb Health Bars
if indexOfSubmenu == 0:
# Update animation
current_time = pygame.time.get_ticks()
if current_time - last_update >= animation_cooldown:
frame += 1
last_update = current_time
if frame >= len(animation_list):
frame = 0
# Vault boy rendering
display.blit(animation_list[frame], (widthX - 168, heightY - 162))
# Display name
display.blit(NameLabel, (LabelOfName.x, LabelOfName.y))
bar = "▀▀▀▀▀"
for i in range(6):
values = [
(400 - 24, heightY - 152),
(400 - 134, heightY - 70),
(400 + 84, heightY - 70),
(400 - 134, heightY + 64),
(400 + 84, heightY + 64),
(400 - 24, heightY + 98),
]
display.blit(font_for_bars.render(bar, True, (174, 174, 174)), values[i])
SpecialStuff = [
" Strength 2",
" Perception 5",
" Endurance 5",
" Charisma 10",
" Intelligence 10",
" Agility 6",
" Luck 15"
]
PerksStuff = [
" Bloody Mess ",
" Mysterious Stranger ",
" Strong Back ",
" Animal Friend ",
" Armorer ",
" Gunsmith ",
" Anime Fiend "
]
if indexOfSubmenu == 1:
display.blit(font.render("██████████████████████████", True, (91, 91, 91)), (53, heightY - 120))
for i, attribute in enumerate(SpecialStuff):
# Calculate the y position for this attribute
attribute_y_position = HighlightedTextRect.y + (i * 40)
button_rect = pygame.Rect(HighlightedTextRect.x, attribute_y_position, HighlightedTextRect.width,
HighlightedTextRect.height)
# Determine if the mouse is over the button
if button_rect.collidepoint(pygame.mouse.get_pos()):
text_color = (0, 0, 0)
background_color = (91, 91, 91)
else:
text_color = (91, 91, 91)
background_color = (0, 0, 0)
# Render the text with the appropriate colors
text = font.render(attribute, True, text_color)
text_rect = text.get_rect()
text_rect.center = (button_rect.width / 2, button_rect.height / 2)
# Fill the button surface with the background color
HighlightedTextButton = pygame.Surface((button_rect.width, button_rect.height))
HighlightedTextButton.fill(background_color)
# Blit the text onto the button surface
HighlightedTextButton.blit(text, text_rect)
# Blit the entire button surface to the display at the correct position
display.blit(HighlightedTextButton, button_rect.topleft)
if indexOfSubmenu == 2:
# perks screen
display.blit(font.render("██████████████████████████", True, (91, 91, 91)), (53, heightY - 120))
for i, attribute in enumerate(PerksStuff):
# Calculate the y position for this attribute
attribute_y_position = HighlightedTextRect.y + (i * 40)
button_rect = pygame.Rect(HighlightedTextRect.x, attribute_y_position, HighlightedTextRect.width,
HighlightedTextRect.height)
# Determine if the mouse is over the button
if button_rect.collidepoint(pygame.mouse.get_pos()):
text_color = (0, 0, 0)
background_color = (91, 91, 91)
else:
text_color = (91, 91, 91)
background_color = (0, 0, 0)
# Render the text with the appropriate colors
text = font.render(attribute, True, text_color)
text_rect = text.get_rect()
text_rect.center = (button_rect.width / 2, button_rect.height / 2)
# Fill the button surface with the background color
HighlightedTextButton = pygame.Surface((button_rect.width, button_rect.height))
HighlightedTextButton.fill(background_color)
# Blit the text onto the button surface
HighlightedTextButton.blit(text, text_rect)
# Blit the entire button surface to the display at the correct position
display.blit(HighlightedTextButton, button_rect.topleft)
frame_tex = surf_to_texture(display)
frame_tex.use(0)
# Program Uniforms (for shaders, **do not touch**).
program['ProjMat'] = [2.0, 0.0, 0.0, 0.0,
0.0, 2.0, 0.0, 0.0,
0.0, 0.0, 2.0, 0.0,
-1.0, 1.0, 0.0, 2.0]
program['DiffuseSampler'] = 0
program['InSize'] = (1, 1)
program['OutSize'] = (1, -1)
program['time'] = t
program['colorization'] = (
0.0 / 255.0, # Red
238.0 / 255.0, # Green
0.0 / 255.0 # Blue
)
brightness = 0
if startUpFlicker:
brightness = ((t * 0.002) / 0.28)
else:
brightness = 1 # Brightness value - default value is 1.0
program['brightness'] = brightness
program['shuckScreen'] = startUpFlicker
timeRunning = 0.0
if startUpFlicker:
timeRunning = t * 0.002
print(timeRunning)
if timeRunning >= 0.28:
startUpFlicker = False
timeRunning = 0
else:
timeRunning = 0
program['timeRunning'] = timeRunning
# Actual rendering of the screen itself
ctx.clear(0, 0, 0, 1, -1)
render_object.render(mode=moderngl.TRIANGLE_STRIP)
# Frame update
pygame.display.flip()
frame_tex.release()
clock.tick(75)