aboutsummaryrefslogtreecommitdiff
path: root/src/master/master.hpp
blob: 8ccb7402a58c8507ad1ead33c4c8c7c2deb4340b (plain) (blame)
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
#ifndef MASTER_H
#define MASTER_H
#include "smelt.hpp"
#include "smdatapack.hpp"
#include "smmath.hpp"
#include "smentity.hpp"
#include "smanim.hpp"
#include <thread>
#include <chrono>
struct pn{int p,n;};
class scenePrototype
{
public:
	virtual bool sceneUpdate(){return false;}
	virtual bool sceneRender(){return false;}
	virtual bool threadUpdate(){return false;}
	virtual ~scenePrototype(){}
};
class sceneManager
{
private:
	scenePrototype *sps[256];
	static SMELT* sm;
	static std::thread* uth;
	char names[256][16];
	bool active[256],thactive;
	int scnt,dlps,lp,utime;
	float lps,lpsud;
	pn pq[256];
public:
	sceneManager();
	~sceneManager();
	int registerScene(scenePrototype *sp,const char* scenename,int priority);
	void activateScene(const char* scene);
	void deactivateScene(const char* scene);
	void startUpdate();
	void stopUpdate();
	bool isThreadActive();
	int getSceneID(const char* scene);
	bool isSceneActive(int sceneid);
	void setLPS(int lps);
	float getLPS();
	int getTHUpdateTime();
	bool update();
	void threadUpdate();
};

class introScene:public scenePrototype
{
private:
	char* ssptr;DWORD sssez;
	smvec2d *pos,*vel,*acc;
	float *scale,delay;
	smEntity2D *blt;
	int bcnt,step,ch;
	static SMELT *sm;
public:
	introScene();
	~introScene();
	void introInit();
	bool sceneUpdate()override;
	bool sceneRender()override;
};
#endif