sabato 12 dicembre 2015

Day 97: GUIObject and scenes improvements

Today I continued to improve the scene management system.

To really test it under the worst conditions I decided to convert the complex scene I used in the last weeks/months to the new pointer system. Thankfully I tought of looking a little into operator overloading, and it turns out that overriding the "=" operator it is possible to assign pointers to smart pointers, making the interface to them identical to normal pointers.

So the conversion of the scene went quite smoothly for the most part, however:

- The emitters were a little problematic during destruction, because the particles didn't go away,but thanks to the smart pointers i fixed that

- The Text and Sprite classes were not going away, because they are not component of a GameObject. So I created a GUIObject, which is an aggregator of components exaclty like the GameObject, but for the GUI. It is not perfect and badly integrated, and should be refactored if the GUI will be expanded, but for now it does its job.

So, now everything is working, but I've not checked yet if there is some leaking of memory, or if the destructors of the various managers are doing exaclty their job. Tomorrow I'll check that with some memory profiler, and the next step is the introduction of custom allocators.

In the picture on the left the "big" scene, on the right the "little" scene created after the "big" one, and with no traces of objects from it.


Nessun commento:

Posta un commento