![]() |
CHGame 0.3.0
Libraries for the CHGame handheld
|
The house drawing: rounded rects and panels, span sprites (plain, scaled, flipped, rotated), dithering, an in-place colour remap, convex polygons, column glyphs and PPOT's 3x5 font. More...
Go to the source code of this file.
Enumerations | |
| enum | : uint8_t { SPR_FLIP_V = 1 , SPR_FLIP_H = 2 } |
| sprite4() flags. More... | |
Functions | |
| void | fillRound (int x, int y, int w, int h, uint8_t r, uint8_t c) |
| Fill a rectangle with rounded corners. | |
| void | roundRect (int x, int y, int w, int h, uint8_t r, uint8_t c) |
| Outline a rectangle with rounded corners, 1 px wide. | |
| void | panel (int x, int y, int w, int h, uint8_t r, uint8_t fill, uint8_t edge) |
A rounded panel: fillRound() in fill, then roundRect() in edge. | |
| void | panelLit (int x, int y, int w, int h, uint8_t r, uint8_t fill, uint8_t edge) |
| A panel lit from above. | |
| void | bevel (int x, int y, int w, int h, uint8_t c) |
| A raised rectangle's rim: light along the top and left, dark along the bottom and right. | |
| void | bevel (int x, int y, int w, int h, uint8_t light, uint8_t dark) |
| A raised rectangle's rim in two given colours. | |
| void | dither (int x, int y, int w, int h, uint8_t c, uint8_t phase) |
| A 50% checkerboard of one colour over a rectangle; the pixels in between are left alone (darkened backdrops, shadows). | |
| void | spotlight (int cx, int cy, int r, uint8_t c) |
| A round spotlight: a disc of dots, on 25% of its pixels (every other pixel of every other row). | |
| void | dropShadow (int x, int y, int w, int h) |
| A soft shadow (a 50% INK checker) 2 px below and right of a box. | |
| void | remapRect (int x, int y, int w, int h, const uint8_t *remap) |
| Recolour a rectangle in place: pixel = remap[pixel] (dimming, highlighting). | |
| void | fillConvex (const int16_t *xy, uint8_t n, uint8_t c, int dither=-1) |
| Fill a convex polygon. | |
| void | sprite4 (const uint8_t *data, int x, int y, const uint8_t *remap=nullptr, int scale=256, uint8_t flip=0) |
| Draw span4 art, through a remap and at a scale. | |
| void | spriteRot (const uint8_t *data, int ax, int ay, int px, int py, uint8_t angle, int scale, const uint8_t *remap) |
| Draw span4 art turned and scaled about a pivot. | |
| void | rotRaw (int w, int h, int ax, int ay, int px, int py, uint8_t angle, int scale, const uint8_t *remap) |
| spriteRot() for raw 4 bpp art the caller has put in the chunk scratch. | |
| void | glyph (int x, int y, const uint8_t *cols, uint8_t ncols, uint8_t c) |
| Draw a column-major 1 bpp glyph (bit 0 = top row, up to 8 rows). | |
| void | glyph16 (int x, int y, const uint16_t *rows, uint8_t nrows, uint8_t c) |
| Draw a row-major 1 bpp glyph up to 16 wide (the leftmost pixel in bit 15). | |
| int | text35 (int x, int y, const char *str, uint8_t c) |
| Draw text in PPOT's 3x5 font. | |
| int | text35Width (const char *str) |
| The width of text in the 3x5 font, without the trailing gap: for centring. | |
| int | text35s (int x, int y, const char *str, uint8_t c, uint8_t shade=0) |
| text35() over its own shade a pixel down and right (embossed). | |
| void | text35x2 (int x, int y, const char *str, uint8_t c) |
| The 3x5 font doubled (8 px advance, 12 rows with the descender): menus. | |
| void | text35x2s (int x, int y, const char *str, uint8_t c, uint8_t shade=0) |
| text35x2() over its own shade a pixel down and right. | |
| int | text35x2Width (const char *str) |
| The width of text drawn with text35x2(). | |
| const uint8_t * | glyph35 (char ch) |
| A character of the 3x5 font, for drawing it yourself with glyph(). | |
Variables | |
| const uint8_t | DARKER [16] |
| One step darker for each house colour (Palette): the shading that gives panels, cards and chips their depth. | |
| const uint8_t | LIGHTER [16] |
| One step lighter for each house colour (Palette). | |
| const uint8_t | RM_ID [16] |
| The identity remap (every colour to itself). | |
The house drawing: rounded rects and panels, span sprites (plain, scaled, flipped, rotated), dithering, an in-place colour remap, convex polygons, column glyphs and PPOT's 3x5 font.
CHGfx 1.3 has its own versions of several of these (gfx_fillRoundRect, gfx_sprite4, gfx_dither, gfx_textFx with CHGfx_Tiny3x5, the same glyphs), written for generality; these are the casino games' smaller ones, the text about 2 KB smaller in flash. Both work on the same framebuffer: use either.
Everything here draws inside CHGfx's clip rectangle (gfx_setClip), like CHGfx's own primitives.
The rule on this chip: code runs from flash with 3 wait states, so a function call per pixel costs ~2-3 us. Everything here is built from gfx_hline spans (word stores, from SRAM) or tight byte and word loops, the hottest from SRAM.