November Engine Features (Part 3): User interface classes (checkbox, refer to embedded design, …)

Posted on

Castle Game Engine play_animation demo
Castle Game Engine Editor - design with checkboxes, labels, edit boxes

New and improved user interface controls:

  1. New TCastleCheckbox shows a standard checkbox with a caption. It supports the standard properties and events, like Checked, Caption, OnChange and so on.

    I also recommend TCastleCheckbox implementation as a demo of implementing a component by composing some other internal components. In this case, TCastleCheckbox is realized as 2x TCastleImageControl and TCastleLabel instances. This is much easier and more powerful than drawing everything in the component Render method yourself.

  2. A new UI control TCastleDesign allows to reference a xxx.castle-user-interface file. This is especially useful inside the editor, to visually see one xxx.castle-user-interface file embedded inside another yyy.castle-user-interface.

    From code, it is usually more straightforward to load designs using UserInterfaceLoad global function, than to use TCastleDesign.

  3. TCastleLabel is now by default black. This makes it consistent with other UI controls (that generally assume “dark text over light background”), and avoids a confusion when default TCastleLabel isn’t visible over default TCastleRectangleColor (as they were both pure white, in previous engine version).

    On a related note, TCastleSceneManager no longer has pure black background, it has very dark gray (0.1, 0.1, 0.1, 1) background. This way pure black things are clearly visible over it. See Upgrading to Castle Game Engine 6.6 for detailed reasoning.

  4. TCastleScrollView received a number of fixes.

  5. TCastleVerticalGroup and TCastleHorizontalGroup have now configurable AutoSize and by default zero Padding and Spacing (more intuitive).

  6. You can now activate TCastleImageControl.DetectScaleFromUrl. This affects how the auto-scaling works, and detects special filenames like [email protected]. If you load an image file called [email protected] with size 20×20, and set DetectScaleFromUrl to true, then the automatically calculated control size will be 10×10 (2x smaller than the actual image size).

    This is a very useful trick to provide “upscaled” images that work with any UI scaling.

  7. TCastleButton.CustomColorXxx allows to configure button look by a solid color.

  8. The TCastleEdit has a number of new features:

    1. Placeholder text with PlaceholderColor
    2. PasswordChar to present password-input fields,
    3. OnChange event, AutoSize property.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.