void display(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); if(full_screen)glutFullScreen(); else{ if(f_s_off){ glutReshapeWindow(900,600); glutPositionWindow(100,100); f_s_off=FALSE; } } if(menu_id==0)DrawMenu(0,0,menuArray[0],true); else if(menu_id==1)DrawMenu(0,0,menuArray[1],true); else if(menu_id==2)DrawMenu(0,0,menuArray[2],true); else if(menu_id==3)DrawMenu(0,0,menuArray[3],true); else if(menu_id==4)DrawMenu(0,0,menuArray[4],true); else { Render_Gioco(); } glutSwapBuffers(); }
void OperMenu(T_E_Sel *Mnu){ int Y; if ((MX>=Mnu->X)&&(MX<Mnu->X+20)){ Y=MY/20; if ((!MBlock)&&(MB)&&(Y==0)&&(Mnu->Top)) {Mnu->Top--;DrawMenu(*Mnu);MBlock=1;} if ((!MBlock)&&(MB)&&(Y==19)&&(Mnu->Top<Mnu->L-1)) {Mnu->Top++;DrawMenu(*Mnu);MBlock=1;} if ((Y>0)&&(Y<19)&&(Mnu->Top+Y-1<Mnu->L)){ if ((!MBlock)&&(MB)){Mnu->Akt=Mnu->Top+Y-1;DrawMenu(*Mnu);MBlock=1;} else DrawMsg(Mnu->E[Mnu->Top+Y-1].Desc); } } }
void StageLose(void) { clear(); DrawMenu(); ClearWindows(); attron(COLOR_PAIR(11)); mvprintw(21,28," __ "); mvprintw(22,28," | |"); mvprintw(23,28," _____ _ _____ _ _ _ | |"); mvprintw(24,28,"| __| |_ ___ ___ ___ | __|___|_| |___ _| | |__|"); mvprintw(25,28,"|__ | _| .'| . | -_| | __| .'| | | -_| . | __ "); mvprintw(26,28,"|_____|_| |__,|_ |___| |__| |__,|_|_|___|___| |__|"); mvprintw(27,28," |___| "); attroff(COLOR_PAIR(11)); refresh(); LoadStage('l'); attron(A_BOLD); mvprintw(32,54,"Done!"); attroff(A_BOLD); refresh(); usleep(500000); ClearMap(); curs_set(1); }
static void MenuModeHandler(unsigned char Option) { PageType = PAGE_TYPE_MENU; if (Option) CurrentPage[PageType] = (eIdleModePage)Option; DrawMenu(CurrentPage[PageType]); }
u32 GetButtonMap(u16 ctrlr_type, char* btn_name) { u32 pressed, previous; char temp[50] = ""; uint k; pressed = 0; previous = 1; switch (ctrlr_type) { case CTRLR_NUNCHUK: strncpy (cfg_text[3], (char*)"NUNCHUK", 7); break; case CTRLR_CLASSIC: strncpy (cfg_text[3], (char*)"CLASSIC", 7); break; case CTRLR_GCPAD: strncpy (cfg_text[3], (char*)"GC PAD", 7); break; case CTRLR_WIIMOTE: strncpy (cfg_text[3], (char*)"WIIMOTE", 7); break; }; /*** note which button we are remapping ***/ sprintf (temp, (char*)"Remapping "); for (k=0; k<9-strlen(btn_name); k++) strcat(temp, " "); // add whitespace padding to align text strncat (temp, btn_name, 9); // snes button we are remapping strncpy (cfg_text[0], temp, 19); // copy this all back to the text we wish to display DrawMenu(&cfg_text[0], NULL, cfg_text_count, 1); // display text pressed = GetInput(ctrlr_type); return pressed; } // end getButtonMap()
static int DrawMenu(int menu, int x, int *y) { int i; int ret = 1; for(i=0; i < Menus[menu].NumItems; i++) { char *s = Menus[menu].Items[i].name; int a = 0; if(MouseY >= *y && MouseY < *y + MENU_FONT_HEIGHT && MouseX >= x && MouseX < x + Menus[menu].width) { a = 1; SelectedMenu = menu; ret = 0; Menus[menu].selected = i; glColor3f(1,0,0); } else glColor3f(1,1,1); *y += MENU_FONT_HEIGHT; glRasterPos2i(x, *y); for(; *s; s++) glutBitmapCharacter(MENU_FONT, *s); if(Menus[menu].selected == i) if(Menus[menu].Items[i].submenu) if(DrawMenu(Menus[menu].Items[i].submenu, x + SUBMENU_OFFSET, y)) { if(!a) Menus[menu].selected = -1; } else ret = 0; } return ret; }
u32 GetButtonMap(u16 ctrlr_type, char* btn_name) { u32 pressed, previous; char title[20]; pressed = 0; previous = 1; switch (ctrlr_type) { case CTRLR_NUNCHUK: strncpy (cfg_text[3], (char*)"NUNCHUK", 7); break; case CTRLR_CLASSIC: strncpy (cfg_text[3], (char*)"CLASSIC", 7); break; case CTRLR_GCPAD: strncpy (cfg_text[3], (char*)"GC PAD", 7); break; case CTRLR_WIIMOTE: strncpy (cfg_text[3], (char*)"WIIMOTE", 7); break; }; sprintf (cfg_text[0], "Remapping %s", btn_name); // note which button we are remapping DrawMenu(&cfg_text[0], title, cfg_text_count, 1); // display text // while (previous != pressed && pressed == 0); // get two consecutive button presses (which are the same) // { // previous = pressed; // VIDEO_WaitVSync(); // slow things down a bit so we don't overread the pads pressed = GetInput(ctrlr_type); // } return pressed; } // end getButtonMap()
void StageWin(void) { clear(); DrawMenu(); ClearWindows(); attron(COLOR_PAIR(8)); mvprintw(17,25, " __ "); mvprintw(18,25, " | |"); mvprintw(19,25, " _____ _ _____ _ _ | |"); mvprintw(20,25, "| __| |_ ___ ___ ___ | | |___ ___ ___ ___ _| | |__|"); mvprintw(21,25, "|__ | _| .'| . | -_| | --| | -_| .'| _| -_| . | __ "); mvprintw(22,25, "|_____|_| |__,|_ |___| |_____|_|___|__,|_| |___|___| |__|"); mvprintw(23,25, " |___| "); attroff(COLOR_PAIR(8)); refresh(); LoadStage('w'); attron(A_BOLD); mvprintw(32,54,"Done!"); attroff(A_BOLD); refresh(); usleep(750000); // ClearMap(); curs_set(1); }
int main (void) { StartCurses(); DrawMenu(); Level lvl; TowerList tList; // Tower List UnitList uList; // Unit List UnitList sQueue; // Spawn queue PathList pList; // Path list UnitList PDUL; // Initializing variables TowerInitialize(&tList); UnitInitialize(&uList); UnitInitialize(&sQueue); UnitInitialize(&PDUL); PathInitialize(&pList); ReadStandardUnits(&PDUL); ReadFile(1, &tList, &pList, &lvl); DrawAvailableUnits(&lvl,&PDUL); refresh(); DrawMap(&tList,&pList); PrintArrows(&pList); PrintUnitSelection(); ClearMap(); LeaderBoard(); getchar(); EndCurses(); }
//メニュー画面を表示 void MainMenu(){ //4つの項目をどれも開いていなかったら if(MapMenu[1].Flag != 1 && MapMenu[2].Flag != 1 && MapMenu[3].Flag != 1 && MapMenu[4].Flag != 1){ // メニュー項目を描画 DrawGraph( MapMenu[0].x, MapMenu[0].y, MapMenu[0].Graph, TRUE ); MapMenu[ DrawMenu( 4, 1, KEY_INPUT_Z, MenuElement2 ) + 1 ].Flag=1; } }
bool GDisplayMenu::DrawTestResultMenu() { m_MenuLabelsMap[GSoftKeysWindowTemplate::eSOFT_L1] = ""; m_MenuLabelsMap[GSoftKeysWindowTemplate::eSOFT_L2] = ""; m_MenuLabelsMap[GSoftKeysWindowTemplate::eSOFT_L3] = ""; m_MenuLabelsMap[GSoftKeysWindowTemplate::eSOFT_L4] = std::string(" Previous\n Menu"); char arycBuffer[64]; GDisplayServiceStatistics & oStats = GDisplayService::GetService()->GetStatistics(); UINT8 u8PassCont1, u8PassCont2, u8PassCont3, u8PassCont4, u8PassCont5 = 0; UINT8 u8FailCont1, u8FailCont2, u8FailCont3, u8FailCont4, u8FailCont5 = 0; UINT16 u16TotalTest = GDisplayService::GetService()->GetStatistics().GetTotalTests(); m_MenuLabelsMap[GSoftKeysWindowTemplate::eSEGMENT_1] = "The result of display test was:"; u8PassCont1= oStats.GetStatistics(GDisplayServiceStatistics::ePass, GDisplayServiceStatistics::eTest1_White_Color); u8FailCont1= oStats.GetStatistics(GDisplayServiceStatistics::eFail, GDisplayServiceStatistics::eTest1_White_Color); snprintf(arycBuffer, sizeof(arycBuffer), "White color: PASS [%d] FAIL [%d].", u8PassCont1, u8FailCont1 ); m_MenuLabelsMap[GSoftKeysWindowTemplate::eSEGMENT_2] = arycBuffer; u8PassCont2= oStats.GetStatistics(GDisplayServiceStatistics::ePass, GDisplayServiceStatistics::eTest2_Black_Color); u8FailCont2= oStats.GetStatistics(GDisplayServiceStatistics::eFail, GDisplayServiceStatistics::eTest2_Black_Color); snprintf(arycBuffer, sizeof(arycBuffer), "Black color: PASS [%d] FAIL [%d].", u8PassCont2, u8FailCont2 ); m_MenuLabelsMap[GSoftKeysWindowTemplate::eSEGMENT_3] = arycBuffer; u8PassCont3= oStats.GetStatistics(GDisplayServiceStatistics::ePass, GDisplayServiceStatistics::eTest3_Red_Color); u8FailCont3= oStats.GetStatistics(GDisplayServiceStatistics::eFail, GDisplayServiceStatistics::eTest3_Red_Color); snprintf(arycBuffer, sizeof(arycBuffer), "Red color: PASS [%d] FAIL [%d].", u8PassCont3, u8FailCont3 ); m_MenuLabelsMap[GSoftKeysWindowTemplate::eSEGMENT_4] = arycBuffer; u8PassCont4= oStats.GetStatistics(GDisplayServiceStatistics::ePass, GDisplayServiceStatistics::eTest4_Green_Color); u8FailCont4= oStats.GetStatistics(GDisplayServiceStatistics::eFail, GDisplayServiceStatistics::eTest4_Green_Color); snprintf(arycBuffer, sizeof(arycBuffer), "Green color: PASS [%d] FAIL [%d].", u8PassCont4, u8FailCont4 ); m_MenuLabelsMap[GSoftKeysWindowTemplate::eSEGMENT_5] = arycBuffer; u8PassCont5= oStats.GetStatistics(GDisplayServiceStatistics::ePass, GDisplayServiceStatistics::eTest5_Blue_Color); u8FailCont5= oStats.GetStatistics(GDisplayServiceStatistics::eFail, GDisplayServiceStatistics::eTest5_Blue_Color); snprintf(arycBuffer, sizeof(arycBuffer), "Blue color: PASS [%d] FAIL [%d].", u8PassCont5, u8FailCont5 ); m_MenuLabelsMap[GSoftKeysWindowTemplate::eSEGMENT_6] = arycBuffer; m_MenuLabelsMap[GSoftKeysWindowTemplate::eSEGMENT_7] = "Summary:"; snprintf(arycBuffer, sizeof(arycBuffer), "PASS [%d] - FAIL [%d] - TOTAL [%d]", (u8PassCont1+u8PassCont2+u8PassCont3+u8PassCont4+u8PassCont5), (u8FailCont1+u8FailCont2+u8FailCont3+u8FailCont4+u8FailCont5), u16TotalTest ); m_MenuLabelsMap[GSoftKeysWindowTemplate::eSEGMENT_8] = arycBuffer; m_MenuLabelsMap[GSoftKeysWindowTemplate::eSEGMENT_9] = ""; m_MenuLabelsMap[GSoftKeysWindowTemplate::eSOFT_R1] = ""; m_MenuLabelsMap[GSoftKeysWindowTemplate::eSOFT_R2] = ""; m_MenuLabelsMap[GSoftKeysWindowTemplate::eSOFT_R3] = ""; m_MenuLabelsMap[GSoftKeysWindowTemplate::eSOFT_R4] = ""; return DrawMenu(); }
void MenuView::DrawMenu() { menu_item = 0; if (menu) { int mx = right_start.x - 2; int my = right_start.y - 2; DrawMenu(mx, my, menu); } }
void C4Viewport::DrawOverlay(C4TargetFacet &cgo, const ZoomData &GameZoom) { if (!Game.C4S.Head.Film || !Game.C4S.Head.Replay) { // Player info C4ST_STARTNEW(PInfoStat, "C4Viewport::DrawOverlay: Player Info") DrawPlayerInfo(cgo); C4ST_STOP(PInfoStat) C4ST_STARTNEW(MenuStat, "C4Viewport::DrawOverlay: Menu") DrawMenu(cgo); C4ST_STOP(MenuStat) }
/**************************************************************************** * domenu * * Returns index into menu array when A is pressed, -1 for B ****************************************************************************/ int DoMenu (char items[][20], int maxitems) { int redraw = 1; int quit = 0; short p; int ret = 0; while (quit == 0) { if (redraw) { DrawMenu (&items[0], maxitems, menu); redraw = 0; } p = getMenuButtons (); if (p & PAD_BUTTON_UP) { redraw = 1; menu--; if (menu < 0) menu = maxitems - 1; } if (p & PAD_BUTTON_DOWN) { redraw = 1; menu++; if (menu == maxitems) menu = 0; } if ((p & PAD_BUTTON_A) || (p & PAD_BUTTON_RIGHT)) { quit = 1; ret = menu; } if (p & PAD_BUTTON_LEFT) { quit = 1; ret = 0 - 2 - menu; } if (p & PAD_BUTTON_B) { quit = 1; ret = -1; } } return ret; }
int StartMenu(){ //DrawGraph(240,40,MenuBackGround,TRUE); DrawFormatString( 320, 240, GetColor( 255, 255, 255 ), "ver4.00"); if(syori==1)syori=help(); else { for(int i=0;i<5; i++)DrawBox( MenuElement[i].x, MenuElement[i].y, MenuElement[i].x+18, MenuElement[i].y+18, GetColor( 255, 0, 0 ), FALSE) ; switch( DrawMenu( 5, 1, KEY_INPUT_Z, MenuElement ) ){ case 0:return 2; // ゲームスタート case 2:syori=help();break; case 4:return 5; // ゲーム終了 } } return 1; }
void MenuState::Enter(Ndk::StateMachine& /*fsm*/) { m_text.SetVisible(true); DrawMenu(); Nz::EventHandler& eventHandler = m_context.window.GetEventHandler(); m_keyPressedSlot.Connect(eventHandler.OnKeyPressed, [this] (const Nz::EventHandler*, const Nz::WindowEvent::KeyEvent& key) { if (key.code >= Nz::Keyboard::Key::A && key.code < (Nz::Keyboard::Key::A + static_cast<int>(EventStatus::Max) - 1)) { m_selectedNextState = key.code - static_cast<int>(Nz::Keyboard::Key::A); } }); }
int Battle( Character_t *Character, int EnemyType){ DrawGraph(0,0,BackGround,TRUE); MessageFrame(); DrawFormatString( 60, 140, GetColor(255, 255, 255), " LV:%d ",Character->LEVEL) ; DrawGauge( 15, 16, Character->MaxHP, Character->HP, GetColor( 0, 255, 0 ), GetColor(0, 255/2, 0),TRUE); DrawGauge( 15, 31, Character->MaxMP, Character->MP, GetColor( 255, 255, 0 ),GetColor( 255/2, 255/2, 0 ),TRUE ); DrawGraph(Enemy[EnemyType].X, Enemy[EnemyType].Y, Enemy[EnemyType].Graph, TRUE); // 現れたとこ if(move==0){if(DrawBattleMessage( 0, 2, BattleMenuString, 0, EnemyType, TRUE) == 1 )move=1;} // 選択 if(move==1)switch( DrawMenu( 2, 2, KEY_INPUT_Z, BattleMenu) ){ // 速度判定 case 0:backmenu=0;if( Character->Speed >= Enemy[EnemyType].Speed ){ Damage=DamageCalc2( *Character, &Enemy[EnemyType]);move=3; }else { Damage=DamageCalc2( Enemy[EnemyType], Character);move=5; }break; case 1:break; case 2:move=2;break; case 3:break; } //逃げ出す勇者の処理 if(move==2)if( DrawBattleMessage( 2, 3, BattleMenuString, 0, EnemyType,FALSE) == 1 ){move=0;Enemy[EnemyType].HP = Enemy[EnemyType].MaxHP ;return 2;} // 的にダメージを与える処理 中かっこの中には勝った時の処理 if(move==3)if(DamageCalc3( Character, &Enemy[EnemyType], 3, 5, 5, EnemyType, FALSE)==1){ Character->Ex += Enemy[EnemyType].Ex ; Enemy->HP = Enemy[EnemyType].MaxHP ; move=0 ; return 2 ; } // 敵のダメージを与える分を表示 中かっこの中には負けた時の処理 if(move==5)if(DamageCalc3( &Enemy[EnemyType], Character, 5, 7, 3, EnemyType, TRUE)==1){ move=0 ; return 0 ; } return 4 ; }/*
void BatchScreenshot(MenuInfo* info, bool full_batch) { for (u32 idx_m = 0; info[idx_m].name != NULL; idx_m++) { for (u32 idx_s = 0; idx_s < ((full_batch) ? info[idx_m].n_entries : 1); idx_s++) { char filename[16]; snprintf(filename, 16, "menu%04lu.bmp", (idx_m * 100) + idx_s); #ifndef USE_THEME DrawMenu(info + idx_m, idx_s, true, true); #else LoadThemeGfxLogo(); LoadThemeGfxMenu((idx_m * 100) + idx_s); #endif Screenshot(filename); } } }
void KeyState::Enter(Ndk::StateMachine& fsm) { m_text.SetVisible(true); DrawMenu(); Nz::EventHandler& eventHandler = m_context.window.GetEventHandler(); m_keyPressedSlot.Connect(eventHandler.OnKeyPressed, [&] (const Nz::EventHandler*, const Nz::WindowEvent::KeyEvent& key) { ManageInput(KeyStatus::Pressed, key, fsm); }); m_keyReleasedSlot.Connect(eventHandler.OnKeyReleased, [&] (const Nz::EventHandler*, const Nz::WindowEvent::KeyEvent& key) { ManageInput(KeyStatus::Released, key, fsm); }); }
/* * Start Allegro and draw the game Menu */ NinmanMenu::NinmanMenu() { NinmanConfig::loadConfig(); install_keyboard(); install_mouse(); install_timer(); if (install_sound(DIGI_AUTODETECT, MIDI_NONE, NULL) < 0) install_sound(DIGI_OSS, MIDI_NONE, NULL); set_color_depth(32); if (NinmanConfig::getFullScreenOption()) set_gfx_mode(GFX_AUTODETECT, 800, 600, 0, 0); else set_gfx_mode(GFX_AUTODETECT_WINDOWED, 800, 600, 0, 0); set_volume(NinmanConfig::getVolume(), 0); DrawMenu(220); MainMenu(); }
/** * Draw a frame * @param delta Delta time between the last frame and now */ void Renderer::DrawFrame(float pDelta, bool pDisplayMenu) { UpdateDynamicElements(); glMemoryBarrier(GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT); glViewport(0, 0, _width, _height); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); DrawUi(pDelta); if (pDisplayMenu && _menuPtr != nullptr) DrawMenu(pDelta); CheckGLError(); }
int NinmanMenu::MainMenu() { int y = 220; while (true) { readkey(); if (key[KEY_ESC]) return 0; if (key[KEY_DOWN]) { y = y + 55; if (y > 440) y = 220; } if (key[KEY_UP]) { y = y - 55; if (y < 220) y = 440; } if (key[KEY_ENTER]) { if (y == 220) { std::string player; while (player == "") player = TextBox(); if (player != "-1") NinmanGame(player.c_str()); } if (y == 275) { Score(); y = 220; } if (y == 330) { OptionMenu(); y = 220; } if (y == 385) { About(); y = 220; } if (y == 440) break; clear_keybuf(); } DrawMenu(y); } return 0; }
void main() { bool StillPlaying=true; // Define our boolean flag to true. In this case, let's make a boolean and set it to true, meaning we int choice=0; // are "StillPlaying" the game. When Quit is chosen, we will set it to false, ending the game loop. // Let's create a while loop to continue until they Press '6' for quit. while(StillPlaying) // This says, do everything below until StillPlaying == false. Remember, a statement doesn't happen if 0 is the result from the expression. { DrawMenu(); // All we need to do is call our function, like so. // Since there are no parameters to pass in, we just close the parenthesis (); with a semicolon. // Now comes the part where we need to be able to choose from the menu. printf("Choose from the menu: "); // Prompt the user scanf("%d", &choice); // Get the users choice, (remember the & makes it so we can change "choice". Think of it as a security thing. It's permission to mess with choice.) // This is our "switch" statement. Just a quick review: // What it does is take "choice" (or whatever is passed in), and does a bunch of if/else statements on it. // it's pretty much the same things as if/else, but looks cleaner. switch(choice) // "case 1:" is the same thing as saying, "if(choice == 1)" You see? A lot cleaner. { case 1: printf("You chose a New Game!\n"); // if (choice == 1) break; // break - breaks out of the switch statement. case 2: printf("You chose to Load a Game!\n"); // if (choice == 2) break; // Print the choice and break; case 3: printf("You chose to Save a Game!\n"); // if (choice == 3) break; // Print the choice and break; case 4: printf("You chose your Inventory!\n"); // if (choice == 4) break; // Print the choice and break; case 5: printf("You chose Options!\n"); // if (choice == 5) break; // Print the choice and break; case 6: StillPlaying = false; // if (choice == 6) printf("Game Over Already?\n"); // StillPlaying is set to false. This means, when the code goes back up to the top, while(StillPlaying) will NOT be true and fail. break; // A weird thing about switch statements, you don't need brackets {} for more than one line. } // You just need a break; } // while (StillPlaying) // It's a good idea to label what the closing bracket is coming from. // When your code gets huge, it's kinda annoying to go back and match up all the brackets to find the statement. } // void main() // Once the user hits 6, the while loop quits and ends our program.
void DrawMenus(void) { int x, y; if(GameMode) return; x = Menus[ActiveMenu].x; y = Menus[ActiveMenu].y; /* save old settings */ glPushAttrib(GL_COLOR_BUFFER_BIT | GL_CURRENT_BIT | GL_ENABLE_BIT | GL_VIEWPORT_BIT); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadMatrixd(MenuProjection); glViewport(0, 0, VarInfo.xres, VarInfo.yres); glDisable(GL_DEPTH_TEST); glDisable(GL_ALPHA_TEST); glDisable(GL_LIGHTING); glDisable(GL_FOG); glDisable(GL_TEXTURE_2D); glEnable(GL_COLOR_LOGIC_OP); glLogicOp(GL_AND_REVERSE); if(DrawMenu(ActiveMenu, x, &y)) Menus[ActiveMenu].selected = -1; /* restore settings */ glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); glPopAttrib(); }
int Game::Draw(){ ClearScreen(); glLoadIdentity(); camera->Update(); //描画処理 switch(phase){ case MENU: DrawMenu(); break; case PLAY: DrawPlay(); break; case RESULT: DrawResult(); break; } SwapScreen(); return 0; }
//Output void cGame::Render() { glClear(GL_COLOR_BUFFER_BIT); glLoadIdentity(); if (level == MENU) { RenderMenu(IMG_MENU); }else if (level == ABOUT) { RenderMenu(IMG_ABOUT); }else if (level == CONTROLS) { RenderMenu(IMG_CONTROLS); }else { Scene.Draw(Data.GetID(IMG_TILESET)); for (int i = 0; i < allDogs.size(); ++i) allDogs[i].Draw(Data.GetID(IMG_DOG)); for (int i = 0; i < allOctopus.size(); ++i) { allOctopus[i].Draw(Data.GetID(IMG_OCTOPUS)); if (allOctopus[i].hasBall()) allOctopus[i].getBall()->Draw(Data.GetID(IMG_OCTOPUS)); } for (int i=0; i < Isaac.getAllTears()->size(); ++i) { Isaac.getTear(i)->Draw(Data.GetID(IMG_OCTOPUS)); } if (!Player.isDead()) Player.Draw(Data.GetID(IMG_PLAYER)); for (int i = 0; i < allSwords.size(); ++i) allSwords[i].Draw(Data.GetID(IMG_SWORD)); Isaac.Draw(Data.GetID(IMG_ISAAC)); DrawMenu(); } glutSwapBuffers(); }
void TextEnterState::Enter(Ndk::StateMachine& fsm) { m_text.SetVisible(true); DrawMenu(); Nz::EventHandler& eventHandler = m_context.window.GetEventHandler(); m_keyPressedSlot.Connect(eventHandler.OnKeyPressed, [&] (const Nz::EventHandler*, const Nz::WindowEvent::KeyEvent& key) { if (key.code == Nz::Keyboard::Key::M && key.shift) { fsm.ChangeState(StateFactory::Get(EventStatus::Menu)); } }); m_textEnteredSlot.Connect(eventHandler.OnTextEntered, [&] (const Nz::EventHandler*, const Nz::WindowEvent::TextEvent& event) { Nz::String content = "Character: " + Nz::String::Unicode(event.character); if (event.repeated) content += " repeated"; m_text.SetContent(content + "\nM for Menu"); }); }
u32 GetButtonMap(u16 ctrlr_type, char* btn_name) { u32 pressed, previous; char temp[50] = ""; uint k; pressed = 0; previous = 1; switch (ctrlr_type) { case CTRLR_NUNCHUK: strncpy (cfg_text[3], (char*)"NUNCHUK", 7); break; case CTRLR_CLASSIC: strncpy (cfg_text[3], (char*)"CLASSIC", 7); break; case CTRLR_GCPAD: strncpy (cfg_text[3], (char*)"GC PAD", 7); break; case CTRLR_WIIMOTE: strncpy (cfg_text[3], (char*)"WIIMOTE", 7); break; }; /*** note which button we are remapping ***/ sprintf (temp, (char*)"Remapping "); for (k=0; k<9-strlen(btn_name); k++) strcat(temp, " "); // add whitespace padding to align text strncat (temp, btn_name, 9); // snes button we are remapping strncpy (cfg_text[0], temp, 19); // copy this all back to the text we wish to display DrawMenu(&cfg_text[0], NULL, cfg_text_count, 1); // display text // while (previous != pressed && pressed == 0); // get two consecutive button presses (which are the same) // { // previous = pressed; // VIDEO_WaitVSync(); // slow things down a bit so we don't overread the pads pressed = GetInput(ctrlr_type); // } return pressed; } // end getButtonMap()
void AGameplayDebuggingHUDComponent::PrintAllData() { #if !(UE_BUILD_SHIPPING || UE_BUILD_TEST) // Allow child hud components to position the displayed info DefaultContext = FPrintContext(GEngine->GetSmallFont(), Canvas, DebugInfoStartX, DebugInfoStartY); DefaultContext.FontRenderInfo.bEnableShadow = true; if (DefaultContext.Canvas != NULL) { float XL, YL; const FString ToolName = FString::Printf(TEXT("Gameplay Debug Tool [Timestamp: %05.03f]"), GetWorld()->TimeSeconds); CalulateStringSize(DefaultContext, DefaultContext.Font, ToolName, XL, YL); PrintString(DefaultContext, FColorList::White, ToolName, DefaultContext.Canvas->ClipX / 2.0f - XL / 2.0f, 0); } const float MenuX = DefaultContext.CursorX; const float MenuY = DefaultContext.CursorY; UGameplayDebuggingComponent* DebugComponent = NULL; if (GetDebuggingReplicator()) { DebugComponent = GetDebuggingReplicator()->GetDebugComponent(); } if (DebugComponent) { APlayerController* const MyPC = Cast<APlayerController>(PlayerOwner); DrawDebugComponentData(MyPC, DebugComponent); } if (DefaultContext.Canvas && DefaultContext.Canvas->SceneView && DefaultContext.Canvas->SceneView->Family && DefaultContext.Canvas->SceneView->Family->EngineShowFlags.Game) { DrawMenu(MenuX, MenuY, DebugComponent); } #endif }
void WindowModificationState::Enter(Ndk::StateMachine& fsm) { m_text.SetVisible(true); DrawMenu(); Nz::EventHandler& eventHandler = m_context.window.GetEventHandler(); m_keyPressedSlot.Connect(eventHandler.OnKeyPressed, [&] (const Nz::EventHandler*, const Nz::WindowEvent::KeyEvent& key) { if (key.code == Nz::Keyboard::Key::M && key.shift) { fsm.ChangeState(StateFactory::Get(EventStatus::Menu)); } }); m_movedSlot.Connect(eventHandler.OnMoved, [&] (const Nz::EventHandler*, const Nz::WindowEvent::PositionEvent& event) { m_text.SetContent("Position(" + Nz::String::Number(event.x) + ", " + Nz::String::Number(event.y) + ")\nM for Menu"); }); m_resizedSlot.Connect(eventHandler.OnResized, [&] (const Nz::EventHandler*, const Nz::WindowEvent::SizeEvent& event) { m_text.SetContent("Size(" + Nz::String::Number(event.width) + ", " + Nz::String::Number(event.height) + ")\nM for Menu"); }); }