Class TCastleTouchControl
Unit
Declaration
type TCastleTouchControl = class(TCastleUserInterface)
Description
Warning: this symbol is deprecated: use TCastleTouchNavigation
Touch user interface to navigate in a 3D world. Shows one "lever", that can be moved up/down/left/right, and controls the movement while Walking or Flying.
Hierarchy
- TObject
- TPersistent
- TComponent
- TCastleComponent
- TCastleUserInterface
- TCastleTouchControl
Overview
Methods
![]() |
procedure PreferredSize(var PreferredWidth, PreferredHeight: Single); override; |
![]() |
constructor Create(AOwner: TComponent); override; |
![]() |
procedure Render; override; |
![]() |
function Press(const Event: TInputPressRelease): boolean; override; |
![]() |
function Release(const Event: TInputPressRelease): boolean; override; |
![]() |
function Motion(const Event: TInputMotion): boolean; override; |
![]() |
procedure SetTouchMode(const Value: TCastleTouchCtlMode); |
![]() |
procedure GetSensorRotation(var X, Y, Z, Angle: Double); |
![]() |
procedure GetSensorTranslation(var X, Y, Z, Length: Double); |
Properties
![]() |
property TouchMode: TCastleTouchCtlMode
read FTouchMode write SetTouchMode default ctcmWalking; |
![]() |
property Position: TCastleTouchPosition
read FPosition write SetPosition default tpManual; |
![]() |
property Scale: Single read FScale write SetScale default 1; |
Description
Methods
![]() |
procedure PreferredSize(var PreferredWidth, PreferredHeight: Single); override; |
This item has no description. Showing description inherited from TCastleUserInterface.PreferredSize. Controls that have a preferred size should override this. By default this contains values derived from Width, WidthFraction, Height, HeightFraction, with Border subtracted. Note that the arguments should be already scaled, i.e. multiplied by UIScale, i.e. expressed in final device pixels. Note that the returned PreferredWidth and PreferredHeight must not include the space for Border. Border size will be added later. |
![]() |
constructor Create(AOwner: TComponent); override; |
This item has no description. |
![]() |
procedure Render; override; |
This item has no description. Showing description inherited from TCastleUserInterface.Render. Render a control. Called only when Exists and GLInitialized, you can depend on it in the implementation of this method. Do not explicitly call this method. Instead, render controls by adding them to the TCastleContainer.Controls list, or render them explicitly (for off-screen rendering) by TCastleContainer.RenderControl. This is method should only be overridden in your own code. Before calling this method we always set some OpenGL state, and you can depend on it (and you can carelessly change it, as it will be reset again before rendering other control). OpenGL state always set:
Beware that GLSL RenderContext.CurrentProgram has undefined value when this is called. You should always set it, before making direct OpenGL drawing calls (all the engine drawing routines of course do it already, this is only a concern if you make direct OpenGL / OpenGLES calls). |
![]() |
function Press(const Event: TInputPressRelease): boolean; override; |
This item has no description. Showing description inherited from TCastleUserInterface.Press.
Handle press or release of a key, mouse button or mouse wheel. Return When implementing in descendants it is best to override it like this: function TMyControl.Press(const Event: TInputPressRelease): boolean; begin Result := inherited; if Result then Exit; // exit if ancestor already handled event if Event.IsKey(keyEnter) then begin // do something in reaction on Enter Exit(ExclusiveEvents); // ExclusiveEvents is true by default end; if Event.IsMouseButton(buttonLeft) then begin // do something in reaction on Enter Exit(ExclusiveEvents); // ExclusiveEvents is true by default end; end;
Note that releasing of the mouse wheel is not reported now by any backend. Only releasing of keys and mouse buttons is reported. The events PreviewPress and PreviewRelease are passed first to the parent control, before children have a chance to process this event. Overriding them makes sense if you draw something in TCastleUserInterface.RenderOverChildren. The events Press and Release are passed to the parent only after the children had a chance to process this event. Overriding them makes sense if you draw something in TCastleUserInterface.Render. This is usually more natural, and adviced. |
![]() |
function Release(const Event: TInputPressRelease): boolean; override; |
This item has no description. |
![]() |
function Motion(const Event: TInputMotion): boolean; override; |
This item has no description. Showing description inherited from TCastleUserInterface.Motion.
|
![]() |
procedure SetTouchMode(const Value: TCastleTouchCtlMode); |
This item has no description. |
![]() |
procedure GetSensorRotation(var X, Y, Z, Angle: Double); |
This item has no description. |
![]() |
procedure GetSensorTranslation(var X, Y, Z, Length: Double); |
This item has no description. |
Properties
![]() |
property TouchMode: TCastleTouchCtlMode
read FTouchMode write SetTouchMode default ctcmWalking; |
This item has no description. |
![]() |
property Position: TCastleTouchPosition
read FPosition write SetPosition default tpManual; |
Set position of touch control. Right now this simply sets the anchor using TCastleUserInterface.Anchor and friends. Tip: Use TCastleContainer.UIScaling to have the anchors automatically scale with screen size. The size of the control is set to be constant physical size, so it's not affected by TCastleContainer.UIScaling, only by TCastleContainer.Dpi. |
![]() |
property Scale: Single read FScale write SetScale default 1; |
This item has no description. |
Generated by PasDoc 0.16.0.