• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ popup函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中popup函数的典型用法代码示例。如果您正苦于以下问题:C++ popup函数的具体用法?C++ popup怎么用?C++ popup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了popup函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: barracks_squad_change_popup

// callback handler for the squadon selection buttons when they are disabled (in single player)
void barracks_squad_change_popup()
{
	// show a popup
	popup( PF_USE_AFFIRMATIVE_ICON | PF_NO_NETWORKING, 1, POPUP_OK, XSTR("You cannot change your squadron in Single Player mode.", 1445));
}
开发者ID:binyu0604,项目名称:fs2_open_patchbucket,代码行数:6,代码来源:barracks.cpp


示例2: utf8_width

void uimenu::show() {
    if (!started) {
        bool w_auto = (w_width == -1 || w_width == -2 );
        bool w_autofold = ( w_width == -2);
        int realtextwidth = 0;

        if ( w_auto ) {
            w_width = 4;
        }

        bool h_auto = (w_height == -1);
        if ( h_auto ) {
            w_height = 4;
        }

        std::vector<int> autoassign;
        autoassign.clear();
        int pad = pad_left + pad_right + 2;
        for ( int i = 0; i < entries.size(); i++ ) {
			int txtwidth = utf8_width(entries[ i ].txt.c_str());
            if(entries[ i ].enabled) {
                if( entries[ i ].hotkey > 0 ) {
                    keymap[ entries[ i ].hotkey ] = i;
                } else if ( entries[ i ].hotkey == -1 ) {
                    autoassign.push_back(i);
                }
                if ( entries[ i ].retval == -1 ) {
                    entries[ i ].retval = i;
                }
                if ( w_auto && w_width < txtwidth + pad + 4 ) {
                    w_width = txtwidth + pad + 4;
                }
            } else {
                if ( w_auto && w_width < txtwidth + pad + 4 ) {
                    w_width = txtwidth + pad + 4;    // todo: or +5 if header
                }
            }
        }
        if ( autoassign.size() > 0 ) {
            for ( int a = 0; a < autoassign.size(); a++ ) {
                int palloc = autoassign[ a ];
                if ( palloc < 9 ) {
                    entries[ palloc ].hotkey = palloc + 49; // 1-9;
                } else if ( palloc == 9 ) {
                    entries[ palloc ].hotkey = palloc + 39; // 0;
                } else if ( palloc < 36 ) {
                    entries[ palloc ].hotkey = palloc + 87; // a-z
                } else if ( palloc < 61 ) {
                    entries[ palloc ].hotkey = palloc + 29; // A-Z
                }
                if ( palloc < 61 ) {
                    keymap[ entries[ palloc ].hotkey ] = palloc;
                }
            }
        }

        if (w_auto && w_width > TERMX) {
            w_width = TERMX;
        }

        if(text.size() > 0 ) {
			int twidth = utf8_width(text.c_str());
            if ( textwidth == -1 ) {
                if ( w_autofold || !w_auto ) {
                   realtextwidth = w_width - 4;
                } else {
                   realtextwidth = twidth;
                   if ( twidth + 4 > w_width ) {
                       if ( realtextwidth + 4 > TERMX ) {
                           realtextwidth = TERMX - 4;
                       }
                       w_width = realtextwidth + 4;
                   }
                }
            } else if ( textwidth != -1 ) {
                realtextwidth = textwidth;
            }
            textformatted = foldstring(text, realtextwidth);
        }

        if (h_auto) {
            w_height = 2 + textformatted.size() + entries.size();
        }

        vmax = entries.size();
        if ( w_height > TERMY ) {
            w_height = TERMY;
        }
        if ( vmax + 2 + textformatted.size() > w_height ) {
            vmax = w_height - 2 - textformatted.size();
            if ( vmax < 1 ) {
                popup("Can't display menu options, %d %d available screen rows are occupied by\n'%s\n(snip)\n%s'\nThis is probably a bug.\n",
                   textformatted.size(),TERMY,textformatted[0].c_str(),textformatted[textformatted.size()-1].c_str()
                );
            }
        }

        if (w_x == -1) {
            w_x = int((TERMX - w_width) / 2);
        }
//.........这里部分代码省略.........
开发者ID:Abalieno,项目名称:Cataclysm-DDA,代码行数:101,代码来源:ui.cpp


示例3: complete_vehicle

void complete_vehicle (game *g)
{
    if (g->u.activity.values.size() < 7)
    {
        debugmsg ("Invalid activity ACT_VEHICLE values:%d", g->u.activity.values.size());
        return;
    }
    vehicle *veh = g->m.veh_at (g->u.activity.values[0], g->u.activity.values[1]);
    if (!veh)
    {
        debugmsg ("Activity ACT_VEHICLE: vehicle not found");
        return;
    }
    char cmd = (char) g->u.activity.index;
    int dx = g->u.activity.values[4];
    int dy = g->u.activity.values[5];
    int part = g->u.activity.values[6];
    int type = g->u.activity.values[7];
    std::vector<component> tools;
    int welder_charges = ((it_tool *) g->itypes["welder"])->charges_per_use;
    int welder_crude_charges = ((it_tool *) g->itypes["welder_crude"])->charges_per_use;
    itype_id itm;
    int partnum;
    item used_item;
    bool broken;
    int replaced_wheel;
    std::vector<int> parts;
    int dd = 2;
    switch (cmd)
    {
    case 'i':
        partnum = veh->install_part (dx, dy, (vpart_id) part);
        if(partnum < 0)
            debugmsg ("complete_vehicle install part fails dx=%d dy=%d id=%d", dx, dy, part);
        used_item = consume_vpart_item (g, (vpart_id) part);
        veh->get_part_properties_from_item(g, partnum, used_item); //transfer damage, etc.
        tools.push_back(component("welder", welder_charges));
        tools.push_back(component("welder_crude", welder_crude_charges));
        tools.push_back(component("toolset", welder_charges/20));
        g->consume_tools(&g->u, tools, true);

        if ( part == vp_head_light ) {
            // Need map-relative coordinates to compare to output of look_around.
            int gx, gy;
            // Need to call coord_translate() directly since it's a new part.
            veh->coord_translate(dx, dy, gx, gy);
            // Stash offset and set it to the location of the part so look_around will start there.
            int px = g->u.view_offset_x;
            int py = g->u.view_offset_y;
            g->u.view_offset_x = veh->global_x() + gx - g->u.posx;
            g->u.view_offset_y = veh->global_y() + gy - g->u.posy;
            popup("Choose a facing direction for the new headlight.");
            point headlight_target = g->look_around();
            // Restore previous view offsets.
            g->u.view_offset_x = px;
            g->u.view_offset_y = py;

            int delta_x = headlight_target.x - (veh->global_x() + gx);
            int delta_y = headlight_target.y - (veh->global_y() + gy);

            const double PI = 3.14159265358979f;
            int dir = (atan2(delta_y, delta_x) * 180.0 / PI);
            dir -= veh->face.dir();
            while(dir < 0) dir += 360;
            while(dir > 360) dir -= 360;

            veh->parts[partnum].direction = dir;
        }

        g->add_msg (_("You install a %s into the %s."),
                    vpart_list[part].name.c_str(), veh->name.c_str());
        g->u.practice (g->turn, "mechanics", vpart_list[part].difficulty * 5 + 20);
        break;
    case 'r':
        if (veh->parts[part].hp <= 0)
        {
            used_item = consume_vpart_item (g, veh->parts[part].id);
            tools.push_back(component("wrench", -1));
            g->consume_tools(&g->u, tools, true);
            tools.clear();
            dd = 0;
            veh->insides_dirty = true;
        }
        tools.push_back(component("welder", welder_charges));
        tools.push_back(component("welder_crude", welder_crude_charges));
        tools.push_back(component("toolset", welder_charges/20));
        g->consume_tools(&g->u, tools, true);
        veh->parts[part].hp = veh->part_info(part).durability;
        g->add_msg (_("You repair the %s's %s."),
                    veh->name.c_str(), veh->part_info(part).name.c_str());
        g->u.practice (g->turn, "mechanics", (vpart_list[part].difficulty + dd) * 5 + 20);
        break;
    case 'f':
        if (!g->pl_refill_vehicle(*veh, part, true))
            debugmsg ("complete_vehicle refill broken");
        g->pl_refill_vehicle(*veh, part);
        break;
    case 'o':
        // Dump contents of part at player's feet, if any.
        for (int i = 0; i < veh->parts[part].items.size(); i++)
//.........这里部分代码省略.........
开发者ID:EschatonOptimizers,项目名称:Cataclysm-DDA,代码行数:101,代码来源:veh_interact.cpp


示例4: construction_menu

void construction_menu()
{
    static bool hide_unconstructable = false;
    // only display constructions the player can theoretically perform
    std::vector<std::string> available;
    load_available_constructions( available, hide_unconstructable );

    if(available.empty()) {
        popup(_("You can not construct anything here."));
        return;
    }

    int iMaxY = TERMY;
    if (available.size() + 2 < iMaxY) {
        iMaxY = available.size() + 2;
    }
    if (iMaxY < FULL_SCREEN_HEIGHT) {
        iMaxY = FULL_SCREEN_HEIGHT;
    }

    WINDOW *w_con = newwin( iMaxY, FULL_SCREEN_WIDTH, (TERMY > iMaxY) ? (TERMY - iMaxY) / 2 : 0,
                            (TERMX > FULL_SCREEN_WIDTH) ? (TERMX - FULL_SCREEN_WIDTH) / 2 : 0 );
    draw_border(w_con);
    mvwprintz(w_con, 0, 8, c_ltred, _(" Construction "));

    mvwputch(w_con,  0, 30, c_ltgray, LINE_OXXX);
    mvwputch(w_con, iMaxY - 1, 30, c_ltgray, LINE_XXOX);
    for( int i = 1; i < iMaxY - 1; ++i ) {
        mvwputch(w_con, i, 30, c_ltgray, LINE_XOXO);
    }

    wrefresh(w_con);

    bool update_info = true;
    int select = 0;
    int chosen = 0;
    long ch;
    bool exit = false;

    inventory total_inv = g->crafting_inventory(&(g->u));

    do {
        // Erase existing list of constructions
        for( int i = 1; i < iMaxY - 1; i++ ) {
            for( int j = 1; j < 30; j++ ) {
                mvwputch(w_con, i, j, c_black, ' ');
            }
        }
        //Draw Scrollbar
        draw_scrollbar(w_con, select, iMaxY - 2, available.size(), 1);
        // Determine where in the master list to start printing
        //int offset = select - 11;
        int offset = 0;
        if (select >= iMaxY - 2) {
            offset = select - iMaxY + 3;
        }
        // Print the constructions between offset and max (or how many will fit)
        for (int i = 0; i < iMaxY - 2 && (i + offset) < available.size(); i++) {
            int current = i + offset;
            nc_color col = (player_can_build(g->u, total_inv, available[current]) ?
                            c_white : c_dkgray);
            // Map menu items to hotkey letters, skipping j, k, l, and q.
            unsigned char hotkey = 97 + current;
            if (hotkey > 122) {
                hotkey = hotkey - 58;
            }

            if (current == select) {
                col = hilite(col);
            }
            // print construction name with limited length.
            // limit(28) = 30(column len) - 2(letter + ' ').
            mvwprintz(w_con, 1 + i, 1, col, "%c %s", hotkey,
                      utf8_substr(available[current].c_str(), 0, 27).c_str());
        }

        if (update_info) {
            update_info = false;
            std::string current_desc = available[select];
            // Clear out lines for tools & materials
            for (int i = 1; i < iMaxY - 1; i++) {
                for (int j = 31; j < 79; j++) {
                    mvwputch(w_con, i, j, c_black, ' ');
                }
            }

            // Print instructions for toggling recipe hiding.
            mvwprintz(w_con, 1, 31, c_white, "%s", _("Press ';' to toggle unavailable constructions."));

            // Print consruction name
            mvwprintz(w_con, 2, 31, c_white, "%s", current_desc.c_str());

            // Print stages and their requirement
            int posx = 33, posy = 2;
            std::vector<construction *> options = constructions_by_desc(current_desc);
            for( unsigned i = 0; i < options.size(); ++i) {
                construction *current_con = options[i];
                if( hide_unconstructable && !can_construct(current_con) ) {
                    continue;
                }
//.........这里部分代码省略.........
开发者ID:Hadesfire27,项目名称:Cataclysm-DDA,代码行数:101,代码来源:construction.cpp


示例5: popup

void defense_game::game_over(game *g)
{
 popup("You managed to survive through wave %d!", current_wave);
}
开发者ID:Alpha16,项目名称:Cataclysm-DDA,代码行数:4,代码来源:defense.cpp


示例6: caravan_items

void defense_game::caravan(game *g)
{
 std::vector<itype_id> items[NUM_CARAVAN_CATEGORIES];
 std::vector<int> item_count[NUM_CARAVAN_CATEGORIES];

// Init the items for each category
 for (int i = 0; i < NUM_CARAVAN_CATEGORIES; i++) {
  items[i] = caravan_items( caravan_category(i) );
  for (int j = 0; j < items[i].size(); j++) {
   if (current_wave == 0 || !one_in(4))
    item_count[i].push_back(0); // Init counts to 0 for each item
   else { // Remove the item
    items[i].erase( items[i].begin() + j);
    j--;
   }
  }
 }

 int total_price = 0;

 WINDOW *w = newwin(25, 80, 0, 0);

 int offset = 0, item_selected = 0, category_selected = 0;

 int current_window = 0;

 draw_caravan_borders(w, current_window);
 draw_caravan_categories(w, category_selected, total_price, g->u.cash);

 bool done = false;
 bool cancel = false;
 while (!done) {

  char ch = input();
  switch (ch) {
   case '?':
    popup_top("\
CARAVAN:\n\
Start by selecting a category using your favorite up/down keys.\n\
Switch between category selection and item selecting by pressing Tab.\n\
Pick an item with the up/down keys, press + to buy 1 more, - to buy 1 less.\n\
Press Enter to buy everything in your cart, Esc to buy nothing.");
    draw_caravan_categories(w, category_selected, total_price, g->u.cash);
    draw_caravan_items(w, g, &(items[category_selected]),
                       &(item_count[category_selected]), offset, item_selected);
    draw_caravan_borders(w, current_window);
    break;

   case 'j':
    if (current_window == 0) { // Categories
     category_selected++;
     if (category_selected == NUM_CARAVAN_CATEGORIES)
      category_selected = CARAVAN_CART;
     draw_caravan_categories(w, category_selected, total_price, g->u.cash);
     offset = 0;
     item_selected = 0;
     draw_caravan_items(w, g, &(items[category_selected]),
                        &(item_count[category_selected]), offset,
                        item_selected);
     draw_caravan_borders(w, current_window);
    } else if (items[category_selected].size() > 0) { // Items
     if (item_selected < items[category_selected].size() - 1)
      item_selected++;
     else {
      item_selected = 0;
      offset = 0;
     }
     if (item_selected > offset + 22)
      offset++;
     draw_caravan_items(w, g, &(items[category_selected]),
                        &(item_count[category_selected]), offset,
                        item_selected);
     draw_caravan_borders(w, current_window);
    }
    break;

   case 'k':
    if (current_window == 0) { // Categories
     if (category_selected == 0)
      category_selected = NUM_CARAVAN_CATEGORIES - 1;
     else
      category_selected--;
     if (category_selected == NUM_CARAVAN_CATEGORIES)
      category_selected = CARAVAN_CART;
     draw_caravan_categories(w, category_selected, total_price, g->u.cash);
     offset = 0;
     item_selected = 0;
     draw_caravan_items(w, g, &(items[category_selected]),
                        &(item_count[category_selected]), offset,
                        item_selected);
     draw_caravan_borders(w, current_window);
    } else if (items[category_selected].size() > 0) { // Items
     if (item_selected > 0)
      item_selected--;
     else {
      item_selected = items[category_selected].size() - 1;
      offset = item_selected - 22;
      if (offset < 0)
       offset = 0;
     }
//.........这里部分代码省略.........
开发者ID:Alpha16,项目名称:Cataclysm-DDA,代码行数:101,代码来源:defense.cpp


示例7: popup

void MainWindow::on_workmenset_btn_clicked()
{
    workmen_select_popup popup(this);
    popup.exec();
}
开发者ID:kimbakcho,项目名称:QCproject,代码行数:5,代码来源:mainwindow.cpp


示例8: inv_s

void game_menus::inv::compare( player &p, const tripoint &offset )
{
    p.inv.restack( &p );
    p.inv.sort();

    inventory_compare_selector inv_s( p );

    inv_s.add_character_items( p );
    inv_s.set_title( _( "Compare" ) );
    inv_s.set_hint( _( "Select two items to compare them." ) );

    if( offset != tripoint_min ) {
        inv_s.add_map_items( p.pos() + offset );
        inv_s.add_vehicle_items( p.pos() + offset );
    } else {
        inv_s.add_nearby_items();
    }

    if( inv_s.empty() ) {
        popup( std::string( _( "There are no items to compare." ) ), PF_GET_KEY );
        return;
    }

    do {
        const auto to_compare = inv_s.execute();

        if( to_compare.first == nullptr || to_compare.second == nullptr ) {
            break;
        }

        std::vector<iteminfo> vItemLastCh, vItemCh;
        std::string sItemLastCh, sItemCh, sItemLastTn, sItemTn;

        to_compare.first->info( true, vItemCh );
        sItemCh = to_compare.first->tname();
        sItemTn = to_compare.first->type_name();

        to_compare.second->info( true, vItemLastCh );
        sItemLastCh = to_compare.second->tname();
        sItemLastTn = to_compare.second->type_name();

        int iScrollPos = 0;
        int iScrollPosLast = 0;
        int ch = ( int ) ' ';

        do {
            draw_item_info( 0, ( TERMX - VIEW_OFFSET_X * 2 ) / 2, 0, TERMY - VIEW_OFFSET_Y * 2,
                            sItemLastCh, sItemLastTn, vItemLastCh, vItemCh, iScrollPosLast, true ); //without getch(
            ch = draw_item_info( ( TERMX - VIEW_OFFSET_X * 2 ) / 2, ( TERMX - VIEW_OFFSET_X * 2 ) / 2,
                                 0, TERMY - VIEW_OFFSET_Y * 2, sItemCh, sItemTn, vItemCh, vItemLastCh, iScrollPos );

            if( ch == KEY_PPAGE ) {
                iScrollPos--;
                iScrollPosLast--;
            } else if( ch == KEY_NPAGE ) {
                iScrollPos++;
                iScrollPosLast++;
            }

            g->refresh_all();
        } while( ch == KEY_PPAGE || ch == KEY_NPAGE );
    } while( true );
}
开发者ID:KarboniteKream,项目名称:Cataclysm-DDA,代码行数:63,代码来源:game_inventory.cpp


示例9: pilot_manage_button_pressed

void pilot_manage_button_pressed(int n)
{
	switch (n) {
		//scroll pilot list up
		case PM_UP_BUTTON:
			pilot_manage_scroll_callsign_up();
			break;

		// scroll pilot list down
		case PM_DOWN_BUTTON:
			pilot_manage_scroll_callsign_down();
			break;
		
		// switch to single mode
		case PM_SINGLE_MODE_BUTTON:
			if (Player_sel_mode != PLAYER_SELECT_MODE_SINGLE) {
				gamesnd_play_iface(SND_USER_SELECT);
				// switching to multi so save multi player offset
				prev_multi_player = Selected_line;
				pilot_manage_init_player_stuff(PLAYER_SELECT_MODE_SINGLE);
			}						
			break;

		// switch to multi mode
		case PM_MULTI_MODE_BUTTON:
			if (Player_sel_mode != PLAYER_SELECT_MODE_MULTI) {
				gamesnd_play_iface(SND_USER_SELECT);
				// switching to multi so save single player offset
				prev_single_player = Selected_line;
				pilot_manage_init_player_stuff(PLAYER_SELECT_MODE_MULTI);
			}
			break;
		
		//create new pilot
		case PM_CREATE_BUTTON:
			Clone_flag = 0;
			pilot_manage_create_new_pilot();
			break;
		
		// select pilot
		case PM_ACTIVE_BUTTON:			
			if (pilot_manage_new_pilot_selected()){
				gamesnd_play_iface(SND_GENERAL_FAIL);
				
				// throw up a popup telling the player that he should create a pilot first
				if(Player_sel_mode == PLAYER_SELECT_MODE_SINGLE){
					popup(PF_USE_AFFIRMATIVE_ICON,1,POPUP_OK,XSTR( "You must create a single player pilot.", 66));
				} else {
					popup(PF_USE_AFFIRMATIVE_ICON,1,POPUP_OK,XSTR( "You must create a multi player pilot.", 67));
				}
			} else {
				gamesnd_play_iface(SND_SCROLL);
			}
			break;	

		// clone pilot
		case PM_CLONE_BUTTON:
		//case B_PILOT_CLONE_BUTTON:
			if (Num_pilots < 1) {
				gamesnd_play_error_beep();
				break;
			}

			Clone_flag = 1;
			pilot_manage_create_new_pilot();
			break;

		// convert pilot single/multi
		case PM_CONVERT_BUTTON: 
		{
			char temp[256], *str;
			char old_pic[256] = "";
			char old_squad_pic[256] = "";
			char old_squad[256] = "";
			int z;

			if (!pilot_manage_new_pilot_selected()) {
				if (Player_sel_mode == PLAYER_SELECT_MODE_SINGLE)
					str = XSTR( "multiplayer", 68);
				else
					str = XSTR( "single player", 69);

				sprintf(temp, XSTR( "This will overwrite your %s pilot.  Proceed?", 70), str);
				if (!verify_pilot_file(Cur_pilot->callsign, Player_sel_mode == PLAYER_SELECT_MODE_MULTI)) {
					z = popup(0, 2, POPUP_CANCEL, POPUP_OK, temp);
					if (z != 1)
						break;
				}

				strcpy(old_pic, Cur_pilot->image_filename);
				strcpy(old_squad_pic, Cur_pilot->squad_filename);
				strcpy(old_squad, Cur_pilot->squad_name);
				init_new_pilot(Cur_pilot, 0);
				strcpy(Cur_pilot->image_filename, old_pic);
				strcpy(Cur_pilot->squad_filename, old_squad_pic);
				strcpy(Cur_pilot->squad_name, old_squad);
				if (Player_sel_mode == PLAYER_SELECT_MODE_SINGLE) {
					Cur_pilot->flags |= PLAYER_FLAGS_IS_MULTI;
					write_pilot_file();
					pilot_manage_init_player_stuff(PLAYER_SELECT_MODE_MULTI);
//.........这里部分代码省略.........
开发者ID:chief1983,项目名称:Imperial-Alliance,代码行数:101,代码来源:pilotmanage.cpp


示例10: while

void CreateDialog::popup_create(bool p_dont_clear, bool p_replace_mode) {

	type_list.clear();
	ClassDB::get_class_list(&type_list);
	ScriptServer::get_global_class_list(&type_list);
	type_list.sort_custom<StringName::AlphCompare>();

	recent->clear();

	FileAccess *f = FileAccess::open(EditorSettings::get_singleton()->get_project_settings_dir().plus_file("create_recent." + base_type), FileAccess::READ);

	if (f) {

		TreeItem *root = recent->create_item();

		while (!f->eof_reached()) {
			String l = f->get_line().strip_edges();

			if (l != String()) {

				TreeItem *ti = recent->create_item(root);
				ti->set_text(0, l);
				ti->set_icon(0, EditorNode::get_singleton()->get_class_icon(l, base_type));
			}
		}

		memdelete(f);
	}

	favorites->clear();

	f = FileAccess::open(EditorSettings::get_singleton()->get_project_settings_dir().plus_file("favorites." + base_type), FileAccess::READ);

	favorite_list.clear();

	if (f) {

		while (!f->eof_reached()) {
			String l = f->get_line().strip_edges();

			if (l != String()) {
				favorite_list.push_back(l);
			}
		}

		memdelete(f);
	}

	_save_and_update_favorite_list();

	// Restore valid window bounds or pop up at default size.
	if (EditorSettings::get_singleton()->has_setting("interface/dialogs/create_new_node_bounds")) {
		popup(EditorSettings::get_singleton()->get("interface/dialogs/create_new_node_bounds"));
	} else {

		Size2 popup_size = Size2(900, 700) * editor_get_scale();
		Size2 window_size = get_viewport_rect().size;

		popup_size.x = MIN(window_size.x * 0.8, popup_size.x);
		popup_size.y = MIN(window_size.y * 0.8, popup_size.y);

		popup_centered(popup_size);
	}

	if (p_dont_clear) {
		search_box->select_all();
	} else {
		search_box->clear();
	}

	search_box->grab_focus();

	_update_search();

	bool enable_rl = EditorSettings::get_singleton()->get("docks/scene_tree/draw_relationship_lines");
	Color rl_color = EditorSettings::get_singleton()->get("docks/scene_tree/relationship_line_color");

	if (enable_rl) {
		search_options->add_constant_override("draw_relationship_lines", 1);
		search_options->add_color_override("relationship_line_color", rl_color);
	} else {
		search_options->add_constant_override("draw_relationship_lines", 0);
	}

	is_replace_mode = p_replace_mode;

	if (p_replace_mode) {
		set_title(vformat(TTR("Change %s Type"), base_type));
		get_ok()->set_text(TTR("Change"));
	} else {
		set_title(vformat(TTR("Create New %s"), base_type));
		get_ok()->set_text(TTR("Create"));
	}
}
开发者ID:johnyc90,项目名称:godot,代码行数:94,代码来源:create_dialog.cpp


示例11: barracks_button_pressed

void barracks_button_pressed(int n)
{
	switch (n) {
		case B_PILOT_SCROLL_UP_BUTTON:
			barracks_scroll_callsign_up();
			break;

		case B_PILOT_SCROLL_DOWN_BUTTON:
			barracks_scroll_callsign_down();
			break;

		case B_STATS_SCROLL_UP_BUTTON:
			barracks_scroll_stats_up();
			break;

		case B_STATS_SCROLL_DOWN_BUTTON:
			barracks_scroll_stats_down();
			break;

		case B_PIC_PREV_PILOT_BUTTON:
			barracks_prev_pic();
			break;

		case B_PIC_NEXT_PILOT_BUTTON:
			barracks_next_pic();
			break;

		case B_SQUAD_PREV_BUTTON:
			barracks_prev_squad_pic();
			break;

		case B_SQUAD_NEXT_BUTTON:
			barracks_next_squad_pic();
			break;

		case B_PILOT_SET_ACTIVE_BUTTON:
			if (barracks_new_pilot_selected()){
				gamesnd_play_iface(SND_GENERAL_FAIL);

				// if it's just the missing campaign file that failed for us then don't give the second popup
				if (Campaign_file_missing) {
					break;
				}
			} else {
				gamesnd_play_iface(SND_SCROLL);

				if (Campaign_file_missing) {
					popup(PF_USE_AFFIRMATIVE_ICON, 1, POPUP_OK, XSTR( "The currently active campaign cannot be found.  Please select another...", 1600));
					gameseq_post_event(GS_EVENT_CAMPAIGN_ROOM);
				}
			}
			break;

		case B_ACCEPT_BUTTON:
			if (Num_pilots && !barracks_pilot_accepted()) {
				gamesnd_play_iface(SND_COMMIT_PRESSED);

				if (Campaign_file_missing) {
					popup(PF_USE_AFFIRMATIVE_ICON, 1, POPUP_OK, XSTR( "The currently active campaign cannot be found.  Please select another...", 1600));
					gameseq_post_event(GS_EVENT_CAMPAIGN_ROOM);
				} else {
					gameseq_post_event(GS_EVENT_MAIN_MENU);
				}
			} else {
				gamesnd_play_iface(SND_GENERAL_FAIL);

				// if it's just the missing campaign file that failed for us then don't give the second popup
				if (Campaign_file_missing) {
					break;
				}
			}
			break;

		case B_PILOT_CLONE_BUTTON:
			if (Num_pilots < 1) {
				gamesnd_play_error_beep();
				break;
			}

			Clone_flag = 1;
			barracks_create_new_pilot();
			break;

		case B_PILOT_CONVERT_BUTTON: {
	/*	New Pilot code no longer needs a conversion function. */
			popup(PF_TITLE_BIG | PF_TITLE_BLUE | PF_USE_AFFIRMATIVE_ICON, 1, POPUP_OK,
				XSTR("Disabled!\n\n\nMulti and Single Player Pilot files are now identical.\n\n"
				"Conversion between the two is no longer necessary.", 1601));
		/*	// no actual conversion with new pilot code
			if (Player_sel_mode == PLAYER_SELECT_MODE_SINGLE) {
				barracks_init_player_stuff(PLAYER_SELECT_MODE_MULTI);
			} else {
				// make sure we don't carry over the multi flag
				if (Cur_pilot->flags & PLAYER_FLAGS_IS_MULTI) {
					Cur_pilot->flags &= ~PLAYER_FLAGS_IS_MULTI;
				}
				barracks_init_player_stuff(PLAYER_SELECT_MODE_SINGLE);
			}

			gamesnd_play_iface(SND_USER_SELECT);	*/
//.........这里部分代码省略.........
开发者ID:binyu0604,项目名称:fs2_open_patchbucket,代码行数:101,代码来源:barracks.cpp


示例12: player_select_process_noninput

void player_select_process_noninput(int k)
{
	int idx;

	// check for pressed buttons
	for (idx=0; idx<NUM_PLAYER_SELECT_BUTTONS; idx++) {
		if (Player_select_buttons[gr_screen.res][idx].button.pressed()) {
			player_select_button_pressed(idx);
		}
	}

	// check for keypresses
	switch (k) {
	// quit the game entirely
	case KEY_ESC:
		gameseq_post_event(GS_EVENT_QUIT_GAME);
		break;

	case KEY_ENTER | KEY_CTRLED:
		player_select_button_pressed(ACCEPT_BUTTON);
		break;

	// delete the currently highlighted pilot
	case KEY_DELETE:
		if (Player_select_pilot >= 0) {
			int ret;

			if (Player_select_mode == PLAYER_SELECT_MODE_MULTI) {
				popup(PF_TITLE_BIG | PF_USE_AFFIRMATIVE_ICON, 1, POPUP_OK, XSTR("Pilots can only be deleted from the single player menu!", 1611));
			} else {
				// display a popup requesting confirmation
				ret = popup(PF_USE_AFFIRMATIVE_ICON | PF_USE_NEGATIVE_ICON,2,POPUP_NO,POPUP_YES,XSTR( "Are you sure you want to delete this pilot?", 383));										

				// delete the pilot
				if (ret == 1) {
					player_select_delete_pilot();
				}
			}
		}
		break;
	}

	// check to see if the user has clicked on the "list region" button
	// and change the selected pilot appropriately
	if (Player_select_list_region.pressed()) {
		int click_y;
		// get the mouse position
		Player_select_list_region.get_mouse_pos(NULL, &click_y);
		
		// determine what index to select
		//idx = (click_y+5) / 10;
		idx = click_y / gr_get_font_height();


		// if he selected a valid item
		if ( ((idx + Player_select_list_start) < Player_select_num_pilots) && (idx >= 0) ) {
			Player_select_pilot = idx + Player_select_list_start;
		}
	}

	// if the player has double clicked on a valid pilot, choose it and hit the accept button
	if (Player_select_list_region.double_clicked()) {
		if ((Player_select_pilot >= 0) && (Player_select_pilot < Player_select_num_pilots)) {
			player_select_button_pressed(ACCEPT_BUTTON);
		}
	}
}
开发者ID:nisselarsson,项目名称:fs2_open_patchbucket,代码行数:67,代码来源:playermenu.cpp


示例13: popup

void CLexiconReadWindow::setupPopupMenu()
{
	popup()->setTitle(tr("Lexicon window"));
	popup()->setIcon(CToolClass::getIconForModule(modules().first()));
	popup()->addAction(m_actions.findText);
	popup()->addAction(m_actions.findStrongs);
	popup()->addAction(m_actions.selectAll);
	popup()->addSeparator();

	m_actions.copyMenu = new QMenu(tr("Copy..."), popup());

	m_actions.copyMenu->addAction(m_actions.copy.reference);
	m_actions.copyMenu->addAction(m_actions.copy.entry);
	m_actions.copyMenu->addSeparator();
	m_actions.copyMenu->addAction(m_actions.copy.selectedText);
	popup()->addMenu(m_actions.copyMenu);

	m_actions.saveMenu = new QMenu(
			tr("Save..."),
			popup()
			);
	m_actions.saveMenu->addAction(m_actions.save.entryAsPlain);
	m_actions.saveMenu->addAction(m_actions.save.entryAsHTML);

	// Save raw HTML action for debugging purposes
	if (qApp->property("--debug").toBool()) {
		QAction* debugAction = new QAction("Raw HTML", this);
		QObject::connect(debugAction, SIGNAL(triggered()), this, SLOT(saveRawHTML()));
		m_actions.saveMenu->addAction(debugAction);
	} // end of Save Raw HTML

	popup()->addMenu(m_actions.saveMenu);

	m_actions.printMenu = new QMenu(
			tr("Print..."),
			popup()
			);
	m_actions.printMenu->addAction(m_actions.print.reference);
	m_actions.printMenu->addAction(m_actions.print.entry);
	popup()->addMenu(m_actions.printMenu);
}
开发者ID:bibletime,项目名称:historic-bibletime-svn,代码行数:41,代码来源:clexiconreadwindow.cpp


示例14: filtered_bionics


//.........这里部分代码省略.........
                                         pos_x - 2, bio_id );

                        for( int i = 0; i < num_bp; ++i ) {
                            mvwprintz( wBio, i + list_start_y, pos_x,
                                       bionic_info( bio_id ).occupied_bodyparts.count( bp_aBodyPart[i] ) > 0 ?
                                       c_yellow : c_ltgray, "%s", bps[i].c_str() );
                        }
                    }

                }
            }

            draw_scrollbar( wBio, cursor, LIST_HEIGHT, current_bionic_list->size(), list_start_y );
        }
        wrefresh( wBio );
        draw_bionics_tabs( w_tabs, active.size(), passive.size(), tab_mode );
        draw_bionics_titlebar( w_title, this, menu_mode );
        if( menu_mode == EXAMINING && !current_bionic_list->empty() ) {
            draw_description( w_description, *( *current_bionic_list )[cursor] );
        }

        const std::string action = ctxt.handle_input();
        const long ch = ctxt.get_raw_input().get_first_input();
        bionic *tmp = NULL;
        bool confirmCheck = false;
        if( menu_mode == REASSIGNING ) {
            menu_mode = ACTIVATING;
            tmp = bionic_by_invlet( ch );
            if( tmp == nullptr ) {
                // Selected an non-existing bionic (or escape, or ...)
                continue;
            }
            redraw = true;
            const long newch = popup_getkey( _( "%s; enter new letter." ),
                                             bionic_info( tmp->id ).name.c_str() );
            wrefresh( wBio );
            if( newch == ch || newch == ' ' || newch == KEY_ESCAPE ) {
                continue;
            }
            if( !bionic_chars.valid( newch ) ) {
                popup( _( "Invalid bionic letter. Only those characters are valid:\n\n%s" ),
                       bionic_chars.get_allowed_chars().c_str() );
                continue;
            }
            bionic *otmp = bionic_by_invlet( newch );
            if( otmp != nullptr ) {
                std::swap( tmp->invlet, otmp->invlet );
            } else {
                tmp->invlet = newch;
            }
            // TODO: show a message like when reassigning a key to an item?
        } else if( action == "NEXT_TAB" ) {
            redraw = true;
            scroll_position = 0;
            cursor = 0;
            if( tab_mode == TAB_ACTIVE ) {
                tab_mode = TAB_PASSIVE;
            } else {
                tab_mode = TAB_ACTIVE;
            }
        } else if( action == "PREV_TAB" ) {
            redraw = true;
            scroll_position = 0;
            cursor = 0;
            if( tab_mode == TAB_PASSIVE ) {
                tab_mode = TAB_ACTIVE;
开发者ID:2birdie,项目名称:Cataclysm-DDA,代码行数:67,代码来源:bionics_ui.cpp


示例15: newwin


//.........这里部分代码省略.........
            status = s_add_global;
        } else if (action == "REMOVE" || raw_input_char == '-') {
            status = s_remove;
        } else if (action == "ANY_INPUT") {
            const size_t hotkey_index = hotkeys.find_first_of(raw_input_char);
            if (status == s_show || hotkey_index == std::string::npos ) {
                continue;
            }
            const size_t action_index = hotkey_index + scroll_offset;
            if( action_index >= org_registered_actions.size() ) {
                continue;
            }
            const std::string &action_id = org_registered_actions[action_index];

            // Check if this entry is local or global.
            bool is_local = false;
            inp_mngr.get_action_attributes(action_id, category, &is_local);
            const std::string name = get_action_name(action_id);


            if (status == s_remove && (!OPTIONS["QUERY_KEYBIND_REMOVAL"] ||
                                       query_yn(_("Clear keys for %s?"), name.c_str()))) {

                // If it's global, reset the global actions.
                std::string category_to_access = category;
                if (!is_local) {
                    category_to_access = default_context_id;
                }

                inp_mngr.remove_input_for_action(action_id, category_to_access);
                changed = true;
            } else if (status == s_add_global && is_local) {
                // Disallow adding global actions to an action that already has a local defined.
                popup(_("There are already local keybindings defined for this action, please remove them first."));
            } else if (status == s_add || status == s_add_global) {
                const long newbind = popup_getkey(_("New key for %s:"), name.c_str());
                const input_event new_event(newbind, CATA_INPUT_KEYBOARD);
                const std::string conflicts = get_conflicts(new_event);
                const bool has_conflicts = !conflicts.empty();
                bool resolve_conflicts = false;

                if (has_conflicts) {
                    resolve_conflicts = query_yn(
                                            _("This key conflicts with %s. Remove this key from the conflicting command(s), and continue?"),
                                            conflicts.c_str());
                }

                if (!has_conflicts || resolve_conflicts) {
                    if (resolve_conflicts) {
                        clear_conflicting_keybindings(new_event);
                    }

                    // We might be adding a local or global action.
                    std::string category_to_access = category;
                    if (status == s_add_global) {
                        category_to_access = default_context_id;
                    }

                    inp_mngr.add_input_for_action(action_id, category_to_access, new_event);
                    changed = true;
                }
            }
            status = s_show;
        } else if (action == "DOWN") {
            if (scroll_offset < org_registered_actions.size() - display_height) {
                scroll_offset++;
开发者ID:Miloch,项目名称:Cataclysm-DDA-1,代码行数:67,代码来源:input.cpp


示例16: newwin

void defense_game::setup()
{
 WINDOW* w = newwin(25, 80, 0, 0);
 int selection = 1;
 refresh_setup(w, selection);

 while (true) {
  char ch = input();

  if (ch == 'S') {
   if (!zombies && !specials && !spiders && !triffids && !robots && !subspace) {
    popup("You must choose at least one monster group!");
    refresh_setup(w, selection);
   } else
    return;
  } else if (ch == '+' || ch == '>' || ch == 'j') {
   if (selection == 19)
    selection = 1;
   else
    selection++;
   refresh_setup(w, selection);
  } else if (ch == '-' || ch == '<' || ch == 'k') {
   if (selection == 1)
    selection = 19;
   else
    selection--;
   refresh_setup(w, selection);
  } else if (ch == '!') {
   std::string name = string_input_popup("Template Name:", 20);
   refresh_setup(w, selection);
  } else if (ch == 'S')
   return;

  else {
   switch (selection) {
    case 1:	// Scenario selection
     if (ch == 'l') {
      if (style == defense_style(NUM_DEFENSE_STYLES - 1))
       style = defense_style(1);
      else
       style = defense_style(style + 1);
     }
     if (ch == 'h') {
      if (style == defense_style(1))
       style = defense_style(NUM_DEFENSE_STYLES - 1);
      else
       style = defense_style(style - 1);
     }
     init_to_style(style);
     break;

    case 2:	// Location selection
     if (ch == 'l') {
      if (location == defense_location(NUM_DEFENSE_LOCATIONS - 1))
       location = defense_location(1);
      else
       location = defense_location(location + 1);
     }
     if (ch == 'h') {
      if (location == defense_location(1))
       location = defense_location(NUM_DEFENSE_LOCATIONS - 1);
      else
       location = defense_location(location - 1);
     }
     mvwprintz(w, 5, 2, c_black, "\
 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
     mvwprintz(w, 5, 2, c_yellow, defense_location_name(location).c_str());
     mvwprintz(w,  5, 28, c_ltgray,
               defense_location_description(location).c_str());
     break;

    case 3:	// Difficulty of the first wave
     if (ch == 'h' && initial_difficulty > 10)
      initial_difficulty -= 5;
     if (ch == 'l' && initial_difficulty < 995)
      initial_difficulty += 5;
     mvwprintz(w, 7, 22, c_black, "xxx");
     mvwprintz(w, 7, NUMALIGN(initial_difficulty), c_yellow, "%d",
               initial_difficulty);
     break;

    case 4:	// Wave Difficulty
     if (ch == 'h' && wave_difficulty > 10)
      wave_difficulty -= 5;
     if (ch == 'l' && wave_difficulty < 995)
      wave_difficulty += 5;
     mvwprintz(w, 8, 22, c_black, "xxx");
     mvwprintz(w, 8, NUMALIGN(wave_difficulty), c_yellow, "%d",
               wave_difficulty);
     break;

    case 5:
     if (ch == 'h' && time_between_waves > 5)
      time_between_waves -= 5;
     if (ch == 'l' && time_between_waves < 995)
      time_between_waves += 5;
     mvwprintz(w, 10, 22, c_black, "xxx");
     mvwprintz(w, 10, NUMALIGN(time_between_waves), c_yellow, "%d",
               time_between_waves);
     break;
//.........这里部分代码省略.........
开发者ID:Alpha16,项目名称:Cataclysm-DDA,代码行数:101,代码来源:defense.cpp


示例17: newwin


//.........这里部分代码省略.........
                        mut_desc << string_format( _(" - %d RU"), md.cost );
                    } else if ( md.cooldown > 0 ) {
                        mut_desc << string_format( _(" - %d turns"), md.cooldown );
                    }
                    if ( td.powered ) {
                        mut_desc << _(" - Active");
                    }
                    mvwprintz( wBio, list_start_y + i, second_column + 2, type,
                               mut_desc.str().c_str() );
                }
            }

            // Scrollbar
            if(scroll_position > 0) {
                mvwputch(wBio, HEADER_LINE_Y + 2, 0, c_ 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ portCLEAR_INTERRUPT_MASK_FROM_ISR函数代码示例发布时间:2022-05-30
下一篇:
C++ populate函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap