Opened 2 years ago

Closed 19 months ago

#125 closed enhancement (fixed)

component system (for GUI windows)

Reported by: Carsten Owned by: Carsten Fuchs <carsten.fuchs@…>
Priority: normal Milestone:
Component: Cafu Engine Version: svn-head
Keywords: Cc:
Platform:

Description

Overview

In the forum thread at http://www.cafu.de/forum/viewtopic.php?f=6&t=1099, author "midix" suggested to use a "component system" for game entities in the Cafu Engine.

Whereas until now we used class hierarchies to introduce new features, component systems are a way to break the inherent limitations and inflexibility. Composing game entities of components to bring in new features in an additive manner removes the combinatorial complexity that exists with class inheritance, can improve encapsulation (features are encapsulated in components), and gives users both more flexibility and control.

The forum thread subsequently gathered a lot of additional and related information, see there for all the details.

GUI Windows

During my research, it turned out that the windows of a GUI essentially profit from a component system as much as game entities do.

In Cafu we already have a pretty good GUI system with an existing class hierarchy for GUI windows. The window class hierarchy starts to suffer (mildly still) from the very problems that a component system is supposed to solve, and at the same time is much smaller than our game entity class hierarchy.

As we're still relatively new to component systems, at this time we cannot foresee all the ramifications and consequences or obligations that switching to a component system will bring. As such, the GUI window class hierarchy seems to be a very good field to introduce a component system to Cafu. It being both "small" but also seeing use in real life makes it the ideal ground for gathering experience, making experiments and learning more about it. The experiences gathered in the course of the implementation of this ticket are intended to facilitate the future migration of the game entities to a component system, too.

Therefore, the objective of this ticket is to introduce a component system that is supposed to replace the current GUI window class hierarchy.

Change History (94)

comment:1 Changed 2 years ago by Carsten

(In [683]) GuiSys: Introduce component system.

This change is a first sketch for introducing a component system for GUI windows.
It does not add any new functionality yet, but just shows some outline how this might be conceptually done.

References #125.

comment:2 Changed 2 years ago by Carsten

(In [684]) GuiSys: Law of the Big Three for "component" classes.

This change adds copy ctors, dtors and the assignment operator to the "component" classes.
These are required so that ComponentBaseT and its derived classes can properly be used in WindowTs.

References #125.

comment:3 Changed 2 years ago by Carsten

(In [685]) GuiSys: Have components have references to their parent window.

Components can never have NULL pointers to their parent window, so better use a reference instead.
(I think that in the course of the development of the component system we will still need non-const references before we will eventually be able to make them const.)

References #125.

comment:4 Changed 2 years ago by Carsten

(In [687]) GuiSys: Update ComponentBaseT::UpdateDependencies() method.

It becomes clear that ComponentBaseT::ResolveDependencies() is called not only when a window and its components have been loaded (a one time issue at init time), but also when a window is copied or when it has been modified in the GUI editor.
This change reflects this insight by renaming the method and updating its documentation.

References #125.

comment:5 Changed 2 years ago by Carsten

(In [688]) GuiSys: Reference-count components.

ComponentBaseT and derived classes must be reference-counted so that they can be bound to our Lua script instances.
As a consequence, we cannot store raw pointers to components in their parent windows (or anywhere!) either.

References #125.

comment:6 Changed 2 years ago by Carsten

(In [689]) GuiSys: Add scripting support for component classes.

This change adds the basic "framework" code for scripting support in our component classes.

References #125.

comment:7 Changed 2 years ago by Carsten

(In [690]) CaWE: Introduce component system to GUI Editor.

The recently added component system for GUI windows is now also introduced to the GUI Editor in CaWE:
The GUI Editor gets a "Component" menu and a "add component" command so that the user can add components to windows.
(At this time however, the "Window Inspector" has not yet been updated, so that the newly added components are not yet visible in the user interface.)

References #125.

comment:8 Changed 2 years ago by Carsten

(In [692]) GuiSys: Add method GetName() to class ComponentBaseT.

References #125.

comment:9 Changed 23 months ago by Carsten

In 693/svn:

TypeSys: Add classes for wrapping variables (of component classes).

The member variables of component classes must have specific features that are provided by the wrapper classes that are introduced in this change.
See the detailed comment in Libs/Variables.hpp for details.

References #125.

comment:10 Changed 23 months ago by Carsten

In 694/svn:

GuiSys: Add type introspection to the ComponentBaseT hierarchy.

This change adds a cf::TypeSys::VarManT instance to the ComponentBaseT class and some (test) cf::TypeSys::VarT<T> variables to ComponentTransformT.

References #125.

comment:11 Changed 23 months ago by Carsten

In 695/svn:

GUI Editor: Add full support for components to the "Window Inspector".

This very important change adds visitors for the variables of our window components that:

  • create a wxPGProperty for the visited variable and add it to the given wxPropertyGridManager,
  • on Observer notification update the value of the given property to the value of the visited variable, and
  • update the value of the visited variable according to the given EVT_PG_CHANGING event.

This change also adds:

  • the required CommandSetCompVarT to change the value of a cf::TypeSys::VarT<T> variable,
  • the required functions in the Observer pattern code, and
  • the required "glue code" in WindowInspectorT.

References #125.

comment:12 Changed 23 months ago by Carsten

In 696/svn:

GUI Editor: In WindowInspectorT, use EVT_PG_CHANGING for component properties.

We used to handle changes of our component properties along with the normal (somewhat outdated) window properties in WindowInspectorT::OnPropertyGridChanged(), where however it is too late to veto the related event.
As the window properties rely on the "changed" (not the "changing") event, we separated our component properties from them, which are now handled in the new WindowInspectorT::OnPropertyGridChanging() handler.

References #125.

comment:13 Changed 23 months ago by Carsten

In 697/svn:

GUI Editor: Add support for "composed" (Vector3fT) component variables.

For more complete and more realistic testing and perspective, we add a VarT<T> variable type to our ComponentTransformT class whose base type T is a "composed" type (a Vector3fT), and extend the GUI Editor appropriately.

It is expected that "composed" types like Vector3fT will later occur in real code frequently and prominently, so accounting for them right from the start through all code paths seems like a reasonable thing to do.

References #125.

comment:14 Changed 23 months ago by Carsten

In 698/svn:

GuiSys: Add support for getting/setting component variables in Lua.

The values of component variables can now be retrieved and set in Lua.
If comp is a component in Lua, and filename is a variable of comp, then we can get and set its value like this:

    comp:set("filename", "image.png")
    print(comp:get("filename"))

Note that at this time, there is no support yet for creating new components in Lua,
and there is no support yet for the more natural short form:

    comp.filename = "image.png"
    print(comp.filename)

References #125.

comment:15 Changed 23 months ago by Carsten

In 699/svn:

GuiSys: Allow components to exist "stand-alone": independent and not a part of any window.

Components now have two clearly defined invariants: "part of" and "not part of" a window.

The normal invariant is that a window knows the components it is composed of,
because it hosts them, and reversely, that each component knows its parent
window that hosts it.

In the second invariant, a component is independent of any window: neither is it part
of the components list of a window, nor does it reversely have a parent window assigned.

The latter is very useful when windows are dynamically constructed, or components are
added to or removed from windows at runtime. This occurs in the Undo/Redo system of our
GUI Editor, as well as when components are created and handled in scripts.

Also see r685, which did not foresee that true "stand-alone" would be required.
References #125.

comment:16 Changed 23 months ago by Carsten

In 700/svn:

GuiSys: Add script methods AddComponent(), RemoveComponent() and GetComponents() to WindowT.

References #125.

comment:17 Changed 23 months ago by Carsten

In 701/svn:

GuiSys: Extend the gui:new() script method to create both new components and windows.

References #125.

comment:18 Changed 23 months ago by Carsten

In 702/svn:

GuiSys: Update the WindowT::AddComponent() script method to accept an arbitrary number of component arguments.

References #125.

comment:19 Changed 23 months ago by Carsten

In 703/svn:

GuiSys: Fix initialization of the Gui script state, so that also ComponentBaseT objects can be bound to the script.

References #125.

comment:20 Changed 23 months ago by Carsten

In 704/svn:

GUI Editor: Add serialization of components.

Components are now saved along with their window when a GUI is saved.

References #125.

comment:21 Changed 23 months ago by Carsten

In 705/svn:

GuiSys: Add optional parameter Index to WindowT::AddComponent().

Callers can now specify the position among the other components the new component is inserted at.
This generally widens the use of this method, especially in the GUI Editor, e.g. for undoing "delete" commands, for "move up/down" commands, etc.

References #125.

comment:22 Changed 23 months ago by Carsten

In 706/svn:

GUI Editor: Revised CommandAddComponentT.

A new component can now be added at an arbitrary index among the other components that already are in the window.
This matches the increased flexibility added to WindowT::AddComponent() in the previous revision r705.

References #125.

comment:23 Changed 23 months ago by Carsten

In 707/svn:

GUI Editor: Add CommandDeleteComponentT.

This command complements CommandAddComponentT.
It is nowhere used yet.

References #125.

comment:24 Changed 23 months ago by Carsten

In 708/svn:

GUI Editor: Add a context menu for window components.

Components can now be moved up and down, and be removed again.

References #125.

comment:25 Changed 23 months ago by Carsten

In 709/svn:

GUI Editor: Add icons to window components context menu.

References #125.

comment:26 Changed 21 months ago by Carsten Fuchs <carsten.fuchs@…>

In 0ef00c143e70ccb761ddca598121dfd8167cf544/git:

GUI Editor: Fix bug with editing old, non-component window variables/properties.

References #125.

comment:27 Changed 21 months ago by Carsten Fuchs <carsten.fuchs@…>

In 4d6a5088d021be968b7770e9ef46ee18d64441ca/git:

Add support for cf::TypeSys::VarT<> variables of type ArrayT<std::string>.

References #125.

comment:28 Changed 21 months ago by Carsten Fuchs <carsten.fuchs@…>

In 1d0a2d8b5005660fd9b51839851fb24b1a722c79/git:

GuiSys: Add method SetText() to the ComponentTextT class.

Other C++ code (especially other components) would normally have to use
GetMemberVars().Find("Text") to set this components text value.
This auxiliary method makes the task much easier.

References #125.

comment:29 Changed 21 months ago by Carsten Fuchs <carsten.fuchs@…>

In 712f55d2640597a1282f18108e025f50fe09643e/git:

GuiSys: Augment ComponentBaseT with methods CallLuaMethod(), OnInputEvent() and OnClockTickEvent().

References #125.

comment:30 Changed 21 months ago by Carsten Fuchs <carsten.fuchs@…>

In 36ab4197bdeeeffe74c4395c6c079bb062fc8ef3/git:

Fix Linux/GCC compilation issues.

References #125.

comment:31 Changed 21 months ago by Carsten Fuchs <carsten.fuchs@…>

In e423958d462d69fecae071fee1dc51031bb430e5/git:

Engine: Fix the one-time init of the components TIM in AppCafuT.

References #125.

comment:32 Changed 21 months ago by Carsten Fuchs <carsten.fuchs@…>

In c36ef47216d4bafc25110541c29193b66d9c1bd5/git:

GuiSys: In ComponentTextT, add flag "IsColor" to the "Color" variable.

References #125.

comment:33 Changed 21 months ago by Carsten Fuchs <carsten.fuchs@…>

In 52ce8058d5d90a0a23ac63c986ed387c853fb121/git:

GuiSys: In the GuiImplT ctor, replace parameter bool IsInlineCode with int Flags.

Obviously, I also add a corresponding enum InitFlagsT in order to give our flags symbolic names.
This change improves both the readability and the extensibility of the code (I plan to add additional flags soon).

References #125.

comment:34 Changed 21 months ago by Carsten Fuchs <carsten.fuchs@…>

