2023-02-24 23:46:34 -05:00
|
|
|
#include "MenuScene.h"
|
|
|
|
|
#include "ActionCode.h"
|
|
|
|
|
|
|
|
|
|
MenuScene::MenuScene(GameEngine* g) : Scene(g)
|
|
|
|
|
{
|
|
|
|
|
text.setFont(game->getFont());
|
2023-07-13 23:01:09 -04:00
|
|
|
text.setString("McRogueFace Engine - r/RoguelikeDev Tutorial 2023");
|
2023-02-24 23:46:34 -05:00
|
|
|
text.setCharacterSize(24);
|
|
|
|
|
//std::cout << "MenuScene Initialized. " << game << std::endl;
|
|
|
|
|
//std::cout << "Font: " << game->getFont().getInfo().family << std::endl;
|
|
|
|
|
|
|
|
|
|
text2.setFont(game->getFont());
|
2023-03-12 00:32:27 -05:00
|
|
|
text2.setString("Press 'Spacebar' to run demo");
|
2023-02-24 23:46:34 -05:00
|
|
|
text2.setCharacterSize(16);
|
|
|
|
|
text2.setPosition(0.0f, 50.0f);
|
2023-07-08 19:42:47 -04:00
|
|
|
|
|
|
|
|
text3.setFont(game->getFont());
|
|
|
|
|
text3.setString("use 'W' 'A' 'S' 'D' to move (even when blank; it's a bug)");
|
|
|
|
|
text3.setCharacterSize(16);
|
|
|
|
|
text3.setPosition(0.0f, 80.0f);
|
2023-02-24 23:46:34 -05:00
|
|
|
|
|
|
|
|
registerAction(ActionCode::KEY + sf::Keyboard::Space, "start_game");
|
|
|
|
|
registerAction(ActionCode::KEY + sf::Keyboard::Up, "up");
|
|
|
|
|
registerAction(ActionCode::KEY + sf::Keyboard::Down, "down");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MenuScene::update()
|
|
|
|
|
{
|
|
|
|
|
//std::cout << "MenuScene update" << std::endl;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MenuScene::doAction(std::string name, std::string type)
|
|
|
|
|
{
|
|
|
|
|
//std::cout << "MenuScene doAction: " << name << ", " << type << std::endl;
|
|
|
|
|
//if (name.compare("start_game") == 0 and type.compare("start") == 0)
|
|
|
|
|
if(ACTION("start_game", "start"))
|
2023-03-12 00:32:27 -05:00
|
|
|
game->changeScene("py");
|
|
|
|
|
/*
|
2023-02-24 23:46:34 -05:00
|
|
|
else if(ACTIONONCE("up"))
|
2023-02-28 23:19:43 -05:00
|
|
|
game->getWindow().setSize(sf::Vector2u(1280, 800));
|
2023-02-24 23:46:34 -05:00
|
|
|
else if(ACTIONONCE("down"))
|
2023-02-28 23:19:43 -05:00
|
|
|
game->getWindow().setSize(sf::Vector2u(1024, 768));
|
2023-03-12 00:32:27 -05:00
|
|
|
*/
|
2023-02-24 23:46:34 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MenuScene::sRender()
|
|
|
|
|
{
|
|
|
|
|
game->getWindow().clear();
|
|
|
|
|
game->getWindow().draw(text);
|
|
|
|
|
game->getWindow().draw(text2);
|
2023-07-08 19:42:47 -04:00
|
|
|
game->getWindow().draw(text3);
|
2023-02-24 23:46:34 -05:00
|
|
|
game->getWindow().display();
|
|
|
|
|
}
|