River Nyxx

A development blog for FFVI3D, the fan-made Final Fantasy VI remake in 3D.

平成20年1月21日月曜日

GUI Rewrite

So I've all but completed my re-write of the GUI system in FFVI3D. I completely reworked how drawing was being handled by the different gui elements, and made the gui skin class act more like it should. Now the gui skin class actually has drawing functions for the fundamental ("primitive" if you will...) drawing aspects of the gui elements, and each element calls the ones it needs.

Additionally, the rectangles for the gui elements used to get recalculated every frame, but since the gui elements in FFVI3D will never change shape dynamically, there's no reason to do that, so I have them calculate them once when they're created. If at some point, I decide to allow them to be changing shape/position dynamically, it won't be hard to implement functions that will recalculate the rectangles at only that time, instead of EVERY frame, which is just wasting CPU cycles.

I completely re-wrote the XML loading algorithm to be not only more effecient, but to work in a cleaner, more appropriate manner, there were some gui elements that I used to stuff with some read-in values, and "init'd" them later, once all of the other elements were loaded (such as the direction map for selecting another gui element via keyboard/mouse wheel), but now I've come up with a way to allow me to link them together linearly so there's no need to "pre-init & init" them anymore. Cleans up the code a lot, and I'm a LOT happier with how it fits together now.

I've also gone thru and replaced all of the gui elements' texture references to instead be pointing at my custom animated texture class instead, meaning that EVERYTHING on the gui can now be animated, including the mouse cursor. For comparison, the only thing that used to be animated was an "overlay" object, which could be anything really, but at the point I had gotten to, that only applied to a flashing "selection bubble" overlaying the currently selected menu item.

Speaking of which, I reworked the animated texture class, so that when you're requesting the current texture, it no longer iterates thru a loop of mathematical calculations, but instead does some simple division/modulo calculations on 1 or 2 lines, once only. Also, no calculations are done at ALL if the animated texture doesn't contain any frames, or only contains 1 frame. Lots of fun little optimizations like that, I've been putting in as I go thru all of my code and rework it. I can really see this already running a lot better on the PSP than it did.

I also started implementing reference counting on my non-Irrlicht classes, using the Irrlicht reference counter class. Nothing major, but it makes for code that's easier to maintain.

Look forward to the last of the GUI reworking, and then various other small things that I haven't gotten around to re-enabling yet... After that, I really don't see much left for the rewriting- so I'll be looking forward to working on new features soon!

0 件のコメント:

コメントを投稿

登録 コメントの投稿 [Atom]

<< ホーム