In c18866f55ea4f0a83e47b4ff7a702f0979bc5485/git:

GuiSys: Augment ComponentBaseT with callback method OnPostLoad(), and add new flag InitFlag_InGuiEditor to properly use it.

References #125.

comment:35 Changed 21 months ago by Carsten Fuchs <carsten.fuchs@…>

In 1033852aa5948b7cbbc48b782654b4ada1bdf465/git:

GuiSys: Add new component ComponentChoiceT.

References #125.

comment:36 Changed 21 months ago by Carsten Fuchs <carsten.fuchs@…>

In ea0cd2e35181d661a444665f29bca279f1938a40/git:

GuiSys: In ComponentTextT, replace static const int class members with plain enums.

static const int class members are surprisingly troublesome:

  • When initialized (the value is assigned) in the .cpp definition file, as it was, then these variables are not considered constants when used in case statements in different .cpp files (which only include the header / declaration file, which in turn doesn't state the values).
  • But when the values are assigned in the header file, as it was up to r36ab41 on 2013-02-12, then the GCC linker requires that the variables are also defined in a .cpp file (or else there remain undefined references), whereas VC++ 2010 requires that this is not done (or else there are multiple definitions).

References #125.

comment:37 Changed 21 months ago by Carsten Fuchs <carsten.fuchs@…>

In 41860fb79832d32f0e10b012e0153b85aa774937/git:

Add support for cf::TypeSys::VarT<> variables of type unsigned int.

References #125.

comment:38 Changed 21 months ago by Carsten Fuchs <carsten.fuchs@…>

In c9237d49bda953a0946cc1e36f9476c8cab5961e/git:

GuiSys: Add new component ComponentTextEditT.

References #125.

comment:39 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In a10adbc76f2fd84da3eda10651aba6faec37c56f/git:

Add support for cf::TypeSys::VarT<> variables of type Vector2fT.

References #125.

comment:40 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In cad388fb1627a702700aefe787b874c9e31c3337/git:

GuiSys: Switch type of ComponentTextT::m_Padding from float to Vector2fT.

References #125.

comment:41 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In f6e46426919deee937a2f18e8386b35f80b1f76f/git:

GuiSys: Add new component ComponentListBoxT.

References #125.

comment:42 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In 1e42cee21c04c28e4039658ae9af01a965b9310e/git:

Fix Linux/GCC compilation issues.

References #125.

comment:43 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In f8e5725d8a1a51485d10d2df8dc6ea38e95ed861/git:

GuiSys: Add method WindowT::GetComponent() that returns the (n-th) component of the given (type) name.

References #125.

comment:44 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In b4f5130cb4adf61637c88cce54ef888334cbe7b0/git:

GUI Editor: Convert subclasses of WindowT to components when a GUI file is saved.

This is intentionally limited to subclasses of WindowT for now. That is,
conversion of WindowT details itself (e.g. text, border, image) is currently
omitted.

This separation into two steps improves the clarity of the conversion, and
gives us a better chance to fix custom GUI scripts as an intermediate step.

References #125.

comment:45 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In 6d2838e09820248504a0037f84e0669a8705d96c/git:

GuiSys: Let ComponentListBoxT colors each have their own alpha value.

It's more flexible this way, and we can maintain backwards-compatibility with
the old listbox window subclass.

References #125.

comment:46 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In 867cc949d0f45c4f4c37a1822d88757df4b3cdc1/git:

GuiSys: Add script method WindowT::GetComponent() that returns the (n-th) component of the given (type) name.

This change complements f8e572/git, where the method was introduced only for C++.

References #125.

comment:47 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In 9a9fe6cba5e5eb2f4cff38d2624d4d92ef8f2d45/git:

GuiSys: Add script method ComponentTextEditT::SetText() that sets the given text in the related Text sibling component and moves the cursor position to its end.

References #125.

comment:48 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In 8e11733d26af2c0a7665dd55b188525794b2b216/git:

GuiSys: In ComponentChoiceT start item index numbers at 1 (as per Lua convention), not 0.

References #125.

comment:49 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In c65c3dbce0c7db88dcddf1622bfd50414ea3b7ef/git:

GuiSys: In ComponentListBoxT start item index numbers at 1 (as per Lua convention), not 0.

References #125.

comment:50 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In a749eb627a9c0e610920a3ba3261a98e7e190a22/git:

GuiSys: Add script method ComponentChoiceT::GetSelItem() that returns the currently selected item.

References #125.

comment:51 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In b8aacc5b93fcd65fbf9301e7c2b7180a90081566/git:

GuiSys: Add script method ComponentListBoxT::GetSelItem() that returns the currently selected item.

References #125.

comment:52 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In b8a5c14df1e05a0079aa0453f127faad01dde4ae/git:

GuiSys: Change signature of ComponentChoiceT::OnSelectionChanged() callback, remove SelNum parameter.

We used to pass the index number of the newly selected item before, but it has
been removed and the signature is now empty.

The main reason for this change was that the index number, e.g. named SelNum,
was in OnSelectionChanged() implementation often used like this:

local Item = self:get("Items")[SelNum]

However, this is now much better written as

local Item = self:GetSelItem()

Note that the code can still easily learn the same SelNum as before:

local SelNum = self:get("Selection")

References #125.

comment:53 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In 22d4d4e7503c810adc2218d5d3540f9e0173d346/git:

GuiSys: Change signature of ComponentListBoxT::OnSelectionChanged() callback, remove SelNum parameter.

We used to pass the index number of the newly selected item before, but it has
been removed and the signature is now empty.

The main reason for this change was that the index number, e.g. named SelNum,
was in OnSelectionChanged() implementation often used like this:

local Item = self:get("Items")[SelNum]

However, this is now much better written as

local Item = self:GetSelItem()

Note that the code can still easily learn the same SelNum as before:

local SelNum = self:get("Selection")

References #125.

comment:54 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In 233e29e87f679148846ce3ab165c8cbbebc71e57/git:

GuiSys: Add script method gui:Init().

With the new method, GUI scripts can have the OnInit() window callbacks be
processed before it would automatically be done at the end of the main script.

This is useful whenever the main script wants to rely on the effects of the
OnInit() methods, e.g. the proper default values all being set, the
components being instantiated, etc.

References #125.

comment:55 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In 7a7adf22040c1373ee02f8f80f9183996bbff4bc/git:

GUI Editor: Fix conversion of subclasses of WindowT to components when a GUI file is saved.

This was initially introduced in b4f513/git and accidentally broken
in 8e1173/git, where item index numbers were changed to start at 1.

References #125.

comment:56 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In 41adfa6c1e9202f1e1d62ba1e8745dd278eff116/git:

DeathMatch GUIs: (partially) convert GUIs to component system.

Using the code introduced in b4f513/git on 2013-02-22, partially convert GUIs to the new component system.

This was done by loading and saving all _init.cgui files twice:

  • first to have them re-written by the conversion code,
  • then to have them cleanly written by the normal save code.

The conversion is partial, because:

  • As indicated in b4f513/git, only subclasses of WindowT are converted (so only three GUIs are affected).
  • It doesn't work: The scripts in the related _main.cgui files must now be fixed.

References #125.

comment:57 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In d4a665c50abd4f3659cdcaf5f76e67391737617f/git:

DeathMatch GUIs: Fix the GUIs that were converted in the previous revision.

Adapting the "main" GUI scripts to the new component system requires a lot of
manual work that unfortunately cannot be schematicized or be done automatically.

References #125.

comment:58 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In 5d551d8d28ad9d02cdc0272331f001640e78819e/git:

GuiSys: Override the set() script method for ComponentChoiceTs.

The override allows choices to "auto-sync" (update the text in the related
text component) whenever one of its parameters is changed.
(This change is required to complete the previous revision.)

References #125.

comment:59 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In 6b11dfec397ba2530f95f14f3121f58499169d2f/git:

GuiSys: In ComponentImageT, if no material is given, use the GUI default material.

References #125.

comment:60 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In b2529af157fa777d02bdea8370b495dee07f36bd/git:

GuiSys: Add support for interpolating component variables over time.

References #125.

comment:61 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In 0fa6de47b0f5062cf3f5513e90b7a0314f3a2edf/git:

GuiSys: Augment ComponentTransformT so that it can overtake the transform data from WindowT.

References #125.

comment:62 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In caec74a8389ba283ef037aff2f5b0760fae8516f/git:

GUI Editor: Convert attributes of WindowT to components when a GUI file is saved.

This change complements b4f513/git of 2013-02-22.
With it, quasi all our "old" window features are converted to components.

References #125.

comment:63 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In a018dc77c985a83f960c5bb90da452117cb45c6a/git:

DeathMatch GUIs: (partially) convert GUIs to component system, covering WindowT attributes.

This change continues the conversion begun in 41adfa/git of 2013-02-25.

Using the code introduced in caec74/git on 2013-03-08, continue converting the GUIs to the new component system, now covering the attributes of class WindowT.

This was done by loading and saving all _init.cgui files twice:

  • first to have them re-written by the conversion code,
  • then to have them cleanly written by the normal save code.

The conversion is partial, because:

  • Now also the attributes of WindowT are converted, but the window rectangles are still written in the old way, too, in order to ease the upcoming transition in the code.
  • It doesn't work: The scripts in the related _main.cgui files must now be fixed, especially interpolations.

References #125.

comment:64 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In 23e1ff099d7add5036abdc788ddc65e0c95a994f/git:

DeathMatch GUIs: Remove empty "Image" components.

The previous conversion steps introduced some "Image" components with an alpha
value of zero. These components cause no harm, but are leftover artifacts that
we clean-up in this revision.

References #125.

comment:65 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In 0f3d841e4c5c60c0ac9e05570a06adb641b674ef/git:

GuiSys: Remove now obsolete subclasses of WindowT.

The subclasses of WindowT have long been obsoleted by the new components.
This change finally removes them.

References #125.

comment:66 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In 9913a9752554fd72d7ef8a903aa762dc6fe68f64/git:

GuiSys: Make the special variable classes of "Text" components publicly accessible.

References #125.

comment:67 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In 19d7e14280a76adcda70b150b71c4dccee50b23a/git:

GuiSys: Add auxiliary methods to "Text" and "Image" components that make access to their data easier.

References #125.

comment:68 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In 21629c9954ea8cb443401ec22eaec76e60d1ba21/git:

GuiSys: Fix the ConsoleByWindowT implementation to use its "Text" component rather than the obsolete "Text" attribute of the window.

References #125.

comment:69 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In 3e2e855b8631569c8104dbcf60eefe38e39341f0/git:

GuiSys: Remove now obsolete attributes of WindowT.

The attributes of WindowT have long been obsoleted by the new components.
This change finally removes them.

References #125.

comment:70 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In 5a026c145f6626010c708061bc1259497d1f777f/git:

GuiSys: In the WindowT interface, make "transform" and other remaining attributes "private".

References #125.

comment:71 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In ba4742386be8bcf0ac0a0b2923570adc60e34ee6/git:

GuiSys: Prepare ComponentTransformT for removal.

We no longer save "Transform" components to .cgui files, because "transform"
data should and will be in the future inherent attributes of the WindowT
class itself.

References #125.

comment:72 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In a2afbaf4663c6526525c15693919d2903e78e090/git:

GuiSys: Remove ComponentTransformT.

References #125.

comment:73 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In b249591cafd4d6d707a12ef7bcd56ea1603f0743/git:

GuiSys: Re-introduce the "Transform" component for replacing the former WindowT transform data.

References #125.

comment:74 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In 4f4efcc7a85cce03580a03a9a754ed7be167936b/git:

GUI Editor: Save window transform data in "Transform" component style.

Beforehand it was saved in self:set("rect", ...) style, which is now obsolete.

References #125.

comment:75 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In e2b917deaa1e56c4bf556959190f9e02f4beecf2/git:

GUI Editor: Show "Transform" component in "Window Inspector" like any other component; remove former custom code.

References #125.

comment:76 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In 029a02413f79903dbb0616d8df13a80ebeaedd0c/git:

GUI Editor: Use the generic CommandSetCompVarT in place of the obsolete "rotate", "scale" and "translate" commands.

References #125.

comment:77 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In f83a097307d4014d0885fca6399d646fe74b98e8/git:

Add support for cf::TypeSys::VarT<> variables of type bool.

References #125.

comment:78 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In 5d0f3478bda2fbf7971678fde08960041b2a8cef/git:

GuiSys: Add new component ComponentBasicsT.

References #125.

comment:79 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In fbda2c5b2e57bf11bdc0e14f8370b0f798975949/git:

GuiSys: Use the new ComponentBasicsT for replacing the former WindowT basics data.

References #125.

comment:80 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In ad114b73e581b028b843d6e38408963905b7afd9/git:

GuiSys: Remove old cruft from WindowT class that is finally no longer needed.

... thanks to the component system. :-)

