예제 #1
0
bool MenuState::onEnter()
{
	StateParser stateParser;
	stateParser.parseState("values.xml", s_menuID, &m_gameObjects, &m_textureIDList);
	m_callbacks.push_back(0); //pushback 0 callbackID start from 1
	m_callbacks.push_back(s_menuToPlay);
	m_callbacks.push_back(s_exitFromMenu);
	// set the callbacks for menu items
	setCallbacks(m_callbacks);
	/*if (!TextureManager::Instance()->load("buttonexit.bmp", "exit", Game::Instance()->getRenderer()))
	{
		return false;
	}
	if (!TextureManager::Instance()->load("buttonstart.bmp", "start", Game::Instance()->getRenderer()))
	{
		return false;
	}
	
	GameObject *bStart = TheGameObjectFactory->CreateGameObject("MenuButton");
	bStart = new MenuButton(new LoaderParams(200, 200, 201, 72, 3, "start"), s_menuToPlay);
	m_gameObjects.push_back(bStart);
	
	GameObject *bExit = TheGameObjectFactory->CreateGameObject("MenuButton");
	bExit = new MenuButton(new LoaderParams(200, 300, 201, 72, 3, "exit"), s_exitFromMenu);
	m_gameObjects.push_back(bExit);
	*/
	
	return true;
}
예제 #2
0
bool PlayState::onEnter()
{
	StateParser stateParser;
	stateParser.parseState("text.xml", s_playID, &m_gameObjects, &m_textureIDList);
	std::cout << "entering PlayState\n";

	return true;
}
예제 #3
0
bool GameOverState::onEnter()
{
	StateParser stateParser;
	stateParser.parseState("values.xml", s_pauseID, &m_gameObjects, &m_textureIDList);
	m_callbacks.push_back(0); //pushback 0 callbackID start from 1
	m_callbacks.push_back(s_resumePlay);
	m_callbacks.push_back(s_overToMain);
	// set the callbacks for menu items
	setCallbacks(m_callbacks);
	SoundManager::Instance()->playMusic("over_music", 0);
	return true;
}
예제 #4
0
    inline bool st_search(StateParser & stparser, const char * s)
    {
        if ( stparser.empty()) {
            return false;
        }

        StatesValue stval(stparser.states(), stparser.nb_capture());

// #ifdef DISPLAY_TRACE
//         display_states(stval, stparser.root());
// #endif

        st_step_range_list_t lst;
        st_step_range_list_t l1;
        add_first(lst, l1, stparser.root());
        if (l1.empty() && lst.empty()) {
            return false;
        }
        utf8_consumer consumer(s);
        st_step_range_list_t l2;
        bool res = false;
        unsigned count = 1;
        while (consumer.valid()) {
#ifdef DISPLAY_TRACE
            std::cout << "\033[01;31mc: '" << utf8_char(consumer.getc()) << "'\033[0m\n";
#endif
            for (st_step_range_iterator_t first = lst.begin(), last = lst.end(); first != last; ++first) {
                if (stval.get_num_at(first->first) != count) {
                    l1.push_back(*first);
                }
            }
            if (l1.empty()) {
                return false;
            }
            l2.clear();
            if ((res = st_step(l1, l2, stval, consumer.bumpc(), consumer, ++count))) {
                break ;
            }
            l1.swap(l2);
        }
        if (res) {
            return true;
        }
        if (consumer.valid()) {
            return false;
        }
        for (st_step_range_iterator_t first = l1.begin(), last = l1.end(); first != last; ++first) {
            if (first->first->type == LAST) {
                return true;
            }
        }
        return false;
    }
