FlyUI
in package
FlyUI is intended as a simple to use immediate mode GUI library primarly for prototyping, debugging or very small projects.
The rendering architecture is designed for convenience and not performance. So please be not supprised when you build a complex UI that it will eat up your system resources more then the rest of your application.
Table of Contents
Properties
- $instance : FlyUI
- Global FlyUI instance
- $performanceTracingEnabled : bool
- Boolean if performance tracing is enabled
- $theme : FUITheme
- The Theme currently used
- $currentContentScale : float
- Internal holder for the current content scale Will be passed to the render context
- $currentResolution : Vec2
- Internal holder for the current resolution
- $currentView : FUIView
- The currently active view in the view stack
- $dispatcher : Dispatcher
- $input : Input
- $performanceOverlay : FUIPerformanceTracerOverlay|null
- Performance tracer overlay for visualizing performance data
- $performanceTracer : FUIPerformanceTracer
- Performance tracer instance
- $selfManageVGContext : bool
- If true, FLyUI will create and end VGContext frames itself
- $vgContext : VGContext
- $viewTree : array<string|int, FUIView>
- The current tree of views This functions as a stack where the last element is the current view
Methods
- __construct() : mixed
- Constructor
- addChildView() : void
- Adds the given view as a child of the current view
- beginCardView() : FUICard
- Begins a new card view
- beginFrame() : void
- Begins a FlyUI frame
- beginHorizontalStack() : FUILayout
- Starts a horiazontal layout where elements are stacked after each other from left to right
- beginLayout() : FUILayout
- Starts a layout element.
- beginSection() : FUILayout
- Starts a section A section is a container with a title and some content underneath
- button() : FUIButton
- Creates a button element
- buttonGroup() : FUIButtonGroup
- Creates a button group element
- checkbox() : FUICheckbox
- Creates a checkbox element
- currentView() : FUIView
- Returns the current view
- enablePerformanceTracing() : void
- Enables performance tracing for the current FlyUI instance
- end() : void
- Ends the current view
- endFrame() : void
- Ends a FlyUI frame
- initailize() : void
- Initializes the global FlyUI instance
- popView() : void
- Pops the last view from the view tree
- pushView() : void
- Adds a view to the view tree
- setSelfManageVGContext() : void
- Sets if FlyUI should manage the VGContext frames itself
- spaceX() : FUISpace
- Creates a X space element
- spaceY() : FUISpace
- Creates a Y space element
- text() : FUIText
- Creates a text element
- internalBeginFrame() : void
- Start a new UI frame
- internalEndFrame() : void
- End a UI frame (Dispatches the rendering of the views)
Properties
$instance
Global FlyUI instance
public
static FlyUI
$instance
$performanceTracingEnabled
Boolean if performance tracing is enabled
public
bool
$performanceTracingEnabled
= false
Performance tracing will replace all views just before rendering with proxies allowing to measure the time they took to execute. Keep in mind this will really only mesure CPU time and not GPU time.
$theme
The Theme currently used
public
FUITheme
$theme
$currentContentScale
Internal holder for the current content scale Will be passed to the render context
private
float
$currentContentScale
= 1.0
$currentResolution
Internal holder for the current resolution
private
Vec2
$currentResolution
$currentView
The currently active view in the view stack
private
FUIView
$currentView
$dispatcher
private
Dispatcher
$dispatcher
Tags
$input
private
Input
$input
$performanceOverlay
Performance tracer overlay for visualizing performance data
private
FUIPerformanceTracerOverlay|null
$performanceOverlay
= null
$performanceTracer
Performance tracer instance
private
FUIPerformanceTracer
$performanceTracer
This thing that does the tracing...
$selfManageVGContext
If true, FLyUI will create and end VGContext frames itself
private
bool
$selfManageVGContext
= false
$vgContext
private
VGContext
$vgContext
$viewTree
The current tree of views This functions as a stack where the last element is the current view
private
array<string|int, FUIView>
$viewTree
= []
Methods
__construct()
Constructor
public
__construct(VGContext $vgContext, Dispatcher $dispatcher, Input $input[, FUITheme|null $theme = null ]) : mixed
Parameters
- $vgContext : VGContext
- $dispatcher : Dispatcher
- $input : Input
- $theme : FUITheme|null = null
addChildView()
Adds the given view as a child of the current view
public
addChildView(FUIView $view) : void
Parameters
- $view : FUIView
beginCardView()
Begins a new card view
public
static beginCardView() : FUICard
Return values
FUICardbeginFrame()
Begins a FlyUI frame
public
static beginFrame(Vec2 $resolution[, float $contentScale = 1.0 ]) : void
Parameters
- $resolution : Vec2
-
The resolution of the frame (in points not pixels)
- $contentScale : float = 1.0
beginHorizontalStack()
Starts a horiazontal layout where elements are stacked after each other from left to right
public
static beginHorizontalStack([float|null $spacing = null ][, Vec4|null $padding = null ]) : FUILayout
Parameters
- $spacing : float|null = null
- $padding : Vec4|null = null
Return values
FUILayoutbeginLayout()
Starts a layout element.
public
static beginLayout([Vec4|null $padding = null ]) : FUILayout
A layout is a container view that arranges its children either vertically or horizontally.
There is support for different sizing modes:
- Fixed: a fixed size in points
- Fill: takes up all available space
- Fit: sizes to the content
The layout can then also align its children to topLeft, topCenter etc...
Parameters
- $padding : Vec4|null = null
Return values
FUILayoutbeginSection()
Starts a section A section is a container with a title and some content underneath
public
static beginSection(string $title) : FUILayout
Parameters
- $title : string
Return values
FUILayoutbutton()
Creates a button element
public
static button(string $text, Closure $onClick) : FUIButton
Parameters
- $text : string
- $onClick : Closure
Return values
FUIButtonbuttonGroup()
Creates a button group element
public
static buttonGroup(string $name, array<string, string> $options[, string|null &$selectedOption = null ][, Closure|null $onSelect = null ]) : FUIButtonGroup
Parameters
- $name : string
- $options : array<string, string>
-
Array of key => label pairs
- $selectedOption : string|null = null
- $onSelect : Closure|null = null
Return values
FUIButtonGroupcheckbox()
Creates a checkbox element
public
static checkbox(string $text, bool &$checked[, callable(bool): void $callback = null ]) : FUICheckbox
Parameters
- $text : string
-
The text to display next to the checkbox
- $checked : bool
-
Reference to the checked state
- $callback : callable(bool): void = null
-
Callback that is called when the checkbox is toggled
Return values
FUICheckboxcurrentView()
Returns the current view
public
currentView() : FUIView
Return values
FUIViewenablePerformanceTracing()
Enables performance tracing for the current FlyUI instance
public
static enablePerformanceTracing([bool $enable = true ]) : void
Parameters
- $enable : bool = true
end()
Ends the current view
public
static end() : void
endFrame()
Ends a FlyUI frame
public
static endFrame() : void
initailize()
Initializes the global FlyUI instance
public
static initailize(VGContext $vgContext, Dispatcher $dispatcher, Input $input) : void
Parameters
- $vgContext : VGContext
- $dispatcher : Dispatcher
- $input : Input
popView()
Pops the last view from the view tree
public
popView() : void
pushView()
Adds a view to the view tree
public
pushView(FUIView $view) : void
Parameters
- $view : FUIView
setSelfManageVGContext()
Sets if FlyUI should manage the VGContext frames itself
public
setSelfManageVGContext(bool $value) : void
When enabled FlyUI will call beginFrame and endFrame itself.
Parameters
- $value : bool
spaceX()
Creates a X space element
public
static spaceX(float $width) : FUISpace
Parameters
- $width : float
Return values
FUISpacespaceY()
Creates a Y space element
public
static spaceY(float $height) : FUISpace
Parameters
- $height : float
Return values
FUISpacetext()
Creates a text element
public
static text(string $text[, VGColor|null $color = null ]) : FUIText
Parameters
- $text : string
- $color : VGColor|null = null
Return values
FUITextinternalBeginFrame()
Start a new UI frame
private
internalBeginFrame(Vec2 $resolution[, float $contentScale = 1.0 ]) : void
Parameters
- $resolution : Vec2
- $contentScale : float = 1.0
internalEndFrame()
End a UI frame (Dispatches the rendering of the views)
private
internalEndFrame() : void