Exemple #1
0
void GameMenuScene::setupConfigButtons(LinearLayout* parentLayout)
{
	SvgButton* infoButton = new SvgButton("ge_button_information", this);
	SvgButton* rewardsButton = new SvgButton("ge_button_rewards", this);
	SvgButton* configButton = new SvgButton("ge_button_config", this);

	LinearLayout* configButtonLayout = new LinearLayout(Qt::Horizontal);
	configButtonLayout->addItem(infoButton, 1.0 / 3.0);
	configButtonLayout->addItem(rewardsButton, 1.0 / 3.0);
	configButtonLayout->addItem(configButton, 1.0 / 3.0);
	parentLayout->addLayout( configButtonLayout, 1.0 / 6.0 );

	infoButton->setPaddings(0.15, 0.0, 0.15, 0.4);
	rewardsButton->setPaddings(0.15, 0.2, 0.15, 0.2);
	configButton->setPaddings(0.15, 0.4, 0.15, 0.0);

	infoButton->alignCenter();
	rewardsButton->alignCenter();
	configButton->alignCenter();

	connect(infoButton, SIGNAL(pressed()), this, SLOT(infoButtonPressed()));
	connect(rewardsButton, SIGNAL(pressed()), this, SLOT(rewardsButtonPressed()));
	connect(configButton, SIGNAL(pressed()), this, SLOT(configButtonPressed()));

	// ToDo: implement these buttons, disabled meanwhile
	infoButton->setEnabled(false);
	rewardsButton->setEnabled(false);
	configButton->setEnabled(false);
}
Exemple #2
0
GameMenuScene::GameMenuScene(Stage* stage, QGraphicsItem* parent)
	: Scene(mapSceneName(sceneGameMenu), stage, parent)
{
	setBackground("gm_background");

	LinearLayout* leftLayout = new LinearLayout(Qt::Vertical);
	Actor* gameTitle = new Actor("ge_game_title", this);
	gameTitle->setPaddings(0.1);
	leftLayout->addItem(gameTitle, 0.2);

	LinearLayout* centralLayout = new LinearLayout(Qt::Horizontal);
	leftLayout->addLayout(centralLayout, 0.8);
	Actor* robot = new Actor("ge_robot", this);
	robot->setPaddings(0.2);
	centralLayout->addItem(robot, 0.5);
	robot->alignCenter();
	centralLayout->addStretch(0.5);

	LinearLayout* rightLayout = new LinearLayout(Qt::Vertical);
	setupButtons(rightLayout);

	LinearLayout* globalLayout = new LinearLayout(Qt::Horizontal);
	globalLayout->addLayout(leftLayout, 0.7);
	globalLayout->addLayout(rightLayout, 0.3);
	setLayout(globalLayout);

	// This is the last scene loaded
	QSettings settings;
	settings.setValue( sk("Application/LastScene"), sceneName );
}