JNGL
work.hpp
Go to the documentation of this file.
1 // Copyright 2012-2020 Jan Niklas Hasse <[email protected]>
2 // For conditions of distribution and use, see copyright notice in LICENSE.txt
4 #pragma once
5 
6 #include "job.hpp"
7 
8 #include <memory>
9 
10 namespace jngl {
11 
13 class Work : public Job {
14 public:
20  virtual void onQuitEvent();
21 
26  virtual void onPauseEvent();
27 
29  virtual void onLoad();
30 };
31 
34 
37 
39 [[deprecated("Use setWork(std::shared_ptr<Work>) instead")]]
40 void setWork(Work*);
41 
47 
48 } // namespace jngl
jngl::Work::onQuitEvent
virtual void onQuitEvent()
Gets called when the user closes the main window or quit() has been called.
std::shared_ptr
jngl::Job
Background job which stays part of the main loop independent of the active jngl::Work.
Definition: job.hpp:14
jngl::Work
Active state of the game, e.g. a menu or the game itself.
Definition: work.hpp:13
jngl::Work::onLoad
virtual void onLoad()
Gets called when the Work is activated by App::mainLoop()
jngl::getWork
std::shared_ptr< Work > getWork()
Returns the current active Work or nullptr if none has been set.
jngl
JNGL's main namespace.
Definition: App.hpp:9
job.hpp
memory
jngl::resetFrameLimiter
void resetFrameLimiter()
Resets the automatic frame limiter of App::mainLoop().
jngl::Work::onPauseEvent
virtual void onPauseEvent()
Gets called when the main window loses focus or the app is put in the background.
jngl::setWork
void setWork(std::shared_ptr< Work > work)
Sets the passed Work to be active in App::mainLoop()