Skip to content

GUI Calculator

App: apps/gui_calculator/

A full calculator built with the Nuklear GUI: digits 0–9, operators + − × /, clear (C), and equals (=). Logic lives in a separate calculator.wren module; the main game only runs _calculator.update(dt).

Terminal window
% ./plume3d gui_calculator

or

Terminal window
% ./../plume3d .
  • One full-window GUI: display line plus a 4×4 grid of buttons (digits, C, =, +, −, *, /).
  • Implements chained operations: enter number → operator → number → = (or another operator).
  • Uses Gui.layoutRowDynamic(28, 4) for a row of four buttons; multiple rows form the keypad.
  • GuibeginWindow, layoutRowDynamic, label, buttonLabel, endWindow.
  • WindowgetWidth, getHeight (calculator fills the window).
  • main.wren — Game class, holds Calculator and calls its update(dt).
  • calculator.wrenCalculator class: display string, pending op/value, and methods digit(n), applyOp(op), doEquals().