_raptorBase - Grisgram/gml-raptor GitHub Wiki

This is the "mother of all objects" in the raptor platform.

As mentioned in raptor's object model, it covers a very powerful feature, I call click-through, and it also is the base for UI Skins.

Let's find out, what this means.
_raptorBase delivers only a handful of variable definitions:

image

log_create_destroy

This boolean is by default disabled and I created it, to allow log output for specific object types, mostly in highly-active and dynamic scenarios, so you can write create- and destroy- events to the log, to track, whether all created objects are correctly destroyed.

It is not meant to log everything. Just turn it on for specific object types, that you want to watch closer, and turn it off again, when you are confident, that's there's no leak going on.

is_enabled (click-through)

You may be familiar with the concept of enabled/disabled controls from web- or desktop-development. Those controls are normally greyed out, when disabled, and don't react on clicks.

raptor takes this concept one step further, you can enable/disable any object, that is a child of _raptorBase! There is a group of #macros available in raptor, which let you react on this (and many other) flags, to decide, whether a mouse-event or any other event shall be processed or not.

Read more about those macros in Utility-and-Helper-#macros.

The UI Subsystem builds upon this feature and enriches it with a GrayScaleShader for disabled controls.

on_enabled_changed

Set this to any function to receive a callback, when the is_enabled state of an object changes.

Note

To ensure, the callback is launched, when you change the is_enabled value, do NOT simply change the bool value in code, instead invoke the method set_enabled(...) on the object! This function checks, whether the state has changed, and if it has, it invokes the callback, if one is set.

skinnable

This is the base setting for one of the most powerful features, raptor has to offer!
You can skin everything in raptor, as long as it is a child object of _raptorBase. Read all about the power of UI Skins, to get most out of raptor!

The function is_topmost(...) in _raptorBase

This function in _raptorBase is another good reason, to use it as base for your objects.

By invoking is_topmost(x,y), you can check any position, whether the object is closest to the user (has the smallest depth), but it does not simply use any of the *_meeting functions alone, it also checks the is_enabled state of all objects at that position and it checks, whether there's a popup open, the layer is visible at all and other things.

Tip

Long story short: This function checks, whether the object is the topmost clickable, reachable, visible and enabled object at this position! And, as if that would not be enough, this check is performed in the room and the UI layer! So, if you get a true return value from this function, you can be sure, it is visible for the user and ready for interaction (from an event point-of-view)


I hope, I could give you good reasons, to use this object as the base object for your game.

Now either head back to raptor's object model, if you didn't finish it yet, or read on in the section about Macros.

⚠️ **GitHub.com Fallback** ⚠️