header image
 

GWEN conversion status

C# port of GWEN is going pretty well so far. I’ve got most of the framework classes translated and the project even compiles now. Time to port one of the renderers and see what will fail…

This project also reminded my why I prefer C# over C++ nowadays. It simplifies so many things and memory management is just one of them. Events/messages, basic things like strings/unicode. No header hell. And of course no f**king STL (yes, I loathe the thing). I’ll end with a simple snippet…

void Gwen::Anim::Cancel( Gwen::Controls::Base* control )
{
        Gwen::Anim::Animation::List::iterator iAnimations;
        if ((iAnimations = g_Animations.find(control)) != g_Animations.end())
        {
                Gwen::Anim::Animation::ChildList &ChildAnimationsForControl = iAnimations->second;
                Gwen::Anim::Animation::ChildList::iterator iAnimationChild = ChildAnimationsForControl.begin();
                if (iAnimationChild != ChildAnimationsForControl.end())
                {
                        do
                        {
                                delete (*iAnimationChild);
                        }while(++iAnimationChild != ChildAnimationsForControl.end());
                }
                g_Animations.erase(iAnimations);
        }
}

vs

public static void Cancel(Base control)
{
    if (g_Animations.ContainsKey(control))
    {
        g_Animations[control].Clear();
        g_Animations.Remove(control);
    }
}

~ by omeg on August 5, 2011.

C/C++, C#, code, GUI, gwen.net, rant

Leave a Reply