guiTickCtrl.h

Engine/source/gui/shiny/guiTickCtrl.h

More...

Classes:

class

This Gui Control is designed to be subclassed to let people create controls which want to receive update ticks at a constant interval.

Detailed Description

 1
 2//-----------------------------------------------------------------------------
 3// Copyright (c) 2012 GarageGames, LLC
 4//
 5// Permission is hereby granted, free of charge, to any person obtaining a copy
 6// of this software and associated documentation files (the "Software"), to
 7// deal in the Software without restriction, including without limitation the
 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 9// sell copies of the Software, and to permit persons to whom the Software is
10// furnished to do so, subject to the following conditions:
11//
12// The above copyright notice and this permission notice shall be included in
13// all copies or substantial portions of the Software.
14//
15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21// IN THE SOFTWARE.
22//-----------------------------------------------------------------------------
23
24#ifndef _GUITICKCTRL_H_
25#define _GUITICKCTRL_H_
26
27#include "gui/core/guiControl.h"
28#include "core/iTickable.h"
29
30/// This Gui Control is designed to be subclassed to let people create controls
31/// which want to receive update ticks at a constant interval. This class was
32/// created to be the Parent class of a control which used a DynamicTexture
33/// along with a VectorField to create warping effects much like the ones found
34/// in visualization displays for iTunes or Winamp. Those displays are updated
35/// at the framerate frequency. This works fine for those effects, however for
36/// an application of the same type of effects for things like Gui transitions
37/// the framerate-driven update frequency is not desirable because it does not
38/// allow the developer to be able to have any idea of a consistent user-experience.
39///
40/// Enter the ITickable interface. This lets the Gui control, in this case, update
41/// the dynamic texture at a constant rate of once per tick, even though it gets
42/// rendered every frame, thus creating a framerate-independent update frequency
43/// so that the effects are at a consistent speed regardless of the specifics
44/// of the system the user is on. This means that the screen-transitions will
45/// occur in the same time on a machine getting 300fps in the Gui shell as a
46/// machine which gets 150fps in the Gui shell.
47/// @see ITickable
48class GuiTickCtrl : public GuiControl, public virtual ITickable
49{
50   typedef GuiControl Parent;
51
52private:
53
54protected:
55
56   // So this can be instantiated and not be a pure virtual class
57   virtual void interpolateTick( F32 delta ) {};
58   virtual void processTick() {};
59   virtual void advanceTime( F32 timeDelta ) {};
60
61public:
62   DECLARE_CONOBJECT( GuiTickCtrl );
63   DECLARE_CATEGORY( "Gui Other" );
64};
65
66
67#endif
68