Exemple #1
0
void	MainMenu::construct(const sf::Texture &texture, Settings &set,
			    const std::vector<APanelScreen *> &panels)
{
  Widget	*wBackground = new Widget("background", {0, 0, SIZEX, SIZEY});
  Widget	*wMback = new Widget("menuback", {30, 100, 300, 600});
  Widget	*wMenuTitle = new Widget("menu-title", {30, 100, 300, 70},
  					 sf::Text("MAIN", _font["default"], 40));
  Widget	*wPlay = new Widget("play", {50, 200, 260, 60},
  				    sf::Text("PLAY ONLINE", _font["default"], 30));
  Widget	*wOpt = new Widget("opt", {50, 280, 260, 60},
				   sf::Text("OPTION", _font["default"], 30));
  Widget	*wQuit = new Widget("quit", {50, 360, 260, 60},
				    sf::Text("QUIT", _font["default"], 30));

  createBgPanel(texture, wBackground, wMback, wMenuTitle);
  createPlayButton(wPlay);
  createOptButton(wOpt);
  createQuitButton(wQuit);

  wPlay->addObserver(this);
  wPlay->addObserver(panels[1]);
  wOpt->addObserver(panels[0]);

  _widgets.push_back(wBackground);
  _widgets.push_back(wMback);
  _widgets.push_back(wMenuTitle);
  _widgets.push_back(wPlay);
  _widgets.push_back(wOpt);
  _widgets.push_back(wQuit);
  resizeWidgets({std::stof(set.getCvarList().getCvar("r_width")),
	std::stof(set.getCvarList().getCvar("r_height"))});
}
Exemple #2
0
bool GameScene::init()
{
	bool bRet = false;
	do
	{
		CC_BREAK_IF(!Scene::init());

		createQuitButton("QuitNormal.png", "QuitSelected.png");
		
		stateMachine = StateMachine::createWithGameScene(this);
		stateMachine->changeState(StartState::create(this));

		score = 0;
		bossFlag = false;

		srand(time(0));
		this->scheduleUpdate();

		//auto rootNode = CSLoader::createNode("MainScene.csb");
		//addChild(rootNode);

		bRet = true;
	} while (0);
	return bRet;
}
Exemple #3
0
bool GameScene::init()
{
	bool bRet = false;
	do
	{
		CC_BREAK_IF(!Scene::init());

		//auto rootNode = CSLoader::createNode("MainScene.csb");
		//addChild(rootNode);

		createQuitButton("images/QuitNormal.png", "images/QuitSelected.png"); //添加退出游戏按钮
		stateMachine = StateMachine::createWithGameScene(this); //创建状态机
		stateMachine->changeState(StartState::create(this)); //进入准备开始游戏状态
		this->scheduleUpdate();

		bRet = true;
	} while (0);
	return bRet;
}
Exemple #4
0
Dialog::Dialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Dialog)
{
    ui->setupUi(this);
    this->setWindowTitle("Competing Species");

    QVBoxLayout *main_layout = new QVBoxLayout;

    createInitialPopulationForm();
    createOutputLabels();
    createQuitButton();

    main_layout->addWidget(form_group_box);
    main_layout->addWidget(output_group_box);
    main_layout->addWidget(quit_group_box);

    setLayout(main_layout);

}
bool GameScene::init()
{
	bool bRet = false;
	do
	{
		CC_BREAK_IF(!Scene::init());

		prevAngle = NOANGLE;
		prevPosition = NOCHOOSE;
		start = NOCHOOSE;
		end = NOCHOOSE;

		restFlag = false;

		lead = NULL;

		enoughPrepareColor = Color4F::MAGENTA;
		notEnoughPrepareColor = Color4F::GRAY;
		actionColor = Color4F::ORANGE;
		enoughColor = Color3B::GREEN;
		notEnoughColor = Color3B::RED;

		initMoveableLayerGroup();
		initControllerLayerGroup();
		initInformationLayerGroup();

		initData();
		createQuitButton();

		initStateMachine();
		scheduleUpdate();

		bRet = true;
	} while (0);
	return bRet;
}