Commit 80228ed1 authored by Konrad McClure's avatar Konrad McClure
Browse files

autosave

parent e57ab6cc
#include <iostream>
#include "2048ScoreState.h"
#include <string>
#include <fstream>
#include <streambuf>
using namespace std;
C2048ScoreState C2048ScoreState::m_2048ScoreState;
void C2048ScoreState::Init()
{
// Load in main menu title
ifstream fs("2048ScoreTitle.txt");
fs.seekg(0, ios::end);
menuTitle.reserve(fs.tellg());
fs.seekg(0, ios::beg);
menuTitle.assign((istreambuf_iterator<char>(fs)),
istreambuf_iterator<char>());
// Set name for debugging
stateName = "2048score";
// Set first input and draw the menu
input = ' ';
Draw(nullptr);
}
void C2048ScoreState::Pause()
{
}
void C2048ScoreState::Resume()
{
input = 0;
}
void C2048ScoreState::Cleanup()
{
}
void C2048ScoreState::HandleEvents(CGameEngine* game)
{
while (game->newInput == false)
{
input = ' ';
}
input = game->input;
game->newInput = false;
}
void C2048ScoreState::Update(CGameEngine* game)
{
switch(input)
{
case 'x':
// Erase Scores
break;
default:
game->PopState();
break;
}
}
void C2048ScoreState::Draw(CGameEngine* game)
{
system("stty cooked");
cout << menuTitle << endl;
cout << "\n\n\n" << "Press w and s to move up and down, d to select" << endl;
system("stty raw");
}
#ifndef C2048SCORESTATE_H
#define C2048SCORESTATE_H
#include "GameState.h"
#include <iostream>
#include <string>
class C2048ScoreState : public CGameState
{
public:
void Init();
void Cleanup();
void Pause();
void Resume();
void HandleEvents(CGameEngine* game);
void Update(CGameEngine* game);
void Draw(CGameEngine* game);
static C2048ScoreState* Instance() { return &m_2048ScoreState; }
protected:
C2048ScoreState() {}
private:
static C2048ScoreState m_2048ScoreState;
char input;
};
#endif
\ No newline at end of file
==================================================================================
|| ___ ___ _ _ ___ _ _ _ _ _____ ||
|| |__ \ / _ \| || | / _ \ | | | (_) | | / ____| ||
|| ) | | | | || || (_) | | |__| |_ __ _| |__ | (___ ___ ___ _ __ ___ ___ ||
|| / /| | | |__ _> _ < | __ | |/ _` | '_ \ \___ \ / __/ _ \| '__/ _ \/ __| ||
|| / /_| |_| | | || (_) | | | | | | (_| | | | | ____) | (_| (_) | | | __/\__ \ ||
|| |____|\___/ |_| \___/ |_| |_|_|\__, |_| |_| |_____/ \___\___/|_| \___||___/ ||
|| __/ | ||
|| |___/ ||
==================================================================================
\ No newline at end of file
=======================================================================================
|| _____ _ _ _ _ _ _____ ||
|| / ____| | | | | | (_) | | / ____| ||
|| | (___ _ __ __ _| | _____ | |__| |_ __ _| |__ | (___ ___ ___ _ __ ___ ___ ||
|| \___ \| '_ \ / _` | |/ / _ \ | __ | |/ _` | '_ \ \___ \ / __/ _ \| '__/ _ \/ __| ||
|| ____) | | | | (_| | < __/ | | | | | (_| | | | | ____) | (_| (_) | | | __/\__ \ ||
|| |_____/|_| |_|\__,_|_|\_\___| |_| |_|_|\__, |_| |_| |_____/ \___\___/|_| \___||___/ ||
|| __/ | ||
|| |___/ ||
=======================================================================================
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment