-
Notifications
You must be signed in to change notification settings - Fork 0
/
UpdateList.h
executable file
·71 lines (58 loc) · 1.84 KB
/
UpdateList.h
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
#pragma once
#include <string>
#include <vector>
#include <deque>
#include <bitset>
#include <atomic>
#include <unordered_map>
#include <exception>
#include <thread>
#include <chrono>
#include "Node.h"
/*
* Created by Stuart Irwin on 4/13/2019.
* Manages list of nodes through update cycle
*/
class UpdateList {
private:
//Node management
static Node *screen[MAXLAYER];
static std::bitset<MAXLAYER> staticLayers;
static std::bitset<MAXLAYER> pausedLayers;
static std::vector<Node *> deleted;
//Window event system
static std::atomic_int event_count;
static std::deque<sf::Event> event_queue;
static std::unordered_map<sf::Event::EventType, std::vector<Node *>> listeners;
//Display variables
static Node *camera;
static sf::View viewPlayer;
static WindowSize windowSize;
static std::bitset<MAXLAYER> hiddenLayers;
static Layer max;
static bool running;
//Update loops
static void update(double time);
static void draw(sf::RenderWindow &window);
static void renderingThread(std::string title);
public:
//Manage node lists
static void addNode(Node *next);
static Node *getNode(Layer layer);
static void clearLayer(Layer layer);
static void addListener(Node *item, sf::Event::EventType type);
//Special node features
static Node *setCamera(Node *follow, sf::Vector2f size, sf::Vector2f position=sf::Vector2f(0,0));
static void sendSignal(Layer layer, int id, Node *sender);
static void sendSignal(int id, Node *sender);
//Layer control features
static void staticLayer(Layer layer, bool _static=true);
static void pauseLayer(Layer layer, bool pause=true);
static void hideLayer(Layer layer, bool hidden=true);
//Utility Functions
static void loadTexture(sf::Texture *texture, std::string filename);
static sf::Texture *getTexture(int index);
//Start engine
static void startEngine(std::string title);
static void stopEngine();
};