app.cpp

                Never    
C++
       
#include "App.h"

// constructor

App::App(const char* title, int screenWidth, int screenHeight, int screenBpp) {
	window.create( sf::VideoMode(screenWidth, screenHeight, screenBpp), title );
	window.setFramerateLimit(0);
	view = window.getDefaultView();
}


// destructor
App::~App() {
	// release memory
}

bool App::Init() {
	circle.setRadius(50);
	circle.setFillColor(sf::Color(150, 150, 255, 255));
	circle.setOrigin(-10, -10);
	// initialise App data members
	
	return true;
}

void App::Update() {
	// update
	circle.move(0.01f, 0.005f);
}

void App::Draw() {
	window.clear();
	window.setView(view);
	// draw
	window.draw(circle);

	window.display();
}

void App::HandleEvents() {
	if (event.type == sf::Event::Closed)
		window.close();

	// other keyboard, mouse events
}

void App::Run() {
	while (window.isOpen()) {
		while (window.pollEvent(event)) {
			HandleEvents();
		}
		Update();
		Draw();
	}
}

Raw Text