References #125.

comment:81 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In c3220777bb00bca0cf7762b262c035c535622741/git:

GuiSys: Fix writing of cf::TypeSys::VarT variables to Lua code for strings that start with a newline.

References #125.

comment:82 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In a9ad276f05cc48298271206036382087db0d6930/git:

Fix Linux/GCC compilation issues.

References #125.

comment:83 Changed 20 months ago by Carsten Fuchs <carsten.fuchs@…>

In daa208143dbe5ef831c30f8ceb8fbae21d775b1f/git:

GUI Editor: Properly handle cf::TypeSys::VarT<>s that "clean" values in their Set() method.

When the user enters a new value in the "Window Inspector", eventually code like

    Var.Set(Event.GetValue());

is called. Note that if Var is of a type derived from cf::TypeSys::VarT<>, the Set() method may well set Var to a value that is different from Event.GetValue().

This change makes sure that the property in the "Window Inspector" reflects the actual value of Var.

References #125.

comment:84 Changed 19 months ago by Carsten Fuchs <carsten.fuchs@…>

In d084ae75ba9e08d0d7f18846a12558b13a4b24fe/git:

GuiSys: Fix interpolation of cf::TypeSys::VarT<>s.

References #125.

comment:85 Changed 19 months ago by Carsten Fuchs <carsten.fuchs@…>

