LCL for game interface in CGE

Good day!
I think about ways to make complex interface for game. When you develop action game or platformer, few buttons can be enough, I think. But for RPG of strategy game are nesessary more complected solutions. And for me it is a very significant work.
I heard, libraries for GUI applications can be helpful in this field of development. For example, they says, what Space Rangers written on Delphi. Is they menus use refined libraries for GUI’s?
Or Morrowind interface - it is are simple stretchable windows with sliders, but for my opinion, it is a better interface in the all TES series :slight_smile:
Moreover, i saw Eugene’s project “Project Helena”, and interface looked like it made with LCL.
It seems nice and effective, and I want to use this to, especially at first steps of development, when I want to concentrate to more principal positions then game menus.

If it is possible, how better to do it? I can’t add in TStateTessellisMain LCL objects directly, as I understand?
Is someone have practice with this? Or it is a bad way to decide my difficulties with interface?

1 Like

Note that Project Helena was my first steps with Castle Game Engine and it’s most certainly not a recommended way to make a UI with CGE :smiley:

Of course, if you need to use Lazarus/Delphi extended UIs that aren’t implemented in Castle Game Engine (e.g. Tree View is not yet available, no ready String Grid and the likes) - you can just use the CGE in a TCastleControl which can be easily put on your form. I’m not sure in which state it is in Delphi but I know it’s the end-goal to have it as simple as in Lazarus.

But in most usecases you can do very complex UIs inside of Castle Game Engine - now especially with Castle Editor that allows you to create and design things very intuitively. It takes a bit of time to learn as any new tech, but it’s definitely worth it.

If you don’t have something that “exactly fits your needs” you can create custom UI components and make them editable in Castle Editor. E.g. this is the UI from my latest game - it easily has a metric ton of information on-screen designed in a rather simple way.

1 Like

Ok, thanks!
Apparently it’s time to look to the editor more intently.
I can create few menus with parameter Exist := False and changes it to True every time when player call them, yes?

Yes, exactly.

In some more complex cases (like menus with variable content) you may choose to “fill in the menu dynamically”. So, you have a “container object” (most often something like TCastleVecticalGroup) and you just fill it in with some UI elements (like TCastleButton).

Sometimes you may have a whole UI layer as a separate TCastleView which can be designed separately and “pushed” or “popped” when necessary - very useful to implement things like in-game menu or pop-ups.

1 Like

Indeed, if you want to have UI designed using Lazarus LCL, or Delphi VCL or FMX – you can do this by placing TCastleControl on a form, following Engine on a form (VCL, FMX, LCL) using TCastleControl | Manual | Castle Game Engine . While technically there are 3 versions of TCastleControl (LCL, VCL, FMX) I deliberately made them to have almost-equivalent API, and they share the same functionality.

They all can display any CGE user-interface (TCastleUserInterface), in particular they all can contain CGE TCastleViewport with 3D or 2D stuff. They all have Container field. They all can even reference some view descendant ( Managing Views | Manual | Castle Game Engine ) which you can set by MyControl.Container.View := MyView, following Engine on a form (VCL, FMX, LCL) using TCastleControl | Manual | Castle Game Engine .

As for whether to design UI using CGE UI, or use LCL, VCL, FMX – indeed the choice is yours. I’m dedicated to extending CGE UI, making it cross-platform, using CGE UI scaling (similar to Unity UI scaling) and customizable for games. On the other hand, LCL, VCL, FMX have some more components (like tree view).

Making a menu-like using CGE UI indeed means to use TCastleVerticalGroup, filled with TCastleButton, and you can toggle Exists of buttons as you see fit. See e.g. examples/component_gallery about some of the things you can do with CGE UI.

( Huh, I think I managed to not say anything substantial in this thread, I see you already mentioned it all above :slight_smile: )

2 Likes