Reference TScene
Declared in Codebot.Render.Scenes.pas on line 127
TScene is the base class of everything a host shows. Override Initialize, Logic, and Render to make a scene.
TScene = class
protected
{ Resize sets the viewport but you might use it to change the perspective
matrix }
procedure Resize; virtual;
public
{ Create a scene of a size using the scene host of the calling thread }
constructor Create(Width, Height: Integer); virtual;
destructor Destroy; override;
{ Name of the scene }
function Name: string; virtual;
{ KeyEvent is fired when a keyboard action occurs }
procedure KeyEvent(KeyCode: Integer; Shift: TShiftKeys); virtual;
{ MouseEvent is fired when a mouse action occurs }
procedure MouseEvent(X, Y: Integer; Action: TMouseAction); virtual;
{ Input events sent by the host. By default key up calls KeyEvent and the
mouse button and move events call MouseEvent. }
procedure DoKeyDown(var Args: TSceneKeyArgs); virtual;
procedure DoKeyUp(var Args: TSceneKeyArgs); virtual;
procedure DoMouseDown(var Args: TSceneMouseArgs); virtual;
procedure DoMouseMove(var Args: TSceneMouseArgs); virtual;
procedure DoMouseUp(var Args: TSceneMouseArgs); virtual;
procedure DoMouseWheel(var Args: TSceneWheelArgs); virtual;
procedure DoTextInput(var Args: TSceneTextArgs); virtual;
{ Update causes a and Logic, Resize, and Render methods to be invoked in
that order }
procedure Update(Width, Height: Integer; Time: Double);
{ Initialize has an active context and is called during Create }
procedure Initialize; virtual;
{ Finalize has an active context and is called during Destroy }
procedure Finalize; virtual;
{ Logic phase allows you to calculate logic and has no current context }
procedure Logic; virtual;
{ Render phase allows you render and has a current context }
procedure Render; virtual;
{ StepInterval is the time in seconds between calls to Step made by a step
thread the host runs for the scene, or 0 when the scene does not need a
step thread. It is read once after the scene is created. }
function StepInterval: Double; virtual;
{ Step is called on the step thread at a fixed rate when StepInterval is
greater than 0. It runs at the same time as Logic and Render, so data they
share must be protected. It has no current context. }
procedure Step(DeltaTime: Double); virtual;
{ When Animated is True update is called continously }
property Animated: Boolean read FAnimated write FAnimated;
{ Context associated with the scene }
property Context: TRenderContext read FContext;
{ The host running the scene, or nil if the scene was created without one }
property Host: TSceneHost read FHost;
{ The canvas and default font of the host }
property Canvas: ICanvas read GetCanvas;
property Font: IFont read GetFont;
{ Time that can be used during Logic or Render }
property Time: Double read GetTime;
{ Width is updated immediately before Render }
property Width: Integer read FWidth;
{ Height is updated immediately before Render }
property Height: Integer read FHeight;
end;See also
ICanvas in Codebot.Render.Graphics.pas
IFont in Codebot.Render.Graphics.pas
TRenderContext in Codebot.Render.Contexts.pas