rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
picker_cat.c File Reference

PICK A PIN's cat: the two spots it offers, what keeps a spot clear, the pick on the first frame of a visit, and the drawing with the screen's static parts. More...

#include "picker_screen.h"
#include "ui_text.h"
#include "picker_screen_int.h"

Macros

#define SPOTS   ((int)(sizeof(k_spots) / sizeof(k_spots[0])))
 How many spots, 2.

Functions

static bool meets (gfx_rect_t a, gfx_rect_t b)
 Whether a and b share a pixel.
static gfx_rect_t hull (gfx_rect_t a, gfx_rect_t b)
 The smallest box holding a and b; an empty one counts as nothing.
static gfx_rect_t board_and_keys (void)
 The board, every key and the traces from pad to key: the box holding the board and every key, which holds the traces too.
static gfx_rect_t pins_table (void)
 The PINS table as drawn: its heading and its rows, or the line that says none is bound; empty when OFF draws no table.
static gfx_rect_t use_table (void)
 The IN USE table as drawn: its heading to its last line, or to the line that says none, out to the panel's edge.
static gfx_rect_t list_and_shadow (void)
 The open list with the 4px shadow ui_choice_list() draws right of it and under it.
static bool clear (gfx_rect_t r)
 Whether a cat may cover r: inside the body above FOOT, and nothing the screen draws within UI_CAT_GAP of it.
void pk_cat_reset (void)
 Forget the cat: none until the next visit.
void pk_cat_enter (void)
 A visit begins: roll for the cat, picked on its first frame.
void pk_cat_render (gfx_canvas_t *c)
 Pick the cat on a visit's first frame and draw it while its box is clear; called last in a frame that draws the static parts.
bool picker_screen_cat (gfx_rect_t *box, int *pose)
 The cat the last frame drew (picker_cat.c): one pose, picked at random on a visit's first frame among the ones with a clear spot, bottom left or bottom right. It takes no touch.

Variables

static const ui_cat_spot_t k_spots []
 The spots: bottom left under the PINS table, its left edge on the table's, and bottom right under the IN USE table, 2px in from the panel's edge; both standing on FOOT.

Detailed Description

PICK A PIN's cat: the two spots it offers, what keeps a spot clear, the pick on the first frame of a visit, and the drawing with the screen's static parts.

A spot is clear when its box, grown by UI_CAT_GAP, meets nothing the screen draws in the state it is in: the head, the PINS table to its last row, the IN USE table to its last line, the board with every key and the traces between them, the open list, or the panel shown for a board that cannot be drawn. The pose is picked once a visit, on its first frame, from the roll entering took; a row or a line that grows into the box later hides the cat until it shrinks back. A tap on the cat lands on nothing the screen hit-tests, so it does nothing.

SPDX-License-Identifier: MIT

Function Documentation

◆ board_and_keys()

gfx_rect_t board_and_keys ( void )
static

The board, every key and the traces from pad to key: the box holding the board and every key, which holds the traces too.

Returns
the box

◆ clear()

bool clear ( gfx_rect_t r)
static

Whether a cat may cover r: inside the body above FOOT, and nothing the screen draws within UI_CAT_GAP of it.

Parameters
rthe box
Returns
true when it is clear

◆ hull()

gfx_rect_t hull ( gfx_rect_t a,
gfx_rect_t b )
static

The smallest box holding a and b; an empty one counts as nothing.

Parameters
aa box
banother
Returns
their union's bounding box

◆ list_and_shadow()

gfx_rect_t list_and_shadow ( void )
static

The open list with the 4px shadow ui_choice_list() draws right of it and under it.

Returns
the box

◆ meets()

bool meets ( gfx_rect_t a,
gfx_rect_t b )
static

Whether a and b share a pixel.

Parameters
aa box
banother
Returns
true when they meet

◆ picker_screen_cat()

bool picker_screen_cat ( gfx_rect_t * box,
int * pose )

The cat the last frame drew (picker_cat.c): one pose, picked at random on a visit's first frame among the ones with a clear spot, bottom left or bottom right. It takes no touch.

Parameters
boxthe box it covers, empty for none; may be NULL
poseits index into ui_cat_poses[], UI_CAT_NONE for none; may be NULL
Returns
true when a cat is drawn

◆ pins_table()

gfx_rect_t pins_table ( void )
static

The PINS table as drawn: its heading and its rows, or the line that says none is bound; empty when OFF draws no table.

Returns
the box

◆ pk_cat_render()

void pk_cat_render ( gfx_canvas_t * c)

Pick the cat on a visit's first frame and draw it while its box is clear; called last in a frame that draws the static parts.

Parameters
cthe screen's canvas

◆ use_table()

gfx_rect_t use_table ( void )
static

The IN USE table as drawn: its heading to its last line, or to the line that says none, out to the panel's edge.

Returns
the box

Variable Documentation

◆ k_spots

const ui_cat_spot_t k_spots[]
static
Initial value:
= {
{ UI_CAT_SPOT_PICKER_LEFT, PINS_X, FOOT, UI_CAT_FROM_LEFT },
{ UI_CAT_SPOT_PICKER_RIGHT, SCREEN_W - 2, FOOT, UI_CAT_FROM_RIGHT },
}
#define SCREEN_W
Definition files_int.h:33
#define FOOT
The lowest row the screen draws or takes a press on, in the screen's coordinates: 4px above the alert...
Definition picker_screen_int.h:39
#define PINS_X
The PINS table, left of the board: 171px, "CH7" in the label face (30px), "GPIO 28" in PK_FONT_PIN fr...
Definition picker_screen_int.h:151
@ UI_CAT_FROM_RIGHT
Definition ui_cats.h:63
@ UI_CAT_FROM_LEFT
Definition ui_cats.h:62

The spots: bottom left under the PINS table, its left edge on the table's, and bottom right under the IN USE table, 2px in from the panel's edge; both standing on FOOT.