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 TCastleEdit Edit box to input 1 line of text.
Class TCastleTheme Theme for 2D GUI controls.

Functions and Procedures

function Theme: TCastleTheme;
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';
procedure Register;

Types

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

Variables

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

Description

Functions and Procedures

function Theme: TCastleTheme;
 
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

 
procedure Register;
 

Types

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.

  • tiEdit: TCastleEdit frame.
TCastleButtonImageLayout = (...);

Copyright 2010-2017 Michalis Kamburelis.

This file is part of "Castle Game Engine".

"Castle Game Engine" is free software; see the file COPYING.txt, included in this distribution, for details about the copyright.

"Castle Game Engine" is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

—————————————————————————-

Values
  • ilTop
  • ilBottom
  • ilLeft
  • ilRight
TCastleTouchCtlMode = (...);

Copyright 2010-2017 Michalis Kamburelis.

This file is part of "Castle Game Engine".

"Castle Game Engine" is free software; see the file COPYING.txt, included in this distribution, for details about the copyright.

"Castle Game Engine" is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

—————————————————————————-

Values
  • ctcmWalking
  • ctcmWalkWithSideRot
  • ctcmHeadRotation
  • ctcmFlyUpdown
  • ctcmPanXY
TCastleTouchPosition = (...);
 
Values
  • tpManual
  • tpLeft
  • tpRight
TShapeType = (...);

Copyright 2010-2017 Michalis Kamburelis.

This file is part of "Castle Game Engine".

"Castle Game Engine" is free software; see the file COPYING.txt, included in this distribution, for details about the copyright.

"Castle Game Engine" is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

—————————————————————————-

Values
  • stRectangle
  • stCircle
TCastleCrosshairShape = (...);

Copyright 2010-2017 Michalis Kamburelis.

This file is part of "Castle Game Engine".

"Castle Game Engine" is free software; see the file COPYING.txt, included in this distribution, for details about the copyright.

"Castle Game Engine" is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

—————————————————————————-

Values
  • csCross
  • csCrossRect

Variables

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

Generated by PasDoc 0.14.0.