Author Topic: clubsandwich, a BearLibTerminal framework for Python 3  (Read 306 times)


  • Acolyte
  • *
  • Posts: 2
    • View Profile
clubsandwich, a BearLibTerminal framework for Python 3
« on: April 16, 2017, 11:28:18 PM »
Since the BearLibTerminal thread is on this forum, I figured I'd do a sibling post about a wrapper framework I've been working on.

In preparation for Ludum Dare 38, I spent this weekend writing a bunch of utilities for BearLibTerminal that will make your life MUCH easier! (If you're a Python 3 developer, that is.) It's a Cocos2D-iOS UIKit mashup, for ASCII.

Readme and source code

API docs


  • Event loop
  • Scene manager
  • Geometry data structures
  • Convenience functions
  • UIKit-like interface framework
  • Script runner to help you iterate quickly

I'm still working on nice documentation, but the Readme should give you a general idea and start a discussion. I love writing docs, so I can safely promise that there will be some good ones very soon.


LD38 is next weekend, and I'm thinking about doing a roguelike. BearLibTerminal has gotten a lot better for OS X lately, so I started playing around and decided to stick with it.

The first thing I did was write an asynchronous event loop and scene manager, Cocos2D-style, to make it easy to transition between game screens. It was simple, and you could probably do it yourself in fifteen minutes, but at least I've saved you some typing.

CataclysmDDA has given me high standards for roguelike UIs. I knew I'd never be able to make both a nice game and a nice UI in 48 hours. But I'm a champ at iOS development, and decided to try implementing the important parts of UIKit from scratch, in Python, for ASCII. And it worked! It will take a while for me to explain the concepts, but I'm confident people will be able to wrap their heads around them.

While writing all this, I added some geometry data structures and utility functions for BearLibTerminal. Stuff like a transform stack for drawing, convenient state access for Python, and a little script to help you iterate quickly by continuously relaunching your program.

If you post a mockup UI, I will write a demo in clubsandwich! I tried to make the UI framework as general as possible, but really only played with a couple of layouts. If you want me to prove the utility a bit, you could help me out by posting an ASCII or MS Paint mockup of what you want your UI to look like, and I'll see if I can build it quickly in clubsandwich.
« Last Edit: April 17, 2017, 04:47:29 AM by irskep »