Skip to main content
Version: Dev

Introduction

Documentation versions

This site has two documentation tracks:

  • Release — matches the stable master branch of batFramework
  • Dev — matches the dev branch (newer APIs, may change)

Use the version dropdown in the navbar to switch. You are viewing Dev.

Getting Started​

BatFramework is available on Windows/Linux and only requires the pygame-ce library as a direct dependency.

What you'll need​

  • Pygame-ce (install latest version using pip install):

  • Python >=3.11

Quick Install

The following command will install batFramework and pygame-ce.

pip install --upgrade --pre batFramework

Your first project​

Project structure​

A batFramework game is organized in the following way:

  • Manager handles the game and its scenes
  • Scenes manage a camera, a list of entities, and a built-in GUI root
  • Entities are the building blocks of the game (sprites, widgets, systems, …)

When you want to add specialized behavior, inherit the relevant class from the framework and override the necessary hooks.

Get a window running​

Here's the minimum you need to run a batFramework project. The following code will create an empty window with the right resolution.


import batFramework as bf

bf.init((640,480))

bf.Manager(bf.Scene("main")).run()

Minimal

Have a Scene​

By inheriting a scene, you can modify access its methods, override them and customize it. As an example, let's change the scene's background.


import batFramework as bf

class MainScene(bf.Scene):
def do_when_added(self)->None:
self.set_clear_color("blue")

bf.init((640,480))

bf.Manager(MainScene("main")).run()

blue

note

You can check the Scene class to learn all the different methods the framework gives you.