-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
59 lines (38 loc) · 1.05 KB
/
Copy pathmain.cpp
File metadata and controls
59 lines (38 loc) · 1.05 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
#include<iostream>
#include<vector>
#include<string>
#include<SFML\Graphics.hpp>
#include"functions.h"
int main()
{
int windowx = 1300;
int windowy = 750;
int click = 0;
int grid_start_x = 89, grid_start_y = 30;
int cellnumber_x = 40, cellnumber_y = 20;
int cellsize = 30;
sf::RenderWindow window(sf::VideoMode(windowx, windowy), "Path visualization");
Grid grid(cellnumber_x, cellnumber_y, &window, grid_start_x, grid_start_y, cellsize);
Buttons buttons(&window);
buttons.add_buttons();
int state = 0;
while (window.isOpen())
{
sf::Event Event;
while (window.pollEvent(Event))
{
if (Event.type == sf::Event::Closed) window.close();
if (Event.type == sf::Event::MouseButtonPressed)
{
int mouse_x = sf::Mouse::getPosition(window).x;
int mouse_y = sf::Mouse::getPosition(window).y;
register_click(mouse_x, mouse_y, &grid, &buttons, &state);
}
}
window.clear(sf::Color::White);
grid.show();
buttons.show();
window.display();
}
return 0;
}