Crazy Eddies GUI System: CEGUIAnimationInstance.h Source File

Crazy Eddies GUI System 0.7.6

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

CEGUIAnimationInstance.h

    00001 /***********************************************************************
    00002     filename:   CEGUIAnimationInstance.h
    00003     created:    7/8/2010
    00004     author:     Martin Preisler
    00005
    00006     purpose:    Defines the interface for the AnimationInstance class
    00007 *************************************************************************/
    00008 /***************************************************************************
    00009  *   Copyright (C) 2004 - 2010 Paul D Turner & The CEGUI Development Team
    00010  *
    00011  *   Permission is hereby granted, free of charge, to any person obtaining
    00012  *   a copy of this software and associated documentation files (the
    00013  *   "Software"), to deal in the Software without restriction, including
    00014  *   without limitation the rights to use, copy, modify, merge, publish,
    00015  *   distribute, sublicense, and/or sell copies of the Software, and to
    00016  *   permit persons to whom the Software is furnished to do so, subject to
    00017  *   the following conditions:
    00018  *
    00019  *   The above copyright notice and this permission notice shall be
    00020  *   included in all copies or substantial portions of the Software.
    00021  *
    00022  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    00023  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    00024  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
    00025  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
    00026  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
    00027  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
    00028  *   OTHER DEALINGS IN THE SOFTWARE.
    00029  ***************************************************************************/
    00030 #ifndef _CEGUIAnimationInstance_h_
    00031 #define _CEGUIAnimationInstance_h_
    00032
    00033 #include "CEGUIEventArgs.h"
    00034 #include "CEGUIEvent.h"
    00035 #include <map>
    00036 #include <vector>
    00037
    00038 #if defined(_MSC_VER)
    00039 #   pragma warning(push)
    00040 #   pragma warning(disable : 4251)
    00041 #endif
    00042
    00043 // Start of CEGUI namespace section
    00044 namespace CEGUI
    00045 {
    00046
    00052 class CEGUIEXPORT AnimationEventArgs : public EventArgs
    00053 {
    00054 public:
    00055     AnimationEventArgs(AnimationInstance* inst) : instance(inst) {}
    00057     AnimationInstance* instance;
    00058 };
    00059
    00074 class CEGUIEXPORT AnimationInstance
    00075 {
    00076 public:
    00079     static const String EventNamespace;
    00080
    00082     static const String EventAnimationStarted;
    00084     static const String EventAnimationStopped;
    00086     static const String EventAnimationPaused;
    00088     static const String EventAnimationUnpaused;
    00090     static const String EventAnimationEnded;
    00092     static const String EventAnimationLooped;
    00093
    00095     AnimationInstance(Animation* definition);
    00096
    00100     ~AnimationInstance(void);
    00101
    00106     Animation* getDefinition() const;
    00107
    00113     void setTarget(PropertySet* target);
    00114
    00119     PropertySet* getTarget() const;
    00120
    00127     void setEventReceiver(EventSet* receiver);
    00128
    00133     EventSet* getEventReceiver() const;
    00134
    00141     void setEventSender(EventSet* sender);
    00142
    00147     EventSet* getEventSender() const;
    00148
    00154     void setTargetWindow(Window* target);
    00155
    00161     void setPosition(float position);
    00162
    00167     float getPosition() const;
    00168
    00174     void setSpeed(float speed);
    00175
    00180     float getSpeed() const;
    00181
    00186     void setSkipNextStep(bool skip);
    00187
    00196     bool getSkipNextStep() const;
    00197
    00213     void setMaxStepDeltaSkip(float maxDelta);
    00214
    00219     float getMaxStepDeltaSkip() const;
    00220
    00234     void setMaxStepDeltaClamp(float maxDelta);
    00235
    00240     float getMaxStepDeltaClamp() const;
    00241
    00252     void start(bool skipNextStep = true);
    00253
    00258     void stop();
    00259
    00264     void pause();
    00265
    00273     void unpause(bool skipNextStep = true);
    00274
    00283     void togglePause(bool skipNextStep = true);
    00284
    00290     bool isRunning() const;
    00291
    00296     void step(float delta);
    00297
    00302     bool handleStart(const CEGUI::EventArgs& e);
    00303
    00308     bool handleStop(const CEGUI::EventArgs& e);
    00309
    00314     bool handlePause(const CEGUI::EventArgs& e);
    00315
    00320     bool handleUnpause(const CEGUI::EventArgs& e);
    00321
    00326     bool handleTogglePause(const CEGUI::EventArgs& e);
    00327
    00332     void savePropertyValue(const String& propertyName);
    00333
    00337     void purgeSavedPropertyValues(void);
    00338
    00342     const String& getSavedPropertyValue(const String& propertyName);
    00343
    00351     void addAutoConnection(Event::Connection conn);
    00352
    00360     void unsubscribeAutoConnections();
    00361
    00362 private:
    00364     void apply();
    00365
    00367     void onAnimationStarted();
    00369     void onAnimationStopped();
    00371     void onAnimationPaused();
    00373     void onAnimationUnpaused();
    00374
    00376     void onAnimationEnded();
    00378     void onAnimationLooped();
    00379
    00381     Animation* d_definition;
    00382
    00384     PropertySet* d_target;
    00386     EventSet* d_eventReceiver;
    00390     EventSet* d_eventSender;
    00391
    00396     float d_position;
    00398     float d_speed;
    00400     bool d_bounceBackwards;
    00402     bool d_running;
    00404     bool d_skipNextStep;
    00406     float d_maxStepDeltaSkip;
    00408     float d_maxStepDeltaClamp;
    00409
    00410     typedef std::map<String, String> PropertyValueMap;
    00414     PropertyValueMap d_savedPropertyValues;
    00415
    00416     typedef std::vector<Event::Connection> ConnectionTracker;
    00418     ConnectionTracker d_autoConnections;
    00419 };
    00420
    00421 } // End of  CEGUI namespace section
    00422
    00423 #if defined(_MSC_VER)
    00424 #   pragma warning(pop)
    00425 #endif
    00426
    00427 #endif  // end of guard _CEGUIAnimationInstance_h_
    00428