A lot of work to improve our main user interface class TCastleUserInterface (formerly called TUIControl), from which all other UI controls descend:
Border and BorderColor allow to draw borders around any UI control. Transparent borders are also incredibly useful, to add space around the control, or to reserve free space for sibling controls. For example, this allows to set one control to have height equal to 100 pixels, and the other control to just “fill the rest of the parent”.
We have optimized and improved internal measuring of the control. It now uses an internal (protected) PreferredSize method, and is cached for some brief moments (during rendering), and is secured from recursive loop (in case the parent’s size depends on the child, but the child’s size depends on the parent).
Visually edit anchors. Anchors are incredibly important when using our user-interface — they allow you to position controls such that they work regardless of the window size (and UI scaling, if you use it).
Visually adjust TCastleImageControl.ProtectedSides. This allows to configure rendering of images using 3×3 (9-slices) algorithm. The editor now shows the “rulers” that split image into 3×3 parts with different scaling.
Copy-pasting of component within the editor is possible. This way you can quickly duplicate a component hierarchy, or move it between various designs.
TSerializedComponent is an alternative approach to deserializing design files. (xxx.castle-user-interface, xxx.castle-transform) It’s powerful when you need to instantiate the same file multiple times. This way the file is loaded only once (at TSerializedComponent.Create call) and you can instantiate it many times fast (using TSerializedComponent.UserInterfaceLoad method).
Before we go into Castle Game Engine 6.6 release (soon!), I wanted to thank people who support Castle Game Engine on Patreon 🙂 The engine is being developed thanks to your support! Here are some features done explicitly thanks to the requests from Patrons in 2018:
The editor supports selecting, translating and resizing UI controls (possibly with snap). You may have already seen it in the movie.
It is possible to use custom components within the editor.
New build tool command “castle-engine editor” will run Castle Game Engine Editor within the current project, with possible project-specific components. It will automatically build CGE editor with additional project-specific components included.
See the editor README, section “Include custom (project-specific) components in the visual designer”.
The editor has menu items to adjust camera (Scene Manager Camera View All), and to reorder 2D scenes (Scene Manager Sort For Correct 2D Blending).
Much more vectors and colors are editable and persistent in the editor. E.g. TCastleLabel.Color, TCastleTransform.Translation/Rotation/Scale.
Note: This change may break backward compatibility in some cases. You may need to adjust your code. This was unfortunately unavoidable, the API looked really messy when I was trying to maintain 100% backward compatibility (having both integer-based and float-based methods and properties). Details in this commit log.
If you just did MyControl.Width := 100 it will work as before. But if you did e.g. MyInteger := MyControl.Width, or MyInteger := MyControl.Width div 2, it will no longer work, as Width is a floating-point value (Single) now. You will need to adjust your code. You can just write Round(MyControl.Width), or you can adjust your code to use float-based coordinates everywhere too.
If you use rectangles, you can convert between integer-based (TRectangle) and float-based (TFloatRectangle) using MyFloatRectangle := FloatRectangle(MyIntRectangle) or MyIntRectangle := MyFloatRectangle.Round;.
TCastleUserInterface now has a size (Width, Height, FullSize properties). The TCastleUserInterfaceRect, TUIControl, TUIControlRect are all now just deprecated aliases for TCastleUserInterface.
All UI controls have non-zero size by default. The base TCastleUserInterface class sets width and height to 100. This is more friendly (especially when using the editor) than previous situation when TCastleUserInterfaceRect / TUIControlRect had by default zero size.
The next issue of Blaise Pascal Magazine will contain a nice long article I wrote about Castle Game Engine! 20 pages, describing how to use the engine from absolute basics, showing how to construct a simple cross-platform 3D game using TCastleWindow, TCastleScene, TCastleTransform, SoundEngine features. I am quite happy with it 🙂
I will also make the article available for all Patrons of Castle Game Engine at the end of this month (September). If you would like to support the development of CGE, now is the time 🙂
My vision and goals for X3D is documented publicly in my “x3d-tests” wiki. This wiki contains an overview + lots of details what I would like to see in X3D standard. Many of the ideas revolve around bringing X3D more “aligned” with glTF 2.0 feature set. Which is of course closely tied with getting glTF 2.0 into Castle Game Engine, as an X3D scene graph. I believe that this is a solution in which everyone wins, i.e. we will have an engine with perfect interchange format (for which glTF 2.0 is now better, although X3D tries to catch up) and a perfect scene graph (where X3D shines already).
We have a number of engine improvements to announce:
A new way to access data files is to use a special protocol castle-data, like this: castle-data:/images/my_image.png. This is exactly equivalent to using ApplicationData('images/my_image.png'). During development, it will simply load a file data/images/my_image.png from your project.
The advantage of the castle-data protocol is that it can be used easily from other data files, like X3D or xxx.castle-user-interface created by Castle Game Engine Editor or Lazarus .lfm. The CGE editor already automatically uses this protocol if you open an image or 3D model within the data subdirectory of the project.
The editor keeps improving. You can add, delete components, you can start a new file from any root (so e.g. you can start building user-interface rooted in TCastleUserInterfaceRect, or TCastleSceneManager), you can see the effect of the UI scaling, we automatically detect when you open a file in project data (and use castle-data protocol), you can easily add a scene with a primitive (like a box or plane, using PrimitiveGeometry underneath).