In 56fc156485584dc1ee478c4d4b03d213e8c80a46/git:

DeathMatch GUIs: Fix _main.cgui scripts.

After the recent switch to the component system, updating the _main.cgui scripts was overdue.

References #125.

comment:86 Changed 19 months ago by Carsten Fuchs <carsten.fuchs@…>

In da3fe78a3fc6eb34e353c1996af2bfc5cd634a87/git:

GuiSys: Flag the "Basics" and "Transform" components as "fundamental".

Fundamental components are explicit C++ members of class WindowT.
Users cannot delete them in the GUI Editor or via script, and cannot add new
ones in the GUI Editor. (It is possible to add additional ones via script,
but not useful.)
Note that most components are not fundamental, but "custom":
Users can freely add or delete them in the GUI Editor or via scripts.

References #125.

comment:87 Changed 19 months ago by Carsten Fuchs <carsten.fuchs@…>

In 09918933adccf7ede93b8088985f8debc2981298/git:

GuiSys: In ComponentTextT, handle "Text" as a long string property, and have the "(Font-)Name" property enumerate the available fonts.

This generically fixes cases where for variables of type string a list of choices is available.

References #125.

comment:88 Changed 19 months ago by Carsten Fuchs <carsten.fuchs@…>

In 8ac1db562c7d89dd8fa599d6319ff9af14f6e2d4/git:

