• 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 
00189     void start();
00190 
00195     void stop();
00196 
00201     void pause();
00202 
00207     void unpause();
00208 
00213     void togglePause();
00214 
00220     bool isRunning() const;
00221 
00226     void step(float delta);
00227 
00232     bool handleStart(const CEGUI::EventArgs& e);
00233 
00238     bool handleStop(const CEGUI::EventArgs& e);
00239 
00244     bool handlePause(const CEGUI::EventArgs& e);
00245 
00250     bool handleUnpause(const CEGUI::EventArgs& e);
00251 
00256     bool handleTogglePause(const CEGUI::EventArgs& e);
00257 
00262     void savePropertyValue(const String& propertyName);
00263 
00267     void purgeSavedPropertyValues(void);
00268 
00272     const String& getSavedPropertyValue(const String& propertyName);
00273 
00281     void addAutoConnection(Event::Connection conn);
00282 
00290     void unsubscribeAutoConnections();
00291 
00292 private:
00294     void apply();
00295 
00297     void onAnimationStarted();
00299     void onAnimationStopped();
00301     void onAnimationPaused();
00303     void onAnimationUnpaused();
00304 
00306     void onAnimationEnded();
00308     void onAnimationLooped();
00309 
00311     Animation* d_definition;
00312 
00314     PropertySet* d_target;
00316     EventSet* d_eventReceiver;
00320     EventSet* d_eventSender;
00321 
00326     float d_position;
00328     float d_speed;
00330     bool d_bounceBackwards;
00332     bool d_running;
00333 
00334     typedef std::map<String, String> PropertyValueMap;
00338     PropertyValueMap d_savedPropertyValues;
00339 
00340     typedef std::vector<Event::Connection> ConnectionTracker;
00342     ConnectionTracker d_autoConnections;
00343 };
00344 
00345 } // End of  CEGUI namespace section
00346 
00347 #if defined(_MSC_VER)
00348 #   pragma warning(pop)
00349 #endif
00350 
00351 #endif  // end of guard _CEGUIAnimationInstance_h_
00352 

Generated on Sat Sep 25 2010 02:10:33 for Crazy Eddies GUI System by  doxygen 1.7.1