forked from HexDecimal/RayWizard
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disallow untyped definitions. Organize imports from VS Code. Enable all runtime warnings.
- Loading branch information
1 parent
b9be189
commit 4e0f803
Showing
4 changed files
with
35 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
"""Shorthand globals module. For sharing mutable objects across modules. | ||
This is for organization and has no special effects. | ||
""" | ||
import tcod | ||
|
||
context: tcod.context.Context # Global context |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,38 @@ | ||
#!/usr/bin/env python3 | ||
"""Main module. | ||
Run this module from Python to start this program. | ||
""" | ||
import sys | ||
import warnings | ||
|
||
import tcod | ||
|
||
import g | ||
|
||
SCREEN_WIDTH = 1280 | ||
SCREEN_HEIGHT = 720 | ||
|
||
CONSOLE_WIDTH = SCREEN_WIDTH // 12 | ||
CONSOLE_HEIGHT = SCREEN_HEIGHT // 12 | ||
|
||
|
||
def main() -> None: | ||
"""Main entrypoint.""" | ||
tileset = tcod.tileset.load_tilesheet("Alloy_curses_12x12.png", 16, 16, tcod.tileset.CHARMAP_CP437) | ||
console = tcod.console.Console(1280 // 12, 720 // 12, order="C") | ||
with tcod.context.new(width=1280, height=720, tileset=tileset) as context: | ||
with tcod.context.new(width=SCREEN_WIDTH, height=SCREEN_HEIGHT, tileset=tileset) as g.context: | ||
while True: | ||
# Rendering. | ||
console = tcod.console.Console(CONSOLE_WIDTH, CONSOLE_HEIGHT, order="C") | ||
console.print(0, 0, "Hello World") | ||
context.present(console, integer_scaling=True) | ||
g.context.present(console, integer_scaling=True) | ||
# Handle input. | ||
for event in tcod.event.wait(): | ||
if isinstance(event, tcod.event.Quit): | ||
raise SystemExit() | ||
|
||
|
||
if __name__ == "__main__": | ||
if not sys.warnoptions: | ||
warnings.simplefilter("default") # Enable all runtime warnings. | ||
main() |