annotate lamertetris/sources/field.h @ 8:923377f8ebcb

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