Quickstart

  1. Instantiate a Window class with the required details.

  2. Define your game loop and decorate it with the loop decorator that should accept one parameter of type Screen.

  3. Write some fancy code with or without built-in models to render.

  4. Call the run method!

from Asciinpy.screen import Screen, Window
from Asciinpy.values import Resolutions
from Asciinpy._2D import Square

# Define a window
window = Window(resolution=Resolutions.Basic)

@window.loop()
def game_loop(screen: Screen) -> None:
   square = Square(coordinate=(0, 0), length=8, texture="%")
   while True:
      screen.blit(square)
      screen.refresh()

if __name__ == "__main__":
   window.run()

Note

Don’t forget to blit the objects after creating them or else they won’t appear. Not calling the refresh method will also result in freezed frames.