-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
92 lines (68 loc) · 2.04 KB
/
main.cpp
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
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
#include <iostream>
#include <fstream>
#include <sstream>
#include <windows.h>
#include <conio.h>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <filesystem>
#include <algorithm>
#include <numeric>
#include <functional>
#include <string>
#include <windows.h>
#include "headers/Window.hpp"
#include "headers/Time.hpp"
#include "headers/Camera.hpp"
#include "headers/Mouse.hpp"
#include "headers/Fonts.hpp"
#include "headers/Textures.hpp"
#include "headers/GUI.hpp"
#include "headers/TextArea.hpp"
#include "headers/Buttons.hpp"
#include "headers/Scrollbar.hpp"
#include "headers/OpenDialogBox.hpp"
void testOpenDialogBox() {
cam = new Camera();
cam->setPosition(sf::Vector2f(screenWidth / 2.0f, screenHeight / 2.0f));
OpenDialogBox* openDial = new OpenDialogBox("Load Map");
while (window->isOpen())
{
prevTime = currentTime;
currentTime = timeClock.getElapsedTime();
dt = currentTime.asSeconds() - prevTime.asSeconds();
mousePosition = sf::Mouse::getPosition(*window); // Pobierz aktualną pozycję myszy względem bieżącego okna
worldMousePosition = window->mapPixelToCoords(mousePosition);
GUIwasHover = false;
GUIwasClicked = false;
sf::Event event;
while (window->pollEvent(event)) {
if (openDial) {
openDial->update(event, dt);
if (openDial->fileSelected) {
cout << openDial->getPathfile() << "\n";
delete openDial;
openDial = nullptr;
}
}
}
// RENDER
window->clear();
if(openDial)
openDial->draw();
window->display();
}
}
int main()
{
// LOADS
loadFonts();
loadTextures();
// PROGRAM
testOpenDialogBox();
return 0;
}