Repository navigation
Expand file tree
/
Copy pathmain.cpp
More file actions
executable file
·84 lines (68 loc) · 2.01 KB
/
Copy pathmain.cpp
File metadata and controls
executable file
·84 lines (68 loc) · 2.01 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
//
// Disclamer:
// ----------
//
// This code will work only if you selected window, graphics and audio.
//
// Note that the "Run Script" build phase will copy the required frameworks
// or dylibs to your application bundle so you can execute it on any OS X
// computer.
//
// Your resource files (images, sounds, fonts, ...) are also copied to your
// application bundle. To get the path to these resource, use the helper
// method resourcePath() from ResourcePath.hpp
//
#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>
#include "Game.h"
#include "Utility.h"
#include "Player.h"
#include "Controller.h"
#include <Box2D/Box2D.h>
#include "OSHandler.h"
#include "Director.h"
int main(int argc, char* argv[])
{
OSHandler* osHandler = new OSHandler();
#ifdef _WIN32
osHandler->win32();
#elif __APPLE__
osHandler->mac();
#else
std::cout << "Not WIN32 or APPLE" << std::endl;
#endif
// Create the main window
sf::ContextSettings settings;
settings.antialiasingLevel = 5;
// 800x600
sf::RenderWindow* window = new sf::RenderWindow(sf::VideoMode(1280, 800), "SFML window", 7U, settings);
// Set the Icon
sf::Image icon;
if (!icon.loadFromFile(osHandler->getResourcePath() + "frog_placeholder.png")) {
cerr << "Could not load frog!" << endl;
//return EXIT_FAILURE;
}
// sf::Music music;
// music.setLoop(true);
// if(!music.openFromFile(osHandler->getResourcePath() + "frog_theme.wav")) {
// cerr << "Could not load music!" << endl;
// }
// else {
// music.play();
// }
window->setIcon(icon.getSize().x, icon.getSize().y, icon.getPixelsPtr());
Director* director = new Director(window, osHandler);
window->setFramerateLimit(60);
// Start the game loop
while (window->isOpen())
{
// Clear screen
window->clear(sf::Color(0,100,160));
director->run();
// Update the window
window->display();
}
/*if(!menu->getGame()->exitCalled)
menu->getGame()->exitGame();*/
return EXIT_SUCCESS;
}