Renamed the Restart scene to CleanUp

This commit is contained in:
Kayne Ruse
2014-06-15 22:39:10 +10:00
parent 5c74ecdd72
commit 618666de43
11 changed files with 26 additions and 28 deletions
+12 -12
View File
@@ -19,7 +19,7 @@
* 3. This notice may not be removed or altered from any source
* distribution.
*/
#include "restart.hpp"
#include "clean_up.hpp"
#include "channels.hpp"
@@ -29,7 +29,7 @@
//Public access members
//-------------------------
Restart::Restart(
CleanUp::CleanUp(
ConfigUtility* const argConfig,
UDPNetworkUtility* const argNetwork,
int* const argClientIndex,
@@ -77,7 +77,7 @@ Restart::Restart(
startTick = std::chrono::steady_clock::now();
}
Restart::~Restart() {
CleanUp::~CleanUp() {
//
}
@@ -85,7 +85,7 @@ Restart::~Restart() {
//Frame loop
//-------------------------
void Restart::Update(double delta) {
void CleanUp::Update(double delta) {
if (std::chrono::steady_clock::now() - startTick > std::chrono::duration<int>(10)) {
QuitEvent();
}
@@ -94,14 +94,14 @@ void Restart::Update(double delta) {
while(network.Receive());
}
void Restart::RenderFrame() {
void CleanUp::RenderFrame() {
SDL_FillRect(GetScreen(), 0, 0);
Render(GetScreen());
SDL_Flip(GetScreen());
fps.Calculate();
}
void Restart::Render(SDL_Surface* const screen) {
void CleanUp::Render(SDL_Surface* const screen) {
backButton.DrawTo(screen);
font.DrawStringTo("You have been disconnected.", screen, 50, 30);
}
@@ -110,28 +110,28 @@ void Restart::Render(SDL_Surface* const screen) {
//Event handlers
//-------------------------
void Restart::QuitEvent() {
void CleanUp::QuitEvent() {
SetNextScene(SceneList::QUIT);
}
void Restart::MouseMotion(SDL_MouseMotionEvent const& motion) {
void CleanUp::MouseMotion(SDL_MouseMotionEvent const& motion) {
backButton.MouseMotion(motion);
}
void Restart::MouseButtonDown(SDL_MouseButtonEvent const& button) {
void CleanUp::MouseButtonDown(SDL_MouseButtonEvent const& button) {
backButton.MouseButtonDown(button);
}
void Restart::MouseButtonUp(SDL_MouseButtonEvent const& button) {
void CleanUp::MouseButtonUp(SDL_MouseButtonEvent const& button) {
if (backButton.MouseButtonUp(button) == Button::State::HOVER) {
SetNextScene(SceneList::MAINMENU);
}
}
void Restart::KeyDown(SDL_KeyboardEvent const& key) {
void CleanUp::KeyDown(SDL_KeyboardEvent const& key) {
//
}
void Restart::KeyUp(SDL_KeyboardEvent const& key) {
void CleanUp::KeyUp(SDL_KeyboardEvent const& key) {
//
}
+5 -5
View File
@@ -19,8 +19,8 @@
* 3. This notice may not be removed or altered from any source
* distribution.
*/
#ifndef RESTART_HPP_
#define RESTART_HPP_
#ifndef CLEANUP_HPP_
#define CLEANUP_HPP_
//network
#include "udp_network_utility.hpp"
@@ -44,10 +44,10 @@
//std namespace
#include <chrono>
class Restart : public BaseScene {
class CleanUp : public BaseScene {
public:
//Public access members
Restart(
CleanUp(
ConfigUtility* const argConfig,
UDPNetworkUtility* const argNetwork,
int* const argClientIndex,
@@ -57,7 +57,7 @@ public:
std::map<int, CharacterData>* argCharacterMap,
std::map<int, EnemyData>* argEnemyMap
);
~Restart();
~CleanUp();
protected:
//Frame loop
+3 -3
View File
@@ -37,7 +37,7 @@
#include "lobby_menu.hpp"
#include "in_world.hpp"
#include "in_combat.hpp"
#include "restart.hpp"
#include "clean_up.hpp"
//-------------------------
//Public access members
@@ -132,8 +132,8 @@ void ClientApplication::LoadScene(SceneList sceneIndex) {
case SceneList::INCOMBAT:
activeScene = new InCombat(&config, &network, &clientIndex, &accountIndex, &characterIndex, &combatMap, &characterMap, &enemyMap);
break;
case SceneList::RESTART:
activeScene = new Restart(&config, &network, &clientIndex, &accountIndex, &characterIndex, &combatMap, &characterMap, &enemyMap);
case SceneList::CLEANUP:
activeScene = new CleanUp(&config, &network, &clientIndex, &accountIndex, &characterIndex, &combatMap, &characterMap, &enemyMap);
break;
default:
throw(std::logic_error("Failed to recognize the scene index"));
+1 -1
View File
@@ -163,7 +163,7 @@ void InCombat::HandlePacket(SerialPacket* const argPacket) {
}
void InCombat::HandleDisconnect(SerialPacket* const) {
SetNextScene(SceneList::RESTART);
SetNextScene(SceneList::CLEANUP);
}
//TODO: more network handlers
+1 -1
View File
@@ -277,7 +277,7 @@ void InWorld::HandlePacket(SerialPacket* const argPacket) {
}
void InWorld::HandleDisconnect(SerialPacket* const argPacket) {
SetNextScene(SceneList::RESTART);
SetNextScene(SceneList::CLEANUP);
}
void InWorld::HandleCharacterNew(CharacterPacket* const argPacket) {
+1 -1
View File
@@ -224,7 +224,7 @@ void LobbyMenu::HandleBroadcastResponse(ServerPacket* const argPacket) {
server.playerCount = argPacket->playerCount;
server.version = argPacket->version;
//NOTE: Check compatibility here
//Checking compatibility
server.compatible = server.version == NETWORK_VERSION;
//push
+1 -1
View File
@@ -35,7 +35,7 @@ enum class SceneList {
LOBBYMENU,
INWORLD,
INCOMBAT,
RESTART,
CLEANUP,
};
#endif