1 /* 2 * Copyright (c) 2009-2012 jMonkeyEngine 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: 8 * 9 * * Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 12 * * Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * * Neither the name of 'jMonkeyEngine' nor the names of its contributors 17 * may be used to endorse or promote products derived from this software 18 * without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 */ 32 package com.jme3.cinematic.events; 33 34 import com.jme3.animation.LoopMode; 35 import com.jme3.app.Application; 36 import com.jme3.cinematic.Cinematic; 37 import com.jme3.cinematic.PlayState; 38 import com.jme3.export.Savable; 39 40 /** 41 * 42 * @author Nehon 43 */ 44 public interface CinematicEvent extends Savable { 45 46 /** 47 * Starts the animation 48 */ play()49 public void play(); 50 51 /** 52 * Stops the animation 53 */ stop()54 public void stop(); 55 56 /** 57 * Pauses the animation 58 */ pause()59 public void pause(); 60 61 /** 62 * Returns the actual duration of the animation 63 * @return the duration 64 */ getDuration()65 public float getDuration(); 66 67 /** 68 * Sets the speed of the animation (1 is normal speed, 2 is twice faster) 69 * @param speed 70 */ setSpeed(float speed)71 public void setSpeed(float speed); 72 73 /** 74 * returns the speed of the animation 75 * @return the speed 76 */ getSpeed()77 public float getSpeed(); 78 79 /** 80 * returns the PlayState of the animation 81 * @return the plat state 82 */ getPlayState()83 public PlayState getPlayState(); 84 85 /** 86 * @param loop Set the loop mode for the channel. The loop mode 87 * determines what will happen to the animation once it finishes 88 * playing. 89 * 90 * For more information, see the LoopMode enum class. 91 * @see LoopMode 92 */ setLoopMode(LoopMode loop)93 public void setLoopMode(LoopMode loop); 94 95 /** 96 * @return The loop mode currently set for the animation. The loop mode 97 * determines what will happen to the animation once it finishes 98 * playing. 99 * 100 * For more information, see the LoopMode enum class. 101 * @see LoopMode 102 */ getLoopMode()103 public LoopMode getLoopMode(); 104 105 /** 106 * returns the initial duration of the animation at speed = 1 in seconds. 107 * @return the initial duration 108 */ getInitialDuration()109 public float getInitialDuration(); 110 111 /** 112 * Sets the duration of the antionamtion at speed = 1 in seconds 113 * @param initialDuration 114 */ setInitialDuration(float initialDuration)115 public void setInitialDuration(float initialDuration); 116 117 /** 118 * called internally in the update method, place here anything you want to run in the update loop 119 * @param tpf time per frame 120 */ internalUpdate(float tpf)121 public void internalUpdate(float tpf); 122 123 /** 124 * initialize this event 125 * @param app the application 126 * @param cinematic the cinematic 127 */ initEvent(Application app, Cinematic cinematic)128 public void initEvent(Application app, Cinematic cinematic); 129 130 /** 131 * When this method is invoked, the event should fast forward to the given time according tim 0 is the start of the event. 132 * @param time the time to fast forward to 133 */ setTime(float time)134 public void setTime(float time); 135 136 /** 137 * returns the current time of the cinematic event 138 * @return the time 139 */ getTime()140 public float getTime(); 141 142 143 } 144