forked from dgcor/DGEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFadeInOut.h
More file actions
executable file
·32 lines (26 loc) · 760 Bytes
/
Copy pathFadeInOut.h
File metadata and controls
executable file
·32 lines (26 loc) · 760 Bytes
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
#pragma once
#include "Actions/Action.h"
#include <memory>
#include "SFML/Graphics/Color.hpp"
#include "Utils/ElapsedTime.h"
// fade out - hide
// fade in - show
class FadeInOut
{
private:
sf::Color color{ sf::Color::Transparent };
bool isFadeOut{ false };
bool enableInput{ false };
uint8_t fadeOffset{ 0 };
ElapsedTime elapsedTime;
std::shared_ptr<Action> action;
bool running{ false };
bool updateEnableInput{ false };
void UpdateFade() noexcept;
bool HasFadeEnded() noexcept;
public:
const sf::Color& getColor() const noexcept { return color; }
void Reset(sf::Color color_, bool isFadeOut_, bool enableInput_, uint8_t fadeOffset_,
const sf::Time& timeout_, const std::shared_ptr<Action>& action_);
void update(Game& game) noexcept;
};