This repository was archived by the owner on Sep 26, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRplTask.h
More file actions
49 lines (40 loc) · 1.42 KB
/
Copy pathRplTask.h
File metadata and controls
49 lines (40 loc) · 1.42 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
enum TaskStatus { CREATED, STARTING, RUNNING, PAUSING, STOPPED, RESUMING};
class RplTask {
private:
protected:
virtual void onStart() {}; // Children implement for first-time start behavior.
virtual void onResume() {}; // Children implement for handling resume
virtual void onPause() {}; // Children implement for handling pause
virtual void onLoop() {}; // Children implement for handling loop
virtual void init(RplTask** tasks, int taskCount) {};
public:
TaskStatus status;
/*
Starts this task.
*/
void start();
/*
Pauses this task, preventing loop-level logic from firing.
*/
void pause();
/*
Called in the main loop, this method manages the loop-level
logic for this task.
If the task was not running, but is now running this loop for
the first time, call onStart().
If the task was not running last loop, but is now running this loop,
call onResume once.
If the task was running but is now not running, call onPause once.
If the task is running, run onLoop.
*/
void process(float deltaTime);
/*
Returns the current status of this task (created, running, or stopped.)
If the status changed, this function should reflect the current state as of
the most recent loop.
*/
TaskStatus getStatus();
void resume();
RplTask() : status(CREATED) {};
~RplTask();
};