Exemple #1
0
// ---
void DragonWindGame::initialize ()
{
	QGAMES::ArcadeGame::initialize ();

	// Sets the icon of the game...
	mainScreen () -> setIcon (formBuilder () -> form (__DRAGONWINDICON__));

	// Add to the world its different world...
	// Initially none of them is active!
	addWorld (__DRAGONSELECTIONWORLD);
	addWorld (__DRAGONTRAININGWORLD);

	// Add to the game its different states...
	addState (new DragonWindPauseState (this), std::string (__DRAGONSTATEPAUSENAME));
	addState (new DragonWindInitialState (this), std::string (__DRAGONSTATEINITIALNAME));
	addState (new DragonWindIntroductionState (this), std::string (__DRAGONSTATEINTRODUCTIONNAME));
	addState (new DragonWindSelectionState (this), std::string (__DRAGONSTATESELECTONNAME));
	addState (new DragonWindInstructionsState (this), std::string (__DRAGONSTATEINSTRUCTIONSNAME));
	addState (new DragonWindTrainingState (this), std::string (__DRAGONSTATETRAININGNAME));
	addState (new DragonWindCountingDownState (this), std::string (__DRAGONSTATECOUNTDOWNNAME));
	addState (new DragonWindPlayingState (this), std::string (__DRAGONSTATEPLAYINGNAME));
	addState (new DragonWindEndState (this), std::string (__DRAGONSTATEENDNAME));
	addState (new DragonWindWinState (this), std::string (__DRAGONSTATEWINNAME));

	// Add to the game its different artists
	// Their visibility will depend on the world and scene the main players are in
	addArtist (_DRAGONNINJAARTIST); // The main character of the game...
	addArtist (_DRAGONNINJAARTISTB); 
	// The other main character of the game...this last one is only used during presentations!

	// The initial state...
	setState (std::string (__DRAGONSTATEINTRODUCTIONNAME));
}
Exemple #2
0
// ---
QGAMES::MapBuilder* DragonWindGame::createMapBuilder ()
{
	QGAMES::MapBuilder* result = new QGAMES::MapBuilder (std::string (__MAPSFILE__));
	result -> addAddsOn (new ObjectDragonMapsBuilderAddsOn (objectBuilder ()));
	result -> addAddsOn (new TMXDragonMapsBuilderAddsOn ((QGAMES::Sprite2DBuilder*) formBuilder ()));
	return (result);
}
Exemple #3
0
QImage NewFormWidget::grabForm(QDesignerFormEditorInterface *core,
                         QIODevice &file,
                         const QString &workingDir,
                         const qdesigner_internal::DeviceProfile &dp)
{
    qdesigner_internal::QDesignerFormBuilder formBuilder(core,
                                                         qdesigner_internal::QDesignerFormBuilder::DisableScripts,
                                                         dp);
    if (!workingDir.isEmpty())
        formBuilder.setWorkingDirectory(workingDir);

    QWidget *widget = formBuilder.load(&file, 0);
    if (!widget)
        return QImage();

    const QPixmap pixmap = QPixmap::grabWidget(widget);
    widget->deleteLater();
    return pixmap.toImage();
}
Exemple #4
0
// ---
void PacmanGame::initialize ()
{
	QGAMES::ArcadeGame::initialize ();

	// Sets the icon to the window...
	mainScreen () -> setIcon (formBuilder () -> form (__PACMANICOFORM));

	// Clean up everything...
	_artists.clear ();
	_gameStates.clear ();
	_worlds.clear ();

	// The main artist of the game, if they have not been created and inserted before...
	// The command entity creates the entities and observe them...
	_pacman = (Pacman*) entity (__ENTITYPACMAN);
	_artists.insert (QGAMES::Entities::value_type (__ENTITYPACMAN, _pacman));

	// The monsters...
	// Blinky
	_blinky = (Blinky*) entity (__ENTITYBLINKY);
	_blinky -> setMyTarget (_pacman); // Target?
	_monsters.push_back (_blinky);
	_artists.insert (QGAMES::Entities::value_type (__ENTITYBLINKY, _blinky));

	// Pinky
	_pinky = (Pinky*) entity (__ENTITYPINKY);
	_pinky -> setMyTarget (_pacman);
	_monsters.push_back (_pinky);
	_artists.insert (QGAMES::Entities::value_type (__ENTITYPINKY, _pinky));

	// Inky
	_inky = (Inky*) entity (__ENTITYINKY);
	_inky -> setMyTarget (_pacman);
	_monsters.push_back (_inky);
	_artists.insert (QGAMES::Entities::value_type (__ENTITYINKY, _inky));

	// Clyde
	_clyde = (Clyde*) entity (__ENTITYCLYDE);
	_clyde -> setMyTarget (_pacman);
	_monsters.push_back (_clyde);
	_artists.insert (QGAMES::Entities::value_type (__ENTITYCLYDE, _clyde));

	// Assign the collegues...
	_blinky -> setCollegues (_monsters);
	_pinky -> setCollegues (_monsters);
	_inky -> setCollegues (_monsters);
	_clyde -> setCollegues (_monsters);

	// Load the states...
	_gameStates.insert (QGAMES::GameStates::value_type 
		(std::string (__GAMESTATELOADINGNAME), new PacmanGameStateLoading (this)));
	_gameStates.insert (QGAMES::GameStates::value_type 
		(std::string (__GAMESTATEINITIALNAME), new GameStateInitial (this)));
	_gameStates.insert (QGAMES::GameStates::value_type 
		(std::string (__GAMESTATEPRELUDENAME), new GameStatePrelude (this)));
	_gameStates.insert (QGAMES::GameStates::value_type 
		(std::string (__GAMESTATEPRELUDESHORTNAME), new GameStatePreludeShort (this)));
	_gameStates.insert (QGAMES::GameStates::value_type 
		(std::string (__GAMESTATEPLAYINGNAME), new GameStatePlaying (this)));
	_gameStates.insert (QGAMES::GameStates::value_type 
		(std::string (__GAMESTATEMAZECLEANNAME), new GameStateMazeClean (this)));
	_gameStates.insert (QGAMES::GameStates::value_type 
		(std::string (__GAMESTATEPACMANDIESNAME), new GameStatePacmanDies (this)));
	_gameStates.insert (QGAMES::GameStates::value_type 
		(std::string (__GAMESTATEROUNDENDNAME), new GameStateRoundEnd (this)));
	_gameStates.insert (QGAMES::GameStates::value_type 
		(std::string (__GAMESTATEENDNAME), new GameStateEnd (this)));
	_gameStates.insert (QGAMES::GameStates::value_type 
		(std::string (__GAMESTATEINTROLETTERSNAME), new GameStateIntroLetters (this)));
	_gameStates.insert (QGAMES::GameStates::value_type 
		(std::string (__GAMESTATESEESCORESNAME), new GameStateSeeScore (this)));

	// When the game starts, the list of the most famous player is loaded
	// The list is something really simple to read
	_scores.clear ();
	std::ifstream scoreFile ("scores.txt");
	if (scoreFile)
	{
		std::string usr, score;
		while (!scoreFile.eof ())
		{
			scoreFile >> score >> usr;
			_scores.insert (std::pair <int, std::string> (atoi (score.c_str ()), usr));
		}

		scoreFile.close ();
	}

	// The initial state...
	setState (std::string (__GAMESTATELOADINGNAME));

	// Load the world...
	_worlds.insert (QGAMES::Worlds::value_type (__WORLDPACMAN,
		_worldBuilder -> world (__WORLDPACMAN)));

	// Sets the first level...
	setLevel (0);
}
Exemple #5
0
// ---
QGAMES::MapBuilder* PacmanGame::createMapBuilder ()
{
	QGAMES::MapBuilder* result = new QGAMES::MapBuilder (std::string (__MAPSFILE__));
	result -> addAddsOn (new MapsBuilderAddsOn ((QGAMES::Sprite2DBuilder*) (formBuilder ())));
	return (result);
}
Exemple #6
0
// ---
QGAMES::EntityBuilder* PacmanGame::createEntityBuilder ()
{ 
	return (new EntitiesBuilder (__ENTITIESFILE__, 
		formBuilder (), movementBuilder ())); 
}
Exemple #7
0
// ---
QGAMES::ObjectBuilder* DragonWindGame::createObjectBuilder ()
{
	return (new QGAMES::ObjectBuilder (std::string (__OBJECTSFILE__), formBuilder ()));
	// In this case the object builde ris used with a reference to the form builder!
}
Exemple #8
0
	virtual QGAMES::EntityBuilder* createEntityBuilder ()
							{ return (new EntityBuilderTest ("entities.xml", 
								formBuilder (), movementBuilder ())); }