Skip to content

Commit

Permalink
Improve Job documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
jhasse committed Oct 26, 2024
1 parent 1e4040c commit 99b1a9b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/jngl/job.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012-2023 Jan Niklas Hasse <jhasse@bixense.com>
// Copyright 2012-2024 Jan Niklas Hasse <jhasse@bixense.com>
// For conditions of distribution and use, see copyright notice in LICENSE.txt
/// Contains jngl::Job class and related functions
/// @file
Expand All @@ -13,18 +13,25 @@ namespace jngl {
///
/// This can be used for an achievement system for example. Override this class and use
/// jngl::addJob to register it.
///
/// Jobs (meaning instances of this class that were added using jngl::addJob) are always stepped
/// before the active jngl::Work and drawn after it.
class Job {
public:
/// Advance the game logic
///
/// This function gets called 60 times per second or whatever has been set by
/// setStepsPerSecond().
///
/// \note JNGL's main loop calls all Jobs' step() functions before the active Work's step()
virtual void step() = 0;

/// Draw the game state
///
/// As it isn't garuanteed that this function is called as often as Job::step, you shouldn't
/// change any game state in it.
///
/// \note JNGL's main loop calls all Jobs' draw() functions after the active Work's draw()
virtual void draw() const = 0;

/// Does nothing
Expand Down

0 comments on commit 99b1a9b

Please sign in to comment.