0
|
1 #ifndef FIELD_H
|
|
2 #define FIELD_H
|
|
3
|
|
4 #include <iostream>
|
|
5 //#include "tool.h"
|
|
6 #include "shape.h"
|
|
7
|
|
8 #define NFIGURE 7
|
|
9 #define NELEMENT 4
|
|
10 #define WHITE 0
|
|
11
|
|
12 typedef struct _FIELD{
|
|
13 SDL_Surface *element[NELEMENT];
|
|
14 int color;
|
|
15 }FIELD;
|
|
16
|
|
17 class Field : public Shape {
|
|
18
|
|
19 public:
|
|
20 void render();
|
|
21 bool loadFromFile( std::string path, SDL_Renderer * renderer);
|
|
22
|
|
23 //Gets collision circle
|
|
24 //Circle& getCollider();
|
|
25 //LTexture *gDotTexture = new LTexture();
|
|
26 SDL_Surface *surface;
|
|
27 SDL_Surface *original;
|
|
28 //SDL_Texture *texture;
|
|
29 bool active;
|
|
30 int mPosX, mPosY;
|
|
31
|
|
32 //protected:
|
|
33 //int mWidth;
|
|
34 //int mHeight;
|
|
35
|
|
36 //Moves the collision circle relative to the dot's offset
|
|
37 //void shiftColliders();
|
|
38
|
|
39 public:
|
|
40 Field();
|
|
41 SDL_Surface * get(int n_figure, int n_element);
|
|
42 int getColor(int n_figure);
|
|
43 bool checkEdgeLeft(SDL_Surface *f, int x_field);
|
|
44 bool checkEdgeRight(SDL_Surface *f, int x_field);
|
|
45 bool checkEdgeRotate(SDL_Surface *f, int x_field);
|
|
46
|
|
47 private:
|
|
48 FIELD field[NFIGURE];
|
|
49 void set(int n_figure, int n_element, int color);
|
|
50 void draw(int n_figure, int n_element,int color, int x, int y);
|
|
51
|
|
52
|
|
53 };
|
|
54
|
|
55 SDL_Rect set_rect(int x, int y, int w, int h);
|
|
56 //SDL_Surface * bg();
|
|
57 Uint32 getpixel(SDL_Surface *surface, int x, int y);
|
|
58
|
|
59
|
|
60 #endif //FIELD_H
|