#pragma once

#include <future>
// This header and cpp file is used for async functions and such. If the async function does not have anything needed from the main game header file then it can be put here :p

// Async generator variables and such
// This is a std::atomic<bool> but I don't need to define the bool part of this
// Seconds cancel flag and future promise
inline std::atomic bSecondsCancelFlag(false);
inline std::future<void> seconds;

// Moneymaker cancel flag and future promise
inline std::atomic bMoneymakerCancelFlag(false);
inline std::future<void> moneymaker;

// This allows me to create a cancel flag and input it from outside, and it also allows me to input a function name as I use std::function which allows when the function is called to reference another function
void StartAsync(std::atomic<bool>& bCancelFlag, std::future<void>& async, std::function<void(const std::atomic<bool>&)> task);

// The function for the moneyMakerTask, this task will make money every 5 seconds behind the scenes
void MoneymakerTask(const std::atomic<bool>& bCancelFlag);

// This function will count every second behind the scenes, this is used for 
void SecondsTask(const std::atomic<bool>& bCancelFlag);

// Custom sleep for use in an async function, makes the current thread sleep
void ThreadSleep(const std::atomic<bool>& bCancelFlag, int secondsSleep);
