/usr/include/cegui-0.8.7/CEGUI/AnimationInstance.h is in libcegui-mk2-dev 0.8.7-1.3+b2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 | /***********************************************************************
created: 7/8/2010
author: Martin Preisler
purpose: Defines the interface for the AnimationInstance class
*************************************************************************/
/***************************************************************************
* Copyright (C) 2004 - 2010 Paul D Turner & The CEGUI Development Team
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
***************************************************************************/
#ifndef _CEGUIAnimationInstance_h_
#define _CEGUIAnimationInstance_h_
#include "CEGUI/EventArgs.h"
#include "CEGUI/Event.h"
#include <map>
#include <vector>
#if defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable : 4251)
#endif
// Start of CEGUI namespace section
namespace CEGUI
{
/*!
\brief
EventArgs based class that holds information about which animation instnace
fired given event.
*/
class CEGUIEXPORT AnimationEventArgs : public EventArgs
{
public:
AnimationEventArgs(AnimationInstance* inst) : instance(inst) {}
//! pointer to a AnimationInstance object of relevance to the event.
AnimationInstance* instance;
};
/*!
\brief
Defines an 'animation instance' class
Animation classes hold definition of the animation. Whilst this class holds
data needed to use the animation definition - target PropertySet, event
receiver, animation position, ...
You have to define animation first and then instantiate it via
AnimationManager::instantiateAnimation
\see
Animation
*/
class CEGUIEXPORT AnimationInstance :
public AllocatedObject<AnimationInstance>
{
public:
//! Namespace for animation instance events
//! these are fired on event receiver, not this animation instance!
static const String EventNamespace;
//! fired when animation instance starts
static const String EventAnimationStarted;
//! fired when animation instance stops
static const String EventAnimationStopped;
//! fired when animation instance pauses
static const String EventAnimationPaused;
//! fired when animation instance unpauses
static const String EventAnimationUnpaused;
//! fired when animation instance ends
static const String EventAnimationEnded;
//! fired when animation instance loops
static const String EventAnimationLooped;
//! internal constructor, please use AnimationManager::instantiateAnimation
AnimationInstance(Animation* definition);
/** internal destructor, please use
* AnimationManager::destroyAnimationInstance
*/
~AnimationInstance(void);
/*!
\brief
Retrieves the animation definition that is used in this instance
*/
Animation* getDefinition() const;
/*!
\brief
Sets the target property set - this class will get it's properties
affected by the Affectors!
*/
void setTarget(PropertySet* target);
/*!
\brief
Retrieves the target property set
*/
PropertySet* getTarget() const;
/*!
\brief
Sets event receiver - this class will receive events when something
happens to the playback of this animation - it starts, stops, pauses,
unpauses, ends and loops
*/
void setEventReceiver(EventSet* receiver);
/*!
\brief
Retrieves the event receiver
*/
EventSet* getEventReceiver() const;
/*!
\brief
Sets event sender - this class will send events and can affect this
animation instance if there are any auto subscriptions defined in the
animation definition
*/
void setEventSender(EventSet* sender);
/*!
\brief
Retrieves the event sender
*/
EventSet* getEventSender() const;
/*!
\brief
Helper method, sets given window as target property set, event receiver
and event set
*/
void setTargetWindow(Window* target);
/*!
\brief
Sets playback position. Has to be higher or equal to 0.0 and lower or
equal to Animation definition's duration.
*/
void setPosition(float position);
/*!
\brief
Retrieves current playback position
*/
float getPosition() const;
/*!
\brief
Sets playback speed - you can speed up / slow down individual instances
of the same animation. 1.0 means normal playback.
*/
void setSpeed(float speed);
/*!
\brief
Retrieves current playback speed
*/
float getSpeed() const;
/*!
\brief
Controls whether the next time step is skipped
*/
void setSkipNextStep(bool skip);
/*!
\brief
Returns true if the next step is *going* to be skipped
\par
If it was skipped already, this returns false as step resets
it to false after it skips one step.
*/
bool getSkipNextStep() const;
/*!
\brief
Sets the max delta before step skipping occurs
\param
maxDelta delta in seconds, if this value is reached, the step is skipped
(use -1.0f if you never want to skip - this is the default)
\par
If you want to ensure your animation is not skipped entirely after layouts
are loaded or other time consuming operations are done, use this method.
For example setMaxStepDeltaSkip(1.0f / 25.0f) ensures that if FPS drops
below 25, the animation just stops progressing and waits till FPS raises.
*/
void setMaxStepDeltaSkip(float maxDelta);
/*!
\brief
Gets the max delta before step skipping occurs
*/
float getMaxStepDeltaSkip() const;
/*!
\brief
Sets the max delta before step clamping occurs
\param
maxDelta delta in seconds, if this value is reached, the step is clamped.
(use -1.0f if you never want to clamp - this is the default)
\par
If you want to ensure the animation steps at most 1.0 / 60.0 seconds at a timem
you should call setMaxStepDeltaClamp(1.0f / 60.0f). This essentially slows
the animation down in case the FPS drops below 60.
*/
void setMaxStepDeltaClamp(float maxDelta);
/*!
\brief
Gets the max delta before step clamping occurs
*/
float getMaxStepDeltaClamp() const;
/*!
\brief
Starts this animation instance - sets position to 0.0 and unpauses
\param
skipNextStep if true the next injected time pulse is skipped
\par
This also causes base values to be purged!
*/
void start(bool skipNextStep = true);
/*!
\brief
Stops this animation instance - sets position to 0.0 and pauses
*/
void stop();
/*!
\brief
Pauses this animation instance - stops it from stepping forward
*/
void pause();
/*!
\brief
Unpauses this animation instance - allows it to step forward again
\param
skipNextStep if true the next injected time pulse is skipped
*/
void unpause(bool skipNextStep = true);
/*!
\brief
Pauses the animation if it's running and unpauses it if it isn't
\param
skipNextStep if true the next injected time pulse is skipped
(only applies when unpausing!)
*/
void togglePause(bool skipNextStep = true);
/*!
\brief
Returns true if this animation instance is currently unpaused,
if it is stepping forward.
*/
bool isRunning() const;
/*!
\brief
Controls whether auto stepping is enabled
\par
If auto stepping is enabled, CEGUI will step this animation instance forward
whenever CEGUI::System::injectTimePulse is called
*/
void setAutoSteppingEnabled(bool enabled);
/*!
\brief
Checks whether auto stepping is enabled
*/
bool isAutoSteppingEnabled() const;
/*!
\brief
Steps the animation forward by the given delta
\par
You don't need to call this unless AutoStepping is disabled (it is enabled by default)
*/
void step(float delta);
/*!
\brief
handler that starts the animation instance
*/
bool handleStart(const CEGUI::EventArgs& e);
/*!
\brief
handler that stops the animation instance
*/
bool handleStop(const CEGUI::EventArgs& e);
/*!
\brief
handler that pauses the animation instance
*/
bool handlePause(const CEGUI::EventArgs& e);
/*!
\brief
handler that unpauses the animation instance
*/
bool handleUnpause(const CEGUI::EventArgs& e);
/*!
\brief
handler that toggles pause on this animation instance
*/
bool handleTogglePause(const CEGUI::EventArgs& e);
/*!
\brief
Internal method, saves given property (called before it's affected)
*/
void savePropertyValue(const String& propertyName);
/** this purges all saved values forcing this class to gather new ones fresh
* from the properties
*/
void purgeSavedPropertyValues(void);
/** retrieves saved value, if it isn't cached already, it retrieves it fresh
* from the properties
*/
const String& getSavedPropertyValue(const String& propertyName);
/*!
\brief
Internal method, adds reference to created auto connection
\par
DO NOT USE THIS DIRECTLY
*/
void addAutoConnection(Event::Connection conn);
/*!
\brief
Internal method, unsubscribes auto connections
\par
DO NOT USE THIS DIRECTLY
*/
void unsubscribeAutoConnections();
/*!
\brief
Applies this animation instance
\par
You should not need to use this directly unless your requirements are very special.
CEGUI calls this automatically in most cases.
*/
void apply();
private:
//! this is called when animation starts
void onAnimationStarted();
//! this is called when animation stops
void onAnimationStopped();
//! this is called when animation pauses
void onAnimationPaused();
//! this is called when animation unpauses
void onAnimationUnpaused();
//! this is called when animation ends
void onAnimationEnded();
//! this is called when animation loops (in RM_Loop or RM_Bounce mode)
void onAnimationLooped();
//! parent Animation definition
Animation* d_definition;
//! target property set, properties of this are affected by Affectors
PropertySet* d_target;
//! event receiver, receives events about this animation instance
EventSet* d_eventReceiver;
/** event sender, sends events and can control this animation instance if
* there are any auto subscriptions
*/
EventSet* d_eventSender;
/** position of this animation instance,
* should always be higher or equal to 0.0 and lower or equal to duration of
* animation definition
*/
float d_position;
//! playback speed, 1.0 means normal playback
float d_speed;
//! needed for RM_Bounce mode, if true, we bounce backwards
bool d_bounceBackwards;
//! true if this animation is unpaused
bool d_running;
//! skip next update (true if the next update should be skipped entirely)
bool d_skipNextStep;
//! skip the update if the step is larger than this value
float d_maxStepDeltaSkip;
//! always clamp step delta to this value
float d_maxStepDeltaClamp;
//! true if auto stepping is enabled
bool d_autoSteppingEnabled;
typedef std::map<String, String, std::less<String>
CEGUI_MAP_ALLOC(String, String)> PropertyValueMap;
/** cached saved values, used for relative application method
* and keyframe property source, see Affector and KeyFrame classes
*/
PropertyValueMap d_savedPropertyValues;
typedef std::vector<Event::Connection
CEGUI_VECTOR_ALLOC(Event::Connection)> ConnectionTracker;
//! tracks auto event connections we make.
ConnectionTracker d_autoConnections;
};
} // End of CEGUI namespace section
#if defined(_MSC_VER)
# pragma warning(pop)
#endif
#endif // end of guard _CEGUIAnimationInstance_h_
|