Big user-interface and editor improvements

Posted on

editor_0
editor_1
  1. The editor supports selecting, translating and resizing UI controls (possibly with snap). You may have already seen it in the movie.

  2. 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”.

  3. 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).

  4. Much more vectors and colors are editable and persistent in the editor. E.g. TCastleLabel.Color, TCastleTransform.Translation/Rotation/Scale.

  5. New property TCastleUserInterface.AutoSizeToChildren allows to adjust size to include all children. In particular useful for TCastleScrollView.ScrollArea.

  6. The user interface coordinates (all positions, sizes) are float-based now. In other words, TCastleUserInterface.Width, TCastleUserInterface.Height, and a lot of “friends” now have a type Single, not Integer. In some cases, we deprecated old integer-based property (like TCastleUserInterface.CalculatedWidth, TCastleUserInterface.ScreenRect) and added a new float-based replacement (like TCastleUserInterface.EffectiveWidth, TCastleUserInterface.RenderRect).

    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;.

    If you encounter troubles adjusting your code, please let us know on Discord or forums, we will help!

  7. TCastleUserInterface now has a size (Width, Height, FullSize properties). The TCastleUserInterfaceRect, TUIControl, TUIControlRect are all now just deprecated aliases for TCastleUserInterface.

  8. 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.

Comments on the forum ➤

“Modern Object Pascal Introduction for Programmers” translated to Russian

Posted on

Thanks to Alexander Skvortsov and Yevhen Loza, the complete book “Modern Object Pascal Introduction for Programmers” is now available in Russian. Read it here in the Russian version:

My many thanks go to the translators for the huge task they did. The translation includes the complete text, comments in the example code, and they also improved and enhanced the English text as well.

It’s all merged now into the GitHub repository, where English and Russian sources (in AsciiDoc) live side-by-side.

P.S. If you’re looking for the English version, it’s (as always) here:

Comments on the forum (4) ➤

Simple water using Castle Game Engine

Posted on

shot0002

I made a new demo of water using Castle Game Engine. The demo is available in demo-models repository, in the water/simple/ subdirectory.

Open it with any viewer using the latest Castle Game Engine code, for example use the “daily build” of view3dscene. Here’s a movie:)

Comments on the forum (2) ➤