-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
34 lines (30 loc) · 974 Bytes
/
main.cpp
File metadata and controls
34 lines (30 loc) · 974 Bytes
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
#include <SFML/Graphics.hpp>
#include <iostream>
#include "Menu.h"
int main()
{
//Creates window and menu object for the board
sf::RenderWindow window(sf::VideoMode(1920,1080), "SFML works!");
Menu menu;
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
//Checks for a mouse press, and records location before going to checkClick
if (event.type == sf::Event::MouseButtonPressed)
{
auto pos = sf::Mouse::getPosition(window);
if (event.mouseButton.button == sf::Mouse::Left)
menu.checkClick(sf::Vector2f(pos.x, pos.y));
}
}
//Clears window, draws, then displays each frame
window.clear();
menu.Draw(window);
window.display();
}
return 0;
}