int menu() { SDL_Event mevent; int option=1, i; /* pirutupiiii */ if(efx[7]) Mix_PlayChannel(-1,efx[7],0); drawMenu(option); /* some dirty init */ scroll=scroll2=0; while(1) { while(SDL_PollEvent(&mevent)) { if (mevent.type==SDL_QUIT) return 0; /* joystick control for the menu */ if(joy[0]) { SDL_JoystickUpdate(); i=SDL_JoystickGetAxis(joy[0],1); if(i>4200) { mevent.type=SDL_KEYDOWN; mevent.key.keysym.sym=SDLK_DOWN; } if(i<-4200) { mevent.type=SDL_KEYDOWN; mevent.key.keysym.sym=SDLK_UP; } if(SDL_JoystickGetButton(joy[0], 0)) { mevent.type=SDL_KEYDOWN; mevent.key.keysym.sym=SDLK_RETURN; } if(SDL_JoystickGetButton(joy[0], 1)) { mevent.type=SDL_KEYDOWN; mevent.key.keysym.sym=SDLK_ESCAPE; } } if(mevent.type==SDL_KEYDOWN) { if(mevent.key.keysym.sym==SDLK_ESCAPE) return 0; if(mevent.key.keysym.sym==SDLK_DOWN || mevent.key.keysym.sym==SDLK_s) { option++; if(option>6) option=1; drawMenu(option); } if(mevent.key.keysym.sym==SDLK_UP || mevent.key.keysym.sym==SDLK_w) { option--; if(option<1) option=6; drawMenu(option); } if(mevent.key.keysym.sym==SDLK_RETURN) { switch(option) { default: break; case 1: player[0].shield=10; player[1].shield=0; player[0].score=player[1].score=0; player[0].stage=player[1].stage=0; return 1; case 2: player[0].shield=10; player[1].shield=10; player[0].score=player[1].score=0; player[0].stage=player[1].stage=0; return 1; case 3: if(!hiscores()) return 0; drawMenu(option); break; case 4: if(!configure()) return 0; drawMenu(option); break; case 5: if(!credits()) return 0; drawMenu(option); break; case 6: return 0; break; } } } } } return 0; }
int menu() { SDL_Event mevent; int option=0, menu=1; //option=1 /* pirutupiiii */ if(efx[7]) Mix_PlayChannel(-1,efx[7],0); drawMenu(option); /* some dirty init */ scroll=scroll2=0; while(1) { while(SDL_WaitEvent(&mevent)) { if (mevent.type==SDL_QUIT) return 0; if (mevent.type == SDL_MOUSEBUTTONDOWN) { //SDL_GetMouseState(&mouse_x, &mouse_y); //printf("mouse x: %i, Mouse y:%i\n",mouse_x, mouse_y); option=clickDetect(menu, mevent.button.button, mevent.button.x,mevent.button.y); //printf("option %i\n",option); drawMenu(option); SDL_Delay(200); mevent.type=SDL_KEYDOWN; mevent.key.keysym.sym=SDLK_RETURN; } /*if (mevent.type == SDL_MOUSEBUTTONUP){ }*/ /*if(SDL_GetMouseState(NULL, NULL)&SDL_BUTTON(1)) { mevent.type=SDL_KEYDOWN; mevent.key.keysym.sym=SDLK_RETURN; }*/ if(mevent.type==SDL_KEYDOWN) { if(mevent.key.keysym.sym==SDLK_ESCAPE) return 0; if(mevent.key.keysym.sym==SDLK_DOWN || mevent.key.keysym.sym==SDLK_d) {//SDLK_s option++; if(option>5)//6 option=1; drawMenu(option); } if(mevent.key.keysym.sym==SDLK_UP || mevent.key.keysym.sym==SDLK_f) {//SDLK_w option--; if(option<1) option=5; drawMenu(option); } if(mevent.key.keysym.sym==SDLK_RETURN) { switch(option) { default: break; case 1: player[0].shield=10; player[1].shield=0; player[0].score=player[1].score=0; player[0].stage=player[1].stage=0; return 1; case 2://3 if(!hiscores()) return 0; drawMenu(option); break; case 3://4 if(!configure()) return 0; drawMenu(option); break; case 4://5 if(!credits()) return 0; drawMenu(option); break; case 5://6 return 0; break; } } } } } return 0; }
//MAIN GAME LOOP void Game::GameLoop() { //check time of last frame float frameTime = frameClock.getElapsedTime().asSeconds(); frameClock.restart(); //event loop sf::Event currentEvent; while(mainWindow.pollEvent(currentEvent)) { //gotta handle resize things here if(currentEvent.type == sf::Event::Resized) { //std::cerr << "resized" << std::endl; float aspectRatio = float(currentEvent.size.width)/float(currentEvent.size.height); float newHeight = (1024.f*currentEvent.size.height)/currentEvent.size.width; float newWidth = (768.f*currentEvent.size.width)/currentEvent.size.height; if(aspectRatio > (4.f/3.f)) { float displace = (newWidth - 1024.f)/(-2.f); View = sf::View(sf::FloatRect(displace, 0, newWidth, 768)); } else if(aspectRatio < (4.f/3.f)) { float displace = (newHeight - 768.f)/(-2.f); View = sf::View(sf::FloatRect(0, displace, 1024, newHeight)); } mainWindow.setView(View); } //broken fullscreen stuff, do not touch else if(currentEvent.type == (sf::Event::KeyPressed) && currentEvent.key.code == (sf::Keyboard::F)) { //mainWindow.close(); //std::vector<sf::VideoMode> FullscreenModes = sf::VideoMode::getFullscreenModes(); //mainWindow.create(FullscreenModes[0],"SHMUP Super Alpha", sf::Style::Fullscreen); } switch(gameState) { case GameOver: { if(currentEvent.type == (sf::Event::KeyPressed) && currentEvent.key.code == (sf::Keyboard::Return)) { scoreboard.clear(); gameState = Uninitialized; } if(currentEvent.type == sf::Event::Closed || (currentEvent.type == (sf::Event::KeyPressed) && (currentEvent.key.code == sf::Keyboard::Escape))) { gameState = Exiting; } break; } case Playing: { if(currentEvent.type == sf::Event::Closed || (currentEvent.type == (sf::Event::KeyPressed) && (currentEvent.key.code == sf::Keyboard::Escape))) { gameState = Exiting; } if(currentEvent.type == (sf::Event::KeyPressed) && currentEvent.key.code == (sf::Keyboard::P)) { sounds[2].play(); gameState = Paused; } break; } case Paused: { if(currentEvent.type == sf::Event::Closed || (currentEvent.type == (sf::Event::KeyPressed) && (currentEvent.key.code == sf::Keyboard::Escape))) { gameState = Exiting; } if(currentEvent.type == (sf::Event::KeyPressed) && currentEvent.key.code == (sf::Keyboard::P)) { sounds[2].play(); gameState = Playing; } break; } case Intro: { if(currentEvent.type == (sf::Event::KeyPressed) && currentEvent.key.code == (sf::Keyboard::Return)) { storyScreen++; sounds[1].play(); unsigned pos = 0; for(int i = 0; i < 10; i++) { pos = story.find_first_of('\n',pos+1); } buffer.assign(story,0,pos); story.erase(0,pos); } if(currentEvent.type == sf::Event::Closed || (currentEvent.type == (sf::Event::KeyPressed) && (currentEvent.key.code == sf::Keyboard::Escape))) { gameState = Exiting; } break; } } } //non event-triggered state stuff (every frame updates) switch(gameState) { case Uninitialized: { mainWindow.clear(); background0.Load("images/acespacebg0.png"); background1.Load("images/acespacebg1.png"); background0.sprite.setTextureRect(sf::Rect<int>(0,(2500-768),576,768)); background1.sprite.setTextureRect(sf::Rect<int>(0,(2500-768),576,768)); bgMove0 = 0; bgMove1 = 0; player1.Load("images/Player.png"); player1.SetPosition(576/2,700); player1.revive(); scoreboard.updatePower(0); scoreboard.updateLives(0); scoreboard.updateScore(-1); scoreboard.updateTargetHP(0,0); scoreboard.updateFont(&datagoth); scoreboard.clear(); } case ShowingSplash: { if(!ShowSplashScreen()) gameState = Exiting; else { gameState = Intro; unsigned pos = 0; for(int i = 0; i < 10; i++) { pos = story.find_first_of('\n',pos+1); } buffer.assign(story,0,pos); story.erase(0,pos); } break; } case Intro: { if(storyScreen == 5) { music[0].stop(); music[1].play(); gameState = Playing; scoreboard.updateLives(1); scoreboard.updatePower(5); scoreboard.updateScore(000000); scoreboard.updateTargetHP(0,0); //intial wave to seed the enemy list Enemy* newEnemy2 = new Enemy(2, 0, -100); newEnemy2->setDestination(200, 300); enemyList.push_front(*newEnemy2); Enemy* newEnemy3 = new Enemy(2, 576, -100); newEnemy3->setDestination(350, 300); enemyList.push_front(*newEnemy3); Enemy* newEnemy4 = new Enemy(2, 60, -100); newEnemy4->setDestination(200, 300); enemyList.push_front(*newEnemy4); Enemy* newEnemy5 = new Enemy(2, 536, -100); newEnemy5->setDestination(350, 300); enemyList.push_front(*newEnemy5); frameClock.restart(); } } case Playing: { //check movement CheckMovement(5, frameTime); if(player1.destroyCheck()) { enemyList.clear(); mainWindow.clear(); player1.clearProjectiles(); music[1].stop(); sounds[4].play(); scoreboard.updateLives(-1); gameState = GameOver; break; } UpdateProj(); UpdateEnemies(); //update paralaxed backgrounds if(bgMove0 > (2500-768)) bgMove0 = 0; bgMove0 += 1; background0.sprite.setTextureRect(sf::Rect<int>(0,(2500-768)-bgMove0,576,768)); break; } } if(bgMove1 > (2500-768)) bgMove1 = 0; bgMove1 += 3; background1.sprite.setTextureRect(sf::Rect<int>(0,(2500-768)-bgMove1,576,768)); //clean up sprites to be deleted CleanUp(); //draw game mainWindow.clear(sf::Color(0,0,0)); mainWindow.draw(wholeArea); background0.Draw(mainWindow); char fps[60]; sprintf(fps,"%.2f\nESC to Quit\nP to Pause\nSPACE to Fire\nWASD to Move",(float(1)/frameTime)); sf::String fpsString(fps); sf::Text text(fpsString, datagoth); text.setCharacterSize(20); text.setColor(sf::Color::White); text.setPosition(596, 650); sf::String sidebar(buffer+"\n\nPress Enter"); sf::Text textBox(sidebar,datagoth); if(gameState == GameOver) { sf::String gameOver("GAME OVER"); sf::Text endingMessage(gameOver, datagoth); endingMessage.setCharacterSize(50); //endingMessage.setStyle(sf::Text::Bold); endingMessage.setColor(sf::Color::Red); endingMessage.setPosition(288-(endingMessage.getGlobalBounds().width/2), 300); sf::String authors("Developed by:\nJohn New\nDevon Gardner\nJon Forcht\nDanny Krulick\n\n\n\n\n\n\nPress Enter to Restart"); sf::Text credits(authors, datagoth); credits.setCharacterSize(20); credits.setColor(sf::Color::White); credits.setPosition(288-(credits.getGlobalBounds().width/2), 500); mainWindow.draw(credits); mainWindow.draw(endingMessage); } DrawProj(); DrawEnemies(); if(player1.destroyCheck() == false) player1.Draw(mainWindow); background1.Draw(mainWindow); mainWindow.draw(spawnArea); mainWindow.draw(rightBound); mainWindow.draw(leftBound); mainWindow.draw(bottomBound); mainWindow.draw(text); if(gameState == Intro && storyScreen < 5) { textBox.setCharacterSize(20); textBox.setColor(sf::Color::White); textBox.setPosition(596, 250); mainWindow.draw(textBox); } scoreboard.drawScoreboard(mainWindow, player1.sprite); //finally, render the frame mainWindow.display(); }
void menu() { fclose(fsaldel); fclose(fsal); FlushConsoleInputBuffer(GetStdHandle(STD_INPUT_HANDLE)); windowSize(96,32); int b=10; unsigned char a; system("cls"); system("color 1f"); printBorders(95,31); printBox(26,7,40,15); gtc(34,10);printf(" 1. Do Sales"); gtc(34,12);printf(" 2. Manage Inventory"); gtc(34,14);printf(" 3. Delete all data"); gtc(34,16);printf(" 4. Credits"); gtc(34,18);printf(" 5. Exit Program"); gtc(32,10); printf("\xb10"); while(getch()!=13) //THIS PART OMG. { a=getch(); if (a==0 || a==0xE0) a=getch(); if (a==27) { break; } else if (a==72) { if(b!=10) { gtc(32,b); printf(" "); b-=2; gtc(32,b); printf("\xb10"); } else { gtc(32,b); printf(" "); b+=8; gtc(32,b); printf("\xb10"); } } else if (a==80) { if(b!=18) { gtc(32,b); printf(" "); b+=2; gtc(32,b); printf("\xb10"); } } } switch(b) { case 10: sales(); break; case 12: menuInventory(); break; case 14: removedata(); break; case 16: credits(); break; case 18: exitR(); break; } }
void CVideoInfoTag::ParseNative(const TiXmlElement* movie, bool prioritise) { std::string value; if (XMLUtils::GetString(movie, "title", value)) SetTitle(value); if (XMLUtils::GetString(movie, "originaltitle", value)) SetOriginalTitle(value); if (XMLUtils::GetString(movie, "showtitle", value)) SetShowTitle(value); if (XMLUtils::GetString(movie, "sorttitle", value)) SetSortTitle(value); XMLUtils::GetFloat(movie, "rating", m_fRating); XMLUtils::GetInt(movie, "userrating", m_iUserRating); XMLUtils::GetFloat(movie, "epbookmark", m_fEpBookmark); int max_value = 10; const TiXmlElement* rElement = movie->FirstChildElement("rating"); if (rElement && (rElement->QueryIntAttribute("max", &max_value) == TIXML_SUCCESS) && max_value>=1) { m_fRating = m_fRating / max_value * 10; // Normalise the Movie Rating to between 1 and 10 } const TiXmlElement* urElement = movie->FirstChildElement("userrating"); if (urElement && (urElement->QueryIntAttribute("max", &max_value) == TIXML_SUCCESS) && max_value >= 1) m_iUserRating = m_iUserRating / max_value * 10; // Normalise the user Movie Rating to between 1 and 10 XMLUtils::GetInt(movie, "year", m_iYear); XMLUtils::GetInt(movie, "top250", m_iTop250); XMLUtils::GetInt(movie, "season", m_iSeason); XMLUtils::GetInt(movie, "episode", m_iEpisode); XMLUtils::GetInt(movie, "track", m_iTrack); if (XMLUtils::GetString(movie, "uniqueid", value)) SetUniqueId(value); XMLUtils::GetInt(movie, "displayseason", m_iSpecialSortSeason); XMLUtils::GetInt(movie, "displayepisode", m_iSpecialSortEpisode); std::string strFlag; XMLUtils::GetString(movie,"specialflag", strFlag); if (strFlag == "seasonfinale") m_iSpecialFlag = EPISODE_FLAG_SEASON_FINALE; else if (strFlag == "seriesfinale") m_iSpecialFlag = EPISODE_FLAG_SERIES_FINALE; else m_iSpecialFlag = EPISODE_FLAG_NONE; int after=0; XMLUtils::GetInt(movie, "displayafterseason",after); if (after > 0) { m_iSpecialSortSeason = after; m_iSpecialSortEpisode = 0x1000; // should be more than any realistic episode number } if (XMLUtils::GetString(movie, "votes", value)) SetVotes(value); if (XMLUtils::GetString(movie, "outline", value)) SetPlotOutline(value); if (XMLUtils::GetString(movie, "plot", value)) SetPlot(value); if (XMLUtils::GetString(movie, "tagline", value)) SetTagLine(value); if (XMLUtils::GetString(movie, "runtime", value) && !value.empty()) m_duration = GetDurationFromMinuteString(StringUtils::Trim(value)); if (XMLUtils::GetString(movie, "mpaa", value)) SetMPAARating(value); XMLUtils::GetInt(movie, "playcount", m_playCount); XMLUtils::GetDate(movie, "lastplayed", m_lastPlayed); if (XMLUtils::GetString(movie, "file", value)) SetFile(value); if (XMLUtils::GetString(movie, "path", value)) SetPath(value); if (XMLUtils::GetString(movie, "id", value)) SetIMDBNumber(value); if (XMLUtils::GetString(movie, "filenameandpath", value)) SetFileNameAndPath(value); XMLUtils::GetDate(movie, "premiered", m_premiered); if (XMLUtils::GetString(movie, "status", value)) SetStatus(value); if (XMLUtils::GetString(movie, "code", value)) SetProductionCode(value); XMLUtils::GetDate(movie, "aired", m_firstAired); if (XMLUtils::GetString(movie, "album", value)) SetAlbum(value); if (XMLUtils::GetString(movie, "trailer", value)) SetTrailer(value); if (XMLUtils::GetString(movie, "basepath", value)) SetBasePath(value); size_t iThumbCount = m_strPictureURL.m_url.size(); std::string xmlAdd = m_strPictureURL.m_xml; const TiXmlElement* thumb = movie->FirstChildElement("thumb"); while (thumb) { m_strPictureURL.ParseElement(thumb); if (prioritise) { std::string temp; temp << *thumb; xmlAdd = temp+xmlAdd; } thumb = thumb->NextSiblingElement("thumb"); } // prioritise thumbs from nfos if (prioritise && iThumbCount && iThumbCount != m_strPictureURL.m_url.size()) { rotate(m_strPictureURL.m_url.begin(), m_strPictureURL.m_url.begin()+iThumbCount, m_strPictureURL.m_url.end()); m_strPictureURL.m_xml = xmlAdd; } std::vector<std::string> genres(m_genre); if (XMLUtils::GetStringArray(movie, "genre", genres, prioritise, g_advancedSettings.m_videoItemSeparator)) SetGenre(genres); std::vector<std::string> country(m_country); if (XMLUtils::GetStringArray(movie, "country", country, prioritise, g_advancedSettings.m_videoItemSeparator)) SetCountry(country); std::vector<std::string> credits(m_writingCredits); if (XMLUtils::GetStringArray(movie, "credits", credits, prioritise, g_advancedSettings.m_videoItemSeparator)) SetWritingCredits(credits); std::vector<std::string> director(m_director); if (XMLUtils::GetStringArray(movie, "director", director, prioritise, g_advancedSettings.m_videoItemSeparator)) SetDirector(director); std::vector<std::string> showLink(m_showLink); if (XMLUtils::GetStringArray(movie, "showlink", showLink, prioritise, g_advancedSettings.m_videoItemSeparator)) SetShowLink(showLink); // cast const TiXmlElement* node = movie->FirstChildElement("actor"); if (node && node->FirstChild() && prioritise) m_cast.clear(); while (node) { const TiXmlNode *actor = node->FirstChild("name"); if (actor && actor->FirstChild()) { SActorInfo info; info.strName = actor->FirstChild()->Value(); if (XMLUtils::GetString(node, "role", value)) info.strRole = StringUtils::Trim(value); XMLUtils::GetInt(node, "order", info.order); const TiXmlElement* thumb = node->FirstChildElement("thumb"); while (thumb) { info.thumbUrl.ParseElement(thumb); thumb = thumb->NextSiblingElement("thumb"); } const char* clear=node->Attribute("clear"); if (clear && stricmp(clear,"true")) m_cast.clear(); m_cast.push_back(info); } node = node->NextSiblingElement("actor"); } if (XMLUtils::GetString(movie, "set", value)) SetSet(value); std::vector<std::string> tags(m_tags); if (XMLUtils::GetStringArray(movie, "tag", tags, prioritise, g_advancedSettings.m_videoItemSeparator)) SetTags(tags); std::vector<std::string> studio(m_studio); if (XMLUtils::GetStringArray(movie, "studio", studio, prioritise, g_advancedSettings.m_videoItemSeparator)) SetStudio(studio); // artists std::vector<std::string> artist(m_artist); node = movie->FirstChildElement("artist"); if (node && node->FirstChild() && prioritise) artist.clear(); while (node) { const TiXmlNode* pNode = node->FirstChild("name"); const char* pValue=NULL; if (pNode && pNode->FirstChild()) pValue = pNode->FirstChild()->Value(); else if (node->FirstChild()) pValue = node->FirstChild()->Value(); if (pValue) { const char* clear=node->Attribute("clear"); if (clear && stricmp(clear,"true")==0) artist.clear(); std::vector<std::string> newArtists = StringUtils::Split(pValue, g_advancedSettings.m_videoItemSeparator); artist.insert(artist.end(), newArtists.begin(), newArtists.end()); } node = node->NextSiblingElement("artist"); } SetArtist(artist); node = movie->FirstChildElement("fileinfo"); if (node) { // Try to pull from fileinfo/streamdetails/[video|audio|subtitle] const TiXmlNode *nodeStreamDetails = node->FirstChild("streamdetails"); if (nodeStreamDetails) { const TiXmlNode *nodeDetail = NULL; while ((nodeDetail = nodeStreamDetails->IterateChildren("audio", nodeDetail))) { CStreamDetailAudio *p = new CStreamDetailAudio(); if (XMLUtils::GetString(nodeDetail, "codec", value)) p->m_strCodec = StringUtils::Trim(value); if (XMLUtils::GetString(nodeDetail, "language", value)) p->m_strLanguage = StringUtils::Trim(value); XMLUtils::GetInt(nodeDetail, "channels", p->m_iChannels); StringUtils::ToLower(p->m_strCodec); StringUtils::ToLower(p->m_strLanguage); m_streamDetails.AddStream(p); } nodeDetail = NULL; while ((nodeDetail = nodeStreamDetails->IterateChildren("video", nodeDetail))) { CStreamDetailVideo *p = new CStreamDetailVideo(); if (XMLUtils::GetString(nodeDetail, "codec", value)) p->m_strCodec = StringUtils::Trim(value); XMLUtils::GetFloat(nodeDetail, "aspect", p->m_fAspect); XMLUtils::GetInt(nodeDetail, "width", p->m_iWidth); XMLUtils::GetInt(nodeDetail, "height", p->m_iHeight); XMLUtils::GetInt(nodeDetail, "durationinseconds", p->m_iDuration); if (XMLUtils::GetString(nodeDetail, "stereomode", value)) p->m_strStereoMode = StringUtils::Trim(value); StringUtils::ToLower(p->m_strCodec); StringUtils::ToLower(p->m_strStereoMode); m_streamDetails.AddStream(p); } nodeDetail = NULL; while ((nodeDetail = nodeStreamDetails->IterateChildren("subtitle", nodeDetail))) { CStreamDetailSubtitle *p = new CStreamDetailSubtitle(); if (XMLUtils::GetString(nodeDetail, "language", value)) p->m_strLanguage = StringUtils::Trim(value); StringUtils::ToLower(p->m_strLanguage); m_streamDetails.AddStream(p); } } m_streamDetails.DetermineBestStreams(); } /* if fileinfo */ const TiXmlElement *epguide = movie->FirstChildElement("episodeguide"); if (epguide) { // DEPRECIATE ME - support for old XML-encoded <episodeguide> blocks. if (epguide->FirstChild() && strnicmp("<episodeguide", epguide->FirstChild()->Value(), 13) == 0) m_strEpisodeGuide = epguide->FirstChild()->Value(); else { std::stringstream stream; stream << *epguide; m_strEpisodeGuide = stream.str(); } } // fanart const TiXmlElement *fanart = movie->FirstChildElement("fanart"); if (fanart) { // we prioritise mixed-mode nfo's with fanart set if (prioritise) { std::string temp; temp << *fanart; m_fanart.m_xml = temp+m_fanart.m_xml; } else m_fanart.m_xml << *fanart; m_fanart.Unpack(); } // resumePoint const TiXmlNode *resume = movie->FirstChild("resume"); if (resume) { XMLUtils::GetDouble(resume, "position", m_resumePoint.timeInSeconds); XMLUtils::GetDouble(resume, "total", m_resumePoint.totalTimeInSeconds); } XMLUtils::GetDateTime(movie, "dateadded", m_dateAdded); }
int main(int argc, char *argv[]) { GFraMe_ret rv; GFraMe_save sv, *pSv; GFraMe_wndext ext; int zoom, lang; state st; ext.atlas = "atlas"; ext.atlasWidth = 256; ext.atlasHeight = 256; ext.flags = GFraMe_wndext_none; //ext.flags = GFraMe_wndext_scanline; rv = GFraMe_init ( SCR_W, SCR_H, WND_W, WND_H, ORG, NAME, GFraMe_window_none, // GFraMe_window_fullscreen &ext, FPS, 1, // Log to file 0 // Log append ); GFraMe_assertRet(rv == GFraMe_ret_ok, "Init failed", __ret); setIcon(); // Set the bg color GFraMe_set_bg_color(0x22, 0x20, 0x34, 0xff); // Set the actual game dimensions pSv = 0; rv = GFraMe_save_bind(&sv, CONFFILE); GFraMe_assertRet(rv == GFraMe_ret_ok, "Error opening file", __ret); pSv = &sv; rv = GFraMe_save_read_int(&sv, "zoom", &zoom); if (rv == GFraMe_ret_ok) { // Switch the resolution if (zoom != 0 && zoom != 2) { GFraMe_ret rv; rv = GFraMe_screen_set_window_size(SCR_W*zoom, SCR_H*zoom); if (rv == GFraMe_ret_ok) GFraMe_screen_set_pixel_perfect(0, 1); } else if (zoom == 0) { GFraMe_ret rv; rv = GFraMe_screen_setFullscreen(); if (rv == GFraMe_ret_ok) GFraMe_screen_set_pixel_perfect(0, 1); } } // Check if the language was stored (and load it) rv = GFraMe_save_read_int(&sv, "lang", &lang); if (rv == GFraMe_ret_ok) { if (lang == EN_US) { gl_lang = EN_US; } else if (lang == PT_BR) { gl_lang = PT_BR; } } else { gl_lang = EN_US; } GFraMe_save_close(&sv); pSv = 0; rv = GFraMe_audio_player_init(); GFraMe_assertRet(rv == GFraMe_ret_ok, "Audio player init failed", __ret); rv = gl_init(); GFraMe_assertRet(rv == GFraMe_ret_ok, "global init failed", __ret); GFraMe_controller_init(1); st = MENUSTATE; // st = CREDITS; while (gl_running) { switch (st) { case MENUSTATE: st = menustate(); break; case NEW_PLAYSTATE: st = playstate(0); break; case CNT_PLAYSTATE: st = playstate(1); break; case OPTIONS: st = options(); break; case DEMO: st = demo(); break; case CREDITS: st = credits(); break; default: rv = 123; GFraMe_assertRet(0, "Invalid state!", __ret); } } rv = 0; __ret: if (pSv) GFraMe_save_close(pSv); GFraMe_audio_player_pause(); GFraMe_audio_player_clear(); gl_clean(); GFraMe_controller_close(); GFraMe_quit(); return rv; }
int main1() { char ch; clrscr(); printf("\n"); textcolor(CYAN); cprintf(" Solutions to Basic Electronics"); printf("\n\n"); textcolor(MAGENTA); cprintf(" - S.P.Prathyush"); printf("\n\n\n"); textcolor(WHITE); cprintf(" Enter The Topic"); printf("\n\n\t 1.Half Wave Rectifier \n\t 2.Full Wave Rectifier \n\t 3.Bridge Rectifier \n\t 4.Transistor \n\t 5.Solve by Equations \n\t 6.Definitions \n\t 7.Question Paper Pattern \n\t 8.Syllabus \n\t 9.Reference"); gotoxy(40,7); printf(" Special Features:"); gotoxy(40,9); printf(" a.Formula List"); gotoxy(40,10); printf(" b.Features"); gotoxy(40,11); printf(" c.View Credits"); printf("\n\n\t"); textcolor(YELLOW); gotoxy(35,23); cprintf(" Press Q to Quit "); printf("\n\n\t"); gotoxy(35,24); cprintf(" Enter Your Choice : "); textcolor(WHITE); printf(""); date(); ch=getche(); switch(ch) { case '1': HWR(); break; case '2': FWR(); break; case '3': Bridge(); break; case '4': Transistor(); break; case '5': Equations(); break; case '6': definitions(); break; case '7': pattern(); break; case '8': syllabus(); break; case '9': reference(); break; case 'a': Formula(); break; case 'b': Features(); break; case 'c': credits(); break; case 'Q': exit(ch-'Q'); break; default: printf("\n\n\t"); textcolor(RED+BLINK); cprintf(" Invalid Choice"); invalid(); getch(); end1(); break; } return 0; }
/*Description - Prints the main menu in a new window using ncurses library*/ void menu() { system("clear"); WINDOW *menu_win; int highlight = 1; int choice = 0; int c; initscr(); clear(); noecho(); cbreak(); /* Line buffering disabled. pass on everything */ startx = (80 - WIDTH) / 2; starty = (24 - HEIGHT) / 2; menu_win = newwin(HEIGHT, WIDTH, starty, startx); keypad(menu_win, TRUE); mvprintw(0, 20, "***************BLACKJACK****************"); mvprintw(2, 7, "Use arrow keys to go up and down, Press enter to select a choice"); refresh(); print_menu(menu_win, highlight); while(1) { c = wgetch(menu_win); switch(c) { case KEY_UP: if(highlight == 1) highlight = n_choices; else --highlight; break; case KEY_DOWN: if(highlight == n_choices) highlight = 1; else ++highlight; break; case 10: choice = highlight; break; default: mvprintw(24, 0, "Charcter pressed is = %3d Hopefully it can be printed as '%c'", c, c); refresh(); break; } print_menu(menu_win, highlight); if(choice != 0) /* User did a choice come out of the infinite loop */ break; } clrtoeol(); endwin(); switch(choice) { case 1: /*Guide*/ guide(); menu(); break; case 2: /*Login*/ login(); break; case 3: /*New account*/ new_user(); menu(); break; case 4: /*Credits*/ credits(); menu(); break; case 5: /*Admin*/ admin_login(); break; case 6: /*exit*/ exit(0); break; } }
ContributorsDialog::ContributorsDialog(QWidget * parent): QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint), ui(new Ui::HtmlDialog) { ui->setupUi(this); setWindowTitle(tr("OpenTX Contributors")); setWindowIcon(CompanionIcon("contributors.png")); QString str = "<html>" \ "<head>" \ " <style type=\"text/css\">" \ " .normal { font-weight:normal;color:#000000;vertical-align:top;font-size:10px;text-align:left;font-family:arial,helvetica,sans-serif; }" \ " .bold { font-weight:bold;color:#C00000;vertical-align:top;font-size:10px;text-align:left;font-family:arial,helvetica,sans-serif; }" \ " .title { font-weight:bold;color:#000000;font-size:14px;text-align:left;font-family:arial,helvetica,sans-serif; }" \ " </style>" \ "</head>" "<body class=\"normal\">"; QFile credits(":/CREDITS.txt"); if (credits.open(QIODevice::ReadOnly | QIODevice::Text)) { QStringList names; while (!credits.atEnd()) { QByteArray line = credits.readLine(); if (line.trimmed() == "") break; names.append(line.trimmed()); } str.append(formatTable(tr("Main Developers"), names, 3)); names.clear(); while (!credits.atEnd()) { QByteArray line = credits.readLine(); names.append(line.trimmed()); } str.append(formatTable(tr("Other contributors"), names, 3)); } QFile donations(":/DONATIONS.txt"); if (donations.open(QIODevice::ReadOnly | QIODevice::Text)) { QStringList names; while (!donations.atEnd()) { QByteArray line = donations.readLine(); if (line.trimmed() == "") break; names.append(line.trimmed()); } str.append(formatTable(tr("Companies and projects who have donated to OpenTX"), names, 3)); names.clear(); while (!donations.atEnd()) { QByteArray line = donations.readLine(); names.append(line); } str.append(formatTable(tr("People who have donated to OpenTX"), names, 6)); } str.append(" <tr><td class=\"normal\"> </td></tr>" \ " <tr><td colspan=3 class=\"normal\">" + tr("Honors go to Rafal Tomczak (RadioClone), Thomas Husterer (th9x) and Erez Raviv (er9x and eePe)") + "<br/></td></tr>" \ " <tr><td colspan=3 class=\"normal\">" + tr("Thank you all !!!") + "</td></tr>" \ "</table>"); str.append("</body></html>"); ui->textEditor->setHtml(str); ui->textEditor->scroll(0, 0); ui->textEditor->setOpenExternalLinks(true); }
void halt_system(char** args, int argc) { credits(args, argc); shutdown(); }
int bb(void) { aa_gotoxy(context, 0, 0); introscreen(); params = aa_getrenderparams(); aa_render(context, params, 0, 0, 1, 1); font = uncompressfont( /*context->params.font */ &aa_font16); scenetimer = tl_create_timer(); srand(time(NULL)); if (stage != 1) finish_stuff = 1; do switch (stage) { default: case 1: load_song("bb.s3m"); bbupdate(); starttime = endtime = TIME; aa_resize (context); scene1(); aa_resize (context); scene3(); if (quitnow) goto quit; aa_resize (context); vezen(&fk1, &fk2, &fk3, &fk4); messager("FILIP KUPSA known as FK, Tingle Notions, Dawn Music\n" "birth: June 22 1979, Tabor, Czech Republic, sex: male\n" "\n" "1992 - Changed his piano for 386/mp.com/pc-speaker music\n" "1993 - Got his first Sound Blaster\n" "1995 - Changed his SB for a new GUS technology\n" "1996 - Composed his first great hits\n" "1996 - FAT recomposition made by Windows 95\n" "1997 - Released his musac in BB\n" "\n" "1998 - Got retired\n" "\n" "Contact address: via KT"); devezen2(); aa_resize (context); scene4(); aa_resize (context); scene2(); aa_resize (context); if (quitnow) goto quit; vezen(&ms1, &ms2, &ms3, &ms4); messager("MOJMIR SVOBODA known as MS, TiTania, MSS, Bill\n" "birth: ??, Tabor, Czech Republic, sex: ? male ?\n" "\n" "1993 - Installed Linux on his 386sx/25 + 40MB HDD\n" "1994 - Removed Linux to make space for Doom\n" "1995 - Reinstalled Linux on his 486Dx4/120 + 850MB\n" "1996 - Removed Linux to make space for Windows 95\n" "\n" "1997 - Removed Windows 95 to make space for aalib\n" "\n" "Contact address: [email protected]"); devezen3(); aa_resize (context); scene8(); aa_resize (context); scene6(); aa_resize (context); case 2: if (quitnow) goto quit; aa_resize (context); vezen(&kt1, &kt2, &kt3, &kt4); messager("KAMIL TOMAN known as KT, Kato, Whale, Bart\n" "birth: May 19 1979, Tabor, Czech Republic, sex: male\n" "\n" "1993 - Became a linux extremist\n" "1993 - Successful attempt to establish a secret organization\n" " Commandline Brotherhood\n" "1995 - Action 'koules' - a secret project to train brotherhood\n" " members - covered under a game design\n" "\n" "1998 - Heading a new wave of command line revolution\n" "\n" "Contact address: [email protected]"); bbupdate(); starttime = endtime = TIME; devezen1(); aa_resize (context); if (quitnow) goto quit; aa_resize (context); scene7(); if (quitnow) goto quit; aa_resize (context); scene5(); if (quitnow) goto quit; aa_resize (context); scene10(); vezen(&hh1, &hh2, &hh3, &hh4); messager("JAN HUBICKA known as HH, Jahusoft, HuJaSoft, JHS, UNIX, Honza\n" "birth: Apr 1 1978, Tabor, Czech Republic, sex: male\n" "\n" "1991 - Installed underground hackers OS Linux\n" "1995 - Headed Action 'koules'\n" "1996 - Famous troan XaoS to convert all windows instalations\n" " into Linux\n" "\n" "1998 - Secret plan to make `Text Windows` system to confuse users\n" "2001 - Planning an assassination of dictator Bill G.\n" "\n" "Contact address: [email protected]"); aa_resize (context); devezen4(); if (quitnow) goto quit; aa_resize (context); credits(); if (quitnow) goto quit; case 3: if (loopmode) break; aa_resize (context); credits2(); } while (loopmode); quit:; aa_close(context); return (0); }
int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPTSTR lpCmdLine, _In_ int nCmdShow) { UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); MSG msg; // call our function to init and create our window if (!InitWindow(hInstance, nCmdShow)) { MessageBox(NULL, TEXT("Unable to create window"), TEXT("ERROR"), MB_OK); return FALSE; } if (!InitDirect3D(hWnd)) { MessageBox(NULL, TEXT("Unable to init Direct3D"), TEXT("ERROR"), MB_OK); return FALSE; } InventorySetup(); // INVENTORY_EXAMPLE - build the inventory //HUD SAMPLE //main declarations SpriteStrip barSprites(L"bar.png", 4); SpriteStrip CreditSprites(L"credits.png", 8); //healthbar float playerHealth = 100.0; float maxPlayerHealth = playerHealth; int healthBarImageID = 0; StatusBar playerHealthBar(L"Health", 5, 5, healthBarImageID, playerHealth, maxPlayerHealth, barSprites ); /* //when health is modified if(playerHealth >= 50.0){ healthBarImageID = 0; }else{ if(playerHealth >= 25.0){ healthBarImageID = 1; }else{ healthBarImageID = 2; } } playerHealthBar.changeImage(healthBarImageID); playerHealthBar.modifyValue(playerHealth, barSprites); */ //stamina bar float playerStamina = 100.0; float maxPlayerStamina = playerStamina; StatusBar playerStaminaBar(L"Stamina", 5, 26, 4, playerStamina, maxPlayerStamina, barSprites ); /* //when stamina is modified playerStaminaBar.modifyValue(playerStamina, barSprites); */ //credits bool showCredits = true; int li = 0; int crSlide = 0; StatusIcon credits(L"credits", SCREEN_WIDTH/4, SCREEN_HEIGHT/4, crSlide, CreditSprites); //END HUD SAMPLE // Main message loop: // Enter the message loop memset(&msg, 0, sizeof(MSG)); while( msg.message!=WM_QUIT ) { // check for messages if( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) ) { TranslateMessage( &msg ); DispatchMessage( &msg ); } // this is called when no messages are pending else { // clear background to a white offset g_pD3DDevice->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(240, 240, 240), 1.0f, 0); if(SUCCEEDED(g_pD3DDevice->BeginScene())) { inventory.drawElement(); // INVENTORY_EXAMPLE //HUD SAMPLE playerHealthBar.drawElement(barSprites); playerStaminaBar.drawElement(barSprites); if(showCredits == true){ credits.drawElement(CreditSprites); li++; if (li > 150){ crSlide++; credits.changeImage(crSlide, CreditSprites); li = 0; } if(crSlide > 7){ li = 0; crSlide = 0; showCredits = false; }else{ showCredits = true; } } //END HUD SAMPLE g_pD3DDevice->EndScene(); } // Present the backbuffer contents to the display g_pD3DDevice->Present( NULL, NULL, NULL, NULL ); } } // release and shutdown Direct3D ShutdownDirect3D(); return (int) msg.wParam; }