This is the base class for Tinman 3D tutorials.
abstract class
|
Tutorial
|
extends
|
Widget
|
||
base of
|
Tutorial_00_Engine
|
||||
Tutorial_01_TerrainMesh
|
|||||
Tutorial_04_Headless
|
Basically each tutorial is a mini application that is run by the DemoApplication. The Tutorial class provides some useful standard functionality.
Returns the configuration value that describes this object.
public
virtual
method
|
ToConfig
()
|
||
type
|
ConfigValue
|
||
returns
|
|
The configuration value. | |
inherited
|
Widget.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.
Returns the actual pixel bounds of this widget.
public
property
|
ActualBounds
{
get
}
|
||
type
|
Box2I
|
||
value
|
The actual pixel bounds or Empty. | ||
inherited
|
Widget.ActualBounds
|
The pixel bounds of this widget.
public
virtual
property
|
Bounds
{
get
set
}
|
||
type
|
IWidgetBounds
|
||
value
|
|
The pixel bounds. | |
inherited
|
Widget.Bounds
|
Remarks:
Defaults to FullScreen.
Returns the lifecycle state of this object.
public
override
property
|
LifecycleState
{
get
}
|
||
type
|
LifecycleState
|
||
value
|
The lifecycle state. | ||
inherited
|
Initializable.LifecycleState
|
The mouse cursor to show for this widget.
public
virtual
property
|
MouseCursor
{
get
}
|
||
type
|
MouseCursor
|
||
value
|
The mouse cursor | ||
inherited
|
Widget.MouseCursor
|
Machine-friendly name of this tutorial.
public
property
|
Name
{
get
}
|
||
type
|
string
|
||
value
|
|
The name. |
Remarks:
The name is used to create the settings path.
Returns the central part of the actual pixel bounds of this widget which is not occluded by the widget user interface.
public
property
|
NonUserInterfaceBounds
{
get
}
|
||
type
|
Box2I
|
||
value
|
The non-UI pixel bounds. | ||
inherited
|
Widget.NonUserInterfaceBounds
|
See also:
IWidget.AddUserInterfaceSpecifies the behaviour for automatically loading and saving of widget settings.
public
property
|
SettingsAuto
{
get
set
}
|
||
type
|
int32
|
||
value
|
A
combination
of
the
following
bit
flags:
1 :
load
settings
when
after
widget
has
been
initialized.
2 :
save
settings
when
widget
consumes
Closing.
|
||
inherited
|
Widget.SettingsAuto
|
Remarks:
Defaults
to
3
.
Path to a directory that this widget can use to store own data and settings.
public
property
|
SettingsPath
{
get
set
}
|
||
type
|
Path
|
||
value
|
Canonical
path
to
the
settings
directory
or
null . |
||
inherited
|
Widget.SettingsPath
|
Remarks:
The settings path must be set before Initialize is called on the widget. Afterwards, the settings path cannot be changed.
Should the mouse be captured, because this input consumer only processes relative input?
public
virtual
property
|
ShouldCaptureMouse
{
get
}
|
||
type
|
bool
|
||
value
|
true
if
the
mouse
should
be
captured,
false
if
not. |
||
inherited
|
Widget.ShouldCaptureMouse
|
See also:
IApplicationWindow.MouseCapturedComputes an offset for the screen center that can be used to compensate for the GUI overlay of this widget.
public
property
|
UserInterfaceCenterOffset
{
get
}
|
||
type
|
Vec2F
|
||
value
|
The screen center offset, in pixels. | ||
inherited
|
Widget.UserInterfaceCenterOffset
|
See also:
CameraViewport.CenterOffsetAcquires 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.
Adds a GUI panel to this widget.
public
method
|
AddUserInterface
(WidgetSlot slot,
[Owner]
Panel panel)
|
||
params
|
slot
|
The widget GUI slot where the given GUI panel will be put. | |
panel
|
[not-null]
|
The GUI panel to add. | |
inherited
|
Widget.AddUserInterface
|
Consumes the given user input event.
public
method
|
ConsumeInput
(InputEvent inputEvent)
|
||
type
|
bool
|
||
params
|
inputEvent
|
The user input event. | |
returns
|
true
if
the
input
event
has
been
consumed,
false
if
not. |
||
inherited
|
Widget.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 this component to the given Graphics context.
public
virtual
method
|
GraphicsAttach
(Graphics graphics)
|
||
params
|
graphics
|
[not-null]
|
The graphics context. |
inherited
|
Widget.GraphicsAttach
|
Remarks:
All graphics-related resources should be created here.
Detaches this user interface component from its Graphics context.
public
override
method
|
GraphicsDetach
()
|
||
overrides
|
Widget.GraphicsDetach
|
Remarks:
All graphics-related resources should be disposed here.
The screen size has changed.
public
method
|
GraphicsResize
(Vec2I screenSize)
|
||
params
|
screenSize
|
The new screen size, in pixels. | |
inherited
|
Widget.GraphicsResize
|
Remarks:
The given screen size is equal to the value of ScreenSize of the Graphics object that has been passed to GraphicsAttach earlier.
Initializes the object, if necessary
public
method
|
Initialize
()
|
||
inherited
|
Initializable.Initialize
|
Remarks:
The Initialize method returns silently if the object is already in the state Initialized.
Attaches this input consumer to the given input state object.
public
virtual
method
|
InputAttach
(IInputState input)
|
||
params
|
input
|
[not-null]
|
The input state object. |
inherited
|
Widget.InputAttach
|
Remarks:
The input state object provides a snapshot of the input keys and buttons. It should not be used to detect up/down/click events.
Detached this input consumer from its input state object.
public
virtual
method
|
InputDetach
()
|
||
inherited
|
Widget.InputDetach
|
Restores the object state from the given JSON value.
public
virtual
method
|
JsonDeserialize
(JsonValue value)
|
||
params
|
value
|
[not-null]
|
The input JSON value. |
inherited
|
Widget.JsonDeserialize
|
Remarks:
Implementations of this method must be able to consume malformed JSON values, without corrupting the object state.
Serializes the object state to an JSON value.
public
virtual
method
|
JsonSerialize
(JsonValue value)
|
||
params
|
value
|
[not-null]
|
The output JSON value. |
inherited
|
Widget.JsonSerialize
|
Performs rendering.
public
virtual
method
|
Render
()
|
||
inherited
|
Widget.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.GraphicsContextAttachPerforms 2D rendering.
public
virtual
method
|
Render2D
(Graphics g)
|
||
params
|
g
|
[not-null]
|
The graphics object to use. |
inherited
|
Widget.Render2D
|
Remarks:
When this method is called, the given Graphics object has already been initialized for 2D rendering:
(0|0)
refers
to
the
top-left
pixel
of
the
target
rectangle
and
ScreenSize
returns
the
target
rectangle
size.
The
target
rectangle
and
the
clipping
rectangle
can
be
different.
Prepares rendering.
public
virtual
method
|
RenderPrepare
()
|
||
inherited
|
Widget.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.
Takes a screenshot the next time this widget is rendered.
public
virtual
method
|
Screenshot
(WidgetScreenshotDelegate result)
|
||
params
|
result
|
[not-null]
|
The screenshot pixels will be passed to this delegate. |
inherited
|
Widget.Screenshot
|
This method is called once per application frame.
public
virtual
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.
|
||
inherited
|
Widget.UpdateFrameTime
|
public
virtual
method
|
UpdateGui
()
|
||
inherited
|
Widget.UpdateGui
|
This method is used as a DatasetFileCacheDelegate in order to provide the default file cache for dataset.
public
method
|
UseCacheIfWeb
(IFile file)
|
||
type
|
DatasetFileCache
|
||
params
|
file
|
The dataset file. | |
returns
|
The
file
cache
or
null . |
Remarks:
The method will return the shared dataset file cache if the given file is streamed from the internet.
General purpose list of child components.
[Owner]
|
||||
protected
field
|
components
|
|||
type
|
ObjectList
|
|||
inherited
|
Widget.components
|
Remarks:
Subclasses are responsible for initializing this object list.
The
current
IGraphicsContext
object
or
null
.
protected
field
|
context
|
||
type
|
IGraphicsContext
|
||
inherited
|
Widget.context
|
See also:
Widget.GraphicsAttachThe
current
Graphics
object
or
null
.
protected
field
|
graphics
|
||
type
|
Graphics
|
||
inherited
|
Widget.graphics
|
See also:
Widget.GraphicsAttachThe
input
state
object
or
InputNone
if
no
input
state
object
has
been
attached
(thus
never
null
).
protected
field
|
input
|
||
type
|
IInputState
|
||
inherited
|
Widget.input
|
See also:
Widget.InputAttachThe current input modifiers.
protected
field
|
inputModifiers
|
||
type
|
InputModifiers
|
||
inherited
|
Widget.inputModifiers
|
Remarks:
These flags are maintained when ConsumeInput is called.
Current position of mouse cursor.
protected
field
|
mouse
|
||
type
|
Vec2I
|
||
inherited
|
Widget.mouse
|
Helper object for placing labels on the screen while avoiding overlaps.
protected
field
|
screenLabels
|
||
type
|
ScreenLabelPlacement
|
||
inherited
|
Widget.screenLabels
|
Creates a new instance of Tutorial.
protected
constructor
|
Tutorial
()
|
Clears the dataset cache.
protected
method
|
ClearDatasetCache
()
|
Marks the widget as dirty.
protected
method
|
Dirty
()
|
||
inherited
|
Widget.Dirty
|
Remarks:
When
a
widget
is
dirty,
the
next
call
to
UpdateFrameTime
will
always
return
true
and
the
dirty
flag
will
be
cleared.
Disposes the managed resources held by a concrete subclass. This method will be called at most once per subclass.
protected
override
method
|
DisposeManaged
()
|
||
overrides
|
Widget.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.
Consumes the given user input event.
[EmptyBody]
|
||||
protected
virtual
method
|
DoConsumeInput
(InputEvent inputEvent)
|
|||
type
|
bool
|
|||
params
|
inputEvent
|
The user input event. | ||
returns
|
true
if
the
input
event
has
been
consumed,
false
if
not. |
|||
inherited
|
Widget.DoConsumeInput
|
Remarks:
The given inputEvent has already been translated to the current widget bounds (see BoundedInput).
Performs initialization.
protected
virtual
method
|
DoInitialize
()
|
||
inherited
|
Initializable.DoInitialize
|
Remarks:
Overriding methods must call the DoInitialize method of their base class. The base call should be the first statement.
This method is called when this object has been initialized completely, i.e. after the DoInitialize call and just before returning from Initialize.
[EmptyBody]
|
||||
protected
override
method
|
Initialized
()
|
|||
inherited
|
Widget.Initialized
|
Begins to load a dataset.
protected
method
|
LoadBegin
(string path)
|
||
params
|
path
|
[not-null]
|
Engine path to the dataset. |
Remarks:
Calls
to
LoadBegin
and
LoadEnd*()
must
be
performed
in
the
same
order.
See also:
LoadEndHeightmapDatasetReturns a loaded heightmap dataset.
[OwnerReturn]
|
||||
protected
method
|
LoadEndHeightmapDataset
()
|
|||
type
|
IHeightmapDataset
|
|||
returns
|
|
The loaded dataset. |
See also:
LoadBeginReturns a loaded vector shape.
protected
method
|
LoadEndShape
()
|
||
type
|
IShape
|
||
returns
|
|
The loaded vector shape. |
See also:
LoadBegin
protected
virtual
method
|
SetName
(string name)
|
||
params
|
name
|
Returns a path into the settings directory of this widget, creating parent directories if necessary.
protected
method
|
Settings
(string path)
|
||
type
|
Path
|
||
params
|
path
|
[not-empty]
|
Relative path into settings directory. |
returns
|
|
The canonical settings path. | |
inherited
|
Widget.Settings
|
Returns a path into the settings directory of this widget, creating parent directories if necessary.
protected
method
|
Settings
(Path path)
|
||
type
|
Path
|
||
params
|
path
|
[not-null]
|
Relative path into settings directory. |
returns
|
|
The canonical settings path. | |
inherited
|
Widget.Settings
|
The pixel size of this widget has changed.
[EmptyBody]
|
||||
protected
virtual
method
|
SizeChanged
(Vec2I size)
|
|||
params
|
size
|
The new pixel size. | ||
inherited
|
Widget.SizeChanged
|
Remarks:
This method is called in these cases:
The logger object of this class.
public
static
readonly
field
|
Logger
|
||
type
|
ILogger
|