Example #1
0
Application::Application(const std::string& filename)
{
    TCODParser parser;
    TCODParserStruct* app = parser.newStructure("Application");
    app->addProperty("Width",  TCOD_TYPE_INT, true);
    app->addProperty("Height", TCOD_TYPE_INT, true);

    parser.run(filename.c_str(), nullptr);

    int width = parser.getIntProperty("Width");
    int height = parser.getIntProperty("Height");
    TCODConsole::initRoot(width, height,
                          "Main Window",
                          false,
                          TCOD_RENDERER_OPENGL);

    TCODConsole::root->setDefaultBackground(TCODColor::black);
    quit = false;

    registerStates();
}
Example #2
0
Application::Application()
	: mWindow(sf::VideoMode(640, 480), "Game", sf::Style::Close)
	, mTextures()
	, mFonts()
	, mPlayer()
	, mStateStack(State::Context(mWindow, mTextures, mFonts, mPlayer))
	, mStatisticsText()
	, mStatisticsUpdateTime()
	, mStatisticsNumFrames(0)
{
	mWindow.setKeyRepeatEnabled(false);

	mFonts.load(Fonts::Main, "Media/Sansation.ttf");
	mTextures.load(Textures::TitleScreen, "Media/Textures/TitleScreen.png");

	mStatisticsText.setFont(mFonts.get(Fonts::Main));
	mStatisticsText.setPosition(5.f, 5.f);
	mStatisticsText.setCharacterSize(10u);

	registerStates();
	mStateStack.pushState(/*States::Title*/States::Game);
}
Example #3
0
Application::Application()
    : mWindow(sf::VideoMode(512, 480), "GALAGA")
    , mTextures()
    , mFonts()
    , mPlayer()
    , mStateStack(State::Context(mWindow, mTextures, mFonts, mPlayer))
    , mStatisticsText()
    , mStatisticsUpdateTime()
    , mStatisticsNumFrames(0)
{
    mWindow.setKeyRepeatEnabled(false);

    mFonts.load(Resource::Font::Galaga, "../../Media/Galaga.ttf");
    mTextures.load(Resource::Texture::Title, "../../Media/Title.png");

    mStatisticsText.setFont(mFonts.get(Resource::Font::Galaga));
    mStatisticsText.setPosition(5.f, 5.f);
    mStatisticsText.setCharacterSize(10u);

    registerStates();
    mStateStack.pushState(States::Starry);	// Start the aesthetic
    mStateStack.pushState(States::Title);	// Let's get started!
}