本文整理汇总了C++中Events::processEvents方法的典型用法代码示例。如果您正苦于以下问题:C++ Events::processEvents方法的具体用法?C++ Events::processEvents怎么用?C++ Events::processEvents使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Events
的用法示例。
在下文中一共展示了Events::processEvents方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
// Initialize globals
initGlobals();
// Window
window.setSize(sf::Vector2u(window_width, window_height));
window.setPosition(sf::Vector2i(200, 200));
window.setFramerateLimit(FRAMES_PER_SECOND);
//window.setVerticalSyncEnabled(true);
window.setKeyRepeatEnabled(false);
// Camera view
sf::View windowView;
// Menu
initializeMenu();
// UI
ui.init();
// Minimap
// Minimap minimap;
// Create & Set contactlistener
BoxContactListener boxContactListener;
physicsWorld.SetContactListener(&boxContactListener);
// Build world
//gameWorld.generateWorld(physicsWorld);
// ------------------------------- MAIN LOOP -------------------------------
while(window.isOpen())
{
// ------------------------------- Input & Views -------------------------------
sf::Event event;
gameEvents.processEvents(window, event);
// Update view in case of window resize
window_width = window.getSize().x;
window_height = window.getSize().y;
windowView.setSize(window_width, window_height);
// if(minimap.updateViewThroughMinimap)
// {
// windowView.setCenter(minimap.newViewCenter.x, minimap.newViewCenter.y);
// }
if(player.hasNewFocus)
{
windowView.setCenter(player.getNewFocus().x, player.getNewFocus().y);
}
// Update normal view with inputs
windowView = updateView(windowView);
if(gameWorld.completionStarted && gameWorld.completionTimer.timeReached())
{
windowView.setCenter(window_width/2, window_height/2);
global_levelComplete = false;
}
// Clear window
window.clear(sf::Color(255, 255, 255, 255));
if(global_isMenu)
{
ui.setSize(window_width, window_height);
window.setView(ui.getView());
menu_logo_bottom->setPosition(window_width - textures["menu_logo_bottom"].getSize().x, window_height - textures["menu_logo_bottom"].getSize().y);
menu.update(gameEvents);
menu.draw(window);
// Instructions
if(show_instructions)
{
showInstructions();
if(show_instructions_controls)
{
showControls();
}
if(show_instructions_gameplay)
{
showGameplay();
}
}
}
else
{
window.setView(windowView);
// ------------------------------- Updates -------------------------------
// Player
player.update(physicsWorld, gameEvents, gameWorld);
//.........这里部分代码省略.........