Even if I dislike Actionscript, I like a few of it's syntax elements as far as I can remember, as well as it's event-based system. Though it's annoying that they made EVERYTHING event-based (you even have to wait for you main sprite (like the screen your drawing on) to appear before you can do anything with it by defining a callback). However, to make my peace with coding As3 (yuck, I still get the creeps when thinking about it), I implement a my version of an event-based system using templates in C++. Like every class of mine, it's tiny in implementation and maximizes the possibilities by beeing as versatile and fundamental as possible. As generic as it is, you can use for all sorts of events, hook it up with a callback and even check if it has an associated callback. Ok, that might be trivially trivial, but it gives me a better understanding about how to image to runs in Actionscript. One thing I love about C++ is that you can make everything as fast as you'd write it directly in one huge, highly optimized block. I can do almost everything with it and it's goin better and better. Recently I finally wrote a generic wrapper for Integer and Float types to get things like resetting the value to their native zero value (0 or 0.0), getting the min/max values, applying mathematical operations via member access and so on. All the neat things you can always need and use through your entire programming life. And the best thing is that there are only a few specializations of it, having essentially one base class for mathematical operations. Cool thing is that you can also use this class to wrap other kinds of user-defined Numbers with defined operators. No idea why anyone would do such a thing, but it would work great, too. Yeah, this is going to be cool thing. I still don't know how to efficiently solve the datatype definition problem for Indices in all my classes, but that should work one day, too. Atleast I'm happy with my event code. The best codes I ever wrote were the smallest ones. Of course, things change and so does my experience with it, but I can't helped - stuff's is elementary useful, almost atomic in design. Why would you split atoms if you won't be able to see the atom's content? You know what's in it.

No comments: