Application::Application(GHOST_ISystem* system) : m_system(system), m_mainWindow(0), m_secondaryWindow(0), m_fullScreenWindow(0), m_gearsTimer(0), m_testTimer(0), m_cursor(GHOST_kStandardCursorFirstCursor), m_exitRequested(false), stereo(false) { fApp = this; // Create the main window STR_String title1 ("gears - main window"); m_mainWindow = system->createWindow(title1, 10, 64, 320, 200, GHOST_kWindowStateNormal, GHOST_kDrawingContextTypeOpenGL, false, false); if (!m_mainWindow) { std::cout << "could not create main window\n"; exit(-1); } // Create a secondary window STR_String title2 ("gears - secondary window"); m_secondaryWindow = system->createWindow(title2, 340, 64, 320, 200, GHOST_kWindowStateNormal, GHOST_kDrawingContextTypeOpenGL, false, false); if (!m_secondaryWindow) { cout << "could not create secondary window\n"; exit(-1); } // Install a timer to have the gears running m_gearsTimer = system->installTimer(0 /*delay*/, 20/*interval*/, gearsTimerProc, m_mainWindow); }
char *complete_title(P_CHAR pc) // generates the ENTIRE title plus criminal stuff { VALIDATEPCR(pc, 0); char tempstr[1024]; char temp[TEMP_STR_SIZE]; //xan -> this overrides the global temp var if (pc->account==0 && pc->IsGM()) // Ripper..special titles for admins :) { sprintf(tempstr, "%s %s", pc->getCurrentNameC(), pc->title.c_str()); } else if (pc->IsGM() && pc->account!=0) {//GM. sprintf(tempstr, "%s %s", pc->getCurrentNameC(), pc->title.c_str()); } // ripper ..rep stuff else if ((pc->IsCriminal()) && (!(pc->dead) && (pc->kills<4))) { sprintf(tempstr, "%s %s", title[0].other, pc->getCurrentNameC()); if ( pc->title != "" ) sprintf(tempstr, "%s, %s,", tempstr, pc->title.c_str()); else sprintf(tempstr, "%s, %s %s,", tempstr, title1(pc), title2(pc)); } else if ((pc->kills>=5) && (!(pc->dead) && (pc->kills<10))) { sprintf(tempstr, "%s %s", title[1].other, pc->getCurrentNameC()); if ( pc->title != "" ) sprintf(tempstr, "%s, %s,", tempstr, pc->title.c_str()); else sprintf(tempstr, "%s, %s %s,", tempstr, title1(pc), title2(pc)); } else if ((pc->kills>=10) && (!(pc->dead) && (pc->kills<20))) { sprintf(tempstr, "%s %s", title[2].other, pc->getCurrentNameC()); if ( pc->title != "" ) sprintf(tempstr, "%s, %s,", tempstr, pc->title.c_str()); else sprintf(tempstr, "%s, %s %s,", tempstr, title1(pc), title2(pc)); } else if ((pc->kills>=20) && (!(pc->dead) && (pc->kills<50))) { sprintf(tempstr, "%s %s", title[3].other, pc->getCurrentNameC()); if ( pc->title != "" ) sprintf(tempstr, "%s, %s,", tempstr, pc->title.c_str()); else sprintf(tempstr, "%s, %s %s,", tempstr, title1(pc), title2(pc)); } else if ((pc->kills>=50) && (!(pc->dead) && (pc->kills<100))) { sprintf(tempstr, "%s %s", title[4].other, pc->getCurrentNameC()); if ( pc->title != "" ) sprintf(tempstr, "%s, %s,", tempstr, pc->title.c_str()); else sprintf(tempstr, "%s, %s %s,", tempstr, title1(pc), title2(pc)); } else if ((pc->kills>=100) && (!(pc->dead))) { sprintf(tempstr, "%s %s", title[5].other, pc->getCurrentNameC()); if ( pc->title != "" ) sprintf(tempstr, "%s, %s,", tempstr, pc->title.c_str()); else sprintf(tempstr, "%s, %s %s,", tempstr, title1(pc), title2(pc)); } // end of rep stuff else {//Player. sprintf(tempstr, "%s%s", title3(pc), pc->getCurrentNameC()); //Repuation + Name {//NoTownTitle strcpy(temp,tempstr); if ( pc->title != "" ) sprintf(tempstr, "%s, %s,", tempstr, pc->title.c_str()); else sprintf(tempstr, "%s, %s %s,", tempstr, title1(pc), title2(pc)); } } strcpy(completetitle, tempstr); return completetitle; }
void Credits::createCreditsOverlay() { std::cout << "Creating credits overlay." << std::endl; // Set Scene and Overlay mEngine->actualScene.reset(new mgf::Node("creditsScene")); mEngine->overlay.reset(new mgf::Overlay()); /* * Create elements for overlay */ float width = 0.0f; float height = 0.0f; float dividend = 0.4f; if (mEngine->isCurrentDisplayMode()) dividend = 0.5f; std::cout << dividend << std::endl; std::shared_ptr <mgf::Label> title1(new mgf::Label("title1")); title1->setBackground("res/images/elemente/transparent.png"); title1->setFont("res/fonts/main.ttf"); title1->setText("ITP 4"); title1->setColor(glm::vec3(255,165,0)); width = (dividend/mEngine->w->getAspectRatio() + title1->getScale()[0]); title1->scale(glm::vec2(2,1)); title1->translate(glm::vec2(width,height)); // width+=0.2f; mEngine->overlay->add(title1); // Create labels std::shared_ptr <mgf::Label> credit1(new mgf::Label("credit1")); credit1->setBackground("res/images/elemente/transparent.png"); credit1->setFont("res/fonts/main.ttf"); credit1->setText("Martin Schwarz"); credit1->setColor(glm::vec3(255,165,0)); width = (dividend/mEngine->w->getAspectRatio() + credit1->getScale()[0]); height += 0.12; std::cout << width << "x" << height << " (Fullscreen Label)" << std::endl; credit1->translate(glm::vec2(width, height)); credit1->scale(glm::vec2(2,1)); mEngine->overlay->add(credit1); std::shared_ptr <mgf::Label> credit2(new mgf::Label("credit2")); credit2->setBackground("res/images/elemente/transparent.png"); credit2->setFont("res/fonts/main.ttf"); credit2->setText("Lukas Stanek"); credit2->setColor(glm::vec3(255,165,0)); height += 0.1f; credit2->translate(glm::vec2(width, height)); credit2->scale(glm::vec2(2,1)); mEngine->overlay->add(credit2); std::shared_ptr <mgf::Label> credit3(new mgf::Label("credit3")); credit3->setBackground("res/images/elemente/transparent.png"); credit3->setFont("res/fonts/main.ttf"); credit3->setText("Guenter Kubicki"); credit3->setColor(glm::vec3(255,165,0)); height += 0.1f; credit3->translate(glm::vec2(width, height)); credit3->scale(glm::vec2(2,1)); mEngine->overlay->add(credit3); // Create buttons backBtn.reset(new mgf::Button("backBtn")); backBtn->setBackground("res/images/elemente/back.png"); height += 0.15f; backBtn->translate(glm::vec2(width, height)); // Add buttons to overlay mEngine->overlay->add(backBtn); mEngine->overlay->add(mEngine->pointer); }
void CDataQuotaView::HandleCommandL(TInt aCommand) { switch (aCommand) { // case EAknSoftkeyBack: // AppUi()->ProcessCommandL(EAknCmdExit); // break; case EAknCmdExit: { TApaTask task(iEikonEnv->WsSession()); task.SetWgId(CEikonEnv::Static()->RootWin().Identifier()); task.SendToBackground(); AppUi()->HandleCommandL(EAknCmdExit); } break; case EDataQuotaRefresh: { iContainer->UpdateValuesL(); iContainer->DrawNow(); #ifdef __OVI_SIGNED__ // UninstallSelfSignedVersionL(); #endif } break; case EDataQuotaEditQuota: { const TInt KMaxQuota(999999); TInt number(iContainer->DataQuota()); CAknNumberQueryDialog* dlg(CAknNumberQueryDialog::NewL(number)); dlg->PrepareLC(R_AVKON_DIALOG_QUERY_VALUE_NUMBER); dlg->SetMinimumAndMaximum(1, KMaxQuota); if (dlg->RunLD()) { iContainer->SetDataQuotaL(number); HandleCommandL(EDataQuotaRefresh); } } break; case EDataQuotaEditBillingDay: { const TInt KMinBillingDay(1); const TInt KMaxBillingDay(31); TInt number(iContainer->BillingDay() + 1); CAknNumberQueryDialog* dlg(CAknNumberQueryDialog::NewL(number)); dlg->PrepareLC(R_AVKON_DIALOG_QUERY_VALUE_NUMBER); dlg->SetMinimumAndMaximum(KMinBillingDay, KMaxBillingDay); if (dlg->RunLD()) { iContainer->SetBillingDayL(number - 1); HandleCommandL(EDataQuotaRefresh); } } break; case EDataQuotaEditDailyQuota: iContainer->SetQuotaTypeL(CDataQuotaContainer::EDaily); HandleCommandL(EDataQuotaRefresh); break; case EDataQuotaEditMonthlyQuota: iContainer->SetQuotaTypeL(CDataQuotaContainer::EMonthly); HandleCommandL(EDataQuotaRefresh); break; /* case EDataQuotaEditBillingPeriod: { TInt number(iContainer->BillingDay() + 1); TBool numberValid(EFalse); while (!numberValid) { CAknNumberQueryDialog* dlg(CAknNumberQueryDialog::NewL(number)); dlg->PrepareLC(R_AVKON_DIALOG_QUERY_VALUE_NUMBER); if (dlg->RunLD()) { if (number > 0 && number < 32) { iContainer->SetBillingDay(number - 1); numberValid = ETrue; } } else { numberValid = ETrue; } } } break; */ case EDataQuotaResetQuota: { CAknQueryDialog* dlg(CAknQueryDialog::NewL()); HBufC* text(iEikonEnv->AllocReadResourceLC( R_DATAQUOTA_RESET_QUOTA_CONFIRMATION)); if (dlg->ExecuteLD(R_DATAQUOTA_YES_NO_QUERY_DIALOG, *text)) { iContainer->ResetQuota(); HandleCommandL(EDataQuotaRefresh); } CleanupStack::PopAndDestroy(text); } break; case EDataQuotaHelp: { // Create the header text HBufC* title(iEikonEnv->AllocReadResourceLC(R_DATAQUOTA_HELP)); HBufC* help(iEikonEnv->AllocReadResourceLC(R_DATAQUOTA_HELP_TEXT)); CAknMessageQueryDialog* dlg(new(ELeave) CAknMessageQueryDialog()); // Initialise the dialog dlg->PrepareLC(R_DATAQUOTA_ABOUT_BOX); dlg->QueryHeading()->SetTextL(*title); dlg->SetMessageTextL(*help); dlg->RunLD(); CleanupStack::PopAndDestroy(2, title); // title, help } break; case EDataQuotaAbout: { // Create the header text HBufC* title1(iEikonEnv->AllocReadResourceLC(R_DATAQUOTA_ABOUT_TEXT)); HBufC* title2(KVersion().AllocLC()); HBufC* title(HBufC::NewLC(title1->Length() + title2->Length())); title->Des().Append(*title1); title->Des().Append(*title2); CAknMessageQueryDialog* dlg(new(ELeave) CAknMessageQueryDialog()); // Initialise the dialog dlg->PrepareLC(R_DATAQUOTA_ABOUT_BOX); dlg->QueryHeading()->SetTextL(*title); _LIT(KMessage, "(C) 2008-2012 Hugo van Kemenade\ncode.google.com/p/dataquota\ntwitter.com/DataQuota"); dlg->SetMessageTextL(KMessage); dlg->RunLD(); CleanupStack::PopAndDestroy(3, title1); // title1, title2, title } break; case EDataQuotaMoreAppsPodOClock: // intentional fall-through case EDataQuotaMoreAppsMobbler: // intentional fall-through case EDataQuotaMoreAppsSugarSync: // intentional fall-through { TBuf<256> url; TBool forceNativeBrowser(EFalse); switch (aCommand) { case EDataQuotaMoreAppsPodOClock: { #ifdef __OVI_SIGNED__ _LIT(KUrl, "http://store.ovi.mobi/content/180798/"); forceNativeBrowser = ETrue; #else _LIT(KUrl, "http://code.google.com/p/podoclock/"); #endif url.Copy(KUrl); } break; case EDataQuotaMoreAppsMobbler: { #ifdef __OVI_SIGNED__ _LIT(KUrl, "http://store.ovi.mobi/content/75692"); forceNativeBrowser = ETrue; #else _LIT(KUrl, "http://code.google.com/p/mobbler/"); #endif url.Copy(KUrl); } break; case EDataQuotaMoreAppsSugarSync: { _LIT(KUrl, "https://www.sugarsync.com/referral?rf=eoovtb627jrd7"); url.Copy(KUrl); } break; default: break; } OpenWebBrowserL(url, forceNativeBrowser); } break; default: break; } }