GuiSys: In ComponentTextT, rename property "Name" to "Font".

"Name" actually meant "Font name", so the new label "Font" is more intuitive and descriptive.

The bulk work of updating the _init.cgui files was accomplished by temporarily applying this simple patch, with which the files were opened and re-saved in CaWE:

  • Libs/GuiSys/CompBase.cpp

    diff --git a/Libs/GuiSys/CompBase.cpp b/Libs/GuiSys/CompBase.cpp
    index 4151dd5..1b8c0ec 100644
    a b int ComponentBaseT::Set(lua_State* LuaState) 
    207207    VarVisitorSetFromLuaT         SetFromLua(LuaState); 
    208208    IntrusivePtrT<ComponentBaseT> Comp    = Binder.GetCheckedObjectParam< IntrusivePtrT<ComponentBaseT> >(1); 
    209209    const char*                   VarName = luaL_checkstring(LuaState, 2); 
     210 
     211    if (strcmp(Comp->GetName(), "Text") == 0 && strcmp(VarName, "Name") == 0) 
     212        VarName = "Font"; 
     213 
    210214    cf::TypeSys::VarBaseT*        Var     = Comp->m_MemberVars.Find(VarName); 
    211215 
    212216    if (!Var) 

References #125.

comment:89 Changed 19 months ago by Carsten Fuchs <carsten.fuchs@…>

In f34bbdd528b33eb30b8ca66fba20fe7a814f9e6e/git:

GuiSys: Revise WindowT::Render() to handle components and children uniformly.

References #125.

comment:90 Changed 19 months ago by Carsten Fuchs <carsten.fuchs@…>

In 649586efc4c9e56778b7d9624998580153012aa8/git:

DeathMatch GUIs: Revise GUIs, fix the remaining conversion artifacts.

After the multi-step conversion of the GUIs to the new component system, the components were converted properly, but not always in the order that produced the same visual result as before.
More precisely, some "Image" components that were intended as background images were too early in the order and thus rendered too late, so that they covered the background and unintentionally the text as well. This change brings such components in proper order.

Also, the old system did not have a "padding" feature for the rendered text, and had to compensate this lack with cleverly inserted space characters or offset window positions. This change also removes the old compensations and sets proper "padding" instead.

References #125.

comment:91 Changed 19 months ago by Carsten Fuchs <carsten.fuchs@…>

In 81e30c9a45f57c06368c9b9af6881d6377300322/git:

GuiSys: Augment WindowT so that it can hold an application-specific component.

The WindowT holds the new application component very much like the "Basics" and "Transform" components, but knows next to nothing about it (except that it is derived from ComponentBaseT).
The application component can be set by the application, and is in fact intended for the sole use by the application. For example, the GUI Editor could use it to implement a "selection gizmo".

References #125.

comment:92 Changed 19 months ago by Carsten Fuchs <carsten.fuchs@…>

In ad25262ed68535723c0c64391a8c8f58203f571a/git:

GUI Editor: Introduce ComponentSelectionT as an example for an application component and as a replacement for the old EditorWindowT class.

References #125.

comment:93 Changed 19 months ago by Carsten Fuchs <carsten.fuchs@…>

In 5911447ce9ddc9db559fb7c961e0bcf38545e0fd/git:

GUI Editor: Employ ComponentSelectionT as a replacement for the old EditorWindowT class.

EditorWindowT was derived from WindowT::ExtDataT, which has become unused and thus removed as well.

This change also contains a few miscellaneous fixes.

References #125.

comment:94 Changed 19 months ago by Carsten Fuchs <carsten.fuchs@…>

  • Owner set to Carsten Fuchs <carsten.fuchs@…>
  • Resolution set to fixed
  • Status changed from new to closed

In 627688cf8394543a5c2978da238b1f9530dfb169/git:

Merge branch 'gui-component-system'.

Although we're far from done with "component systems" in general, both the
'gui-component-system' branch as well as the related ticket #125 have well
served their purpose:
The successful introduction of a component system for our GUI windows.

The introduction was a complete success, and we're *very* pleased with the
results.

Future work will address:

  • the use of a component system also for game entities,
  • extra features like "Prefabs",
  • scripting documentation,
  • ...

Closes #125.

Note: See TracTickets for help on using tickets.