예제 #5
0
bool PlayState::onEnter()
{
    LevelParser levelParser;
    pLevel = levelParser.parseLevel("assets/space_tilemap.tmx");

    // Parse the states file
    StateParser stateParser;
    stateParser.parseState("assets/states-config.xml", s_playID, &m_gameObjects, &m_textureIDList);
	
    std::cout << "Entering PlayState" << std::endl;
    return true;
}
예제 #6
0
bool PauseState::onEnter()
{
	StateParser stateParser;
	stateParser.parseState("test.xml", s_pauseID, &m_gameObjects, &m_textureIDList);

	m_callbacks.push_back(0);
	m_callbacks.push_back(s_pauseToMain);
	m_callbacks.push_back(s_resumePlay);
	
	setCallbacks(m_callbacks);

	return true;
}
bool MainMenuState::onEnter() {
	cout << "MenuState onEnter" << '\n';

	StateParser stateParser;
	stateParser.parseState("assets/attack.xml",s_menuID,&m_gameObjects,&m_textureIDList);
	m_callbacks.push_back(0);

	m_callbacks.push_back(s_menuToPlay);
	m_callbacks.push_back(s_exitFromMenu);
	setCallbacks(m_callbacks);

	return true;
}
예제 #8
0
bool MainMeneState::onEnter()
{
	StateParser stateParser;
	stateParser.parseState("text.xml", s_menuID, &m_gameObjects, &m_textureIDList);
	m_callbacks.push_back(0);
	m_callbacks.push_back(s_menuToPlay);
	m_callbacks.push_back(s_exitFromMenu);

	setCallbacks(m_callbacks);
	std::cout << "entering MenuState\n";

	return true;
}
예제 #9
0
bool AboutState::onEnter() {
    StateParser stateParser;
    stateParser.parseState("resources/data.json", s_aboutID, &m_gameObjects,
            &m_textureIDList, &m_fontIDList);

    if (!MenuState::onEnter()) {
        return false;
    }

    initCallbacks();

    std::cout << "entering AboutState\n";
    return true;
}
예제 #10
0
bool PauseState::onEnter()
{
    // Parse the states file
    StateParser stateParser;
    stateParser.parseState("assets/states-config.xml", s_pauseID, &m_gameObjects, &m_textureIDList);

    m_callbacks.push_back(NULL);
    m_callbacks.push_back(s_pauseToMain);
    m_callbacks.push_back(s_resumePlay);

    setCallbacks(m_callbacks);

    std::cout << "Entering PauseState" << std::endl;
    return true;
}
예제 #11
0
bool GameOverState::onEnter() {

	StateParser stateParser;
	stateParser.parseState("./Data/Tiny.xml", s_gameOverID, &m_gameObjects, &m_TextureIDList);

	m_callbacks.push_back(0);
	m_callbacks.push_back(s_menuTOMain);

	setCallbacks(m_callbacksID);

	std::cout << "Entrada al menuState\n";
	return true;


}
예제 #12
0
bool PauseState::onEnter()
{
    StateParser stateParser;
    stateParser.parseState(DATA_PREFIX "attack.xml", s_pauseID, &m_gameObjects, &m_textureIDList);
    
    m_callbacks.push_back(0);
    m_callbacks.push_back(s_pauseToMain);
    m_callbacks.push_back(s_resumePlay);
    
    setCallbacks(m_callbacks);
    
    m_loadingComplete = true;
    
    std::cout << "entering PauseState\n";
    return true;
}
예제 #13
0
bool MenuState::onEnter(){


	StateParser stateParser;
	stateParser.parseState("tiny.xml", s_menuID, &m_gameObjects, &m_textureIDList);

	m_callbacks.push_back(0);
	m_callbacks.push_back(s_menuToPlay);
	m_callbacks.push_back(s_exitFromMenu);
	setCallbacks(m_callbacks);


return true;



}
bool MainMenuState::onEnter()
{
    // parse the state
    StateParser stateParser;
    stateParser.parseState(DATA_PREFIX "conan.xml", s_menuID, &m_gameObjects, &m_textureIDList);
    
    m_callbacks.push_back(0);
    m_callbacks.push_back(s_menuToPlay);
    m_callbacks.push_back(s_exitFromMenu);
    
    // set the callbacks for menu items
    setCallbacks(m_callbacks);
    
    m_loadingComplete = true;
    std::cout << "entering MenuState\n";
    return true;
}
예제 #15
0
bool MenuState::onEnter()
{
	SoundManager::Instance()->playMusic("SongMenu", -1);
	SDL_Renderer* render;
	render = Game::Instance()->getRender();
	SDL_SetRenderDrawColor(render, 255, 229, 204, 255);
	Game::Instance()->setRender(render);
	// parse the state
	StateParser stateParser;
	stateParser.parseState("assets/images.xml", s_menuID, &m_gameObjectsMenuState, &m_textureIDList);
	m_callbacksMenu.push_back(0); //pushback 0 callbackID start from 1
	m_callbacksMenu.push_back(s_menuToPlay);
	m_callbacksMenu.push_back(s_exitFromMenu);
	// set the callbacks for menu items
	setCallbacks(m_callbacksMenu);

	return true;
}
예제 #16
0
bool MenuState::onEnter() {

	if (!TextureManager::Instance()->load("play.bmp", "play", Game::Instance()->getRender())) {
		return false;
	}
	if (!TextureManager::Instance()->load("exit.bmp", "exit", Game::Instance()->getRender())) {
		return false;
	}

	StateParser stateParser;
	stateParser.parseState("XMLFile.xml", s_menuID, &m_gameObjects, &m_textureIDList);

	m_callbacks.push_back(0); //El primero vacío
	m_callbacks.push_back(s_menuToPlay);
	m_callbacks.push_back(s_exitFromMenu);
	setCallbacks(m_callbacks);
	
	return true;
}
예제 #17
0
bool PlayState::onEnter() {

	StateParser stateParser;
	stateParser.parseState("./Data/Tiny.xml", s_playID, &m_gObjects, &m_TextureIDList);

	LevelParser levelParser;
	pLevel = levelParser.parseLevel("./Data/mapaObjetos.tmx");

	//layerParser.parseTileLayer("./Data/mapa1.tmx");
	

	m_callbacks.push_back(0);
	setCallbacks();

	SoundManager::Instance()->playMusic("play", -1);

	/*player = new Player();
	zep = new Zep();
	gordo = new Gordo();

	TextureManager::Instance()->load("Kirby.bmp", "player", Game::Instance()->getRender());
	TextureManager::Instance()->load("ZepS.bmp", "zep", Game::Instance()->getRender());
	TextureManager::Instance()->load("GordoS.bmp", "gordo", Game::Instance()->getRender());

	load = new LoaderParams(100, 100, 35, 32,10, "player",0);
	load2 = new LoaderParams(200, 200, 89, 78,4, "zep",0);
	load3 = new LoaderParams(400, 300, 50, 70,4, "gordo", 0);

	player->load(load);
	m_gObjects.push_back(player);

	zep->load(load2);
	m_gObjects.push_back(zep);

	gordo->load(load3);
	m_gObjects.push_back(gordo);*/

	

	return true;
}
    inline bool st_exact_search(StateParser & stparser, const char * s)
    {
        if ( stparser.empty() ) {
            return false;
        }

        StatesValue stval(stparser.states(), stparser.nb_capture());

// #ifdef DISPLAY_TRACE
//         display_states(stval, stparser.root());
// #endif

        st_step_range_list_t l1;
        add_first(l1, l1, stparser.root());
        if (l1.empty()) {
            return false;
        }
        utf8_consumer consumer(s);
        st_step_range_list_t l2;
        bool res = false;
        unsigned count = 1;
        while (consumer.valid() && !(res = st_exact_step(l1, l2, stval, consumer.bumpc(), consumer, ++count))) {
#ifdef DISPLAY_TRACE
            std::cout << "\033[01;31mc: '" << utf8_char(consumer.getc()) << "'\033[0m\n";
#endif
            if (l2.empty()) {
                return false;
            }
            l1.swap(l2);
            l2.clear();
        }

        if (consumer.valid()) {
            return false;
        }
        if (res) {
            return true;
        }
        return false;
    }