forked from NaiJi/project-kyoku
Make GUIState interface, rearrange include
This commit is contained in:
parent
00360f6c8d
commit
92fd5c0c27
|
@ -6,11 +6,24 @@
|
|||
#include <SFML/Window/Keyboard.hpp>
|
||||
#include <SFML/Window/Event.hpp>
|
||||
|
||||
#include "game.h"
|
||||
#include "game/game.h"
|
||||
#include "gui/state.h"
|
||||
|
||||
class Application
|
||||
{
|
||||
public:
|
||||
|
||||
enum State
|
||||
{
|
||||
SPLASH_SCREEN,
|
||||
MAIN_MENU,
|
||||
GAME_PICKER,
|
||||
GAME,
|
||||
EDITOR_PICKER,
|
||||
EDITOR,
|
||||
SETTINGS
|
||||
};
|
||||
|
||||
Application();
|
||||
void run();
|
||||
void input();
|
||||
|
@ -18,9 +31,12 @@ public:
|
|||
void draw();
|
||||
|
||||
private:
|
||||
std::stack<std::shared_ptr<GUIState>> _states;
|
||||
sf::RenderWindow _game_window;
|
||||
std::shared_ptr<Game> _game;
|
||||
|
||||
State _state;
|
||||
|
||||
void exec();
|
||||
};
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define GAME_H
|
||||
|
||||
#include <SFML/Graphics/RenderWindow.hpp>
|
||||
#include "inputtype.h"
|
||||
#include "game/inputtype.h"
|
||||
|
||||
class Game
|
||||
{
|
|
@ -2,7 +2,7 @@
|
|||
#define INPUTTYPE_H
|
||||
|
||||
#include <SFML/Window/Event.hpp>
|
||||
#include "mathutils.h"
|
||||
#include "game/mathutils.h"
|
||||
|
||||
struct PlayerInput
|
||||
{
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "inputtype.h"
|
||||
#include "game/inputtype.h"
|
||||
|
||||
class Note
|
||||
{
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef PRECISIONEVALUATOR_H
|
||||
#define PRECISIONEVALUATOR_H
|
||||
|
||||
#include "mathutils.h"
|
||||
#include "game/mathutils.h"
|
||||
#include <numeric>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
|
@ -1,7 +1,8 @@
|
|||
#ifndef TIMELINE_H
|
||||
#define TIMELINE_H
|
||||
|
||||
#include "mathutils.h"
|
||||
#include "game/mathutils.h"
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
#pragma once
|
||||
|
||||
#include <stack>
|
||||
#include <memory>
|
||||
#include <SFML/Window/Event.hpp>
|
||||
#include <SFML/Graphics/Drawable.hpp>
|
||||
|
||||
class GUIState : public sf::Drawable
|
||||
{
|
||||
virtual ~GUIState() = default;
|
||||
|
||||
virtual void input(const sf::Event& event, std::stack<std::shared_ptr<GUIState>>& states) = 0;
|
||||
virtual void update() = 0;
|
||||
virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const = 0;
|
||||
};
|
|
@ -1,5 +1,5 @@
|
|||
#include "application.h"
|
||||
#include "inputtype.h"
|
||||
#include "game/inputtype.h"
|
||||
|
||||
#include "classicgame/classicgame.h"
|
||||
#include "classicgame/classicgraphicsmanager.h"
|
||||
|
@ -33,7 +33,6 @@ void Application::exec()
|
|||
|
||||
while (_game_window.isOpen())
|
||||
{
|
||||
|
||||
time_since_last_update += timer.restart();
|
||||
|
||||
input();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "mathutils.h"
|
||||
#include "game/mathutils.h"
|
||||
#include <memory>
|
||||
|
||||
class ClassicSprite;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define CLASSICGAME_H
|
||||
|
||||
#include <map>
|
||||
#include "game.h"
|
||||
#include "game/game.h"
|
||||
#include "classicactions.h"
|
||||
#include <SFML/Audio/SoundBuffer.hpp>
|
||||
#include <SFML/Audio/Sound.hpp>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "game/spritecontainer.h"
|
||||
#include "classicactions.h"
|
||||
#include "spritecontainer.h"
|
||||
#include "classicspritefactory.h"
|
||||
|
||||
#include <SFML/Graphics/RenderTarget.hpp>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <vector>
|
||||
|
||||
#include "note.h"
|
||||
#include "game/mathutils.h"
|
||||
#include "classicgraphicsmanager.h"
|
||||
|
||||
struct Beatmap
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "note.h"
|
||||
#include "precisionevaluator.h"
|
||||
#include "game/note.h"
|
||||
#include "game/precisionevaluator.h"
|
||||
#include "classicactions.h"
|
||||
|
||||
#include <memory>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "mathutils.h"
|
||||
#include "sprite.h"
|
||||
#include "game/mathutils.h"
|
||||
#include "game/sprite.h"
|
||||
#include "SFML/Graphics/RectangleShape.hpp"
|
||||
#include "SFML/Graphics/Text.hpp"
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "timeline.h"
|
||||
#include "game/timeline.h"
|
||||
|
||||
#include <SFML/Audio/Music.hpp>
|
||||
#include <SFML/System/Clock.hpp>
|
||||
|
|
Loading…
Reference in New Issue