Skip to content

Component

Igor Usenko edited this page May 23, 2022 · 28 revisions

The part of the UI screen.
An array of the components represents the UI screen.
Maintains its state.
Renders its state on the screen

Palette

All the components use predefined palette colors only:

  • black - just black color
  • information - color for information components
  • interaction - color for interactive components
  • attention - color for components which are required user attention

Properties

  • bounding box (x, y, w, h) - x, y initially it is the relative to the parent coordinates. see mount
  • state

Screen API

  • mount(component, x, y) - mounts component to the screen by converting its relative coordinates to the real screen coordinates
  • contains(component, x, y) - returns true if (x, y) is inside component bounding box

Render API

  • isStateModified(component) - compares the new state with previous. returns true if render needed
  • updateState(component) - copies new state data to previous state data
  • render(component, forced, tftApi) - renders the component's state. the forced flag means that the component should perform a full redraw.

Event API

  • onTouch(component, x, y, tickCount) - called when user touched screen
  • onMove(component, x, y, tickCount) - called when user moving touch point
  • onRelease(component, x, y, tickCount) - called when user released touch screen
  • onGesture(component, gesture) - called when user made a gesture (handled by active tile,by default never reaches to component)
  • onButton(component) - called when user press power button (handled by active tile,by default never reaches to component)
Clone this wiki locally