Getting started#

This page takes you from nothing to a CEUI program running on a calculator or in an emulator.

Requirements#

What

Version

CE C toolchain

v15.0 or newer

CE libraries

Any recent release, on the calculator

git

Any version with submodules

Calculator

TI-84 Plus CE or TI-83 Premium CE, or an emulator such as CEmu

CEUI has no other dependencies. It uses graphx for drawing and reads the keypad registers directly, so the only CE libraries it needs on the calculator are graphx and libload.

Install the toolchain#

Download the newest stable release of the CE C toolchain for your system from its releases page and follow its install notes. Once its bin folder is on your PATH, this prints the version:

cedev-config --version

Add CEUI to your project#

CEUI is not a library you install. Its sources are compiled into each program, so you keep a copy in your project as a git submodule under vendor/ceui:

git submodule add https://github.com/alessiodam/CEUI vendor/ceui

When someone clones your project later, they fetch it with git submodule update --init.

The makefile#

Include ui.mk before the toolchain’s makefile. ui.mk adds CEUI’s sources and the theme you pick to the build, and its include folders to CFLAGS.

NAME = HELLO
DESCRIPTION = "My first CEUI program"
COMPRESSED = NO

CFLAGS = -Wall -Wextra -Oz
EXTRA_LDFLAGS += --no-warn-execstack
EXTRA_PRE_LDFLAGS += --no-warn-execstack

UI_THEME = default
include vendor/ceui/ui.mk
include $(shell cedev-config --makefile)

Variable

Meaning

UI_THEME

default, dark, classic, contrast, or none when your program brings its own theme. See themes

CFLAGS

Set it before ui.mk. Configuration macros like -DUI_COMMANDS=4096 go here, see configuration

EXTRA_LDFLAGS, EXTRA_PRE_LDFLAGS

The two --no-warn-execstack lines silence a linker warning about executable stacks. They are optional; the CEUI examples use them so the build has no warnings

If CFLAGS is not set, ui.mk uses -Wall -Wextra -Oz.

The hello program#

Put this in src/main.c:

#include <ui.h>

static const char *const keys[UI_SOFTKEYS] = {NULL, NULL, NULL, NULL, "Quit"};

int main(void)
{
  int presses = 0;

  ui_init();
  while (ui_frame()) {
    if (ui_softkeys(keys) == UI_F5) ui_quit();
    ui_titlebar("Hello", NULL);
    ui_text("Press enter on the button below.");
    if (ui_button("Press me")) presses++;
    ui_label(ui_fmt("Pressed %d times", presses));
  }
  ui_exit();
  return 0;
}

ui_init switches the screen to graphx and the keypad to CEUI. Each pass through the while loop is one frame: ui_frame waits until a key is pressed, then you describe the whole screen again. ui_button returns true in the frame the button is pressed, so presses is just an int in main. [graph] is the fifth softkey, UI_F5, and ui_quit makes the next ui_frame return false. ui_exit gives the screen and keypad back to the OS.

The frame loop page explains this model in detail.

Build it#

make

The program ends up in bin/HELLO.8xp. The build should print no warnings. A program that uses only this much of CEUI is about 17 KB.

Send it to a calculator or emulator#

File

Where it comes from

bin/HELLO.8xp

Your build

clibs.8xg

The CE libraries release. It holds every CE library; CEUI needs only LibLoad and graphx from it

Most calculators already have the CE libraries. If yours does not, or they are older than your toolchain, send clibs.8xg once. Use TI Connect CE or tilp for a real calculator, or drag the files onto CEmu.

Run it#

On the home screen, press [prgm], pick HELLO and press [enter] to run the line it pastes. OS 5.5 and later do not run native programs by themselves; on those, start it through arTIfiCE or a shell such as Cesium. CEmu runs it the same way.

The hello program after it starts

The hello program right after it starts. The button has focus.#

The hello program after three presses of enter

After pressing [enter] three times.#

Press [graph] to quit.

Next steps#

The frame loop

How immediate mode works and where your state lives.

The frame loop
Widgets

Every widget with an example and a screenshot.

Widgets
Themes

Pick a built-in theme or write your own.

Themes
The showcase

A program with seven screens that uses every widget, a custom theme and dark mode.

https://github.com/alessiodam/CEUI/tree/main/examples/showcase