Changeset c6f0793 in opengl-game for vulkan-game.cpp


Ignore:
Timestamp:
Feb 14, 2021, 12:11:30 AM (4 years ago)
Author:
Dmitry Portnoy <dportnoy@…>
Branches:
feature/imgui-sdl
Children:
9067efc
Parents:
d8cf709
git-author:
Dmitry Portnoy <dportnoy@…> (02/14/21 00:11:10)
git-committer:
Dmitry Portnoy <dportnoy@…> (02/14/21 00:11:30)
Message:

Use done instead of quit as the game loop flag and change it to an instance variable in SDLGame

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vulkan-game.cpp

    rd8cf709 rc6f0793  
    112112
    113113void VulkanGame::quitGame() {
    114    this->quit = true;
     114   done = true;
    115115}
    116116
     
    771771
    772772void VulkanGame::mainLoop() {
    773    this->quit = false;
    774 
    775773   this->startTime = high_resolution_clock::now();
    776774   curTime = duration<float, seconds::period>(high_resolution_clock::now() - this->startTime).count();
     
    781779   lastSpawn_asteroid = curTime;
    782780
    783    while (!this->quit) {
     781   done = false;
     782   while (!done) {
    784783
    785784      this->prevTime = curTime;
     
    805804            case UI_EVENT_QUIT:
    806805               cout << "Quit event detected" << endl;
    807                this->quit = true;
     806               done = true;
    808807               break;
    809808            case UI_EVENT_WINDOW:
     
    821820
    822821               if (e.key.keycode == SDL_SCANCODE_ESCAPE) {
    823                   this->quit = true;
     822                  done = true;
    824823               } else if (e.key.keycode == SDL_SCANCODE_SPACE) {
    825824                  cout << "Adding a plane" << endl;
Note: See TracChangeset for help on using the changeset viewer.