-
Notifications
You must be signed in to change notification settings - Fork 1
/
frameFactory.h
37 lines (32 loc) · 1016 Bytes
/
frameFactory.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
#ifndef FRAME_FACTORY
#define FRAME_FACTORY
#include <string>
#include <vector>
#include <map>
#include <limits>
#include "frame.h"
#include "gamedata.h"
class FrameFactory {
public:
static FrameFactory& getInstance();
~FrameFactory();
Frame* getFrame(const std::string&, float * const scale, bool ignorePrevious);
std::vector<Frame*> getFrameVector(const std::string&, float * const scale);
private:
Gamedata* gdata;
std::map<std::string, SDL_Surface*> surfaces;
std::map<std::string, Frame*> frames;
std::map<std::string, std::vector<Frame*> > frameVectors;
FrameFactory() :
gdata( Gamedata::getInstance() ), surfaces(), frames(), frameVectors()
{}
FrameFactory(const FrameFactory&);
FrameFactory& operator=(const FrameFactory&);
float getRand(int min, int max) {
return min + (rand() / (std::numeric_limits<int>::max()+1.0f))*(max-min);
}
float getRand(float min, float max) {
return min + (rand() / (std::numeric_limits<int>::max()+1.0f))*(max-min);
}
};
#endif