-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
65 lines (61 loc) · 1.53 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
#include <SFML/Graphics.hpp>
#include <iostream>
#ifdef __linux__
#error not yet supported you cuckold
#elif _WIN32
#include <windows.h>
#endif
#include "states.hpp"
int game()
{
// Create the main window
sf::RenderWindow app(sf::VideoMode(800, 600), "The Epic Boohbah Game");
switchState<MainState>();
sf::Music music;
/* Load a sprite to display
sf::Texture texture;
if (!texture.loadFromFile("cb.bmp"))
return EXIT_FAILURE;
sf::Sprite sprite(texture);
*/
app.setFramerateLimit(60);
// Start the game loop
while (app.isOpen())
{
// Process events
sf::Event event;
while (app.pollEvent(event))
{
// Close window : exit
switch(event.type){
case sf::Event::Closed:
app.close();
case sf::Event::KeyPressed:
curState->keyPress();
}
}
// Clear screen
app.clear(sf::Color::White);
// Draw the sprite
//app.draw(logo.sprite);
curState->updateObj(&app);
curState->update();
// Update the window
app.display();
}
delete curState;
return EXIT_SUCCESS;
}
int main(){
#ifdef _WIN32
int msgboxID = MessageBoxW(
NULL,
L"the boohbah game will most likely make you blow your brains out\nYou sure you want to continue?",
L"VERY IMPORTANT WARNING",
MB_ICONWARNING | MB_YESNO
);
return msgboxID==IDYES?game():0;
#elif __linux__
return game();
#endif // __linux__
}