Changeset 0807aeb in opengl-game for vulkan-game.hpp


Ignore:
Timestamp:
Mar 10, 2020, 2:53:34 AM (5 years ago)
Author:
Dmitry Portnoy <dmp1488@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
22217d4
Parents:
44f23af
git-author:
Dmitry Portnoy <dmp1488@…> (03/10/20 00:43:57)
git-committer:
Dmitry Portnoy <dmp1488@…> (03/10/20 02:53:34)
Message:

Spawn asteroids at a regular interval and make them move in the player's direction, change the movement of all game objects to depend on elapsed time and be framerate-independent, and switch from SDL2 timers to the C++ chrono library

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vulkan-game.hpp

    r44f23af r0807aeb  
    11#ifndef _VULKAN_GAME_H
    22#define _VULKAN_GAME_H
     3
     4#include <chrono>
    35
    46#define GLM_FORCE_RADIANS
     
    1517
    1618using namespace glm;
     19using namespace std::chrono;
    1720
    1821#ifdef NDEBUG
     
    182185      UBO_VP_mats asteroid_VP_mats;
    183186
    184       Uint64 curTime, prevTime;
    185       double elapsedTime;
     187      time_point<steady_clock> startTime;
     188      float curTime, prevTime, elapsedTime;
     189
     190      float shipSpeed = 0.5f;
     191      float asteroidSpeed = 2.0f;
     192
     193      float spawnRate_asteroid = 0.5;
     194      float lastSpawn_asteroid;
    186195
    187196      bool initWindow(int width, int height, unsigned char guiFlags);
     
    286295}
    287296
     297// TODO: Just pass in the single object instead of a list of all of them
    288298template<class VertexType, class SSBOType>
    289299void VulkanGame::updateObject(vector<SceneObject<VertexType, SSBOType>>& objects,
Note: See TracChangeset for help on using the changeset viewer.