Build your first Kraken application by creating a game window.
Congratulations on getting Kraken Engine installed! This page helps you launch your first window with in-depth descriptions of what each line means.
If you want a ready-to-run window template, you can generate one with the built-in CLI:
pykraken init my_project
cd my_project && python main.py
Usage:
pykraken init [-h] [-f] [--demo] [path]
path: Folder to create the project in (defaults to current directory)-f, --force: Overwrite an existing main.py--demo: Generate starter code with text and shape renderingIf you prefer to write it manually, use the following:
import pykraken as kn
kn.init()
kn.window.create("Kraken Example", 900, 500)
while kn.window.is_open():
kn.event.poll()
kn.renderer.clear()
kn.renderer.present()
kn.quit()
This simple program serves as a basic skeleton for applications built with the Kraken Engine. Let's break down the key components that make this program function:
kn.init() prepares the underlying frameworks and features, ensuring the engine is ready to deliver everything it promises.kn.window.create("Kraken Example", 900, 500) creates the window with a size of 900x500 pixels and a title of "Kraken Example".while kn.window.is_open(): loop keeps the application running as long as the window is open.
Inside it, kn.event.poll() updates internal event states like keyboard, mouse, and controller user input.kn.renderer.clear() overwrites the back buffer's pixels to prepare for new drawing operations.kn.renderer.present() copies the back buffer to the screen with any drawing commands issued since the last clear.kn.quit() safely shuts down the engine and frees any resources in use.This template establishes a foundation for more advanced game logic and rendering.