-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathLoadingScreen.h
35 lines (29 loc) · 1023 Bytes
/
LoadingScreen.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#pragma once
#include "RenderPath2D.h"
#include "wiColor.h"
#include "wiJobSystem.h"
#include <functional>
class MainComponent;
class LoadingScreen :
public RenderPath2D
{
private:
wiJobSystem::context ctx;
std::vector<std::function<void(wiJobArgs)>> tasks;
std::function<void()> finish;
public:
//Add a loading task which should be executed
//use std::bind( YourFunctionPointer )
void addLoadingFunction(std::function<void(wiJobArgs)> loadingFunction);
//Helper for loading a whole renderable component
void addLoadingComponent(RenderPath* component, MainComponent* main, float fadeSeconds = 0, wiColor fadeColor = wiColor(0, 0, 0, 255));
//Set a function that should be called when the loading finishes
//use std::bind( YourFunctionPointer )
void onFinished(std::function<void()> finishFunction);
//See if the loading is currently running
bool isActive();
//Start Executing the tasks and mark the loading as active
virtual void Start() override;
//Clear all tasks
virtual void Stop() override;
};