Moving windows automatically

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

SalvoFa
Not too shy to talk
Not too shy to talk
Posts: 29
Joined: Mon Feb 25, 2008 15:25
Location: Italy

Moving windows automatically

Postby SalvoFa » Tue Aug 26, 2008 12:49

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?

daves
Home away from home
Home away from home
Posts: 253
Joined: Thu Feb 02, 2006 20:12

Postby daves » Tue Aug 26, 2008 23:07

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.

SalvoFa
Not too shy to talk
Not too shy to talk
Posts: 29
Joined: Mon Feb 25, 2008 15:25
Location: Italy

Postby SalvoFa » Wed Aug 27, 2008 08:43

Thank you!
Ok for the setArea...but how can I use the timer?
Are there any examples?

daves
Home away from home
Home away from home
Posts: 253
Joined: Thu Feb 02, 2006 20:12

Postby daves » Wed Aug 27, 2008 12:05

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.

SalvoFa
Not too shy to talk
Not too shy to talk
Posts: 29
Joined: Mon Feb 25, 2008 15:25
Location: Italy

Postby SalvoFa » Mon Sep 01, 2008 07:25

Thank you again!
I will search for some example of this timer...it doesn't seem to be hard to implement.


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 8 guests