The initialization order in the Application was wrong, so some code has been moved from run to the constructor.
37 lines
969 B
C++
37 lines
969 B
C++
#pragma once
|
|
|
|
#include "String.h"
|
|
|
|
namespace Gedeng {
|
|
|
|
class Application {
|
|
public:
|
|
Application(unsigned long ms_per_update, unsigned int window_size_x, unsigned int window_size_y,
|
|
String window_name);
|
|
|
|
// Virtual since this class will be inherited by user-created applications
|
|
virtual ~Application() = default;
|
|
|
|
// Game Loop
|
|
void run();
|
|
|
|
// Primarily for gameplay and physics
|
|
// To be overridden by client applications
|
|
virtual void fixed_update(double delta) = 0;
|
|
|
|
// Primarily for rendering
|
|
// To be overridden by client applications
|
|
virtual void dynamic_update(double delta) = 0;
|
|
|
|
private:
|
|
// TODO: These will probably become a separate Settings struct
|
|
const unsigned long MS_PER_UPDATE;
|
|
const unsigned int WINDOW_SIZE_X;
|
|
const unsigned int WINDOW_SIZE_Y;
|
|
const String WINDOW_NAME;
|
|
};
|
|
|
|
// To be defined in client applications
|
|
Application *create_application();
|
|
|
|
} // namespace Gedeng
|