Changeset 5192672 in opengl-game


Ignore:
Timestamp:
Mar 7, 2021, 11:05:27 PM (3 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

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • VulkanGame.vcxproj

    r317ad13 r5192672  
    7272  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    7373    <IncludePath>include;$(VULKAN_SDK)/Include;$(VULKAN_SDK)/Third-Party/Include;$(IncludePath)</IncludePath>
    74     <LibraryPath>lib;$(VULKAN_SDK)\Lib;$(LibraryPath)</LibraryPath>
     74    <LibraryPath>lib;$(VULKAN_SDK)/Lib;$(LibraryPath)</LibraryPath>
    7575  </PropertyGroup>
    7676  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
     
    177177    <ClInclude Include="gui\screen.hpp" />
    178178    <ClInclude Include="gui\ui-element.hpp" />
     179    <ClInclude Include="gui\ui-value.hpp" />
    179180    <ClInclude Include="IMGUI\imconfig.h" />
    180181    <ClInclude Include="IMGUI\imgui.h" />
  • VulkanGame.vcxproj.filters

    r317ad13 r5192672  
    55    <ClCompile Include="FileStackWalker.cpp" />
    66    <ClCompile Include="game-gui-sdl.cpp" />
    7     <ClCompile Include="gui\button.cpp" />
    8     <ClCompile Include="gui\game-screen.cpp" />
    9     <ClCompile Include="gui\main-screen.cpp" />
    10     <ClCompile Include="gui\panel.cpp" />
    11     <ClCompile Include="gui\screen.cpp" />
    12     <ClCompile Include="gui\ui-element.cpp" />
    137    <ClCompile Include="logger.cpp" />
    148    <ClCompile Include="main-vulkan.cpp" />
     
    3832      <Filter>IMGUI SDL Reference</Filter>
    3933    </ClCompile>
     34    <ClCompile Include="gui\button.cpp">
     35      <Filter>gui</Filter>
     36    </ClCompile>
     37    <ClCompile Include="gui\game-screen.cpp">
     38      <Filter>gui</Filter>
     39    </ClCompile>
     40    <ClCompile Include="gui\main-screen.cpp">
     41      <Filter>gui</Filter>
     42    </ClCompile>
     43    <ClCompile Include="gui\panel.cpp">
     44      <Filter>gui</Filter>
     45    </ClCompile>
     46    <ClCompile Include="gui\screen.cpp">
     47      <Filter>gui</Filter>
     48    </ClCompile>
     49    <ClCompile Include="gui\ui-element.cpp">
     50      <Filter>gui</Filter>
     51    </ClCompile>
    4052  </ItemGroup>
    4153  <ItemGroup>
     
    4860    <ClInclude Include="graphics-pipeline.hpp" />
    4961    <ClInclude Include="graphics-pipeline_vulkan.hpp" />
    50     <ClInclude Include="gui\button.hpp" />
    51     <ClInclude Include="gui\game-screen.hpp" />
    52     <ClInclude Include="gui\main-screen.hpp" />
    53     <ClInclude Include="gui\panel.hpp" />
    54     <ClInclude Include="gui\screen.hpp" />
    55     <ClInclude Include="gui\ui-element.hpp" />
    5662    <ClInclude Include="logger.hpp" />
    5763    <ClInclude Include="StackWalker.h" />
     
    8692      <Filter>IMGUI SDL Reference</Filter>
    8793    </ClInclude>
     94    <ClInclude Include="gui\button.hpp">
     95      <Filter>gui</Filter>
     96    </ClInclude>
     97    <ClInclude Include="gui\game-screen.hpp">
     98      <Filter>gui</Filter>
     99    </ClInclude>
     100    <ClInclude Include="gui\main-screen.hpp">
     101      <Filter>gui</Filter>
     102    </ClInclude>
     103    <ClInclude Include="gui\panel.hpp">
     104      <Filter>gui</Filter>
     105    </ClInclude>
     106    <ClInclude Include="gui\screen.hpp">
     107      <Filter>gui</Filter>
     108    </ClInclude>
     109    <ClInclude Include="gui\ui-element.hpp">
     110      <Filter>gui</Filter>
     111    </ClInclude>
     112    <ClInclude Include="gui\ui-value.hpp">
     113      <Filter>gui</Filter>
     114    </ClInclude>
    88115  </ItemGroup>
    89116  <ItemGroup>
     
    114141      <UniqueIdentifier>{e540b46d-7c98-427d-a28d-4fc20d495826}</UniqueIdentifier>
    115142    </Filter>
     143    <Filter Include="gui">
     144      <UniqueIdentifier>{56453757-f40b-4772-898b-04121b61d0fc}</UniqueIdentifier>
     145    </Filter>
    116146  </ItemGroup>
    117147</Project>
  • vulkan-game.cpp

    r317ad13 r5192672  
    823823         }
    824824
    825          switch(e.type) {
     825         switch (e.type) {
    826826            case UI_EVENT_QUIT:
    827827               cout << "Quit event detected" << endl;
     
    10471047         BaseEffectOverTime* eot = *it;
    10481048
    1049          eot->applyEffect();
     1049         eot->applyEffect(curTime);
    10501050
    10511051         it++;
     
    20432043         // TODO: Use some sort of smart pointer instead
    20442044         eot = new EffectOverTime<AsteroidVertex, SSBO_Asteroid>(asteroidPipeline, asteroidObjects, closestAsteroidIndex,
    2045             offset_of(&SSBO_Asteroid::hp), -20.0f);
     2045            offset_of(&SSBO_Asteroid::hp), curTime, -20.0f);
    20462046         effects.push_back(eot);
    20472047      }
     
    20642064   laser.vertices[7].pos.z = -length;
    20652065
    2066    // TODO: Consider if I want to set a flag and do this update in in updateScene() instead
     2066   // TODO: Consider if I want to set a flag and do this update in updateScene() instead
    20672067   updateObjectVertices(this->laserPipeline, laser, index);
    20682068}
  • 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.