Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "SFMLApp.h"
- #include "SFML/Window/VideoMode.hpp"
- #include "SFML/Window/Keyboard.hpp"
- #include "SFML/Graphics/Color.hpp"
- SFMLApp::SFMLApp() {
- MapGenerator generator;
- this->currentMap = generator.GenerateMap(10, 10, 3);
- }
- SFMLApp::~SFMLApp() {
- delete this->window;
- delete this->currentMap;
- }
- bool SFMLApp::Init(const char * title) {
- this->window = new sf::RenderWindow(sf::VideoMode(SFMLApp::WINDOW_WIDTH, SFMLApp::WINDOW_HEIGHT, 32), title);
- return (this->window != NULL);
- }
- void SFMLApp::HandleEvent(sf::Event* event) {
- if(event->type == sf::Event::Closed) this->running = false;
- if(event->type == sf::Event::KeyPressed) {
- if(sf::Keyboard::isKeyPressed(sf::Keyboard::Key::Escape)) this->running = false;
- }
- }
- void SFMLApp::Update(sf::Time elapsedTime) {
- }
- void SFMLApp::Render() {
- this->window->clear(sf::Color::Black);
- this->currentMap->DrawTiles(this->window);
- this->window->display();
- }
- void SFMLApp::Cleanup() {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement