Commit 83b8e087

add new padding and sizing modes in order to allow for near pixel-perfect widget alignment

This took a while and was fairly frustrating. This is visually a considerably better result, but by no means perfect. It essentially tries to bring the concepts of “relative sizes” and “pixel specified sizes” closer together, but still suffers from some rounding problems. Be that as it may, it’s a clear improvement, as can be seen in this before/after shot:

Commit 87143d09

Add the first semi-working version of the status bar

For the time being this is the most complex widget, the StatusBar.
Next to a text label, one can also set a percentage value, the eponymous status, that it will translate into renderable model data that looks like, well, a status bar.
To make the distinctions between the different widget types work, they can now all return their type, thanks to the introduction of a new WidgetType enum class.
In order to showcase this in action the new status bars are being shown when a ControllableObject is selected, showing the values of health and hunger.
Furthermore, a bit of preliminary game logic is added in order to decrease an object’s food value when it moves. Check out the result:

Commit b430ea76

Add a class that is derived from object which has extra members pertinent to controllable objects. Add names to the dummy objects.

Using the work that was done in the previous commit, we now add some more information to the newly added ControllableObject. For now it primarily just extends the base Object class by a name, hit points (== health) and hunger (== food). The last one being slightly misleading in name.
The two ControllableObjects, now named “Foobert” and “Bart” also get their name rendered in the simulation mode as opposed to just drawing their object id.

Commit 295d0aa6

– Store objects as (unique) pointers internally (so that they can be used in class hierarchy)
– Fix bug that meant that some object types would not rotate properly

In preparation of adding more information to some, but not all, objects the ObjectManager now internally only stores (smart) pointers to objects, not the objects themselves as otherwise we cannot cast them easily to the inherited classes that are going to be introduced, which will add extra attributes to the existing base object class.
The rotation bug was in relation to the refactoring of the ObjectCategory enums and how they were evaluated when calculating an object’s rotation.

Commit a2533447

Make the controllable objects selectable via the UI (by listing them as a default behaviour if nothing is selected)

This brings OLives a lot closer to look something like an actual game, by showing a list of controllable objects (read: “humans”) in the simulation game mode.
Under the bonnet that also forced me to add a convenience function that returns all objects of a certain category, one in the long list of functions that make me scratch my head and wonder “I thought I’d already written something like that”.
Check it out:

Or maybe check it out in motion: