app now just coordinates the components initialized in main
reduced responsibilities of constructors started using more pointers. sessions through app rather than app itself. mostly split view away from app (still hard coded) haven't decoupled sorts from timers as their actuator yet
This commit is contained in:
+4
-8
@@ -4,14 +4,10 @@
|
||||
#include <cstddef>
|
||||
#include <ctime>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <chrono>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
//check if the timer is still valid, check if enough time has passed and if so, actuate action
|
||||
|
||||
class Timer {
|
||||
public:
|
||||
size_t triggeramount;
|
||||
@@ -19,9 +15,9 @@ public:
|
||||
bool isexpired = false;
|
||||
bool isinfinite = false;
|
||||
size_t triggercount = 0;
|
||||
function<bool()> timeraction;
|
||||
std::function<bool()> timeraction;
|
||||
|
||||
Timer(size_t triggeramount, function<bool()> myaction, std::chrono::milliseconds triggerinterval);
|
||||
Timer(size_t triggeramount, std::function<bool()> myaction, std::chrono::milliseconds triggerinterval);
|
||||
void add_time(std::chrono::milliseconds deltatime);
|
||||
|
||||
private:
|
||||
@@ -33,9 +29,9 @@ private:
|
||||
//CRUD timers and give them dt on update
|
||||
class TimerManager {
|
||||
public:
|
||||
vector<Timer> timers;
|
||||
std::vector<Timer> timers;
|
||||
TimerManager(){previoustime = std::chrono::steady_clock::now();}
|
||||
void add_timer(size_t triggeramount, function<bool()> myaction, std::chrono::milliseconds triggerinterval);
|
||||
void add_timer(size_t triggeramount, std::function<bool()> myaction, std::chrono::milliseconds triggerinterval);
|
||||
void delete_timer();
|
||||
void update_timers();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user