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/Keyboard.hpp>
|
||||||
#include <SFML/Window/Event.hpp>
|
#include <SFML/Window/Event.hpp>
|
||||||
|
|
||||||
#include "game.h"
|
#include "game/game.h"
|
||||||
|
#include "gui/state.h"
|
||||||
|
|
||||||
class Application
|
class Application
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
enum State
|
||||||
|
{
|
||||||
|
SPLASH_SCREEN,
|
||||||
|
MAIN_MENU,
|
||||||
|
GAME_PICKER,
|
||||||
|
GAME,
|
||||||
|
EDITOR_PICKER,
|
||||||
|
EDITOR,
|
||||||
|
SETTINGS
|
||||||
|
};
|
||||||
|
|
||||||
Application();
|
Application();
|
||||||
void run();
|
void run();
|
||||||
void input();
|
void input();
|
||||||
|
@ -18,9 +31,12 @@ public:
|
||||||
void draw();
|
void draw();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
std::stack<std::shared_ptr<GUIState>> _states;
|
||||||
sf::RenderWindow _game_window;
|
sf::RenderWindow _game_window;
|
||||||
std::shared_ptr<Game> _game;
|
std::shared_ptr<Game> _game;
|
||||||
|
|
||||||
|
State _state;
|
||||||
|
|
||||||
void exec();
|
void exec();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#define GAME_H
|
#define GAME_H
|
||||||
|
|
||||||
#include <SFML/Graphics/RenderWindow.hpp>
|
#include <SFML/Graphics/RenderWindow.hpp>
|
||||||
#include "inputtype.h"
|
#include "game/inputtype.h"
|
||||||
|
|
||||||
class Game
|
class Game
|
||||||
{
|
{
|
|
@ -2,7 +2,7 @@
|
||||||
#define INPUTTYPE_H
|
#define INPUTTYPE_H
|
||||||
|
|
||||||
#include <SFML/Window/Event.hpp>
|
#include <SFML/Window/Event.hpp>
|
||||||
#include "mathutils.h"
|
#include "game/mathutils.h"
|
||||||
|
|
||||||
struct PlayerInput
|
struct PlayerInput
|
||||||
{
|
{
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "inputtype.h"
|
#include "game/inputtype.h"
|
||||||
|
|
||||||
class Note
|
class Note
|
||||||
{
|
{
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef PRECISIONEVALUATOR_H
|
#ifndef PRECISIONEVALUATOR_H
|
||||||
#define PRECISIONEVALUATOR_H
|
#define PRECISIONEVALUATOR_H
|
||||||
|
|
||||||
#include "mathutils.h"
|
#include "game/mathutils.h"
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <vector>
|
#include <vector>
|
|
@ -1,7 +1,8 @@
|
||||||
#ifndef TIMELINE_H
|
#ifndef TIMELINE_H
|
||||||
#define TIMELINE_H
|
#define TIMELINE_H
|
||||||
|
|
||||||
#include "mathutils.h"
|
#include "game/mathutils.h"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#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 "application.h"
|
||||||
#include "inputtype.h"
|
#include "game/inputtype.h"
|
||||||
|
|
||||||
#include "classicgame/classicgame.h"
|
#include "classicgame/classicgame.h"
|
||||||
#include "classicgame/classicgraphicsmanager.h"
|
#include "classicgame/classicgraphicsmanager.h"
|
||||||
|
@ -33,7 +33,6 @@ void Application::exec()
|
||||||
|
|
||||||
while (_game_window.isOpen())
|
while (_game_window.isOpen())
|
||||||
{
|
{
|
||||||
|
|
||||||
time_since_last_update += timer.restart();
|
time_since_last_update += timer.restart();
|
||||||
|
|
||||||
input();
|
input();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "mathutils.h"
|
#include "game/mathutils.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
class ClassicSprite;
|
class ClassicSprite;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#define CLASSICGAME_H
|
#define CLASSICGAME_H
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include "game.h"
|
#include "game/game.h"
|
||||||
#include "classicactions.h"
|
#include "classicactions.h"
|
||||||
#include <SFML/Audio/SoundBuffer.hpp>
|
#include <SFML/Audio/SoundBuffer.hpp>
|
||||||
#include <SFML/Audio/Sound.hpp>
|
#include <SFML/Audio/Sound.hpp>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "game/spritecontainer.h"
|
||||||
#include "classicactions.h"
|
#include "classicactions.h"
|
||||||
#include "spritecontainer.h"
|
|
||||||
#include "classicspritefactory.h"
|
#include "classicspritefactory.h"
|
||||||
|
|
||||||
#include <SFML/Graphics/RenderTarget.hpp>
|
#include <SFML/Graphics/RenderTarget.hpp>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "note.h"
|
#include "game/mathutils.h"
|
||||||
#include "classicgraphicsmanager.h"
|
#include "classicgraphicsmanager.h"
|
||||||
|
|
||||||
struct Beatmap
|
struct Beatmap
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "note.h"
|
#include "game/note.h"
|
||||||
#include "precisionevaluator.h"
|
#include "game/precisionevaluator.h"
|
||||||
#include "classicactions.h"
|
#include "classicactions.h"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "mathutils.h"
|
#include "game/mathutils.h"
|
||||||
#include "sprite.h"
|
#include "game/sprite.h"
|
||||||
#include "SFML/Graphics/RectangleShape.hpp"
|
#include "SFML/Graphics/RectangleShape.hpp"
|
||||||
#include "SFML/Graphics/Text.hpp"
|
#include "SFML/Graphics/Text.hpp"
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "timeline.h"
|
#include "game/timeline.h"
|
||||||
|
|
||||||
#include <SFML/Audio/Music.hpp>
|
#include <SFML/Audio/Music.hpp>
|
||||||
#include <SFML/System/Clock.hpp>
|
#include <SFML/System/Clock.hpp>
|
||||||
|
|
Loading…
Reference in New Issue