-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
51 lines (34 loc) · 1.09 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
50
51
#!/usr/bin/env python3
import copy
import time
import tcod
from engine import Engine
from application_path import get_app_path
def main() -> None:
screen_width = 40
screen_height = 28
tileset = tcod.tileset.load_tilesheet(
get_app_path() + "/ceefax_teletext_6x10.png", 16, 16, tcod.tileset.CHARMAP_CP437
)
with tcod.context.new_terminal(
screen_width * 3,
screen_height * 3,
tileset=tileset,
title="Teletext",
vsync=True,
sdl_window_flags = tcod.context.SDL_WINDOW_FULLSCREEN
) as root_context:
tcod.lib.SDL_SetHint(b"SDL_RENDER_SCALE_QUALITY", b"0")
root_console = tcod.Console(screen_width, screen_height, order="F")
engine = Engine()
cycle = 0
while True:
root_console.clear()
engine.event_handler.on_render(root_console=root_console)
root_context.present(root_console)
engine.handle_events(root_context)
cycle += 1
if cycle % 2 == 0:
engine.update()
if __name__ == "__main__":
main()