-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
49 lines (45 loc) · 1.57 KB
/
main.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
import random
import pygame
FPS = 30
WIDTH = 1920
HEIGHT = 1080
COL_SIZE = 23
ROW_SIZE = 23
COLS_NUM = int(WIDTH / COL_SIZE)
KATAKANA_FONT_SIZE = 30
KATAKANA_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYabcdefghijkl!<"
SECOND_FONT_SIZE = 28
SECOND_CHARS = "0123456789!<>=+-"
pygame.init()
screen = pygame.display.set_mode((WIDTH, HEIGHT), pygame.FULLSCREEN)
katakana_font = pygame.font.Font("katakana.ttf", KATAKANA_FONT_SIZE)
second_font = pygame.font.SysFont(None, SECOND_FONT_SIZE)
clock = pygame.time.Clock()
columns = [0] * COLS_NUM
while True:
clock.tick(FPS)
for event in pygame.event.get():
if event.type == pygame.QUIT:
quit()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
quit()
for i, column in enumerate(columns):
c = (0, 120 + random.randint(0, 120), 0)
if random.random() < 0.01:
c = (255, 255, 255)
letter = katakana_font.render(random.choice(list(KATAKANA_CHARS)), True, c)
if random.random() < 0.1:
letter = second_font.render(random.choice(list(SECOND_CHARS)), True, c)
letter = pygame.transform.flip(letter, True, False)
screen.blit(letter, (i * COL_SIZE, column * ROW_SIZE))
columns[i] += 1
if columns[i] > 30 + random.random() * 2000:
columns[i] = 0
s = pygame.Surface((WIDTH, HEIGHT))
s.set_alpha(7)
s.fill((0, 0, 0))
screen.blit(s, (0, 0))
pygame.display.update()
# scaled = pygame.transform.smoothscale(screen, (WIDTH + 1, HEIGHT + 1))
# screen.blit(scaled, (-1, -1))