Changeset 5192672 in opengl-game for vulkan-game.hpp


Ignore:
Timestamp:
Mar 7, 2021, 11:05:27 PM (4 years ago)
Author:
Dmitry Portnoy <dportnoy@…>
Branches:
feature/imgui-sdl
Children:
429ac01
Parents:
317ad13
Message:

Add ui-value\.hpp to the VulkanGame project and make curTime an instance variable of VulkanGame instead of a global

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vulkan-game.hpp

    r317ad13 r5192672  
    55#include <chrono>
    66#include <map>
     7#include <vector>
    78
    89#define GLM_FORCE_RADIANS
     
    135136// them mamdatory
    136137
    137 // TODO: Make a singleton timer class instead
    138 static float curTime;
    139 
    140138
    141139// TODO: Look into using dynamic_cast to check types of SceneObject and EffectOverTime
     
    144142   bool deleted;
    145143
    146    virtual void applyEffect() = 0;
     144   virtual void applyEffect(float curTime) = 0;
    147145
    148146   BaseEffectOverTime() :
     
    166164   EffectOverTime(GraphicsPipeline_Vulkan<VertexType, SSBOType>& pipeline,
    167165         vector<SceneObject<VertexType, SSBOType>>& objects, unsigned int objectIndex,
    168          size_t effectedFieldOffset, float changePerSecond) :
     166         size_t effectedFieldOffset, float startTime, float changePerSecond) :
    169167         pipeline(pipeline),
    170168         objects(objects),
    171169         objectIndex(objectIndex),
    172170         effectedFieldOffset(effectedFieldOffset),
    173          startTime(curTime),
     171         startTime(startTime),
    174172         changePerSecond(changePerSecond) {
    175173      size_t ssboOffset = offset_of(&SceneObject<VertexType, SSBOType>::ssbo);
     
    181179   }
    182180
    183    void applyEffect() {
     181   void applyEffect(float curTime) {
    184182      if (objects[objectIndex].ssbo.deleted) {
    185183         this->deleted = true;
     
    364362      vector<BaseEffectOverTime*> effects;
    365363
     364      // TODO: Make a separate TImer class
     365      // It could also deal with the steady_clock vs high_resolution_clock issue
    366366      time_point<steady_clock> startTime;
    367       float prevTime, elapsedTime;
    368 
    369       float fpsStartTime;
     367      float fpsStartTime, curTime, prevTime, elapsedTime;
     368
    370369      int frameCount;
    371370
Note: See TracChangeset for help on using the changeset viewer.