#include "Assets.hpp"
#include "FrameCounter.hpp"
-#include "init.hpp"
#include "RandomWalk.hpp"
#include "../audio/Audio.hpp"
#include "../graphics/Viewport.hpp"
namespace blank {
+class Window;
+
class Application {
public:
World::Config world = World::Config();
};
- explicit Application(const Config &);
+ Application(Window &, const Config &);
~Application();
Application(const Application &) = delete;
static Entity &MakeTestEntity(World &);
private:
- Init init;
+ Window &window;
Viewport viewport;
Assets assets;
Audio audio;
#include "Runtime.hpp"
+#include "init.hpp"
+
#include <cctype>
#include <cstdlib>
#include <iostream>
return 1;
}
- Application app(config);
+ Init init(config.doublebuf, config.multisampling);
+ Application app(init.window, config);
switch (mode) {
default:
case NORMAL:
#include "Assets.hpp"
#include "FrameCounter.hpp"
+#include "init.hpp"
#include "../audio/Sound.hpp"
#include "../graphics/Font.hpp"
#include "../world/BlockType.hpp"
namespace blank {
-Application::Application(const Config &config)
-: init(config.doublebuf, config.multisampling)
+Application::Application(Window &win, const Config &config)
+: window(win)
, viewport()
, assets(get_asset_path())
, audio()
void Application::Run() {
running = true;
Uint32 last = SDL_GetTicks();
- init.window.GrabMouse();
+ window.GrabMouse();
while (running) {
Uint32 now = SDL_GetTicks();
int delta = now - last;
void Application::Handle(const SDL_WindowEvent &event) {
switch (event.event) {
case SDL_WINDOWEVENT_FOCUS_GAINED:
- init.window.GrabMouse();
+ window.GrabMouse();
break;
case SDL_WINDOWEVENT_FOCUS_LOST:
- init.window.ReleaseMouse();
+ window.ReleaseMouse();
break;
case SDL_WINDOWEVENT_RESIZED:
viewport.Resize(event.data1, event.data2);
interface.Render(viewport);
counter.ExitRender();
- init.window.Flip();
+ window.Flip();
}