Unit CastleControls

Description

Standard 2D controls: buttons, labels, sliders etc.

Uses

Overview

Classes, Interfaces, Objects and Records

Name Description
Class TUIControlFont Base class for all user interface controls using a font.
Class TCastleButton Clickable button.
Class TCastlePanel Panel or a toolbar control.
Class TCastleImageControl Image control.
Class TCastleTouchControl Touch user interface to navigate in a 3D world.
Class TCastleRectangleControl Fill a rectangle on screen with given color.
Class TCastleShape Draw a simple shape (rectangle, circle) with given color and optional outline.
Class TCastleSimpleBackground Fill the whole window with a simple color.
Class TCastleDialog Dialog box that can display a long text, with automatic vertical scrollbar.
Class TCastleLabel Label with possibly multiline text, in an optional box.
Class TCastleCrosshair Display a simple crosshair in the middle of the parent control.
Class TCastleProgressBar Progress bar user interface.
Class TErrorBackground Error background, for various error handlers.
Class TCastleAbstractSlider An abstract slider user interface.
Class TCastleFloatSlider Slider to change a float value within a given range.
Class TCastleIntegerSlider Slider to change an integer value within a given range.
Class TCastleScrollView Children added to ScrollArea can be scrolled vertically.
Class TCastleTimer Timer, running the OnTimer event periodically.
Class TCastleTheme Theme for 2D GUI controls.

Functions and Procedures

function GetUIFont: TCastleFont;
procedure SetUIFont(const Value: TCastleFont);
function GetUIFontSmall: TCastleFont; deprecated 'use UIFont and temporarily change the size to be smaller, or use TUIControlFont.SmallFont';
procedure SetUIFontSmall(const Value: TCastleFont); deprecated 'use UIFont and temporarily change the size to be smaller, or use TUIControlFont.SmallFont';
function Theme: TCastleTheme;
procedure Register;

Types

TCastleButtonImageLayout = (...);
TCastleTouchCtlMode = (...);
TCastleTouchPosition = (...);
TShapeType = (...);
TThemeImage = (...);
TCastleCrosshairShape = (...);

Variables

property UIFont: TCastleFont read GetUIFont write SetUIFont;
property UIFontSmall: TCastleFont read GetUIFontSmall write SetUIFontSmall;

Description

Functions and Procedures

function GetUIFont: TCastleFont;

The 2D fonts used throughout UI interface.

By default, this is a modern sans-serif font hardcoded into the engine. It will be automatically created and freed if needed. This is comfortable for simple applications, you can just start "drawing text" without initializing anything.

You can assign your own font here, to make this the default font used by all 2D controls.

Note that assigning font here does not make it automatically freed (this would cause more trouble than comfort). To make sure your own fonts are always freed, set the font "owner" at creation, e.g. the example below sets the Application as owner:

MyFont := TTextureFont.Create(Application);
MyFont.Load(TextureFont_Xxxx);
UIFont := MyFont;

procedure SetUIFont(const Value: TCastleFont);
 
function GetUIFontSmall: TCastleFont; deprecated 'use UIFont and temporarily change the size to be smaller, or use TUIControlFont.SmallFont';

Warning: this symbol is deprecated: use UIFont and temporarily change the size to be smaller, or use TUIControlFont.SmallFont

 
procedure SetUIFontSmall(const Value: TCastleFont); deprecated 'use UIFont and temporarily change the size to be smaller, or use TUIControlFont.SmallFont';

Warning: this symbol is deprecated: use UIFont and temporarily change the size to be smaller, or use TUIControlFont.SmallFont

 
function Theme: TCastleTheme;
 
procedure Register;
 

Types

TCastleButtonImageLayout = (...);
 
Values
  • ilTop
  • ilBottom
  • ilLeft
  • ilRight
TCastleTouchCtlMode = (...);
 
Values
  • ctcmWalking
  • ctcmWalkWithSideRot
  • ctcmHeadRotation
  • ctcmFlyUpdown
  • ctcmPanXY
TCastleTouchPosition = (...);
 
Values
  • tpManual
  • tpLeft
  • tpRight
TShapeType = (...);
 
Values
  • stRectangle
  • stCircle
TThemeImage = (...);
 
Values
  • tiPanel
  • tiPanelSeparator
  • tiProgressBar
  • tiProgressFill
  • tiButtonPressed
  • tiButtonDisabled
  • tiButtonFocused
  • tiButtonNormal
  • tiWindow
  • tiScrollbarFrame
  • tiScrollbarSlider
  • tiSlider
  • tiSliderPosition
  • tiLabel
  • tiActiveFrame
  • tiTooltip
  • tiTouchCtlInner
  • tiTouchCtlOuter
  • tiTouchCtlFlyInner
  • tiTouchCtlFlyOuter
  • tiCrosshair1
  • tiCrosshair2
  • tiErrorBackground
  • tiLoading: Image displayed when the application is initializing, during Application.OnInitialize and Window.OnOpen. And TUIControl.GLContextOpen for all initially present UI controls. This "loading image" is loaded and displayed first, so that user does not see a black screen while the resources are prepared.

    It is especially useful on Android, where we can lose the OpenGL context at any moment, as user may switch applications in the middle of the game. When getting back to the application, we need to initiailize some resources, and during this process we also show this image. So this serves as a universal "please wait, we're loading" screen.

    You can customize this image, by setting Theme.Images[tiLoading], LoadingBackgroundColor, LoadingTextColor. See http://castle-engine.sourceforge.net/tutorial_player_2d_controls.php for a sample code that sets a theme image.

    Note that the customization of this image should be done before Application.OnInitialize has started, so it has to be usually done from the "initialization" section of some unit. And in the "initialization" section of a unit, you cannot load files (doing LoadImage at this point may fail on some Android devices, as we cannot load assets before activity is started). So you can only assign images already available in code — use image-to-pascal tool to convert any image to a Pascal code for this purpose.

TCastleCrosshairShape = (...);
 
Values
  • csCross
  • csCrossRect

Variables

property UIFont: TCastleFont read GetUIFont write SetUIFont;
 
property UIFontSmall: TCastleFont read GetUIFontSmall write SetUIFontSmall;
 

Generated by PasDoc 0.14.0.