void MenuStanje::Input() { static sf::Clock clock; float deltaT=clock.restart().asSeconds(); if(tranzicija==T_NEMA) { if(stanje==GLAVNI_MENU) { if(misOtpusten==true) { if(startGumb.odabran==true) { stanje=NIVO_ODABIR; } if(oigriGumb.odabran==true) { stanje=O_IGRI; } if(izlazGumb.odabran==true) { tranzicija=T_FADEOUT; } misOtpusten=false; } } if(stanje==NIVO_ODABIR) if(misOtpusten==true) { if(natragGumb.odabran==true) stanje=GLAVNI_MENU; for(int i=0; i<nivoi.size(); i++) { if(nivoi[i].gumb.odabran==true) { RenderLoading(); nivo_datoteka=nivoi[i].datoteka; nivo_datoteka_g=nivoi[i].datoteka_g; nivo_trenutni=i; igra->SetState(new GameState(), true); break; } } misOtpusten=false; } if(stanje==O_IGRI) if(misOtpusten==true) { if(natragGumb.odabran==true) stanje=GLAVNI_MENU; } } misOtpusten=false; }
void MenuStanje::Input() { float deltaT=igra->DajRW()->GetFrameTime()/1000.f; if(tranzicija==T_NEMA) { if(stanje==GLAVNI_MENU) { if(misOtpusten==true) { if(startGumb.odabran==true) { stanje=NIVO_ODABIR; } if(oigriGumb.odabran==true) { stanje=O_IGRI; } if(izlazGumb.odabran==true) { tranzicija=T_FADEOUT; } misOtpusten=false; } } if(stanje==NIVO_ODABIR) if(misOtpusten==true) { if(natragGumb.odabran==true) stanje=GLAVNI_MENU; for(int i=0; i<nivoi.size(); i++) { if(nivoi[i].gumb.odabran==true) { RenderLoading(); nivo_datoteka=nivoi[i].datoteka; nivo_datoteka_g=nivoi[i].datoteka_g; nivo_trenutni=i; igra->DodajStanje(new GlavnoStanje(), true); break; } } misOtpusten=false; } if(stanje==O_IGRI) if(misOtpusten==true) { if(natragGumb.odabran==true) stanje=GLAVNI_MENU; } } misOtpusten=false; }
void CGameWindow::Run() { while (IsOpen()) { CProfiler::BeginFrame(); if (true) { TPROF("CGameWindow::Run"); PreFrame(); if (GameServer()->IsHalting()) { //DestroyGame(); //CreateGame(m_eRestartAction); } float flTime = GetTime(); if (GameServer()) { if (GameServer()->IsLoading()) { // Pump the network CNetwork::Think(); RenderLoading(); continue; } else if (GameServer()->IsClient() && !GameNetwork()->IsConnected()) { //DestroyGame(); //CreateGame(GAMETYPE_MENU); } else { GameServer()->Think(flTime); Render(); } } PostFrame(); } CProfiler::Render(); SwapBuffers(); } }
void CGameWindow::OpenWindow() { int iScreenWidth, iScreenHeight; GetScreenSize(iScreenWidth, iScreenHeight); #ifdef _DEBUG BaseClass::OpenWindow(iScreenWidth*2/3, iScreenHeight*2/3, false, false); #else BaseClass::OpenWindow(iScreenWidth*2/3, iScreenHeight*2/3, false, false); #endif RenderLoading(); m_pGameServer = new CGameServer(); m_pRenderer = CreateRenderer(); m_pRenderer->Initialize(); }
bool CApp::OnInit() { COptions::options.LoadOptions(); if (SDL_Init(SDL_INIT_EVERYTHING) < 0) { return false; } if (!(Surf_WIcon = SDL_LoadBMP(data::FindFile("gfx/ITD++.bmp").c_str()))) { return false; } SDL_WM_SetIcon(Surf_WIcon, NULL); int ScreenWidth = COptions::options.getScreenWidth(); int ScreenHeight = COptions::options.getScreenHeight(); Uint32 flags = SDL_HWSURFACE | SDL_DOUBLEBUF; if (!(Surf_Display = SDL_SetVideoMode(ScreenWidth, ScreenHeight, 32, flags))) { return false; } if (!CText::TextControl.OnLoad()) { return false; } std::string window_title("Into The Dungeon++ "); window_title += VERSION; SDL_WM_SetCaption(window_title.c_str(), window_title.c_str()); if (!COptions::options.getWindowed()) { Surf_Display = SDL_SetVideoMode(ScreenWidth, ScreenHeight, 32, SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_FULLSCREEN); } Surf_LoadScreen = CSurface::OnLoad( data::FindFile("gfx/UI/MENU_BACKGROUND_800x600.png").c_str()); if (!Surf_LoadScreen) { return false; } RenderLoading(); Surf_Background = SDL_CreateRGBSurface(SDL_SWSURFACE, ScreenWidth, ScreenHeight, 32, 0, 0, 0, 0); if (!CArea::area_control.OnLoad()) { return false; } ItemRenderSystem::surf_items = CSurface::OnLoad(data::FindFile("gfx/Items.png").c_str()); if (!ItemRenderSystem::surf_items) { return false; } if (!CHud::HUD.OnLoad()) { return false; } player = LevelLoader::startNewGame(); /*Initialize audio*/ if (Mix_OpenAudio(22050, AUDIO_S16SYS, 2, 4096) < 0) { setSurf_Text("NoSound"); } Music = CMusic::OnLoad(data::FindFile("audio/BGM/ITDInGame.ogg").c_str()); MusicBoss = CMusic::OnLoad(data::FindFile("audio/BGM/ITDBossFight.ogg").c_str()); MusicIntro = CMusic::OnLoad(data::FindFile("audio/BGM/ITDIntro.ogg").c_str()); if (!Music || !MusicBoss || !MusicIntro) { setSurf_Text("Unable to open music"); } if (!CMusic::SoundControl.LoadSounds()) { setSurf_Text("Unable to open sounds"); } CMusic::SoundControl.Play(MusicIntro, -1); Surf_TextOverlay = CSurface::OnLoad(data::FindFile("gfx/UI/Text.png").c_str()); if (!Surf_TextOverlay) { return false; } SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); SDL_EnableUNICODE(SDL_ENABLE); return true; }