Ejemplo n.º 1
0
void handleMenuButtons(entity **menuButtons, baseEntity *mouse, SDL_Event *events, int *inBattle, int *success)
{
	if(checkButtonClicked(mouse, menuButtons[START_BUT_MENU], events) == SUCCESS && *inBattle != SUCCESS)
	{			
		*inBattle = SUCCESS;
	}
	if(checkButtonClicked(mouse, menuButtons[QUIT_BUT_MENU], events) == SUCCESS & *success == SUCCESS)
	{
		*success = FAIL;
	}
	

}
Ejemplo n.º 2
0
AddMusicList::AddMusicList(QWidget *parent) : QDialog(parent)
{
	m_okButton = new QPushButton("确定");
	m_cancelButton = new QPushButton("取消");
	m_nameLineEdit = new QLineEdit;
	m_nameLineEdit->setFixedWidth(180);
	m_pathLineEdit = new QLineEdit;
	m_pathLineEdit->setFixedWidth(130);
	m_checkPathButton = new QPushButton("浏览");
	m_checkPathButton->setFixedWidth(40);

	connect(m_okButton, SIGNAL(clicked()), this, SLOT(okButtonClicked()));
	connect(m_cancelButton, SIGNAL(clicked()), this, SLOT(accept()));
	connect(m_checkPathButton, SIGNAL(clicked()), this, SLOT(checkButtonClicked()));

	QLabel *nameLabel = new QLabel("歌单名称");
	QLabel *pathLabel = new QLabel("歌曲路径");

	QHBoxLayout *name = new QHBoxLayout;
	name->addWidget(nameLabel, 0, Qt::AlignLeft | Qt::AlignVCenter);
	name->addSpacing(5);
	name->addWidget(m_nameLineEdit, 0, Qt::AlignVCenter);
	name->setContentsMargins(5, 5, 5, 5);

	QHBoxLayout *path = new QHBoxLayout;
	path->addWidget(pathLabel, 0, Qt::AlignLeft | Qt::AlignVCenter);
	path->addSpacing(5);
	path->addWidget(m_pathLineEdit, Qt::AlignVCenter);
	path->addWidget(m_checkPathButton, 0, Qt::AlignRight | Qt::AlignVCenter);
	path->setContentsMargins(5, 5, 5, 5);

	QHBoxLayout *button = new QHBoxLayout;
	button->addWidget(m_okButton, 0, Qt::AlignVCenter | Qt::AlignHCenter);
	button->addSpacing(10);
	button->addWidget(m_cancelButton, 0, Qt::AlignVCenter | Qt::AlignHCenter);
	button->setContentsMargins(5, 5, 5, 5);

	QVBoxLayout *mainLayout = new QVBoxLayout(this);
	mainLayout->addLayout(name);
	mainLayout->addLayout(path);
	mainLayout->addLayout(button);
	mainLayout->setContentsMargins(5, 5, 5, 5);
}
Ejemplo n.º 3
0
void handleGameButtons(entity **gameButtons, entity **men, baseEntity **corpses, soldiers *army, baseEntity *mouse, SDL_Event *events, int *success, options *opt, Mix_Chunk **deathsounds, soldiers *bullets, entity *shell, entity *gas, Mix_Chunk **explosionSounds, int *points)
{
	
	if(checkButtonClicked(mouse, gameButtons[ANZACBUY], events) == SUCCESS)
	{
		if(*points > men[ANZACSPR]->cost)
		{
			newSquad(army,opt,men[ANZACSPR], corpses,success, deathsounds);
			fprintf(stderr, "%d \n", men[ANZACSPR]->cost);
			*points -= men[ANZACSPR]->cost;
		}
		
	}
	else if(checkButtonClicked(mouse, gameButtons[BEFBUY], events) == SUCCESS)
	{
		if(*points > men[BEFSPR]->cost)
		{
			newSquad(army,opt,men[BEFSPR], corpses,success, deathsounds);
			*points -= men[BEFSPR]->cost;
		}
	}
	else if(checkButtonClicked(mouse, gameButtons[ARTILLERYBUY], events) == SUCCESS && *success == SUCCESS)
	{
		if(*points > shell->cost)
		{
			newShells(bullets, opt, shell, success, explosionSounds, BRITISH);
			*points -= shell->cost;
		}
	}
	else if(checkButtonClicked(mouse, gameButtons[GASBUY], events) == SUCCESS && *success == SUCCESS)
	{
		if(*points > gas->cost)
		{
			newShells(bullets, opt, gas, success, explosionSounds, BRITISH);
			*points -= gas->cost;
		}
	}
	else if(checkButtonClicked(mouse, gameButtons[AUDIO_ONBUT], events) == SUCCESS)
	{
		Mix_Volume(-1, MAX_VOL);
	
	}
	else if(checkButtonClicked(mouse, gameButtons[AUDIO_OFFBUT], events) == SUCCESS)
	{
		Mix_Volume(-1, MIN_VOL);
	
	}


}