Kiwano Engine v1.3.x
Transition.h
1// Copyright (c) 2016-2018 Kiwano - Nomango
2//
3// Permission is hereby granted, free of charge, to any person obtaining a copy
4// of this software and associated documentation files (the "Software"), to deal
5// in the Software without restriction, including without limitation the rights
6// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7// copies of the Software, and to permit persons to whom the Software is
8// furnished to do so, subject to the following conditions:
9//
10// The above copyright notice and this permission notice shall be included in
11// all copies or substantial portions of the Software.
12//
13// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19// THE SOFTWARE.
20
21#pragma once
22#include <kiwano/2d/Stage.h>
23#include <kiwano/render/Layer.h>
24
25namespace kiwano
26{
27class Director;
28class RenderContext;
29
44class KGE_API Transition : public ObjectBase
45{
46 friend class Director;
47
48public:
49 Transition();
50
51 virtual ~Transition();
52
57 void SetDuration(Duration dt);
58
63 bool IsDone();
64
65protected:
72 virtual void Init(Stage* prev, Stage* next);
73
79 virtual void Update(Duration dt);
80
86 virtual void Render(RenderContext& ctx);
87
92 virtual void Stop();
93
98 virtual void Reset() {}
99
100protected:
101 bool done_;
102 float process_;
103 Duration duration_;
104 Duration delta_;
105 Size window_size_;
106 RefPtr<Stage> out_stage_;
107 RefPtr<Stage> in_stage_;
108 Layer out_layer_;
109 Layer in_layer_;
110};
111
115{
116 duration_ = dt;
117}
118
119} // namespace kiwano
导演
Definition: Director.h:38
图层
Definition: Layer.h:37
基础对象
Definition: ObjectBase.h:138
引用计数智能指针
Definition: RefBasePtr.hpp:35
渲染上下文
Definition: RenderContext.h:62
舞台
Definition: Stage.h:40
舞台过渡动画
Definition: Transition.h:45
void SetDuration(Duration dt)
设置动画时长
Definition: Transition.h:114
virtual void Reset()
重置动画
Definition: Transition.h:98
时间段
Definition: Duration.h:48