Actually, you guys missed my point。。。
I am currently working on a GUI.
and I try to avoid re-render the texture of a GUI in one game frame for multiple times.
For example, when I try to drag the border of a window to resize it, if the onDragTo() function re-create the Texture of the Window on each time of MouseMotionEvent. it would become extremely slow and unnecessary
, what I'm doing is to push a callback of these "slow" function to a list(and do a check to see if a similar callback is already pushed, that even if you call create multiple time, eventually there is only one onCreate() called in a frame), and do these callbacks(create, render, render contains etc.) on each frame of the main loop.
And this bring the problem that, during one frame, the acrually create callback is maybe just pending and have not actually done yet.
for example:
Button* btn = Button::factory.newInstance2(gui);
btn->create(80,25);
btn->backColor.set(Color::Blue);
btn->text.set(L"按钮");
the btn->create(80,25) line did not actually create the texture of the button, so the following code btn->backColor.set(Color::Blue); need not to trigger the render function to render the texture(it would be automatically done when onCreate() called).