Add main headers
This commit is contained in:
parent
bd0dc22e1d
commit
aa19fff3dd
58
src/Main.cpp
58
src/Main.cpp
@ -1,51 +1,23 @@
|
|||||||
#include <iostream>
|
|
||||||
#include <SFML/Graphics.hpp>
|
#include <SFML/Graphics.hpp>
|
||||||
|
|
||||||
int main(int argc, char const *argv[])
|
#include "Model/Chart.hpp"
|
||||||
{
|
#include "Model/MusicList.hpp"
|
||||||
|
#include "Model/Score.hpp"
|
||||||
|
|
||||||
|
#include "Screens/MusicSelect.hpp"
|
||||||
|
#include "Screens/Gameplay.hpp"
|
||||||
|
#include "Screens/Result.hpp"
|
||||||
|
|
||||||
|
int main(int argc, char const *argv[]) {
|
||||||
sf::RenderWindow window(sf::VideoMode(800,600), "jujube");
|
sf::RenderWindow window(sf::VideoMode(800,600), "jujube");
|
||||||
window.setVerticalSyncEnabled(true);
|
window.setVerticalSyncEnabled(true);
|
||||||
|
Screen::MusicSelect music_select;
|
||||||
bool fullscreen = false;
|
while (true) {
|
||||||
while (window.isOpen())
|
Chart& selected_chart = music_select.display(window);
|
||||||
{
|
Screen::Gameplay gameplay(selected_chart);
|
||||||
sf::Event event;
|
Score score = gameplay.display(window);
|
||||||
while (window.pollEvent(event))
|
Screen::Result result(score);
|
||||||
{
|
result.display(window);
|
||||||
switch (event.type)
|
|
||||||
{
|
|
||||||
case sf::Event::KeyPressed:
|
|
||||||
switch (event.key.code)
|
|
||||||
{
|
|
||||||
case sf::Keyboard::Enter:
|
|
||||||
if (event.key.alt)
|
|
||||||
{
|
|
||||||
window.close();
|
|
||||||
if (fullscreen)
|
|
||||||
{
|
|
||||||
window.create(sf::VideoMode(800,600), "jujube");
|
|
||||||
} else {
|
|
||||||
auto width = sf::VideoMode::getDesktopMode().width;
|
|
||||||
auto height = sf::VideoMode::getDesktopMode().height;
|
|
||||||
window.create(sf::VideoMode(width,height), "jujube", sf::Style::Fullscreen);
|
|
||||||
}
|
|
||||||
fullscreen = not fullscreen;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case sf::Event::Closed:
|
|
||||||
window.close();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
window.clear(sf::Color::Black);
|
|
||||||
window.display();
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
6
src/Model/Chart.hpp
Normal file
6
src/Model/Chart.hpp
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
class Chart {
|
||||||
|
public:
|
||||||
|
Chart();
|
||||||
|
};
|
6
src/Model/MusicList.hpp
Normal file
6
src/Model/MusicList.hpp
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
class MusicList {
|
||||||
|
public:
|
||||||
|
MusicList();
|
||||||
|
};
|
6
src/Model/Score.hpp
Normal file
6
src/Model/Score.hpp
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
class Score {
|
||||||
|
public:
|
||||||
|
Score();
|
||||||
|
};
|
15
src/Screens/Gameplay.hpp
Normal file
15
src/Screens/Gameplay.hpp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <SFML/Window.hpp>
|
||||||
|
#include "../Model/Chart.hpp"
|
||||||
|
#include "../Model/Score.hpp"
|
||||||
|
|
||||||
|
namespace Screen {
|
||||||
|
class Gameplay {
|
||||||
|
const Chart& chart;
|
||||||
|
public:
|
||||||
|
explicit Gameplay(const Chart& selected_chart);
|
||||||
|
Score display(sf::Window& window) const;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
14
src/Screens/MusicSelect.hpp
Normal file
14
src/Screens/MusicSelect.hpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <SFML/Window.hpp>
|
||||||
|
#include "../Model/MusicList.hpp"
|
||||||
|
#include "../Model/Chart.hpp"
|
||||||
|
|
||||||
|
namespace Screen {
|
||||||
|
class MusicSelect {
|
||||||
|
MusicList music_list;
|
||||||
|
public:
|
||||||
|
MusicSelect();
|
||||||
|
Chart& display(sf::Window& window) const;
|
||||||
|
};
|
||||||
|
};
|
13
src/Screens/Result.hpp
Normal file
13
src/Screens/Result.hpp
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <SFML/Window.hpp>
|
||||||
|
#include "../Model/Score.hpp"
|
||||||
|
|
||||||
|
namespace Screen {
|
||||||
|
class Result {
|
||||||
|
const Score& score;
|
||||||
|
public:
|
||||||
|
explicit Result(const Score& score);
|
||||||
|
void display(sf::Window& window);
|
||||||
|
};
|
||||||
|
};
|
Loading…
x
Reference in New Issue
Block a user