libgui 2.01
libgui is a GUI library for the GameCube, Wii, and Wii U
 
Loading...
Searching...
No Matches
Controller drawing

A controller drawn from shapes and described as a table (GuiControllerLayout), with a view that lights controls up and highlights them (GuiControllerView) and small control icons (GuiGlyph). More...

Classes

struct  GuiControlSpot
 One control on a controller drawing. More...
 
struct  GuiBodyPiece
 One rounded rectangle of the silhouette (the pieces are merged into one outline). More...
 
struct  GuiControllerLayout
 A controller: its drawing size, silhouette and controls. More...
 
class  GuiControllerView
 Draws a controller from a GuiControllerLayout and shows what is happening on it: controls light up while pressed, a chosen control is highlighted (optionally with a line from a list row to it), and sticks follow their position. More...
 
class  GuiGlyph
 A small control icon drawn from shapes: a light badge with a dark symbol or letter, for list rows and hint bars. More...
 

Enumerations

enum class  CTL_STATE { NORMAL , CTL_STATE::LIT , CTL_STATE::HIGHLIGHT , LIT_HIGHLIGHT }
 The look a control is drawn in. More...
 
enum  { GUI_CTL_CAPTURE = (1 << 24) }
 A control with no input bit of its own on any supported hardware (the Switch Pro / Wii U capture button). More...
 
enum class  CTL_SHAPE { CTL_SHAPE::CIRCLE , CTL_SHAPE::ROUNDRECT , CTL_SHAPE::STICK }
 How a control is drawn. More...
 
enum class  GLYPH {
  GLYPH::BUTTON , GLYPH::BUMPER , GLYPH::UP , DOWN ,
  LEFT , RIGHT , PLUS , MINUS ,
  GLYPH::STICK , GLYPH::CAPTURE , HOME
}
 Small control icons for lists and hints (the "A" in a circle, a bumper, a D-pad arrow). More...
 

Functions

void GuiBuildControllerBody (GuiMesh &mesh, const GuiControllerLayout &layout, float scale)
 Builds the resting drawing of a controller (silhouette, then every decorative control) in local coordinates, with the layout multiplied by scale.
 
void GuiBuildControllerSpot (GuiMesh &mesh, const GuiControlSpot &spot, CTL_STATE state, float scale)
 Builds one control in one state (an analog stick's cap is separate, see GuiBuildControllerStickCap).
 
void GuiBuildControllerStickCap (GuiMesh &mesh, const GuiControlSpot &spot, float x, float y, bool lit, float scale)
 Builds an analog stick's cap, displaced by (x, y) (each -1 to 1) from the middle of its ring.
 
const GuiControllerLayout & GuiProControllerLayout ()
 A Pro-style gamepad: two sticks, D-pad, ABXY, L/R/ZL/ZR, plus, minus, home and capture (Switch Pro, Wii U Pro, and a good stand-in for the Classic Controller Pro).
 
static void GuiGlyph::size (GLYPH kind, float &w, float &h)
 Gets the natural size of a glyph.
 
static void GuiGlyph::build (GuiMesh &mesh, GLYPH kind, float w, float h)
 Builds a glyph filling a w x h box at the origin, in the theme's light-on-dark colors.
 

Detailed Description

A controller drawn from shapes and described as a table (GuiControllerLayout), with a view that lights controls up and highlights them (GuiControllerView) and small control icons (GuiGlyph).

Control ids are the INPUT_* bits, so an input state maps straight onto what is drawn.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

A control with no input bit of its own on any supported hardware (the Switch Pro / Wii U capture button).

Definition at line 21 of file GuiControllerLayout.h.

◆ CTL_SHAPE

enum class CTL_SHAPE
strong

How a control is drawn.

Enumerator
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.

Definition at line 25 of file GuiControllerLayout.h.

◆ CTL_STATE

enum class CTL_STATE
strong

The look a control is drawn in.

Enumerator
LIT 

Pressed.

HIGHLIGHT 

Being edited / pointed at.

Definition at line 16 of file GuiControllerDraw.h.

◆ GLYPH

enum class GLYPH
strong

Small control icons for lists and hints (the "A" in a circle, a bumper, a D-pad arrow).

Enumerator
BUTTON 

A light circle (face buttons; the letter goes on it)

BUMPER 

A light rounded rectangle (L, R, ZL, ZR)

UP 

D-pad arrows: a circle with a triangle.

STICK 

A circle with an inner ring (stick click; the letter goes on it)

CAPTURE 

A rounded square with a ring.

Definition at line 17 of file GuiGlyph.h.

Function Documentation

◆ build()

void GuiGlyph::build ( GuiMesh & mesh,
GLYPH kind,
float w,
float h )
inlinestatic

Builds a glyph filling a w x h box at the origin, in the theme's light-on-dark colors.

Letters are text and are not part of the mesh.

Definition at line 71 of file GuiGlyph.h.

◆ GuiBuildControllerBody()

void GuiBuildControllerBody ( GuiMesh & mesh,
const GuiControllerLayout & layout,
float scale )

Builds the resting drawing of a controller (silhouette, then every decorative control) in local coordinates, with the layout multiplied by scale.

The silhouette's outline is made by drawing each piece's outline first and the fills after, so overlapping pieces merge into one shape.

Definition at line 31 of file GuiControllerDraw.cpp.

◆ GuiBuildControllerSpot()

void GuiBuildControllerSpot ( GuiMesh & mesh,
const GuiControlSpot & spot,
CTL_STATE state,
float scale )

Builds one control in one state (an analog stick's cap is separate, see GuiBuildControllerStickCap).

Definition at line 61 of file GuiControllerDraw.cpp.

◆ GuiBuildControllerStickCap()

void GuiBuildControllerStickCap ( GuiMesh & mesh,
const GuiControlSpot & spot,
float x,
float y,
bool lit,
float scale )

Builds an analog stick's cap, displaced by (x, y) (each -1 to 1) from the middle of its ring.

Definition at line 106 of file GuiControllerDraw.cpp.

◆ GuiProControllerLayout()

const GuiControllerLayout & GuiProControllerLayout ( )

A Pro-style gamepad: two sticks, D-pad, ABXY, L/R/ZL/ZR, plus, minus, home and capture (Switch Pro, Wii U Pro, and a good stand-in for the Classic Controller Pro).

Definition at line 76 of file GuiControllerLayout.cpp.

◆ size()

void GuiGlyph::size ( GLYPH kind,
float & w,
float & h )
inlinestatic

Gets the natural size of a glyph.

Definition at line 62 of file GuiGlyph.h.