An IApplication implementation that wraps one or more IWidget instances.
class
|
WidgetApplication
|
extends
|
ApplicationBase
|
||
base of
|
DemoApplication
|
Returns the configuration value that describes this object.
public
override
method
|
ToConfig
()
|
||
type
|
ConfigValue
|
||
returns
|
|
The configuration value. | |
overrides
|
ApplicationBase.ToConfig
|
Remarks:
All configurable objects need to implement this interface. For simple types, it is preferable to delegate to ToValue.
The returned value may be of type Invalid, which means that this object in its current state cannot be described with the configuration API.
Before returning the resulting configuration value, Cache must be called on it, passing this IConfigurable object as parameter.
Request to close the application by calling Closing when Escape is pressed an no widgets has consumed the corresponding input event?
public
property
|
EnableCloseOnEscape
{
get
set
}
|
||
type
|
bool
|
||
value
|
true
to
close
the
application
upon
Escape,
false
to
keep
running.
|
Remarks:
The
default
value
is
true
.
Toggle fullscreen mode (if possible) when the F12 key is pressed?
public
property
|
EnableFullscreenOnF12
{
get
set
}
|
||
type
|
bool
|
||
value
|
true
to
enable
fullscreen
mode
toggling,
false
to
disable
it. |
Remarks:
The
default
value
is
true
.
Optional limit for rendering frames.
public
override
property
|
FrameRateLimit
{
get
}
|
||
type
|
int32
|
||
value
|
|
The
frame
rate
limit,
in
Hz.
If
0
the
limit
will
be
disabled. |
|
overrides
|
ApplicationBase.FrameRateLimit
|
Remarks:
Defaults
to
100
.
Returns the lifecycle state of this object.
public
virtual
property
|
LifecycleState
{
get
}
|
||
type
|
LifecycleState
|
||
value
|
The lifecycle state. | ||
inherited
|
Disposable.LifecycleState
|
Creates a new instance of WidgetApplication.
public
constructor
|
WidgetApplication
(int32 frameRateLimit = 100)
|
||
params
|
frameRateLimit
|
[>=0]
|
The
frame
rate
limit
(see
FrameRateLimit).
Defaults
to
100 .
|
Acquires a strong reference to this disposable object.
[OwnerReturn, ThreadSafe]
|
||||
public
method
|
AcquireTry
()
|
|||
type
|
IDisposable
|
|||
returns
|
this
if
a
new
strong
reference
has
been
acquired,
null
if
this
object
is
already
being
disposed.
|
|||
inherited
|
Disposable.AcquireTry
|
Remarks:
The object will not be actually disposed by calls to Dispose when there is at least one strong reference left. Code that calls the AcquireTry method is responsible for calling the Dispose method accordingly.
This method is not intended to be used in performance-critical code. It should only be used to high-level resource management.
Consumes the given user input event.
public
override
method
|
ConsumeInput
(InputEvent inputEvent)
|
||
type
|
bool
|
||
params
|
inputEvent
|
The user input event. | |
returns
|
true
if
the
input
event
has
been
consumed,
false
if
not. |
||
overrides
|
ApplicationBase.ConsumeInput
|
Remarks:
Input events are provided to an IInputConsumer object only if it has the input focus (see FocusGained and FocusLost). Mouse events are provided when the mouse cursor is inside of the input bounds (MouseEnter and MouseLeave). The Closing event can be provided at any time.
Releases all resources held by this object if there are no more strong references to it, decrements the reference counter by one otherwise.
[Dispose, OwnerThis, ThreadSafe]
|
||||
public
method
|
Dispose
()
|
|||
inherited
|
Disposable.Dispose
|
Remarks:
The Dispose method silently returns if the object has already been disposed.
Attaches the application to its graphics context.
public
override
method
|
GraphicsContextAttach
(IGraphicsContext context)
|
||
params
|
context
|
[not-null]
|
The graphics context. |
overrides
|
ApplicationBase.GraphicsContextAttach
|
Detaches the application from its graphics context.
public
override
method
|
GraphicsContextDetach
()
|
||
overrides
|
ApplicationBase.GraphicsContextDetach
|
Is the given keyboard key pressed down?
[Pure]
|
||||
public
method
|
IsDown
(KeyboardKey key)
|
|||
type
|
bool
|
|||
params
|
key
|
The keyboard key. | ||
returns
|
true
if
the
key
is
pressed
down,
false
if
not. |
|||
inherited
|
ApplicationBase.IsDown
|
Is the given mouse button pressed down?
[Pure]
|
||||
public
method
|
IsDown
(MouseButton button)
|
|||
type
|
bool
|
|||
params
|
button
|
The mouse button. | ||
returns
|
true
if
the
button
is
pressed
down,
false
if
not. |
|||
inherited
|
ApplicationBase.IsDown
|
Performs rendering.
public
override
method
|
Render
()
|
||
overrides
|
ApplicationBase.Render
|
Remarks:
Implementing methods must not assume that any specific render state is in place when being called. Instead, the implementing method is responsible for setting up all state that is required for rendering.
Usually, implementing classes receive their current graphics context directly or indirectly from GraphicsContextAttach or GraphicsAttach.
In order to maximize parallelism between the CPU and GPU, only actual rendering (using the current graphics context) should be performed here. All other preparation resp. setup should be done in RenderPrepare instead.
See also:
IApplication.GraphicsContextAttachPrepares rendering.
public
override
method
|
RenderPrepare
()
|
||
overrides
|
ApplicationBase.RenderPrepare
|
Remarks:
This method is called before Render, when the graphics context has not yet begun to render the scene.
All setup work that does not require a graphics context (e.g. matrix computation, per-frame visibility determination) should be done here. This can help to maximize parallelism between the CPU and the GPU.
Runs the given operation within the lifecycle of this application.
public
method
|
RunOperation
([Owner]
IOperation operation)
|
||
type
|
RunningOperation
|
||
params
|
operation
|
[not-null]
|
The operation to run. |
returns
|
|
The running operation. | |
inherited
|
ApplicationBase.RunOperation
|
Remarks:
The Update method is called from within the applications UpdateFrameTime method.
The returned RunningOperation can be used to track progress resp. errors and to cancel the running operation.
When the application is disposed, all running operations are canceled (see Cancel) and then disposed.
Provides runtime performance statistics to the application.
public
virtual
method
|
Statistics
(ApplicationStats stats)
|
||
params
|
stats
|
The performance statistic values. | |
inherited
|
ApplicationBase.Statistics
|
Remarks:
This information is gathered by the application loop which is running the application.
Calling this method is optional. Implementations of IApplication must never depend on the availability of ApplicationStats values.
This method is called once per application frame.
public
override
method
|
UpdateFrameTime
(float32 time)
|
||
type
|
bool
|
||
params
|
time
|
[>0]
|
The amount of time that has elapsed since the last frame, in seconds. |
returns
|
true
if
the
object
needs
to
be
presented
again,
false
if
the
current
presentation
is
still
valid.
|
||
overrides
|
ApplicationBase.UpdateFrameTime
|
Adds the given widget.
public
method
|
WidgetAdd
([Owner]
IWidget widget)
|
||
params
|
widget
|
[not-null]
|
The widget to add. |
Removes the given widget.
public
method
|
WidgetRemove
(IWidget widget)
|
||
params
|
widget
|
[not-null]
|
The widget to remove. |
Puts the given widget into the background.
public
method
|
WidgetToBack
(IWidget widget)
|
||
params
|
widget
|
[not-null]
|
The widget. |
Remarks:
Widgets are rendered back-to-front. Input is consumed front-to-back until a widget has consumed the input event.
Puts the given widget into the foreground.
public
method
|
WidgetToFront
(IWidget widget)
|
||
params
|
widget
|
[not-null]
|
The widget. |
Remarks:
Widgets are rendered back-to-front. Input is consumed front-to-back until a widget has consumed the input event.
Attaches the application to its window.
public
virtual
method
|
WindowAttach
(IApplicationWindow window)
|
||
params
|
window
|
[not-null]
|
The application window. |
inherited
|
ApplicationBase.WindowAttach
|
Remarks:
This is always the first callback that the application receives.
Informs the application about the client size of its window.
public
override
method
|
WindowSize
(Vec2I clientSize)
|
||
params
|
clientSize
|
The client size of the application window. | |
overrides
|
ApplicationBase.WindowSize
|
The graphics context for custom rendering.
protected
field
|
context
|
||
type
|
IGraphicsContext
|
||
inherited
|
ApplicationBase.context
|
The application window.
protected
field
|
window
|
||
type
|
IApplicationWindow
|
||
inherited
|
ApplicationBase.window
|
Disposes the managed resources held by a concrete subclass. This method will be called at most once per subclass.
protected
override
method
|
DisposeManaged
()
|
||
overrides
|
ApplicationBase.DisposeManaged
|
Remarks:
This method will only be called when a disposable object is explicitly destroyed by user code calling the Dispose method. It will not be called when the object is collected as garbage by the system.
Overriding methods must call the DisposeManaged method of their base class. The base call should be the last statement.
The DisposeManaged method is called before the DisposeUnmanaged method.
Disposes the unmanaged resources held by a concrete subclass. This method will be called exactly once per subclass.
protected
virtual
method
|
DisposeUnmanaged
()
|
||
inherited
|
Disposable.DisposeUnmanaged
|
Remarks:
Overriding methods must call the DisposeUnmanaged method of their base class. The base call should be the last statement.
The DisposeUnmanaged method is called after the DisposeManaged method.
The logger object of this class.
public
static
readonly
field
|
Logger
|
||
type
|
ILogger
|