Created
April 26, 2018 23:11
-
-
Save eXpl0it3r/d3f9cf0d0b9ad1801d166124cb1835c6 to your computer and use it in GitHub Desktop.
Sample SFML Setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Application.hpp" | |
Application::Application() | |
: m_window{{1280, 720}, "Sample SFML Setup"} | |
, m_shape{{200.f, 200.f}} | |
{ | |
} | |
void Application::run() | |
{ | |
while(m_window.isOpen()) | |
{ | |
sf::Event event; | |
while(m_window.pollEvent(event)) | |
{ | |
if(event.type == sf::Event::Closed) | |
m_window.close(); | |
} | |
m_window.clear(); | |
m_window.draw(m_shape); | |
m_window.display(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <SFML/Graphics.hpp> | |
class Application | |
{ | |
public: | |
Application(); | |
void run(); | |
private: | |
sf::RenderWindow m_window; | |
sf::RectangleShape m_shape; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Application.hpp" | |
int main() | |
{ | |
Application app; | |
app.run(); | |
// TODO: Added top-level exception handling | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment