Exemple #1
0
//=============================================================================
// MenuManager::Quit
//
//=============================================================================
int GameEngine::Quit(void)
{
	char c='\0';

	BM.TypeString(63, 6, "               \0", m_color(R_BLUE,R_GREY,0,1));
	BM.TypeString(79, 6, "_", m_color(R_BLUE, R_BROWN, 1,1));
	BM.TypeString(64, 6, "End this game?\0", m_color(R_BLUE,R_GREY,0,1));

	// check answer
	while ( (c!='y') && (c!='Y') && (c!='n') && (c!='N') )
	{
		// read a key from the keyboard buffer.
		c=MM.GetChar();
	}

	// if yes was typed, pass the exit code to the calling loop.
	if (c=='y' || c=='Y')
		return 1;
	else
	{
		// otherwise, redraw the GAMNEMENU and return the exit code.
		MM.DrawMenu(GAMEMENU);
		return 0;
	}
}
Exemple #2
0
void Update()
{
  switch (state)
  {
    case MENU:
      game->Update();
      menuManager.Update();
      
      if (menuManager.StartGame()) 
      {
        state = GAME;
        game->SetDemoMode(false);
      }
      break;
    case GAME:
      game->Update();

      if (game->QuitGame())
      {
        state = MENU;
        game = new Game();
      }
      break;
  }

  Display();
}
Exemple #3
0
ITSMenu& PlayListPane::GetInternalMenu(MenusEnum mnu)
{
	TRACEST(_T("PlayListPane::GetMenu."), mnu);
	ASSERT(mnu < M_Last);
	PrgAPI* pAPI = PRGAPI();
	if (m_pMenu[mnu] == NULL)
		m_pMenu[mnu] = pAPI->CreatePopupMenu();
	ITSMenu& curMenu = *m_pMenu[mnu];
	if (curMenu.GetInternalHandler() != NULL)
		return curMenu;
	curMenu.Create();
	switch (mnu)
	{
	case M_Main:
		{
			MenuManager* pMM = pAPI->GetMenuManager();
			curMenu.AppendMenu(ITSMenu::MIT_Menu, 
				(INT)pMM->GetMenu(MenuManager::MNU_PlayListModes).GetInternalHandler(), (LPTSTR)pAPI->GetString(IDS_MODE));
			
			curMenu.AppendMenu(ITSMenu::MIT_Menu, 
				(INT)pMM->GetMenu(MenuManager::MNU_PlayListSerialization).GetInternalHandler(), (LPTSTR)pAPI->GetString(IDS_PLAYLIST));

			curMenu.AppendMenu(ITSMenu::MIT_Separator, NULL, NULL);
			curMenu.AppendMenu(ITSMenu::MIT_String, MI_ShowNumbers, (LPTSTR)pAPI->GetString(IDS_SHOWNUMBERS));
		}
		break;
	default:
		ASSERT(0);
	}
	return curMenu;
}
Exemple #4
0
ITSMenu* PlayListPane::GetMenu(UINT idx)
{
	switch (idx)
	{
	case BTN_Options:
		{
			PrgAPI* pAPI = PRGAPI();
			MediaPlayer* pPlayer = pAPI->GetMediaPlayer();
			MenuManager* pMM = pAPI->GetMenuManager();
			MenuCommandsEnum cmd = (MenuCommandsEnum) idx;
			ITSMenu& mnu = GetInternalMenu(M_Main);
			pMM->PreparePlayerCommands(*pPlayer);
			mnu.CheckMenuItem(MI_ShowNumbers, m_PlayList.GetConfigurationOption(CPlayListListCtrl::C_ShowNumbers) != 0);
			return &mnu;
		}
		break;
	case BTN_QuickSearch:
		{
			PrgAPI* pAPI = PRGAPI();
			QuickSearchDlg* pQSDlg = pAPI->GetQuickSearchDlg();
			pQSDlg->SetSearchText(_T(""));
			pQSDlg->ShowRelative(AfxGetMainWnd(), QuickSearchDlg::RP_Centered);
			return NULL;
		}
		break;
	default:
		return NULL;
	}
	return NULL;
}
Exemple #5
0
int main()
{
	sf::VideoMode videoMode(WINDOW_WIDTH, WINDOW_HEIGHT);
	sf::RenderWindow window(videoMode, "~~~Tower Defense!~~~");
	window.setFramerateLimit(FRAME_RATE);

	shared_ptr<AudioManager> audio = AudioManager::getAudioManager();
	audio->play();

	MenuManager* menuManager = MenuManager::getMenuManager();
	menuManager->addMenu(make_shared<StartMenu>(START_MENU_TEXTURE, sf::Vector2u(1100, 600), sf::Vector2i(0, 0)));

	while (window.isOpen())
	{
		window.clear();

		sf::Event event;
		while (window.pollEvent(event))
		{
			if ((event.type == sf::Event::Closed) ||
				(menuManager->getExitFlag() == true))
				window.close();
			
			menuManager->resolveEvent(event);
		}

		menuManager->display(window);
		window.display();
	
	}
	return EXIT_SUCCESS;
}
void StartMenu::startGame()
{
	MenuManager* m = MenuManager::getMenuManager();

	m->popMenu();
	m->addMenu(make_shared<GameMenu>(GAME_MENU_DEFAULT_TEXTURE, sf::Vector2u(WINDOW_WIDTH, WINDOW_HEIGHT), sf::Vector2i(0, 0)));

	//this -> ~StartMenu();
}
bool ContactManager::onContactBeginPro_Wall(){

    target_pro = node_Pro->getScheduler()->pauseAllTargets();
    MenuManager menuManager;
    
    Node* layer =menuManager.create_Menu(FAIL_LAYER);
    node_else->getParent()->addChild(layer);
    
    MenuManager::move_in(layer);

    return false;
}
Exemple #8
0
int main(int, char*[]) {
   try {
      //Manager manager;
      //manager.play();
	  MenuManager menuManager;
      menuManager.play();
   }
   catch (const string& msg) { std::cout << msg << std::endl; }
   catch (...) {
      std::cout << "Oops, someone threw an exception!" << std::endl;
   }
   return 0;
}
void CTeenSpiritDlg::ShowTrayMenu(CPoint& pt)
{

	PrgAPI* pAPI = PRGAPI();
	MenuManager* pMM = pAPI->GetMenuManager();
	ITSMenu& trayMenu = pMM->GetMenu(MenuManager::MNU_Tray);
	pMM->PrepareMenu(MenuManager::MNU_Tray);
	pMM->PreparePlayerCommands(*pAPI->GetMediaPlayer());
	//=== This handling is done because otherwise the menu will not disappear when the user clicks outside
	SetForegroundWindow();
	trayMenu.TrackPopupMenu(pt.x, pt.y, GetSafeHwnd());
	PostMessage(WM_NULL, 0, 0);
}
bool ContactManager::onContactBeginPro_End(){
    
    target_pro = node_Pro->getScheduler()->pauseAllTargets();
    MenuManager menuManager;
    
    Node* layer =menuManager.create_Menu(SUCCESS_LAYER);
    
    getScore();
    strstream ss;
    string score;
    ss<<SCORE_GET;
    ss>>score;
    
    auto text_score=layer->getChildByName<ui::TextBMFont*>("Text_Score");
    text_score->setString(score);

    
    if(GameManager::stepNow==STEP){
        STEP++;
    }

    //此处应该有个算星星的方法
    int stateN = getState();
     strstream ss1;
    string state;
    ss1<<stateN;
    ss1>>state;
    CCLOG("星星:%d",stateN);
    auto text_state=layer->getChildByName<ui::TextBMFont*>("Text_State");
    text_state->setString(state);
    GameVo gVo;
    GameVo gvoG = getGameInfo(GameManager::stepNow);
    
    if(gvoG._score<SCORE_GET){
        gVo.setData(SCORE_GET, 3, getState());
        setGameInfo(gVo,GameManager::stepNow);
    }
    
    updateConstant();
    
    node_else->getParent()->addChild(layer);
    
    MenuManager::move_in(layer);

    
    
    return false;
}
Exemple #11
0
void DirectxFunctions::RenderDirectX()
{
	DirectX.Device->BeginScene();
	if (GetForegroundWindow() == Target.Window)
	{
		mMenuManager.Render();

		if (crosshair == true)
		{
			float centerx = Overlay.Width / 2, centery = Overlay.Height / 2;
			Drawing::Line(centerx - 3, centery, centerx - 10, centery, Color::Red);
			Drawing::Line(centerx + 3, centery, centerx + 10, centery, Color::Red);
			Drawing::Line(centerx, centery - 3, centerx, centery - 10, Color::Red);
			Drawing::Line(centerx, centery + 3, centerx, centery + 10, Color::Red);
		}

		if (trigger == true)
		{
			Yarin(&lPlayer, &InCH);
		}
		
	
	}


	DirectX.Device->EndScene();
	DirectX.Device->PresentEx(0, 0, 0, 0, 0);
	DirectX.Device->Clear(0, 0, D3DCLEAR_TARGET, 0, 1.0f, 0);
}
Exemple #12
0
BOOL CTeenSpiritDlg::OnCommand(WPARAM wParam, LPARAM lParam)
{
	TRACEST(_T("CTeenSpiritDlg::OnCommand"), wParam);
	PrgAPI* pAPI = PRGAPI();

	switch (wParam)
	{
	case CToolbarWnd::CMD_About:
		return pAPI->GetActionManager()->ShowAboutDlg(this);
	case CToolbarWnd::CMD_Collections:
		return pAPI->GetActionManager()->ShowCollectionsDlg(this);
	case CToolbarWnd::CMD_Search:
		return pAPI->GetAdvancedSearchDlg()->ShowWindow(SW_SHOW);
	case CToolbarWnd::CMD_History:
		return pAPI->GetActionManager()->ShowHistoryDlg(this);
	case CToolbarWnd::CMD_Options:
		return pAPI->GetActionManager()->ShowOptionsDlg(this);
	case CToolbarWnd::CMD_Games:
		return pAPI->GetActionManager()->ShowGamesDlg(this);

	case CToolbarWnd::CMD_Min:
		return SendMessage(WM_SYSCOMMAND, SC_MINIMIZE, 0);
	case CToolbarWnd::CMD_Restore:
		return SendMessage(WM_SYSCOMMAND, SC_RESTORE, 0);
	case CToolbarWnd::CMD_Close:
		return SendMessage(WM_SYSCOMMAND, SC_CLOSE, 0);
		break;

	default:
		{
			if (wParam > MENU_First && wParam < MENU_Last)
			{
				MenuManager* pMM = pAPI->GetMenuManager();
				MenuCommandsEnum cmd = (MenuCommandsEnum) wParam;
				if (pMM->HandleGeneralCommands(cmd) || pMM->HandlePlayerCommands(*pAPI->GetMediaPlayer(), cmd, 0))
					return TRUE;
			}
		}
		return CDialog::OnCommand(wParam, lParam);
	}
	return TRUE;
}
bool NotepadPlusWrapper::runMenuCommand(boost::python::str menuName, boost::python::str menuOption, bool refreshCache)
{
	bool retVal = false;
	MenuManager *menuManager = MenuManager::getInstance();
	if (!menuName.is_none() && !menuOption.is_none())
	{
		std::shared_ptr<TCHAR> tmenuName = WcharMbcsConverter::char2tchar(boost::python::extract<const char *>(menuName));
		std::shared_ptr<TCHAR> tmenuOption = WcharMbcsConverter::char2tchar(boost::python::extract<const char *>(menuOption));
		GILRelease release;
		idx_t commandID = menuManager->findMenuCommand(tmenuName.get(), tmenuOption.get(), refreshCache);
		if (commandID)
		{
			::SendMessage(m_nppHandle, WM_COMMAND, commandID, 0);
			retVal = true;
		}

	}
	return retVal;

}
bool ContactManager::onContactBeginPro_Jailer(){
    //node_Pro->getScheduler()->setTimeScale(0.0f);
    if(node_else->isVisible()){
        SpriteManager::setStopJailer(node_else->getTag());
        
        SchedulerManager::stopTimeLine(node_else->getTag());
        node_else->setVisible(false);
        target_pro = node_Pro->getScheduler()->pauseAllTargets();
        MenuManager menuManager;
        
        Node* layer =menuManager.create_Menu(FAIL_LAYER);
        node_else->getParent()->addChild(layer);
        
        MenuManager::move_in(layer);
    }
    
    //layer->setVisible(true);

    return false;
}
//Callback for the LeftClick event listener on the logout button
//param:buttonClicked->Pointer to the button clicked
//param:thisClass->Main menu class, in case we need it
 void MainMenu::LogoutClickListener(MenuButton* buttonClicked, void* thisClass)
 {
	MenuManager* networkManager = MenuManager::GetInstance();

	//Make sure we aren't logged in
	if(networkManager->GetLoggedIn())
	{
		//Create a Login Data Gamedata stucture to indicate logout
		GameData dataToSend = GameDataBuilder::CreateLoginData(
			networkManager->network.GetClientID(), false, (char*)networkManager->GetUsername().c_str(),
			"");

		//Send the login
		networkManager->network.SendData(dataToSend);
	}
	else
	{
		std::cout<< "Not Logged In" << std::endl;
	}
 }
Exemple #16
0
ITSMenu& WebPane::GetInternalMenu(MenusEnum mnu)
{
	TRACEST(_T("PlayListPane::GetMenu."), mnu);
	ASSERT(mnu < M_Last);
	PrgAPI* pAPI = PRGAPI();
	if (m_pMenu[mnu] == NULL)
		m_pMenu[mnu] = pAPI->CreatePopupMenu();
	ITSMenu& curMenu = *m_pMenu[mnu];
	if (curMenu.GetInternalHandler() != NULL)
		return curMenu;
	curMenu.Create();
	switch (mnu)
	{
	case M_Main:
		{
			MenuManager* pMM = pAPI->GetMenuManager();
			curMenu.AppendMenu(ITSMenu::MIT_Menu, 
				(INT)pMM->GetMenu(MenuManager::MNU_ArtistServices).GetInternalHandler(), (LPTSTR)pAPI->GetString(IDS_ARTIST));

			curMenu.AppendMenu(ITSMenu::MIT_Menu, 
				(INT)pMM->GetMenu(MenuManager::MNU_AlbumServices).GetInternalHandler(), (LPTSTR)pAPI->GetString(IDS_ALBUM));

			curMenu.AppendMenu(ITSMenu::MIT_Menu, 
				(INT)pMM->GetMenu(MenuManager::MNU_TrackServices).GetInternalHandler(), (LPTSTR)pAPI->GetString(IDS_TITLE));
			
			curMenu.AppendMenu(ITSMenu::MIT_Separator, NULL, NULL);
			
			curMenu.AppendMenu(ITSMenu::MIT_String, MI_SyncWithSectionChanger, (LPTSTR)pAPI->GetString(IDS_SYNCWITHSECTIONS));
			curMenu.AppendMenu(ITSMenu::MIT_String, MI_SyncWithTracksChanger, (LPTSTR)pAPI->GetString(IDS_SYNCWITHTRACKS));
			curMenu.AppendMenu(ITSMenu::MIT_String, MI_SyncWithPlayer, (LPTSTR)pAPI->GetString(IDS_SYNCWITHPLAYER));
			
			curMenu.AppendMenu(ITSMenu::MIT_Separator, NULL, NULL);
			
			curMenu.AppendMenu(ITSMenu::MIT_String, MI_UseAsWebViewer, (LPTSTR)pAPI->GetString(IDS_WEBVIEWER));
		}
		break;
	default:
		ASSERT(0);
	}
	return curMenu;
}
 //Callback for the LeftClick event listener on the logout button
//param:buttonClicked->Pointer to the button clicked
//param:thisClass->Main menu class, in case we need it
 void MainMenu::StatsClickListener(MenuButton* buttonClicked, void* thisClass)
 {
	MenuManager* networkManager = MenuManager::GetInstance();

	//Make sure we aren't logged in
	if(networkManager->GetLoggedIn())
	{
		//Create a Login Data Gamedata stucture to indicate logout
		GameData dataToSend = GameDataBuilder::CreateStatsData(networkManager->network.GetClientID(),
			networkManager->GetUsername(), -1, -1, -1);

		//Send the login
		networkManager->network.SendData(dataToSend);

		networkManager->SetScreen(MenuManager::MenuState::STATE_STATS);
	}
	else
	{
		std::cout<< "Not Logged In" << std::endl;
	}
 }
Exemple #18
0
BOOL PlayListPane::OnButton(UINT idx)
{
	TRACEST(_T("PlayListPane::OnCommand"), idx);
	switch (idx)
	{
	case MI_ShowNumbers:
		m_PlayList.SetConfigurationOption(CPlayListListCtrl::C_ShowNumbers, 
			m_PlayList.GetConfigurationOption(CPlayListListCtrl::C_ShowNumbers) == 0 ? 1 : 0);
		break;
	default:
		{
			PrgAPI* pAPI = PRGAPI();
			MediaPlayer* pPlayer = pAPI->GetMediaPlayer();
			MenuManager* pMM = pAPI->GetMenuManager();
			MenuCommandsEnum cmd = (MenuCommandsEnum) idx;
			if (!pMM->HandlePlayerCommands(*pPlayer, cmd, pPlayer->GetPlayListPos()) || (pMM->HandleGeneralCommands(cmd)))
				return FALSE;
		}
	}
	return TRUE;;
}
Exemple #19
0
void MouseMotion(int x, int y)
{
  switch (state)
  {
    case MENU:
      menuManager.MouseMotion(x, WINDOW_HEIGHT-y);
    break;
    case GAME:
      game->MouseMotion(x, WINDOW_HEIGHT-y);
    break;
  }
}
void loop(void){
	result = encoder.waitForEvent();
	
	switch(result) {
		case next:
			menu.next();
			break;
			
		case previous:
			menu.previous();
			break;
			
		case click:
			menu.select();
			break;
			
		case clickLong
			menu.nextMenu();
			break;
	}
}
Exemple #21
0
void Mouse(int button, int mouseState, int x, int y)
{
  switch (state)
  {
    case MENU:
      menuManager.MousePress(button, mouseState, x, WINDOW_HEIGHT-y);
    break;
    case GAME:
      game->MousePress(button, mouseState, x, WINDOW_HEIGHT-y);
    break;
  }
}
Exemple #22
0
ITSMenu* WebPane::GetMenu(UINT idx)
{
	switch (idx)
	{
	case BTN_Options:
		{
			PrgAPI* pAPI = PRGAPI();
			//MediaPlayer* pPlayer = pAPI->GetMediaPlayer();
			MenuManager* pMM = pAPI->GetMenuManager();
			//MenuCommandsEnum cmd = (MenuCommandsEnum) idx;
			ITSMenu& mnu = GetInternalMenu(M_Main);
			//pMM->ResetServicesMenu PlayerCommands(*pPlayer);
			//mnu.CheckMenuItem(MI_ShowNumbers, m_PlayList.GetConfigurationOption(CPlayListListCtrl::C_ShowNumbers) != 0);
			pMM->PrepareMenu(MenuManager::MNU_ArtistServices);
			pMM->PrepareMenu(MenuManager::MNU_AlbumServices);
			pMM->PrepareMenu(MenuManager::MNU_TrackServices);
			if (m_SyncWithArtistService > -1)
				mnu.CheckMenuItem(MENU_WebServicesHolder + m_SyncWithArtistService, TRUE);
			if (m_SyncWithAlbumService > -1)
				mnu.CheckMenuItem(MENU_WebServicesHolder + m_SyncWithAlbumService, TRUE);
			if (m_SyncWithTrackService > -1)
				mnu.CheckMenuItem(MENU_WebServicesHolder + m_SyncWithTrackService, TRUE);

			mnu.CheckMenuItem(MI_SyncWithPlayer, m_bSyncWithPlayer);
			mnu.CheckMenuItem(MI_SyncWithSectionChanger, m_bSyncWithSectionsChanger);
			mnu.CheckMenuItem(MI_SyncWithTracksChanger, m_bSyncWithTracksChanger);

			ServicesRegistrationSrv::IWebViewer* pViewer = pAPI->GetServicesRegistrationSrv()->GetWebViewer();
			mnu.CheckMenuItem(MI_UseAsWebViewer, pViewer == this);

			return &mnu;
		}
		break;
	default:
		return NULL;
	}
	return NULL;
}
Exemple #23
0
int main()
{
  int persoChoisi;

  std::cout << "Starting DCSI ..." << std::endl;
  MenuManager mainMenu;
  //pvr_init_defaults();
  //cdrom_init();
  bool cont = true;
  
  mainMenu.Init();
  mainMenu.IntroLaunch();
  persoChoisi = mainMenu.MenuLaunch();
  //mainMenu.Unload();
  pvr_shutdown();
  
  while (cont) {
	cont = myWorld::Init(persoChoisi);
	pvr_shutdown();
	persoChoisi = (persoChoisi + 1)%3;
	}

  std::cout << "Terminating DCSI ..." << std::endl;
}
Exemple #24
0
/*
 * Allows user to move camera and light positions using keyboard
 */
void Keyboard(unsigned char key, int x, int y)
{
  switch (key) {
  case 27: // ESC
    exit(0);
    break;
  }

  switch (state)
  {
    case MENU:
      menuManager.KeyboardPress(key);
    break;
    case GAME:
      game->KeyboardPress(key);
    break;
  }
}
Exemple #25
0
void Display()
{
  // Clear colour and depth buffers
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

  switch (state)
  {
    case MENU:
      game->Draw();
      menuManager.Draw();
      break;
      
    case GAME:
      game->Draw();
      break;
  }  
  
  glutSwapBuffers();
}
void EditableSceneBodyImpl::onContextMenuRequest(const SceneWidgetEvent& event, MenuManager& menuManager)
{
    if(!bodyItem->isEditable()){
        return;
    }
    if(self->body()->isStaticModel()){
        return;
    }
    
    PointedType pointedType = findPointedObject(event.nodePath());

    if(bodyItem && pointedType == PT_SCENE_LINK){

        menuManager.addItem(_("Set Free"))->sigTriggered().connect(
            boost::bind(&EditableSceneBodyImpl::makeLinkFree, this, pointedSceneLink));
        menuManager.addItem(_("Set Base"))->sigTriggered().connect(
            boost::bind(&EditableSceneBodyImpl::setBaseLink, this, pointedSceneLink));
        menuManager.addItem(_("Set Translation Pin"))->sigTriggered().connect(
            boost::bind(&EditableSceneBodyImpl::togglePin, this, pointedSceneLink, true, false));
        menuManager.addItem(_("Set Rotation Pin"))->sigTriggered().connect(
            boost::bind(&EditableSceneBodyImpl::togglePin, this, pointedSceneLink, false, true));
        menuManager.addItem(_("Set Both Pins"))->sigTriggered().connect(
            boost::bind(&EditableSceneBodyImpl::togglePin, this, pointedSceneLink, true, true));

        menuManager.addSeparator();

        menuManager.addItem(_("Level Attitude"))->sigTriggered().connect(
            boost::bind(&EditableSceneBodyImpl::makeLinkAttitudeLevel, this));

        menuManager.addSeparator();
        
        menuManager.setPath(N_("/Markers"));
        
        Action* item = menuManager.addCheckItem(_("Center of Mass"));
        item->setChecked(isCmVisible);
        item->sigToggled().connect(boost::bind(&EditableSceneBodyImpl::showCenterOfMass, this, _1));

        item = menuManager.addCheckItem(_("ZMP"));
        item->setChecked(isZmpVisible);
        item->sigToggled().connect(boost::bind(&EditableSceneBodyImpl::showZmp, this, _1));

        menuManager.setPath("/");
        menuManager.addSeparator();
    }
}
void TitleScreen::Draw(ALLEGRO_DISPLAY *display)
{
	//al_draw_text(font,al_map_rgb(255,0,0),100,100,NULL,"TitleScreen");
	menu.Draw(display);
}
void TitleScreen::Update(ALLEGRO_EVENT ev)
{
	menu.Update(ev, input);
}
void TitleScreen::UnloadContent()
{
	GameScreen::UnloadContent();
	al_destroy_font(font);
	menu.UnloadContent();
}
void TitleScreen::LoadContent()
{
	font = al_load_font("arial.ttf", 30, NULL);
	menu.LoadContent("Title");
}