Hi all,
I'd like to add some nice effects when a window appear...so I need to move and change window dimensions without the user interaction.
For example a "for" cycle in which I smoothly move the window around the screen.
Is it possible?
Moving windows automatically
Moderators: CEGUI MVP, CEGUI Team
Very possible. In my own application I created a class called RoboticWindow. I use this class to create specific effects including the kind of effect that you describe. CEGUI does not have any direct support for this kind of dynamic, but CEGUI provides all the flexibility you need to create a higher level class that performs the dynamic coloring (or more generally texturing), sizing, positioning operations that you might envision.
Really the kind of effect that you describe is easily achieved using setArea along with a timer that allows you to modify the area (which includes both size and position) according to some simple mathematical formula.
Really the kind of effect that you describe is easily achieved using setArea along with a timer that allows you to modify the area (which includes both size and position) according to some simple mathematical formula.
I'm referring to a simple application level timer. For example in my application I have an AppTimerManager that accepts registration requests from multiple AppTimerClients. In my main rendering loop (perhaps 40 or 50 times each second) the AppTimerManager will run through the list of AppTimerClients and invoke an "update" method for each. This gives the client a chance to perform a periodic task.
The way my "RoboticWindow" class works is that each active instance of a RoboticWindow will register as an AppTimerClient. It will then begin to receive "wakeup calls" (40 or 50 times per second) through the "update" method invocation. The RoboticWindow will then perform some "prescribed" dynamic which may include a sizing operation over time (e.g. start at 50x50 pixels and grow to 100x100 pixels in size within 2 seconds), a positoning operation, a "flashing operation", a "fading operation", etc. Once the prescribed operation is complete the RoboticWindow will unregister for timing events .. its job is done. The cegui window is now in its "final resting state". The only "state" information that the RoboticWindow needs to keep track of are "the prescribed action" and "the time since the prescribed operation began". This state information is enough for it to compute the current values for size, position, color, etc with each wakeup call.
The way my "RoboticWindow" class works is that each active instance of a RoboticWindow will register as an AppTimerClient. It will then begin to receive "wakeup calls" (40 or 50 times per second) through the "update" method invocation. The RoboticWindow will then perform some "prescribed" dynamic which may include a sizing operation over time (e.g. start at 50x50 pixels and grow to 100x100 pixels in size within 2 seconds), a positoning operation, a "flashing operation", a "fading operation", etc. Once the prescribed operation is complete the RoboticWindow will unregister for timing events .. its job is done. The cegui window is now in its "final resting state". The only "state" information that the RoboticWindow needs to keep track of are "the prescribed action" and "the time since the prescribed operation began". This state information is enough for it to compute the current values for size, position, color, etc with each wakeup call.
Return to “Modifications / Integrations / Customisations”
Who is online
Users browsing this forum: No registered users and 7 guests