This repository was archived by the owner on Nov 21, 2021. It is now read-only.
forked from GammaTwoGames/2048Balls
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdrawing.h
More file actions
96 lines (81 loc) · 3.13 KB
/
drawing.h
File metadata and controls
96 lines (81 loc) · 3.13 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#ifndef DRAWING_H_INCLUDED
#define DRAWING_H_INCLUDED
#include "button.h"
void drawing_balls(RenderWindow* window, vector<Ball>* balls)
{
float x1, y1;
float x2, y2;
RectangleShape rectangle(sf::Vector2f(800, 800));
rectangle.setPosition(10,110);
rectangle.setFillColor(Color(255,255,230));
rectangle.setOutlineThickness(10);
rectangle.setOutlineColor(sf::Color(182, 92, 0));
window->draw(rectangle);
for (int i = 0; i < balls->size(); i ++)
{
//cout << (*balls)[i].lg_size() << endl;
(*balls)[i].adj_size();
CircleShape shape((*balls)[i].p);
shape.setPosition(Vector2f(10 + (*balls)[i].x - (*balls)[i].p,110+(*balls)[i].y - (*balls)[i].p));
shape.setFillColor(Color(255, 220 - 10*((*balls)[i].num - 4), ((100 - 30*((*balls)[i].num - 4))>0)?(100 - 30*((*balls)[i].num - 4)):0));
window->draw(shape);
Text chi;
Font rita;
ostringstream playerScoreString;
playerScoreString << (*balls)[i].st;
rita.loadFromFile("rita.ttf");
chi.setFont(rita);
//chi.setString("Boulat - Petooh");
chi.setString("" + playerScoreString.str());
chi.setPosition(Vector2f(10 + (*balls)[i].x + 0*(*balls)[i].p - chi.getLocalBounds().width/2,110 + (*balls)[i].y + 0*(*balls)[i].p - 10 - chi.getLocalBounds().height/2));
chi.setFillColor(Color(0,0,0));
window->draw(chi);
}
}
void drawing_button(RenderWindow* window, button_zero but, int alfa)
{
RectangleShape rectangle(sf::Vector2f(but.l, but.h));
rectangle.setPosition(but.x,but.y);
rectangle.setFillColor(Color(182, 92, 0));
window->draw(rectangle);
Font rita;
Text chi("",rita,but.siz);
rita.loadFromFile("rita.ttf");
chi.setFont(rita);
//chi.setStyle(sf::Text::Bold | sf::Text::Regular);
chi.setString(but.st);
chi.setPosition(Vector2f(but.x + but.l/2 - chi.getLocalBounds().width/2 - but.siz/15, but.y + but.h/2 - but.siz/3.5 - chi.getLocalBounds().height/2));
chi.setFillColor(Color(255,255,255,alfa));
window->draw(chi);
}
void drawing_button(RenderWindow* window, button_active but, int px, int py)
{
RectangleShape rectangle(sf::Vector2f(but.l, but.h));
rectangle.setPosition(but.x,but.y);
if (but.is_in(px,py) == 0)
{
rectangle.setFillColor(Color(182, 92, 0));
}
else
{
rectangle.setFillColor(Color(255, 255, 255));
}
window->draw(rectangle);
Font rita;
Text chi("",rita,but.siz);
rita.loadFromFile("rita.ttf");
chi.setFont(rita);
//chi.setStyle(sf::Text::Bold | sf::Text::Regular);
chi.setString(but.st);
chi.setPosition(Vector2f(but.x + but.l/2 - chi.getLocalBounds().width/2 - but.siz/15, but.y + but.h/2 - but.siz/3.5 - chi.getLocalBounds().height/2));
if (but.is_in(px,py) == 0)
{
chi.setFillColor(Color(255,255,255));
}
else
{
chi.setFillColor(Color(182, 92, 0));
}
window->draw(chi);
}
#endif // DRAWING_H_INCLUDED