-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodel.h
43 lines (37 loc) · 1003 Bytes
/
model.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
#ifndef MODEL_H
#define MODEL_H
#include <QObject>
#include <QImage>
// The class represent the model and the main logic behind the Game of Life.
// It has a matrix structure that save the life of the cell and a image representing
// this life.
// It define all the methods that evolve the cells life.
// It has no reference to the vew.
class Model: public QObject
{
Q_OBJECT
public:
Model();
~Model();
void setImage(QImage* image);
void saveImage();
bool loadImage(QString name);
QImage* getImage() const;
void changePixel(int x, int y);
void changePixelWhite(int x, int y);
void changePixelBlack(int x, int y);
void updateImage();
int size = 300;
int fps = 30;
bool heatmap = false;
void filter();
void initializeImage();
private:
int** correlation(int** matrix);
int** tryEvolve(int** matrix);
int** m_matrix;
QImage* m_image;
QRgb black = qRgb(0,0,0);
QRgb white = qRgb(255,255,255);
};
#endif // MODEL_H