Gamedev Framework (gf)
1.2.0
A C++17 framework for 2D games
include
gf
Segue.h
1
/*
2
* Gamedev Framework (gf)
3
* Copyright (C) 2016-2022 Julien Bernard
4
*
5
* This software is provided 'as-is', without any express or implied
6
* warranty. In no event will the authors be held liable for any damages
7
* arising from the use of this software.
8
*
9
* Permission is granted to anyone to use this software for any purpose,
10
* including commercial applications, and to alter it and redistribute it
11
* freely, subject to the following restrictions:
12
*
13
* 1. The origin of this software must not be misrepresented; you must not
14
* claim that you wrote the original software. If you use this software
15
* in a product, an acknowledgment in the product documentation would be
16
* appreciated but is not required.
17
* 2. Altered source versions must be plainly marked as such, and must not be
18
* misrepresented as being the original software.
19
* 3. This notice may not be removed or altered from any source distribution.
20
*/
21
#ifndef GF_SEGUE_H
22
#define GF_SEGUE_H
23
24
#include "Drawable.h"
25
#include "Easings.h"
26
#include "GraphicsApi.h"
27
#include "Rect.h"
28
#include "Time.h"
29
#include "Vertex.h"
30
31
namespace
gf
{
32
#ifndef DOXYGEN_SHOULD_SKIP_THIS
33
inline
namespace
v1 {
34
#endif
35
36
class
SegueEffect;
37
class
Texture
;
38
45
class
GF_GRAPHICS_API
Segue
:
public
Drawable
{
46
public
:
50
Segue
();
51
57
void
start
(
Time
time);
58
62
void
stop
();
63
69
void
update
(
Time
time);
70
76
bool
isActive
() {
77
return
m_currentTime < m_totalTime;
78
}
79
86
void
setTextures
(
const
Texture
& texture0,
const
Texture
& texture1);
87
93
void
setEffect
(
SegueEffect
& effect) {
94
m_effect = &effect;
95
}
96
102
void
setEasing
(
Easing
easing) {
103
m_easing = easing;
104
}
105
106
virtual
void
draw
(
RenderTarget
& target,
const
RenderStates
& states)
override
;
107
108
private
:
109
void
updatePositions();
110
void
updateTexCoords();
111
112
private
:
113
const
Texture
*m_texture0;
114
const
Texture
*m_texture1;
115
RectF
m_textureRect;
116
SegueEffect
*m_effect;
117
Easing
m_easing;
118
Vertex
m_vertices[4];
119
120
Time
m_totalTime;
121
Time
m_currentTime;
122
};
123
124
#ifndef DOXYGEN_SHOULD_SKIP_THIS
125
}
126
#endif
127
}
128
129
#endif
// GF_SEGUE_H
gf::Drawable
Abstract base class for objects that can be drawn to a render window.
Definition:
Drawable.h:57
gf::RenderTarget
Base class for all render targets (window, texture, ...)
Definition:
RenderTarget.h:102
gf::SegueEffect
A segue effect.
Definition:
SegueEffect.h:38
gf::Segue
A transition between two scenes.
Definition:
Segue.h:45
gf::Segue::Segue
Segue()
Contructor.
gf::Segue::start
void start(Time time)
Start the segue for a specified time.
gf::Segue::update
void update(Time time)
Update the segue.
gf::Segue::isActive
bool isActive()
Tell if the segue is still active.
Definition:
Segue.h:76
gf::Segue::stop
void stop()
Stop the segue.
gf::Segue::setEasing
void setEasing(Easing easing)
Set the easing for the segue.
Definition:
Segue.h:102
gf::Segue::draw
virtual void draw(RenderTarget &target, const RenderStates &states) override
Draw the object to a render target.
gf::Segue::setTextures
void setTextures(const Texture &texture0, const Texture &texture1)
Set the two texture for the segue.
gf::Segue::setEffect
void setEffect(SegueEffect &effect)
Set the effect to apply.
Definition:
Segue.h:93
gf::Texture
A texture for colored images.
Definition:
Texture.h:313
gf::Time
Represents a time value.
Definition:
Time.h:65
gf::Easing
float(*)(float) Easing
An easing function.
Definition:
Easings.h:48
gf::GraphicsTag::Texture
@ Texture
A GPU texture.
gf
The namespace for gf classes.
gf::Rect< float >
gf::RenderStates
Define the states used for drawing to a RenderTarget.
Definition:
RenderStates.h:82
gf::Vertex
A point associated with a color and a texture coordinate.
Definition:
Vertex.h:75
Generated by
1.9.4