diff options
| author | Cliff Click <cliffc@acm.org> | 2026-08-10 11:11:18 -0700 |
|---|---|---|
| committer | Cliff Click <cliffc@acm.org> | 2026-11-12 13:48:30 -0800 |
| commit | 7824fa044ac7d2db13af5873ce2e90365153e0be (patch) | |
| tree | 0795225a660a8bda2ae0b0bb6d7b013803c9775e /docs/chapter31/README.md | |
| parent | 2eb27046f9b2bca887fd9ea0a7c5a67547153ef3 (diff) | |
| download | Simple-linear.tar.gz Simple-linear.zip | |
Chapter 31: Software Drawing and Graphical Gameslinear-chapter31linear
Co-authored-by: Hsiang-Ying Fu <66062782+fuhsnn@users.noreply.github.com>
Co-authored-by: fuhsnn <66062782+fuhsnn@users.noreply.github.com>
Co-authored-by: Symious <14933944+symious@users.noreply.github.com>
Co-authored-by: Jun Kawasaki <jun784@gmail.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'docs/chapter31/README.md')
| -rw-r--r-- | docs/chapter31/README.md | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/docs/chapter31/README.md b/docs/chapter31/README.md new file mode 100644 index 00000000..0e133fce --- /dev/null +++ b/docs/chapter31/README.md @@ -0,0 +1,55 @@ +# Chapter 31: Software Drawing and Graphical Games + +English | [日本語](README.ja.md) + +[Previous: Chapter 30 — Text Formatting and Diagnostics](../chapter30/README.md) + +Small graphical games drive this chapter's language and library work, starting +with a pixel window for a Simple-written 2-D graphics library. MiniFB supplies +the optional native window/input backend; drawing stays in Simple. + +The [drawing library](drawing.md) provides a pixel canvas, colors, +rectangles, circles, thick lines, and bitmap labels. The +[graphical tic-tac-toe game](examples/TicTacToeGraphical.smp) uses it for +mouse/keyboard play against the terminal game's CPU strategy. +The optional [audio library](audio.md) adds soft move sounds and rising +or falling win/loss cues, played in the background by miniaudio. +Hexadecimal colors (`0xe47b57`) and leading-zero octal font masks (`025755`) +are supported by this chapter's integer literal syntax. + +```sh +make -C chapter31 libs CTAGS= # Once while online (also: init or lib). +make -C chapter31 run-graphical-tictactoe CTAGS= +``` + +This explicitly builds the optional graphics/audio backends and opens a window. Use +`graphical-tictactoe` instead to build the executable without starting it or +requiring MiniFB. +Dependencies stay cached under `chapter31/lib`, including across `make clean`. +Only explicit `libs`/`init`/`lib` setup targets access the internet; other +targets use local files and fail promptly if something needs downloading. + +The default build and test suite need no graphics dependencies. See +[optional graphics](graphics.md) for building MiniFB, running the pixel +example, and handling a missing backend. `make tests_nographics CTAGS=` runs +all ordinary tests with graphics explicitly disabled. + +The inherited language and library are described in [Chapter 30](../chapter30/README.md). +The [grammar and code map](31-grammar.md), +[source layout](../../src/main/java/com/seaofnodes/simple/README.md), and +[runnable examples](examples/) describe this snapshot. + +From the repository root: + +```sh +make lib tests release CHAPTERS=chapter31 CTAGS= +make -C chapter31 tictactoe CTAGS= +``` + +The game binary is `chapter31/build/examples/x86_64_v2_win64/TicTacToe.exe` +on Windows and `chapter31/build/examples/x86_64_v2_SystemV/TicTacToe` on Linux. +For a WSL build in the same checkout, use `CLZDIR=build/classes-linux` to keep +Linux Java outputs separate from Windows outputs. + +IntelliJ has a `chapter31` module and a **chapter31 tests** run configuration. +Inherited Java test names retain their historical chapter numbers. |
