libgui 2.01
libgui is a GUI library for the GameCube, Wii, and Wii U
 
Loading...
Searching...
No Matches
GuiControllerLayout.h
1/****************************************************************************
2 * libgui
3 * Daryl Borth 2026
4 * GuiControllerLayout.h
5 *
6 * A controller described as data: a silhouette made of rounded pieces and a
7 * table of controls (buttons, sticks, triggers), each with a position, shape
8 * and id. GuiControllerView draws any layout, lights controls up and
9 * highlights them; supporting another controller means adding a table, not
10 * drawing code. Control ids are the INPUT_BTN_* / INPUT_TRIGGER_* /
11 * INPUT_THUMB_* bits from InputData.h, so an input state maps straight onto
12 * what lights up. Platform-agnostic.
13 ***************************************************************************/
14#pragma once
15#include <cstddef>
16#include <vector>
17#include "../drivers/InputData.h"
18
21enum { GUI_CTL_CAPTURE = (1 << 24) };
22
30
34 int id;
35 CTL_SHAPE shape;
36 float x, y, w, h;
37 float radius;
38 const char * label;
39};
40
44 float x, y, w, h;
45 float radius;
46 float angle;
47};
48
52 float width, height;
53 std::vector<GuiBodyPiece> body;
54 std::vector<GuiControlSpot> spots;
55
57 const GuiControlSpot * find(int id) const;
58};
59
const GuiControllerLayout & GuiProControllerLayout()
A Pro-style gamepad: two sticks, D-pad, ABXY, L/R/ZL/ZR, plus, minus, home and capture (Switch Pro,...
CTL_SHAPE
How a control is drawn.
@ CIRCLE
A round button.
@ ROUNDRECT
A rounded rectangle: bumpers, triggers, D-pad arms, small square buttons.
@ STICK
An analog stick: an outer ring with a cap that can move.
One rounded rectangle of the silhouette (the pieces are merged into one outline).
float angle
Rotation about its center, degrees clockwise.
float h
Rectangle before rotation.
One control on a controller drawing.
int id
Input bit this control stands for; 0 for decoration (never lit or highlighted).
float h
Bounding box.
float radius
Corner radius for ROUNDRECT.
const char * label
Text drawn on the control ("A", "ZL", "+"), or null.
A controller: its drawing size, silhouette and controls.
const GuiControlSpot * find(int id) const
Finds a control by id (null if the layout has none)