Kraken Logo

Kraken Engine

DocumentationGuidesShowcaseCommunity
Ctrl
K
Installation
Creating a Window

Built bydurkisneer1.Kraken Engine is open source and available onGitHub.

  1. Guides
  2. Getting Started
  3. Create Window

Creating a Window

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.

Quickstart with the CLI (Optional)

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 rendering

Starter Code Snippet

If you prefer to write it manually, use the following:

main.py
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()

Breakdown

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:

  1. Initializing Kraken Engine
    • kn.init() prepares the underlying frameworks and features, ensuring the engine is ready to deliver everything it promises.
  2. Creating the Window
    • kn.window.create("Kraken Example", 900, 500) creates the window with a size of 900x500 pixels and a title of "Kraken Example".
  3. Looping and Event Polling
    • The 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.
  4. Rendering
    • kn.renderer.clear() overwrites the back buffer's pixels to prepare for new drawing operations.
  5. Presenting the Frame
    • kn.renderer.present() copies the back buffer to the screen with any drawing commands issued since the last clear.
  6. Cleanly Quitting the Application
    • Once the window is closed, exiting the main loop, 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.

PreviousInstallation
NextHow It Works

On this page

Quickstart with the CLI (Optional)Starter Code SnippetBreakdown