Announcement

Collapse
No announcement yet.

Visitor message from madgypsy

Collapse

Profile Sidebar

Collapse
Profile Picture
MadGypsy
  • 24
  • 24

  • Visitor message from MadGypsy

    MadGypsy
    MadGypsy posted a Visitor Message for MadGypsy
    CUSTOM CLASSES FROM OBJECTS


    As with anything in this world my method could be better but, it is definitely quite sufficient as it stands. In the image is an object named _Label and it defines some custom properties as they relate to a TextObject. A little bit above that there is a nested object named main_Label and it defines some new properties. What happens with all of this is pretty simple. All of the objects in this class (there are many) get read all the way to their most nested ancestors on startup. Anytime a "main_" is encountered it's corresponding Object is fetched and an overwrite happens BUT the overwrite is not as simple as replace A with B. What actually happens is a copy of _Label is overwritten with any duplicate property of main_Label and any non duplicate property is simply injected into _Label. The results of that are then assigned back to main_Label. So, i guess a shorter way to put that would be to say that the 2 objects are combined with the properties of main_Label taking precedence over the ones of _Label. By using a copy and returning the results to main_Label my original _Label remains untouched for the next main_Label to utilize.

    This method may seem a bit contrived but, to go about this the intended way would have me writing a whole bunch of classes that are barely different from one another. I would be stuck writing "10" slightly different label classes instead of writing NO label classes and instead passing properties to 1 TextObject class. 1 TextObject class that doesn't have to be a label...it can be any imaginable thing that you can do with a text box. The same goes for my GraphicObject and TextFormat classes. All 3 of these classes represent every possible thing they could ever be. It's my object method above that determines more specifically what that thing will be. This is actually illustrated well with the _Input object that is right below the _Label one. 2 sufficiently different text boxes with different behaviors and intentions created with practically no effort at all and both of them are based on the same TextObject.

    Like I said in my last blog post - I made this shit way too easy. There's no challenge. You can practically just make shit up and it will more-than-likely work. For instance, let's pretend you had my system at your fingertips and read nothing at all but had some familiarity with generic text boxes and/or styles. You could absolutely guess your way to your desired results.



    Dutch - did it work? ie..notifying you.
    Last edited by MadGypsy; 07-24-2017, 08:17 PM.

  • Dutch
    commented
    Never got a notification, came here manually. That's kinda lame, what's the point of being able to "@" someone if it doesn't work anytime, anywhere?

    Anyways, your _Label copy trick is actually a concept I've used many a time in QC...storing old vectors for velocities that get updated in a recursive think function, for instance. Pretty neat seeing it work in something other than game logic.

    Edit: looks like your tag did subscribe me, so I can view the thread directly from my profile board, so I guess it works. It just didn't tell me in the notifications that I got subscribed...
    Last edited by Dutch; 07-29-2017, 03:02 AM.
  • Leave a comment:

Working...
X