![]() |
CHGame 0.3.0
Libraries for the CHGame handheld
|
The one include for a CHGame game: buttons, frame pacing, palette, drawing, lettering, effects, sound, saving and the debug protocol. More...
Modules | |
| Buttons and frame pacing | |
| The global chgame object: the frame clock and the eight buttons. | |
| Palette | |
| The sixteen house colours and pal::: felt themes, fades, flashes and colour cycling. | |
| Drawing | |
| Panels, span sprites, dithering, polygons and the 3x5 font, drawn into CHGfx's framebuffer. | |
| Lettering masks | |
| Outlined, shadowed and gradient lettering, logos and the cover titles. | |
| Effects maths | |
| fx::: easing curves, integer sine and cosine, presentation randomness and the screen shake. | |
| Particles, banners and floating texts | |
| fx:: particles (sparks, confetti, coins ...), the pop-up banner and floating texts, configured per game. | |
| Sound and LED | |
| audio::: sound effects, music and the status LED. | |
| Saving | |
| save::: a game's options and progress in flash, with a CRC, kept across power cycles and re-uploads. | |
| Number formatting | |
| Integers, money and times as text, without printf. | |
| RAM functions | |
| RAMFUNC(name): put a hot function in SRAM, about three times faster than flash. | |
| Debug protocol | |
| dbg::: the serial protocol the simulator and the PC tools drive a game through. | |
| Build switches | |
| CHGAME_DEBUG and CHGAME_PROFILE: set them with build.extra_flags. | |
The one include for a CHGame game: buttons, frame pacing, palette, drawing, lettering, effects, sound, saving and the debug protocol.
brings everything the twenty casino games share, on top of CHGfx (the framebuffer, the panel and its DMA). It is modelled on the Arduboy2 library: one global object, chgame, with the same button names, nextFrame() and pollButtons(), and a handful of small namespaces for the rest (pal::, fx::, audio::, save::, dbg::).
Every CHGame game runs the same frame loop: logic, then gfx_wait() (the previous frame has finished going out to the panel), then drawing into the framebuffer, then gfx_flushAsync() (the panel gets it by DMA while the next frame's logic runs).
The whole of that sketch, with a sound and a saved counter, is the Hello example. The twenty games in the library's examples/Games/ folder are complete programs built on it.