本文整理汇总了C++中UI_INPUTBOX类的典型用法代码示例。如果您正苦于以下问题:C++ UI_INPUTBOX类的具体用法?C++ UI_INPUTBOX怎么用?C++ UI_INPUTBOX使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UI_INPUTBOX类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: pilot_manage_init
void pilot_manage_init(void)
{
UI_WINDOW *w = &Ui_window;
// create interface
Ui_window.create(0, 0, gr_screen.max_w, gr_screen.max_h, 0);
Ui_window.set_mask_bmap(PilotManage_bitmap_mask_fname[gr_screen.res]);
// load background bitmap
Background_bitmap = bm_load(PilotManage_bitmap_fname[gr_screen.res]);
if(Background_bitmap < 0){
// we failed to load the bitmap - this is very bad
Int3();
}
for (int i=0; i<PM_NUM_BUTTONS; i++) {
// create the object
Buttons[gr_screen.res][i].button.create(&Ui_window, "", Buttons[gr_screen.res][i].x, Buttons[gr_screen.res][i].y, 60, 30, Buttons[gr_screen.res][i].repeat, 1);
// set the sound to play when highlighted
Buttons[gr_screen.res][i].button.set_highlight_action(common_play_highlight_sound);
// set the ani for the button
Buttons[gr_screen.res][i].button.set_bmaps(Buttons[gr_screen.res][i].filename);
// set the hotspot
Buttons[gr_screen.res][i].button.link_hotspot(Buttons[gr_screen.res][i].hotspot);
}
// load in help overlay bitmap
// needs to be fixed, taked out to get to compile
// help_overlay_load(PILOT_MANAGE_OVERLAY);
// help_overlay_set_state(PILOT_MANAGE_OVERLAY,0);
// button for selecting pilot
List_region.create(&Ui_window, "", Pilot_manage_list_coords[gr_screen.res][PM_X_COORD], Pilot_manage_list_coords[gr_screen.res][PM_Y_COORD], Pilot_manage_list_coords[gr_screen.res][PM_W_COORD], Pilot_manage_list_coords[gr_screen.res][PM_H_COORD], 0, 1);
List_region.hide();
// create input box (for new pilot)
Inputbox.create(&Ui_window, Pilot_manage_list_coords[gr_screen.res][PM_X_COORD], Pilot_manage_list_coords[gr_screen.res][PM_Y_COORD], Pilot_manage_list_coords[gr_screen.res][PM_W_COORD], CALLSIGN_LEN - 1, "", UI_INPUTBOX_FLAG_INVIS | UI_INPUTBOX_FLAG_KEYTHRU | UI_INPUTBOX_FLAG_LETTER_FIRST);
Inputbox.set_valid_chars(VALID_PILOT_CHARS);
Inputbox.disable();
Inputbox.hide();
Rank_pips_bitmaps = bm_load_animation("IconRankMini.ani", &Rank_pips_count);
pilot_manage_callsign_enter_mode = 0;
List_scroll_offset = Pic_number = Pic_squad_number;// = Selected_line = 0;
prev_single_player = -1;
prev_multi_player = -1;
pilot_manage_init_player_stuff(is_pilot_multi(Player));
// enable hotkeys from start
pilot_manage_set_callsign_enter_mode(false);
}
开发者ID:chief1983,项目名称:Imperial-Alliance,代码行数:60,代码来源:pilotmanage.cpp
示例2: pilot_manage_create_new_pilot
// creates a new pilot file
void pilot_manage_create_new_pilot()//UI_INPUTBOX *Inputbox)
{
// check if too many pilots
if (Num_pilots >= MAX_PILOTS) {
gamesnd_play_iface(SND_GENERAL_FAIL);
return;
}
// play sound for pilot creation
gamesnd_play_iface(SND_SCROLL);
// only write pilot file if there is an active pilot
if (strlen(Player->callsign)) {
write_pilot_file();
}
// move other pilot names and ranks down to make room for the new one
int idx = Num_pilots;
Assert(Num_pilots >= 0);
while (idx--) {
strcpy(Pilots[idx + 1], Pilots[idx]);
Pilot_ranks[idx + 1] = Pilot_ranks[idx];
}
Selected_line = 0;
Num_pilots++;
Pilots[Selected_line][0] = 0;
Pilot_ranks[Selected_line] = 0;
List_scroll_offset = 0;
// set mode to accept pilot name text
pilot_manage_set_callsign_enter_mode(true);
// set focus to input box
Inputbox.set_focus();
// set initial pilot name to ""
Inputbox.set_text("");
// reset size of input box to only 1 line
Inputbox.update_dimensions(Pilot_manage_list_coords[gr_screen.res][PM_X_COORD], Pilot_manage_list_coords[gr_screen.res][PM_Y_COORD], Pilot_manage_list_coords[gr_screen.res][PM_W_COORD], gr_get_font_height());
}
开发者ID:chief1983,项目名称:Imperial-Alliance,代码行数:41,代码来源:pilotmanage.cpp
示例3: popup_init
// init the Popup window
int popup_init(popup_info *pi, int flags)
{
int i;
UI_BUTTON *b;
popup_background *pbg;
char *fname;
if(pi->nchoices == 0){
pbg = &Popup_background[gr_screen.res][0];
} else {
pbg = &Popup_background[gr_screen.res][pi->nchoices-1];
}
// anytime in single player, and multiplayer, not in mission, go ahead and stop time
if ( (Game_mode & GM_NORMAL) || ((Game_mode & GM_MULTIPLAYER) && !(Game_mode & GM_IN_MISSION)) ){
game_stop_time();
}
// create base window
Popup_window.create(pbg->coords[0], pbg->coords[1], Popup_text_coords[gr_screen.res][2]+100, Popup_text_coords[gr_screen.res][3]+50, 0);
Popup_window.set_foreground_bmap(pbg->filename);
// create buttons
for (i=0; i<pi->nchoices; i++) {
b = &Popup_buttons[i];
// accommodate single-choice positive icon being positioned differently
if ( (pi->nchoices == 1) && (flags&PF_USE_AFFIRMATIVE_ICON) ) {
b->create(&Popup_window, "", Button_coords[gr_screen.res][i+1][0], Button_coords[gr_screen.res][i+1][1], 30, 25, 0, 1);
} else {
b->create(&Popup_window, "", Button_coords[gr_screen.res][i][0], Button_coords[gr_screen.res][i][1], 30, 25, 0, 1);
}
fname = popup_get_button_filename(pi, i, flags);
b->set_bmaps(fname, 3, 0);
b->set_highlight_action(common_play_highlight_sound);
if ( pi->keypress[i] >= 0 ) {
b->set_hotkey(pi->keypress[i]);
}
// create invisible buttons to detect mouse presses... can't use mask since button region is dynamically sized
int lx, w, h;
gr_get_string_size(&w, &h, pi->button_text[i]);
lx = Button_regions[gr_screen.res][i][0] - w;
b = &Popup_button_regions[i];
// accommodate single-choice positive icon being positioned differently
if ( (pi->nchoices == 1) && (flags&PF_USE_AFFIRMATIVE_ICON) ) {
b->create(&Popup_window, "", lx, Button_regions[gr_screen.res][i+1][1], Button_regions[gr_screen.res][i+1][2]-lx, Button_regions[gr_screen.res][i+1][3]-Button_regions[gr_screen.res][i+1][1], 0, 1);
} else {
b->create(&Popup_window, "", lx, Button_regions[gr_screen.res][i][1], Button_regions[gr_screen.res][i][2]-lx, Button_regions[gr_screen.res][i][3]-Button_regions[gr_screen.res][i][1], 0, 1);
}
b->hide();
}
// webcursor setup
if (Web_cursor_bitmap >= 0) {
if (flags & PF_WEB_CURSOR_1) {
Popup_buttons[1].set_custom_cursor_bmap(Web_cursor_bitmap);
}
if (flags & PF_WEB_CURSOR_2) {
Popup_buttons[2].set_custom_cursor_bmap(Web_cursor_bitmap);
}
}
// if this is an input popup, create and center the popup
if(flags & PF_INPUT){
Popup_input.create(&Popup_window, Popup_text_coords[gr_screen.res][0], pbg->coords[1] + Popup_input_y_offset[gr_screen.res], Popup_text_coords[gr_screen.res][2], pi->max_input_text_len, "", UI_INPUTBOX_FLAG_INVIS | UI_INPUTBOX_FLAG_ESC_CLR | UI_INPUTBOX_FLAG_ESC_FOC | UI_INPUTBOX_FLAG_KEYTHRU | UI_INPUTBOX_FLAG_TEXT_CEN);
Popup_input.set_focus();
}
Popup_default_choice=0;
Popup_should_die = 0;
if (flags & PF_RUN_STATE) {
Popup_running_state = 1;
} else {
Popup_running_state = 0;
}
popup_split_lines(pi, flags);
// create the popup slider (which we may not need to use
Popup_slider.create(&Popup_window, Popup_slider_coords[gr_screen.res][0], Popup_slider_coords[gr_screen.res][1], Popup_slider_coords[gr_screen.res][2], Popup_slider_coords[gr_screen.res][3], pi->nlines > Popup_max_display[gr_screen.res] ? pi->nlines - Popup_max_display[gr_screen.res] : 0,
Popup_slider_name[gr_screen.res], popup_slider_bogus, popup_slider_bogus, NULL);
return 0;
}
开发者ID:Admiral-MS,项目名称:fs2open.github.com,代码行数:90,代码来源:popup.cpp
示例4: barracks_init
// -----------------------------------------------------------------------------
void barracks_init()
{
//Set these to null, 'cause they aren't allocated yet.
Stat_labels = NULL;
Stats = NULL;
UI_WINDOW *w = &Ui_window;
// save current pilot file, so we don't possibly loose it.
Pilot.save_player();
// create interface
Ui_window.create(0, 0, gr_screen.max_w_unscaled, gr_screen.max_h_unscaled, 0);
Ui_window.set_mask_bmap(Barracks_bitmap_mask_fname[gr_screen.res]);
// load background bitmap
Background_bitmap = bm_load(Barracks_bitmap_fname[gr_screen.res]);
if(Background_bitmap < 0){
// we failed to load the bitmap - this is very bad
Int3();
}
// create buttons
int i;
for (i=0; i<BARRACKS_NUM_BUTTONS; i++) {
// create the object
Buttons[gr_screen.res][i].button.create(&Ui_window, "", Buttons[gr_screen.res][i].x, Buttons[gr_screen.res][i].y, 60, 30, Buttons[gr_screen.res][i].repeat, 1);
// set the sound to play when highlighted
Buttons[gr_screen.res][i].button.set_highlight_action(common_play_highlight_sound);
// set the ani for the button
Buttons[gr_screen.res][i].button.set_bmaps(Buttons[gr_screen.res][i].filename);
// set the hotspot
Buttons[gr_screen.res][i].button.link_hotspot(Buttons[gr_screen.res][i].hotspot);
}
// add all strings
w->add_XSTR("Create", 1034, Buttons[gr_screen.res][0].text_x, Buttons[gr_screen.res][0].text_y, &Buttons[gr_screen.res][0].button, UI_XSTR_COLOR_GREEN);
w->add_XSTR("Accept", 1035, Buttons[gr_screen.res][5].text_x, Buttons[gr_screen.res][5].text_y, &Buttons[gr_screen.res][5].button, UI_XSTR_COLOR_PINK);
w->add_XSTR("Help", 928, Buttons[gr_screen.res][6].text_x, Buttons[gr_screen.res][6].text_y, &Buttons[gr_screen.res][6].button, UI_XSTR_COLOR_GREEN);
w->add_XSTR("Options",1036, Buttons[gr_screen.res][7].text_x, Buttons[gr_screen.res][7].text_y, &Buttons[gr_screen.res][7].button, UI_XSTR_COLOR_GREEN);
w->add_XSTR("Medals", 1037, Buttons[gr_screen.res][8].text_x, Buttons[gr_screen.res][8].text_y, &Buttons[gr_screen.res][8].button, UI_XSTR_COLOR_GREEN);
w->add_XSTR("Remove", 1038, Buttons[gr_screen.res][11].text_x, Buttons[gr_screen.res][11].text_y, &Buttons[gr_screen.res][11].button, UI_XSTR_COLOR_GREEN);
w->add_XSTR("Select", 1552, Buttons[gr_screen.res][12].text_x, Buttons[gr_screen.res][12].text_y, &Buttons[gr_screen.res][12].button, UI_XSTR_COLOR_GREEN);
w->add_XSTR("Clone", 1040, Buttons[gr_screen.res][13].text_x, Buttons[gr_screen.res][13].text_y, &Buttons[gr_screen.res][13].button, UI_XSTR_COLOR_GREEN);
w->add_XSTR("Single", 1041, Buttons[gr_screen.res][14].text_x, Buttons[gr_screen.res][14].text_y, &Buttons[gr_screen.res][14].button, UI_XSTR_COLOR_GREEN);
w->add_XSTR("Multi", 1042, Buttons[gr_screen.res][15].text_x, Buttons[gr_screen.res][15].text_y, &Buttons[gr_screen.res][15].button, UI_XSTR_COLOR_GREEN);
// w->add_XSTR("Convert",1043, Buttons[gr_screen.res][16].text_x, Buttons[gr_screen.res][16].text_y, &Buttons[gr_screen.res][16].button, UI_XSTR_COLOR_GREEN);
for(i=0; i<BARRACKS_NUM_TEXT; i++) {
w->add_XSTR(&Barracks_text[gr_screen.res][i]);
}
// button for selecting pilot
List_region.create(&Ui_window, "", Barracks_list_coords[gr_screen.res][BARRACKS_X_COORD], Barracks_list_coords[gr_screen.res][BARRACKS_Y_COORD], Barracks_list_coords[gr_screen.res][BARRACKS_W_COORD], Barracks_list_coords[gr_screen.res][BARRACKS_H_COORD], 0, 1);
List_region.hide();
// create input box (for new pilot)
Inputbox.create(&Ui_window, Barracks_list_coords[gr_screen.res][BARRACKS_X_COORD], Barracks_list_coords[gr_screen.res][BARRACKS_Y_COORD], Barracks_list_coords[gr_screen.res][BARRACKS_W_COORD], CALLSIGN_LEN - 1, "", UI_INPUTBOX_FLAG_INVIS | UI_INPUTBOX_FLAG_KEYTHRU | UI_INPUTBOX_FLAG_LETTER_FIRST);
Inputbox.set_valid_chars(VALID_PILOT_CHARS);
Inputbox.disable();
Inputbox.hide();
// load in help overlay bitmap
Barracks_overlay_id = help_overlay_get_index(BARRACKS_OVERLAY);
help_overlay_set_state(Barracks_overlay_id,gr_screen.res,0);
// other init stuff
Barracks_callsign_enter_mode = 0;
List_scroll_offset = Stats_scroll_offset = Pic_number = Pic_squad_number = Selected_line = 0;
Cur_pilot = &Players[Player_num];
// disable squad logo selection buttons in single player
if(!(Cur_pilot->flags & PLAYER_FLAGS_IS_MULTI)){
// squad logo picture buttons
Buttons[gr_screen.res][B_SQUAD_PREV_BUTTON].button.hide();
Buttons[gr_screen.res][B_SQUAD_PREV_BUTTON].button.disable();
Buttons[gr_screen.res][B_SQUAD_NEXT_BUTTON].button.hide();
Buttons[gr_screen.res][B_SQUAD_NEXT_BUTTON].button.disable();
} else {
// squad logo picture buttons
Buttons[gr_screen.res][B_SQUAD_PREV_BUTTON].button.enable();
Buttons[gr_screen.res][B_SQUAD_PREV_BUTTON].button.unhide();
Buttons[gr_screen.res][B_SQUAD_NEXT_BUTTON].button.enable();
Buttons[gr_screen.res][B_SQUAD_NEXT_BUTTON].button.unhide();
}
// set up hotkeys for buttons so we draw the correct animation frame when a key is pressed
barracks_set_hotkeys(1);
// load ramp pips
Rank_pips_bitmaps = bm_load_animation("IconRankMini.ani", &Rank_pips_count);
// load up the pilot pic list
pilot_load_pic_list();
pilot_load_squad_pic_list();
// don't load pilot images yet
//.........这里部分代码省略.........
开发者ID:PhantomHoover,项目名称:fs2open.github.com,代码行数:101,代码来源:barracks.cpp
示例5: chatbox_create
// initialize all chatbox details with the given mode flags
int chatbox_create(int mode_flags)
{
int idx;
// don't do anything if the chatbox is already initialized
if (Chatbox_created){
return -1;
}
// probably shouldn't be using the chatbox in single player mode
Assert(Game_mode & GM_MULTIPLAYER);
// setup all data to correspond to our mode flags
chatbox_set_mode(mode_flags);
// initialize all low-level details related to chatting
chatbox_chat_init();
// attempt to load in the chatbox background bitmap
if(Chatbox_mode_flags & CHATBOX_FLAG_DRAW_BOX){
Chatbox_big_bitmap = bm_load(Chatbox_big_bitmap_fname[gr_screen.res]);
Chatbox_small_bitmap = bm_load(Chatbox_small_bitmap_fname[gr_screen.res]);
Chatbox_mp_bitmap = bm_load(Chatbox_p_bitmap_fname[gr_screen.res]);
if(Chatbox_mode_flags & CHATBOX_FLAG_SMALL){
Chatbox_bitmap = Chatbox_small_bitmap;
} else if(Chatbox_mode_flags & CHATBOX_FLAG_BIG){
Chatbox_bitmap = Chatbox_big_bitmap;
} else {
Chatbox_bitmap = Chatbox_mp_bitmap;
}
if((Chatbox_bitmap == -1) || (Chatbox_small_bitmap == -1) || (Chatbox_big_bitmap == -1) || (Chatbox_mp_bitmap == -1)){
return -1;
}
}
// attempt to create the ui window for the chatbox and assign the mask
Chat_window.create( 0, 0, gr_screen.max_w_unscaled, gr_screen.max_h_unscaled, 0 );
Chat_window.set_mask_bmap(Chatbox_mask);
// create the chat text enter input area
Chat_inputbox.create( &Chat_window, Chatbox_inputbox_x, Chatbox_textenter_y, Chatbox_inputbox_w, CHATBOX_MAX_LEN, "", UI_INPUTBOX_FLAG_INVIS | UI_INPUTBOX_FLAG_ESC_CLR | UI_INPUTBOX_FLAG_KEYTHRU | UI_INPUTBOX_FLAG_EAT_USED, Chatbox_w, Color_netplayer[MY_NET_PLAYER_NUM]);
Chat_inputbox.set_focus();
Chat_inputbox.set_invalid_chars(CHATBOX_INVALID_CHARS);
// if we're supposed to supply and check for out own buttons
if((Chatbox_mode_flags & CHATBOX_FLAG_BUTTONS) && (Chatbox_mode_flags & CHATBOX_FLAG_DRAW_BOX)){
for(idx=0; idx<CHATBOX_NUM_BUTTONS; idx++){
// create the button
Chatbox_buttons[gr_screen.res][idx].button.create(&Chat_window, "", Chatbox_buttons[gr_screen.res][idx].x, Chatbox_buttons[gr_screen.res][idx].y, 60, 30, (idx == CHATBOX_TOGGLE_SIZE) ? 0 : 1);
// set the highlight action
Chatbox_buttons[gr_screen.res][idx].button.set_highlight_action(common_play_highlight_sound);
// set the bitmap
Chatbox_buttons[gr_screen.res][idx].button.set_bmaps(Chatbox_buttons[gr_screen.res][idx].filename);
// set the hotspot
Chatbox_buttons[gr_screen.res][idx].button.link_hotspot(Chatbox_buttons[gr_screen.res][idx].hotspot);
}
// now create the toggle size button with the appropriate button
if(Chatbox_mode_flags & CHATBOX_FLAG_SMALL){
Chatbox_buttons[gr_screen.res][CHATBOX_TOGGLE_SIZE].button.set_bmaps(Chatbox_buttons[gr_screen.res][CHATBOX_TOGGLE_SIZE].filename);
} else {
Chatbox_buttons[gr_screen.res][CHATBOX_TOGGLE_SIZE].button.set_bmaps(Chatbox_buttons[gr_screen.res][CHATBOX_TOGGLE_SIZE+1].filename);
}
}
// an invisible button that will set focus to input box when clicked on
Chat_enter_text.create( &Chat_window, "", 0, 0, 60, 30, 0);
Chat_enter_text.hide(); // button doesn't show up
Chat_enter_text.link_hotspot(50);
Chatbox_created = 1;
return 0;
}
开发者ID:DahBlount,项目名称:Freespace-Open-Swifty,代码行数:79,代码来源:chatbox.cpp
示例6: player_select_init
// functions for selecting single/multiplayer pilots at the very beginning of FreeSpace
void player_select_init()
{
int i;
barracks_buttons *b;
UI_WINDOW *w;
// start a looping ambient sound
main_hall_start_ambient();
Player_select_force_main_hall = "";
Player_select_screen_active = 1;
// create the UI window
Player_select_window.create(0, 0, gr_screen.max_w_unscaled, gr_screen.max_h_unscaled, 0);
Player_select_window.set_mask_bmap(Player_select_background_mask_bitmap[gr_screen.res]);
// initialize the control buttons
for (i=0; i<NUM_PLAYER_SELECT_BUTTONS; i++) {
b = &Player_select_buttons[gr_screen.res][i];
// create the button
b->button.create(&Player_select_window, NULL, b->x, b->y, 60, 30, 1, 1);
// set its highlight action
b->button.set_highlight_action(common_play_highlight_sound);
// set its animation bitmaps
b->button.set_bmaps(b->filename);
// link the mask hotspot
b->button.link_hotspot(b->hotspot);
}
// add some text
w = &Player_select_window;
w->add_XSTR("Create", 1034, Player_select_buttons[gr_screen.res][CREATE_PILOT_BUTTON].xt, Player_select_buttons[gr_screen.res][CREATE_PILOT_BUTTON].yt, &Player_select_buttons[gr_screen.res][CREATE_PILOT_BUTTON].button, UI_XSTR_COLOR_GREEN);
w->add_XSTR("Clone", 1040, Player_select_buttons[gr_screen.res][CLONE_BUTTON].xt, Player_select_buttons[gr_screen.res][CLONE_BUTTON].yt, &Player_select_buttons[gr_screen.res][CLONE_BUTTON].button, UI_XSTR_COLOR_GREEN);
w->add_XSTR("Remove", 1038, Player_select_buttons[gr_screen.res][DELETE_BUTTON].xt, Player_select_buttons[gr_screen.res][DELETE_BUTTON].yt, &Player_select_buttons[gr_screen.res][DELETE_BUTTON].button, UI_XSTR_COLOR_GREEN);
w->add_XSTR("Select", 1039, Player_select_buttons[gr_screen.res][ACCEPT_BUTTON].xt, Player_select_buttons[gr_screen.res][ACCEPT_BUTTON].yt, &Player_select_buttons[gr_screen.res][ACCEPT_BUTTON].button, UI_XSTR_COLOR_PINK);
w->add_XSTR("Single", 1041, Player_select_buttons[gr_screen.res][SINGLE_BUTTON].xt, Player_select_buttons[gr_screen.res][SINGLE_BUTTON].yt, &Player_select_buttons[gr_screen.res][SINGLE_BUTTON].button, UI_XSTR_COLOR_GREEN);
w->add_XSTR("Multi", 1042, Player_select_buttons[gr_screen.res][MULTI_BUTTON].xt, Player_select_buttons[gr_screen.res][MULTI_BUTTON].yt, &Player_select_buttons[gr_screen.res][MULTI_BUTTON].button, UI_XSTR_COLOR_GREEN);
for(i=0; i<PLAYER_SELECT_NUM_TEXT; i++) {
w->add_XSTR(&Player_select_text[gr_screen.res][i]);
}
// create the list button text select region
Player_select_list_region.create(&Player_select_window, "", Choose_list_coords[gr_screen.res][0], Choose_list_coords[gr_screen.res][1], Choose_list_coords[gr_screen.res][2], Choose_list_coords[gr_screen.res][3], 0, 1);
Player_select_list_region.hide();
// create the pilot callsign input box
Player_select_input_box.create(&Player_select_window, Choose_list_coords[gr_screen.res][0], Choose_list_coords[gr_screen.res][1], Choose_list_coords[gr_screen.res][2] , CALLSIGN_LEN - 1, "", UI_INPUTBOX_FLAG_INVIS | UI_INPUTBOX_FLAG_KEYTHRU | UI_INPUTBOX_FLAG_LETTER_FIRST);
Player_select_input_box.set_valid_chars(VALID_PILOT_CHARS);
Player_select_input_box.hide();
Player_select_input_box.disable();
// not currently entering any text
Player_select_input_mode = 0;
// set up hotkeys for buttons so we draw the correct animation frame when a key is pressed
Player_select_buttons[gr_screen.res][SCROLL_LIST_UP_BUTTON].button.set_hotkey(KEY_UP);
Player_select_buttons[gr_screen.res][SCROLL_LIST_DOWN_BUTTON].button.set_hotkey(KEY_DOWN);
Player_select_buttons[gr_screen.res][ACCEPT_BUTTON].button.set_hotkey(KEY_ENTER);
Player_select_buttons[gr_screen.res][CREATE_PILOT_BUTTON].button.set_hotkey(KEY_C);
// attempt to load in the background bitmap
Player_select_background_bitmap = bm_load(Player_select_background_bitmap_name[gr_screen.res]);
Assert(Player_select_background_bitmap >= 0);
// load in the palette for the screen
// Player_select_palette = bm_load(PLAYER_SELECT_PALETTE);
// Player_select_palette_set = 0;
// unset the very first pilot data
Player_select_very_first_pilot = 0;
Player_select_initial_count = -1;
memset(Player_select_very_first_pilot_callsign, 0, CALLSIGN_LEN + 2);
// if(Player_select_num_pilots == 0){
// Player_select_autoaccept = 1;
// }
// if we found a pilot
if ( player_select_get_last_pilot_info() ) {
if (Player_select_last_is_multi && !Networking_disabled) {
player_select_init_player_stuff(PLAYER_SELECT_MODE_MULTI);
} else {
player_select_init_player_stuff(PLAYER_SELECT_MODE_SINGLE);
}
} else { // otherwise go to the single player mode by default
player_select_init_player_stuff(PLAYER_SELECT_MODE_SINGLE);
}
if ( (Player_select_num_pilots == 1) && Player_select_input_mode ) {
Player_select_autoaccept = 1;
}
}
开发者ID:alisci01,项目名称:fs2open.github.com,代码行数:100,代码来源:playermenu.cpp
示例7: popup_init
//.........这里部分代码省略.........
break;
case GS_STATE_VIEW_CUTSCENES:
pbg = &Popup_background[gr_screen.res][choice][POPUP_FILMROOM];
break;
case GS_STATE_GAME_PLAY:
pbg = &Popup_background[gr_screen.res][choice][POPUP_FLY];
break;
/*case GS_STATE_MULTI_DOGFIGHT_DEBRIEF:
case GS_STATE_MULTI_JOIN_GAME:
case GS_STATE_DEBRIEF:
pbg = &Popup_background[gr_screen.res][choice][POPUP_DEFAULT];
break;*/
default:
pbg = &Popup_background[gr_screen.res][choice][POPUP_DEFAULT];
}
// anytime in single player, and multiplayer, not in mission, go ahead and stop time
if ( (Game_mode & GM_NORMAL) || ((Game_mode && GM_MULTIPLAYER) && !(Game_mode & GM_IN_MISSION)) ){
game_stop_time();
}
// create base window
Popup_window.create(pbg->coords[0], pbg->coords[1], Popup_text_coords[gr_screen.res][2]+100, Popup_text_coords[gr_screen.res][3]+50, 0);
Popup_window.set_foreground_bmap(pbg->filename);
// create buttons
for (i=0; i<pi->nchoices; i++) {
b = &Popup_buttons[i];
// accommodate single-choice positive icon being positioned differently
if ( (pi->nchoices == 1) && (flags&PF_USE_AFFIRMATIVE_ICON) ) {
b->create(&Popup_window, "", Button_coords[gr_screen.res][i+1][0], Button_coords[gr_screen.res][i+1][1], 30, 25, 0, 1);
} else {
b->create(&Popup_window, "", Button_coords[gr_screen.res][i][0], Button_coords[gr_screen.res][i][1], 30, 25, 0, 1);
}
fname = popup_get_button_filename(pi, i, flags);
b->set_bmaps(fname, 3, 0);
b->set_highlight_action(common_play_highlight_sound);
if ( pi->keypress[i] >= 0 ) {
b->set_hotkey(pi->keypress[i]);
}
// create invisible buttons to detect mouse presses... can't use mask since button region is dynamically sized
int lx, w, h;
gr_get_string_size(&w, &h, pi->button_text[i]);
lx = Button_regions[gr_screen.res][i][0] - w;
b = &Popup_button_regions[i];
// accommodate single-choice positive icon being positioned differently
if ( (pi->nchoices == 1) && (flags&PF_USE_AFFIRMATIVE_ICON) ) {
b->create(&Popup_window, "", lx, Button_regions[gr_screen.res][i+1][1], Button_regions[gr_screen.res][i+1][2]-lx, Button_regions[gr_screen.res][i+1][3]-Button_regions[gr_screen.res][i+1][1], 0, 1);
} else {
b->create(&Popup_window, "", lx, Button_regions[gr_screen.res][i][1], Button_regions[gr_screen.res][i][2]-lx, Button_regions[gr_screen.res][i][3]-Button_regions[gr_screen.res][i][1], 0, 1);
}
b->hide();
}
// webcursor setup
if (Web_cursor_bitmap >= 0) {
if (flags & PF_WEB_CURSOR_1) {
Popup_buttons[1].set_custom_cursor_bmap(Web_cursor_bitmap);
}
if (flags & PF_WEB_CURSOR_2) {
Popup_buttons[2].set_custom_cursor_bmap(Web_cursor_bitmap);
}
}
// if this is an input popup, create and center the popup
if(flags & PF_INPUT){
Popup_input.create(&Popup_window, Popup_text_coords[gr_screen.res][0], pbg->coords[1] + Popup_input_y_offset[gr_screen.res], Popup_text_coords[gr_screen.res][2], pi->max_input_text_len, "", UI_INPUTBOX_FLAG_INVIS | UI_INPUTBOX_FLAG_ESC_CLR | UI_INPUTBOX_FLAG_ESC_FOC | UI_INPUTBOX_FLAG_KEYTHRU | UI_INPUTBOX_FLAG_TEXT_CEN);
Popup_input.set_focus();
}
Popup_default_choice=0;
Popup_should_die = 0;
if (flags & PF_RUN_STATE) {
Popup_running_state = 1;
} else {
Popup_running_state = 0;
}
popup_split_lines(pi, flags);
// create the popup slider (which we may not need to use
Popup_slider.create(&Popup_window, Popup_slider_coords[gr_screen.res][0], Popup_slider_coords[gr_screen.res][1], Popup_slider_coords[gr_screen.res][2], Popup_slider_coords[gr_screen.res][3], pi->nlines > Popup_max_display[gr_screen.res] ? pi->nlines - Popup_max_display[gr_screen.res] : 0,
Popup_slider_name[gr_screen.res], popup_slider_bogus, popup_slider_bogus, NULL);
return 0;
}
开发者ID:chief1983,项目名称:Imperial-Alliance,代码行数:101,代码来源:POPUP.CPP
示例8: chatbox_force_big
// force the chatbox to go into big mode (if its in small mode) - will not work if in multi paused chatbox mode
void chatbox_force_big()
{
int new_mode_flags;
// don't do anything unless we're currently in "small" mode
if(!(Chatbox_mode_flags & CHATBOX_FLAG_SMALL)){
return;
}
new_mode_flags = Chatbox_mode_flags;
// switch to the appropriate mode
new_mode_flags &= ~(CHATBOX_FLAG_SMALL | CHATBOX_FLAG_BIG);
new_mode_flags |= CHATBOX_FLAG_BIG;
Chatbox_bitmap = Chatbox_big_bitmap;
// flip the up/down arrow
Chatbox_buttons[gr_screen.res][CHATBOX_TOGGLE_SIZE].button.set_bmaps(Chatbox_buttons[gr_screen.res][CHATBOX_TOGGLE_SIZE+1].filename);
// call this to set everything up correctly
chatbox_set_mode(new_mode_flags);
// change the location of the input box
Chat_inputbox.update_dimensions(Chatbox_inputbox_x, Chatbox_textenter_y, Chatbox_inputbox_w,15);
Chat_inputbox.set_focus();
// adjust what line we start displaying from based upon the new size of the window
chatbox_toggle_size_adjust_lines();
}
开发者ID:DahBlount,项目名称:Freespace-Open-Swifty,代码行数:30,代码来源:chatbox.cpp
示例9: chatbox_recall_up
// user has pressed the "up" key
void chatbox_recall_up()
{
// if we've got no recall lines, do nothing
if(Chatbox_recall_count <= 0){
return;
}
// if we can increment up
if(Chatbox_recall_index < (Chatbox_recall_count - 1)){
// if this is the last line we recalled, pre-increment
if(Chatbox_recall_last == Chatbox_recall_index){
Chat_inputbox.set_text(Chatbox_recall_lines[++Chatbox_recall_index]);
Chatbox_recall_last = Chatbox_recall_index;
}
// otherwise, post increment
else {
Chat_inputbox.set_text(Chatbox_recall_lines[Chatbox_recall_index++]);
Chatbox_recall_last = Chatbox_recall_index - 1;
}
}
// if we can't increment up
else {
Chat_inputbox.set_text(Chatbox_recall_lines[Chatbox_recall_index]);
Chatbox_recall_last = Chatbox_recall_index;
}
}
开发者ID:DahBlount,项目名称:Freespace-Open-Swifty,代码行数:27,代码来源:chatbox.cpp
示例10: chatbox_recall_down
// user has pressed the "down" key
void chatbox_recall_down()
{
// if we've got no recall lines, do nothing
if(Chatbox_recall_count <= 0){
return;
}
// if we can decrement down
if(Chatbox_recall_index > 0){
// if this is the last line we recalled, pre-decrement
if(Chatbox_recall_last == Chatbox_recall_index){
Chat_inputbox.set_text(Chatbox_recall_lines[--Chatbox_recall_index]);
Chatbox_recall_last = Chatbox_recall_index;
}
// otherwise post,decrement
else {
Chat_inputbox.set_text(Chatbox_recall_lines[Chatbox_recall_index--]);
Chatbox_recall_last = Chatbox_recall_index + 1;
}
}
// if we can't decrement down
else {
Chat_inputbox.set_text("");
Chatbox_recall_last = -1;
}
}
开发者ID:DahBlount,项目名称:Freespace-Open-Swifty,代码行数:27,代码来源:chatbox.cpp
示例11: pilot_manage_set_callsign_enter_mode
void pilot_manage_set_callsign_enter_mode(bool set_callsign_enter_mode)
{
// set global mode variable
pilot_manage_callsign_enter_mode = set_callsign_enter_mode;
// disable/enable all buttons
for (int idx=0; idx<PM_NUM_BUTTONS; idx++) {
Buttons[gr_screen.res][idx].button.enable(!set_callsign_enter_mode);
}
// enable/disable hotkeys
pilot_manage_set_hotkeys(!set_callsign_enter_mode);
// disable/enable inputbox
Inputbox.enable(set_callsign_enter_mode);
// hide/unhide inputbox
Inputbox.hide(!set_callsign_enter_mode);
}
开发者ID:chief1983,项目名称:Imperial-Alliance,代码行数:17,代码来源:pilotmanage.cpp
示例12: chatbox_process
// process this frame for the chatbox
int chatbox_process(int key_in)
{
int key_out;
key_out = key_in;
// if the chatbox hasn't explicitly been created, we can't do any processing
if(!Chatbox_created){
return key_out;
}
// process the incoming key appropriately
if (key_in == -1) {
key_out = Chat_window.process();
} else {
key_out = Chat_window.process(key_in);
}
// look for special keypresses
switch(key_out){
// line recall up one
case KEY_UP:
chatbox_recall_up();
key_out = 0;
break;
// line recall down one
case KEY_DOWN:
chatbox_recall_down();
key_out = 0;
break;
}
// if we're supposed to be checking our own scroll buttons
if((Chatbox_mode_flags & CHATBOX_FLAG_BUTTONS) && (Chatbox_mode_flags & CHATBOX_FLAG_DRAW_BOX)){
if ( Chatbox_buttons[gr_screen.res][CHATBOX_SCROLL_UP].button.pressed() ) {
chatbox_scroll_up();
}
if ( Chatbox_buttons[gr_screen.res][CHATBOX_SCROLL_DOWN].button.pressed() ) {
chatbox_scroll_down();
}
if ( Chatbox_buttons[gr_screen.res][CHATBOX_TOGGLE_SIZE].button.pressed() ){
chatbox_toggle_size();
}
}
// check to see if the enter text button has been pressed
if ( Chat_enter_text.pressed() ) {
Chat_inputbox.set_focus();
}
// check to see if the current input text needs to be split up and sent automaticall
chatbox_autosplit_line();
return key_out;
}
开发者ID:DahBlount,项目名称:Freespace-Open-Swifty,代码行数:59,代码来源:chatbox.cpp
示例13: chatbox_lose_focus
// "lose" the focus on the chatbox inputbox
void chatbox_lose_focus()
{
if(!Chatbox_created){
return;
}
// clear the focus on the inputbox
Chat_inputbox.clear_focus();
}
开发者ID:DahBlount,项目名称:Freespace-Open-Swifty,代码行数:10,代码来源:chatbox.cpp
示例14: chatbox_autosplit_line
// automatically split up any input text, send it, and leave the remainder
void chatbox_autosplit_line()
{
char *remainder,msg[150];
int msg_pixel_width;
// if the chat line is getting too long, fire off the message, putting the last
// word on the next input line.
memset(msg,0,150);
Chat_inputbox.get_text(msg);
remainder = "";
// determine if the width of the string in pixels is > than the inputbox width -- if so,
// then send the message
gr_get_string_size(&msg_pixel_width, NULL, msg);
// if ( msg_pixel_width >= (Chatbox_inputbox_w - Player->short_callsign_width) ) {
if ( msg_pixel_width >= (Chatbox_inputbox_w - 25)) {
remainder = strrchr(msg, ' ');
if ( remainder ) {
*remainder = '\0';
remainder++;
} else {
remainder = "";
}
// if I'm the server, then broadcast the packet
chatbox_recall_add(msg);
send_game_chat_packet(Net_player, msg, MULTI_MSG_ALL,NULL);
chatbox_add_line(msg, MY_NET_PLAYER_NUM);
// display any remainder of text on the next line
Chat_inputbox.set_text(remainder);
} else if((Chat_inputbox.pressed() && (strlen(msg) > 0)) || (strlen(msg) >= CHATBOX_MAX_LEN)) {
// tack on the null terminator in the boundary case
int x = strlen(msg);
if(x >= CHATBOX_MAX_LEN){
msg[CHATBOX_MAX_LEN-1] = '\0';
}
// if I'm the server, then broadcast the packet
chatbox_recall_add(msg);
send_game_chat_packet(Net_player, msg, MULTI_MSG_ALL,NULL);
chatbox_add_line(msg, MY_NET_PLAYER_NUM);
// display any remainder of text on the next line
Chat_inputbox.set_text(remainder);
}
}
开发者ID:chief1983,项目名称:Imperial-Alliance,代码行数:45,代码来源:Chatbox.cpp
示例15: player_select_create_new_pilot
int player_select_create_new_pilot()
{
int idx;
// make sure we haven't reached the max
if (Player_select_num_pilots >= MAX_PILOTS) {
gamesnd_play_iface(SND_GENERAL_FAIL);
return 0;
}
int play_scroll_sound = 1;
if ( play_scroll_sound ) {
gamesnd_play_iface(SND_SCROLL);
}
idx = Player_select_num_pilots;
// move all the pilots in the list up
while (idx--) {
strcpy(Pilots[idx + 1], Pilots[idx]);
}
// by default, set the default netgame protocol to be VMT
Multi_options_g.protocol = NET_TCP;
// select the beginning of the list
Player_select_pilot = 0;
Player_select_num_pilots++;
Pilots[Player_select_pilot][0] = 0;
Player_select_list_start= 0;
// set us to be in input mode
player_select_set_input_mode(1);
// set the input box to have focus
Player_select_input_box.set_focus();
Player_select_input_box.set_text("");
Player_select_input_box.update_dimensions(Choose_list_coords[gr_screen.res][0], Choose_list_coords[gr_screen.res][1], Choose_list_coords[gr_screen.res][2], gr_get_font_height());
return 1;
}
开发者ID:alisci01,项目名称:fs2open.github.com,代码行数:42,代码来源:playermenu.cpp
示例16: barracks_set_callsign_enter_mode
void barracks_set_callsign_enter_mode(bool set_callsign_enter_mode)
{
// set global mode variable
Barracks_callsign_enter_mode = set_callsign_enter_mode;
// disable/enable all buttons
for (int idx=0; idx<BARRACKS_NUM_BUTTONS; idx++) {
// don't ever mess with the prev and next squad logo buttons
if((idx != B_SQUAD_PREV_BUTTON) && (idx != B_SQUAD_NEXT_BUTTON)){
Buttons[gr_screen.res][idx].button.enable(!set_callsign_enter_mode);
}
}
// enable/disable hotkeys
barracks_set_hotkeys(!set_callsign_enter_mode);
// disable/enable inputbox
Inputbox.enable(set_callsign_enter_mode);
// hide/unhide inputbox
Inputbox.hide(!set_callsign_enter_mode);
}
开发者ID:PhantomHoover,项目名称:fs2open.github.com,代码行数:20,代码来源:barracks.cpp
示例17: player_select_set_input_mode
void player_select_set_input_mode(int n)
{
int i;
// set the input mode
Player_select_input_mode = n;
// enable all the player select buttons
for (i=0; i<NUM_PLAYER_SELECT_BUTTONS; i++) {
Player_select_buttons[gr_screen.res][i].button.enable(!n);
}
Player_select_buttons[gr_screen.res][ACCEPT_BUTTON].button.set_hotkey(n ? -1 : KEY_ENTER);
Player_select_buttons[gr_screen.res][CREATE_PILOT_BUTTON].button.set_hotkey(n ? -1 : KEY_C);
// enable the player select input box
if (Player_select_input_mode) {
Player_select_input_box.enable();
Player_select_input_box.unhide();
} else {
Player_select_input_box.hide();
Player_select_input_box.disable();
}
}
开发者ID:alisci01,项目名称:fs2open.github.com,代码行数:24,代码来源:playermenu.cpp
示例18: chatbox_autosplit_line
// automatically split up any input text, send it, and leave the remainder
void chatbox_autosplit_line()
{
char *remainder,msg[150];
char temp[150];
int msg_pixel_width;
int target, target_length = -1;
// if the chat line is getting too long, fire off the message, putting the last
// word on the next input line.
memset(msg,0,150);
Chat_inputbox.get_text(msg);
remainder = "";
// check if this message is supposed to have a recipient
target = chatbox_get_msg_target_type(msg);
target_length = chatbox_get_msg_target_length(msg);
// determine if the width of the string in pixels is > than the inputbox width -- if so,
// then send the message
gr_get_string_size(&msg_pixel_width, NULL, msg);
// if ( msg_pixel_width >= (Chatbox_inputbox_w - Player->short_callsign_width) ) {
if ( msg_pixel_width >= (Chatbox_inputbox_w - 25)) {
remainder = strrchr(msg, ' ');
if ( remainder ) {
*remainder = '\0';
remainder++;
} else {
remainder = "";
}
// if I'm the server, then broadcast the packet
chatbox_recall_add(msg);
if (target != MULTI_MSG_EXPR) {
send_game_chat_packet(Net_player, msg, target);
}
else {
// copy the name of the player the message is being sent to
strncpy(temp, msg+1, target_length-2);
temp[target_length-2] = '\0';
send_game_chat_packet(Net_player, msg, target, NULL, temp);
}
chatbox_add_line(msg, MY_NET_PLAYER_NUM);
if (target != MULTI_MSG_ALL) {
// we need to add the target the message is going to before we add the rest of the string
strncpy(temp, msg, target_length);
temp[target_length] = ' ';
temp[target_length+1] = '\0';
strcat_s(temp, remainder);
Chat_inputbox.set_text(temp);
}
else {
// display any remainder of text on the next line
Chat_inputbox.set_text(remainder);
}
} else if((Chat_inputbox.pressed() && (msg[0] != '\0')) || (strlen(msg) >= CHATBOX_MAX_LEN)) {
// tack on the null terminator in the boundary case
int x = strlen(msg);
if(x >= CHATBOX_MAX_LEN){
msg[CHATBOX_MAX_LEN-1] = '\0';
}
// if I'm the server, then broadcast the packet
chatbox_recall_add(msg);
if (target != MULTI_MSG_EXPR) {
send_game_chat_packet(Net_player, msg, target);
}
else {
// copy the name of the player the message is being sent to
strncpy(temp, msg+1, target_length-2);
temp[target_length-2] = '\0';
send_game_chat_packet(Net_player, msg, target, NULL, temp);
}
chatbox_add_line(msg, MY_NET_PLAYER_NUM);
// display any remainder of text on the next line
Chat_inputbox.set_text(remainder);
}
}
开发者ID:DahBlount,项目名称:Freespace-Open-Swifty,代码行数:81,代码来源:chatbox.cpp
示例19: pilot_manage_do
void pilot_manage_do(void)
{
int k = Ui_window.process();
int i;
if ( k > 0 ) {
// put back in when overlay stuff is fixed
// if ( help_overlay_active(PILOT_MANAGE_OVERLAY) ) {
// help_overlay_set_state(PILOT_MANAGE_OVERLAY,0);
// k = 0;
// }
}
switch (k)
{
case KEY_ESC: // cancel only if not trying to enter a pilot name
if (!pilot_manage_callsign_enter_mode)
gameseq_post_event(GS_EVENT_BARRACKS_MENU);//GS_EVENT_PREVIOUS_STATE
break;
} // end switch
int prospective_pilot = -1;
// Entering pilot callsign
if (pilot_manage_callsign_enter_mode) {
// set focus to inputbox
Inputbox.set_focus();
switch (k) {
case KEY_ESC:
// cancel create pilot
Num_pilots--;
for (i=0; i<Num_pilots; i++) {
strcpy(Pilots[i], Pilots[i + 1]);
Pilot_ranks[i] = Pilot_ranks[i + 1];
}
pilot_manage_set_callsign_enter_mode(false);
break;
case KEY_ENTER:
pilot_manage_accept_new_pilot_callsign();
break;
}
}
// process buttons
for (i=0; i<PM_NUM_BUTTONS; i++) {
if (Buttons[gr_screen.res][i].button.pressed()) {
pilot_manage_button_pressed(i);
}
}
// pilot tha
|
请发表评论