make game update function pure virtual, add Animation class to sb namespace
This commit is contained in:
parent
b02ae013ab
commit
5be1c38e7f
|
@ -68,4 +68,12 @@ public:
|
|||
|
||||
};
|
||||
|
||||
/* Add Animation class to the sb namespace. This should be the default location, but Animation is left in the global namespace
|
||||
* for backward compatibility.
|
||||
*/
|
||||
namespace sb
|
||||
{
|
||||
using ::Animation;
|
||||
}
|
||||
|
||||
#include "Node.hpp"
|
||||
|
|
|
@ -62,7 +62,6 @@ protected:
|
|||
|
||||
private:
|
||||
|
||||
int ticks;
|
||||
float frame_length = 1000.0 / 60.0;
|
||||
SDL_Window* _window;
|
||||
std::shared_ptr<TTF_Font> _font;
|
||||
|
@ -151,7 +150,7 @@ public:
|
|||
void run();
|
||||
void frame(float);
|
||||
void flag_to_end();
|
||||
virtual void update(float timestamp) {};
|
||||
virtual void update(float timestamp) = 0;
|
||||
void set_framerate(int);
|
||||
float get_frame_length() const;
|
||||
void handle_quit_event(SDL_Event&);
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace sb
|
|||
private:
|
||||
|
||||
bool timing = false, previous_is_recorded = false;
|
||||
float timestamp = 0.0f, timestamp_previous = 0.0f, frame_duration = 0.0f, _elapsed = 0.0f;
|
||||
float timestamp_previous = 0.0f, frame_duration = 0.0f, _elapsed = 0.0f;
|
||||
|
||||
public:
|
||||
|
||||
|
|
Loading…
Reference in New Issue