本文整理汇总了C++中UI_WINDOW::create方法的典型用法代码示例。如果您正苦于以下问题:C++ UI_WINDOW::create方法的具体用法?C++ UI_WINDOW::create怎么用?C++ UI_WINDOW::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UI_WINDOW
的用法示例。
在下文中一共展示了UI_WINDOW::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pause_init
// initialize the pause screen
void pause_init()
{
// if we're already paused. do nothing
if ( Paused ) {
return;
}
Assert( !(Game_mode & GM_MULTIPLAYER) );
// pause all weapon sounds
weapon_pause_sounds();
if (Pause_type == PAUSE_TYPE_NORMAL) {
Pause_saved_screen = gr_save_screen();
}
// pause all game music
audiostream_pause_all();
Pause_win.create(0, 0, gr_screen.max_w_unscaled, gr_screen.max_h_unscaled, 0);
Pause_background_bitmap = bm_load(Pause_bmp_name[gr_screen.res]);
Paused = 1;
}
示例2: mission_hotkey_init
// ---------------------------------------------------------------------
// mission_hotkey_init()
//
// Initialize the hotkey assignment screen system. Called when GS_STATE_HOTKEY_SCREEN
// is entered.
//
void mission_hotkey_init()
{
int i;
hotkey_buttons *b;
// pause all beam weapon sounds
beam_pause_sounds();
// pause all game music
audiostream_pause_all();
reset_hotkeys();
common_set_interface_palette(); // set the interface palette
Ui_window.create(0, 0, gr_screen.max_w, gr_screen.max_h, 0);
Ui_window.set_mask_bmap(Hotkey_mask_fname[gr_screen.res]);
for (i=0; i<NUM_BUTTONS; i++) {
b = &Buttons[gr_screen.res][i];
b->button.create(&Ui_window, "", b->x, b->y, 60, 30, i < 2 ? 1 : 0, 1);
// set up callback for when a mouse first goes over a button
b->button.set_highlight_action(common_play_highlight_sound);
b->button.set_bmaps(b->filename);
b->button.link_hotspot(b->hotspot);
}
// add all xstr text
for(i=0; i<HOTKEY_NUM_TEXT; i++) {
Ui_window.add_XSTR(&Hotkey_text[gr_screen.res][i]);
}
for (i=0; i<LIST_BUTTONS_MAX; i++) {
List_buttons[i].create(&Ui_window, "", 0, 0, 60, 30, (i < 2), 1);
List_buttons[i].hide();
List_buttons[i].disable();
}
// set up hotkeys for buttons so we draw the correct animation frame when a key is pressed
Buttons[gr_screen.res][SCROLL_UP_BUTTON].button.set_hotkey(KEY_PAGEUP);
Buttons[gr_screen.res][SCROLL_DOWN_BUTTON].button.set_hotkey(KEY_PAGEDOWN);
// ensure help overlay is off
help_overlay_set_state(HOTKEY_OVERLAY,0);
// load in relevant bitmaps
Background_bitmap = bm_load(Hotkey_background_fname[gr_screen.res]);
if (Background_bitmap < 0) {
// bitmap didnt load -- this is bad
Int3();
}
Wing_bmp = bm_load("WingDesignator");
if (Wing_bmp < 0) {
// bitmap didnt load -- this is bad
Int3();
}
Scroll_offset = 0;
Selected_line = 1;
hotkey_build_listing();
}
示例3: red_alert_init
// Called once when red alert interface is started
void red_alert_init()
{
int i;
ui_button_info *b;
if ( Red_alert_inited ) {
return;
}
Ui_window.create(0, 0, gr_screen.max_w_unscaled, gr_screen.max_h_unscaled, 0);
Ui_window.set_mask_bmap(Red_alert_mask[gr_screen.res]);
for (i=0; i<NUM_BUTTONS; i++) {
b = &Buttons[gr_screen.res][i];
b->button.create(&Ui_window, "", b->x, b->y, 60, 30, 0, 1);
// set up callback for when a mouse first goes over a button
b->button.set_highlight_action(common_play_highlight_sound);
b->button.set_bmaps(b->filename);
b->button.link_hotspot(b->hotspot);
}
// all text
for(i=0; i<RED_ALERT_NUM_TEXT; i++){
Ui_window.add_XSTR(&Red_alert_text[gr_screen.res][i]);
}
// set up red alert hotkeys
Buttons[gr_screen.res][RA_CONTINUE].button.set_hotkey(KEY_CTRLED | KEY_ENTER);
// hud_anim_init(&Flash_anim, Ra_flash_coords[gr_screen.res][RA_X_COORD], Ra_flash_coords[gr_screen.res][RA_Y_COORD], NOX("AlertFlash"));
// hud_anim_load(&Flash_anim);
Red_alert_voice = -1;
if ( !Briefing ) {
Briefing = &Briefings[0];
}
// load in background image and flashing red alert animation
Background_bitmap = mission_ui_background_load(Briefing->background[gr_screen.res], Red_alert_fname[gr_screen.res]);
// Make sure word wrapping and rendering use the same font
font::set_font(font::FONT1);
if ( Briefing->num_stages > 0 ) {
brief_color_text_init(Briefing->stages[0].text.c_str(), Ra_brief_text_wnd_coords[gr_screen.res][RA_W_COORD], default_redalert_briefing_color, 0);
}
red_alert_voice_load();
// we have to reset/setup the shipselect and weaponselect pointers before moving on
ship_select_common_init();
weapon_select_common_init();
Text_delay = timestamp(200);
Red_alert_voice_started = 0;
Red_alert_inited = 1;
}
示例4: 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);
}
示例5: multi_df_debrief_init
// debrief
void multi_df_debrief_init()
{
// no longer is mission
Game_mode &= ~(GM_IN_MISSION);
game_flush();
// call scoring level close for my stats. Needed for award_init. The stats will
// be backed out if used chooses to replace them.
scoring_level_close();
// multiplayer debriefing stuff
multi_debrief_init();
// close down any old instances of the chatbox
chatbox_close();
// create the new one
chatbox_create();
// always play success music
common_music_init(SCORE_DEBRIEF_SUCCESS);
// setup kill matrix
multi_df_setup_kill_matrix();
UI_WINDOW *w;
ui_button_info *b;
int idx;
// load background bitmap
Multi_df_background_bitmap = bm_load(Multi_df_background_fname[gr_screen.res]);
Assert(Multi_df_background_bitmap);
// create the UI window
Multi_df_window.create(0, 0, gr_screen.max_w_unscaled, gr_screen.max_h_unscaled, 0);
Multi_df_window.set_mask_bmap(Multi_df_mask_fname[gr_screen.res]);
// initialize the control buttons
for (idx=0; idx<NUM_MULTI_DF_BUTTONS; idx++) {
b = &Multi_df_buttons[gr_screen.res][idx];
// create the button
b->button.create(&Multi_df_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 = &Multi_df_window;
w->add_XSTR("Accept", 1035, Multi_df_buttons[gr_screen.res][ACCEPT_BUTTON].xt, Multi_df_buttons[gr_screen.res][ACCEPT_BUTTON].yt, &Multi_df_buttons[gr_screen.res][ACCEPT_BUTTON].button, UI_XSTR_COLOR_PINK);
}
示例6: cutscenes_screen_init
void cutscenes_screen_init()
{
int i;
ui_button_info *b;
Ui_window.create(0, 0, gr_screen.max_w, gr_screen.max_h, 0);
Ui_window.set_mask_bmap(Cutscene_mask_name[gr_screen.res]);
for (i=0; i<NUM_BUTTONS; i++) {
b = &Buttons[gr_screen.res][i];
b->button.create(&Ui_window, "", b->x, b->y, 60, 30, (i < 2), 1);
// set up callback for when a mouse first goes over a button
b->button.set_highlight_action(common_play_highlight_sound);
b->button.set_bmaps(b->filename);
b->button.link_hotspot(b->hotspot);
}
// add xstrs
for(i=0; i<NUM_CUTSCENE_TEXT; i++){
Ui_window.add_XSTR(&Cutscene_text[gr_screen.res][i]);
}
Buttons[gr_screen.res][EXIT_BUTTON].button.set_hotkey(KEY_CTRLED | KEY_ENTER);
Buttons[gr_screen.res][SCROLL_UP_BUTTON].button.set_hotkey(KEY_PAGEUP);
Buttons[gr_screen.res][SCROLL_DOWN_BUTTON].button.set_hotkey(KEY_PAGEDOWN);
List_region.create(&Ui_window, "", Cutscene_list_coords[gr_screen.res][0], Cutscene_list_coords[gr_screen.res][1], Cutscene_list_coords[gr_screen.res][2], Cutscene_list_coords[gr_screen.res][3], 0, 1);
List_region.hide();
// set up hotkeys for buttons so we draw the correct animation frame when a key is pressed
Buttons[gr_screen.res][SCROLL_UP_BUTTON].button.set_hotkey(KEY_PAGEUP);
Buttons[gr_screen.res][SCROLL_DOWN_BUTTON].button.set_hotkey(KEY_PAGEDOWN);
Background_bitmap = bm_load(Cutscene_bitmap_name[gr_screen.res]);
Scroll_offset = Selected_line = 0;
Description_index = -1;
// when doing a debug version, just put all of the movie files here.
#ifndef NDEBUG
//Cutscenes_viewable = 0xffffffff; // makes all cutscenes viewble.
#endif
if (All_movies_enabled)
Cutscenes_viewable = 0xffffffff; // Cheat code enables all movies.
Num_files = 0;
for ( i = 0; i < Num_cutscenes; i++ ) {
if ( Cutscenes_viewable & (1<<i) ) {
Cutscene_list[Num_files] = i;
Num_files++;
}
}
}
示例7: hud_scrollback_init
void hud_scrollback_init()
{
int i;
scrollback_buttons *b;
// pause all game sounds
beam_pause_sounds();
audiostream_pause_all();
common_set_interface_palette("BriefingPalette"); // set the interface palette
Ui_window.create(0, 0, gr_screen.max_w, gr_screen.max_h, 0);
Ui_window.set_mask_bmap(Hud_mission_log_mask_fname[gr_screen.res]);
for (i=0; i<NUM_BUTTONS; i++) {
b = &Buttons[gr_screen.res][i];
b->button.create(&Ui_window, "", b->x, b->y, 60, 30, (i < 2), 1);
// set up callback for when a mouse first goes over a button
b->button.set_highlight_action(common_play_highlight_sound);
b->button.set_bmaps(b->filename);
b->button.link_hotspot(b->hotspot);
}
// add all strings
#ifndef MAKE_FS1
Ui_window.add_XSTR("Continue", 1069, Buttons[gr_screen.res][ACCEPT_BUTTON].xt, Buttons[gr_screen.res][ACCEPT_BUTTON].yt, &Buttons[gr_screen.res][ACCEPT_BUTTON].button, UI_XSTR_COLOR_PINK);
Ui_window.add_XSTR("Events", 1070, Buttons[gr_screen.res][SHOW_EVENTS_BUTTON].xt, Buttons[gr_screen.res][SHOW_EVENTS_BUTTON].yt, &Buttons[gr_screen.res][SHOW_EVENTS_BUTTON].button, UI_XSTR_COLOR_GREEN);
Ui_window.add_XSTR("Objectives", 1071, Buttons[gr_screen.res][SHOW_OBJS_BUTTON].xt, Buttons[gr_screen.res][SHOW_OBJS_BUTTON].yt, &Buttons[gr_screen.res][SHOW_OBJS_BUTTON].button, UI_XSTR_COLOR_GREEN);
Ui_window.add_XSTR("Messages", 1072, Buttons[gr_screen.res][SHOW_MSGS_BUTTON].xt, Buttons[gr_screen.res][SHOW_MSGS_BUTTON].yt, &Buttons[gr_screen.res][SHOW_MSGS_BUTTON].button, UI_XSTR_COLOR_GREEN);
#endif
// set up hotkeys for buttons so we draw the correct animation frame when a key is pressed
Buttons[gr_screen.res][SCROLL_UP_BUTTON].button.set_hotkey(KEY_UP);
Buttons[gr_screen.res][SCROLL_DOWN_BUTTON].button.set_hotkey(KEY_DOWN);
Background_bitmap = bm_load(Hud_mission_log_fname[gr_screen.res]);
#ifdef MAKE_FS1
Status_bitmap = bm_load(Hud_mission_log_status_fname[gr_screen.res]);
#endif
message_log_init_scrollback(Hud_mission_log_list_coords[gr_screen.res][2]);
if (Scrollback_mode == SCROLLBACK_MODE_EVENT_LOG)
Scroll_max = Num_log_lines * gr_get_font_height();
else if (Scrollback_mode == SCROLLBACK_MODE_OBJECTIVES)
Scroll_max = Num_obj_lines * gr_get_font_height();
else
Scroll_max = hud_query_scrollback_size();
Num_obj_lines = ML_objectives_init(Hud_mission_log_list_coords[gr_screen.res][0], Hud_mission_log_list_coords[gr_screen.res][1], Hud_mission_log_list_coords[gr_screen.res][2], Hud_mission_log_list_objective_x_coord[gr_screen.res]);
hud_scroll_reset();
}
示例8: cutscenes_screen_init
void cutscenes_screen_init()
{
int i;
ui_button_info *b;
Ui_window.create(0, 0, gr_screen.max_w_unscaled, gr_screen.max_h_unscaled, 0);
Ui_window.set_mask_bmap(Cutscene_mask_name[gr_screen.res]);
for (i=0; i<NUM_BUTTONS; i++) {
b = &Buttons[gr_screen.res][i];
b->button.create(&Ui_window, "", b->x, b->y, 60, 30, (i < 2), 1);
// set up callback for when a mouse first goes over a button
b->button.set_highlight_action(common_play_highlight_sound);
b->button.set_bmaps(b->filename);
b->button.link_hotspot(b->hotspot);
}
// add xstrs
for(i=0; i<NUM_CUTSCENE_TEXT; i++){
Ui_window.add_XSTR(&Cutscene_text[gr_screen.res][i]);
}
Buttons[gr_screen.res][EXIT_BUTTON].button.set_hotkey(KEY_CTRLED | KEY_ENTER);
Buttons[gr_screen.res][SCROLL_UP_BUTTON].button.set_hotkey(KEY_PAGEUP);
Buttons[gr_screen.res][SCROLL_DOWN_BUTTON].button.set_hotkey(KEY_PAGEDOWN);
List_region.create(&Ui_window, "", Cutscene_list_coords[gr_screen.res][0], Cutscene_list_coords[gr_screen.res][1], Cutscene_list_coords[gr_screen.res][2], Cutscene_list_coords[gr_screen.res][3], 0, 1);
List_region.hide();
// set up hotkeys for buttons so we draw the correct animation frame when a key is pressed
Buttons[gr_screen.res][SCROLL_UP_BUTTON].button.set_hotkey(KEY_PAGEUP);
Buttons[gr_screen.res][SCROLL_DOWN_BUTTON].button.set_hotkey(KEY_PAGEDOWN);
Background_bitmap = bm_load(Cutscene_bitmap_name[gr_screen.res]);
Scroll_offset = Selected_line = 0;
Description_index = -1;
Cutscene_list.clear();
int u = 0;
for (SCP_vector<cutscene_info>::iterator cut = Cutscenes.begin(); cut != Cutscenes.end(); ++cut, u++) {
if ( (*cut).viewable ) {
Cutscene_list.push_back(u);
}
}
}
示例9: gameplay_help_init
// called once when the gameplay help state is entered
void gameplay_help_init()
{
int i;
gameplay_help_buttons *b;
if ( Gameplay_help_inited ) {
return;
}
common_set_interface_palette("InterfacePalette"); // set the interface palette
Ui_window.create(0, 0, gr_screen.max_w_unscaled, gr_screen.max_h_unscaled, 0);
Ui_window.set_mask_bmap(Game_help_mask_filename[gr_screen.res]);
for (i=0; i<NUM_BUTTONS; i++) {
b = &Buttons[gr_screen.res][i];
b->button.create(&Ui_window, "", b->x, b->y, 60, 30, 0, 1);
// set up callback for when a mouse first goes over a button
b->button.set_highlight_action(common_play_highlight_sound);
b->button.set_bmaps(b->filename);
b->button.link_hotspot(b->hotspot);
}
// add all xstrs
for (i=0; i<GAME_HELP_NUM_TEXT; i++)
{
Ui_window.add_XSTR(&Game_help_text[gr_screen.res][i]);
}
// set the proper last screen # based upon game mode
if(Game_mode & GM_MULTIPLAYER){
Gp_last_screen = GP_LAST_SCREEN_MULTI;
} else {
Gp_last_screen = GP_LAST_SCREEN_SINGLE;
}
// setup hotkeys so lights flash when keys are pressed
Buttons[gr_screen.res][CONTINUE_BUTTON].button.set_hotkey(KEY_CTRLED | KEY_ENTER);
Buttons[gr_screen.res][PREVIOUS_PAGE_BUTTON].button.set_hotkey(KEY_LEFT);
Buttons[gr_screen.res][NEXT_PAGE_BUTTON].button.set_hotkey(KEY_RIGHT);
Background_bitmap = bm_load(Game_help_filename[gr_screen.res]);
Current_help_page = GP_HELP_BASIC_KEYS;
Gameplay_help_inited = 1;
}
示例10: mht_init
void mht_init()
{
int idx;
// create the interface window
Mht_window.create(0, 0, gr_screen.max_w_unscaled,gr_screen.max_h_unscaled, 0);
Mht_window.set_mask_bmap(Mht_bitmap_mask_fname[gr_screen.res]);
// load the background bitmap
Mht_bitmap = bm_load(Mht_bitmap_fname[gr_screen.res]);
if(Mht_bitmap < 0){
// we failed to load the bitmap - this is very bad
Int3();
}
// create the interface buttons
for(idx=0; idx<MHT_NUM_BUTTONS; idx++){
// create the object
Mht_buttons[gr_screen.res][idx].button.create(&Mht_window, "", Mht_buttons[gr_screen.res][idx].x, Mht_buttons[gr_screen.res][idx].y, 1, 1, 0, 1);
// set the sound to play when highlighted
Mht_buttons[gr_screen.res][idx].button.set_highlight_action(common_play_highlight_sound);
// set the ani for the button
Mht_buttons[gr_screen.res][idx].button.set_bmaps(Mht_buttons[gr_screen.res][idx].filename);
// set the hotspot
Mht_buttons[gr_screen.res][idx].button.link_hotspot(Mht_buttons[gr_screen.res][idx].hotspot);
}
// remove any multiplayer flags from the game mode
Game_mode &= ~(GM_MULTIPLAYER);
// initialize the music
main_hall_start_music();
// set the game_mode based on the type of player
Assert( Player != NULL );
if ( Player->flags & PLAYER_FLAGS_IS_MULTI ){
Game_mode = GM_MULTIPLAYER;
} else {
Game_mode = GM_NORMAL;
}
}
示例11: pause_debug_init
// debug pause init
void pause_debug_init()
{
Pause_win.create( 100,100,400,300, WIN_DIALOG );
Pause_physics.create( &Pause_win, NOX("Physics Pause <P>"), 200, 150, physics_paused );
Pause_ai.create( &Pause_win, NOX("AI Pause <A>"), 200, 175, ai_paused );
#ifndef NDEBUG
Pause_ai_render.create( &Pause_win, NOX("AI Render Stuff <R>"), 200, 200, Ai_render_debug_flag);
#endif
Pause_firing.create( &Pause_win, NOX("AI firing <F>"), 200, 225, Ai_firing_enabled);
Pause_external_view_mode_check.create( &Pause_win, NOX("External View <E>"), 200, 250, Pause_external_view_mode);
Pause_single_step.create( &Pause_win, NOX("Single Step <S>"), 200, 290, game_single_step );
Pause_continue.create( &Pause_win, NOX("Leave Pause"), 200, 350, 200, 40 );
Pause_single_step.set_hotkey( KEY_S );
Pause_physics.set_hotkey( KEY_P );
Pause_ai.set_hotkey( KEY_A );
Pause_ai_render.set_hotkey( KEY_R );
Pause_firing.set_hotkey( KEY_F );
Pause_external_view_mode_check.set_hotkey( KEY_E );
Pause_continue.set_hotkey( KEY_ESC );
Pause_continue.set_focus();
}
示例12: 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
//.........这里部分代码省略.........
示例13: credits_init
//.........这里部分代码省略.........
break;
case -5:
ch = 150;
break;
case -7:
ch = 151;
break;
case -42:
ch = 153;
break;
case -36:
ch = 154;
break;
case -31:
ch = 160;
break;
case -19:
ch = 161;
break;
case -13:
ch = 162;
break;
case -6:
ch = 163;
break;
case -32:
ch = 133;
break;
case -22:
ch = 136;
break;
case -20:
ch = 141;
break;
}
*ii = (char) ch;
}
}
int temp_h;
int h = 0;
for (iter = Credit_text_parts.begin(); iter != Credit_text_parts.end(); ++iter)
{
gr_get_string_size(NULL, &temp_h, iter->c_str(), (int)iter->length());
h = h + temp_h;
}
Credit_start_pos = i2fl(Credits_text_coords[gr_screen.res][CREDITS_H_COORD]);
Credit_stop_pos = -i2fl(h);
Credit_position = Credit_start_pos;
Ui_window.create(0, 0, gr_screen.max_w_unscaled, gr_screen.max_h_unscaled, 0);
Ui_window.set_mask_bmap(Credits_bitmap_mask_fname[gr_screen.res]);
common_set_interface_palette("InterfacePalette"); // set the interface palette
for (i=0; i<NUM_BUTTONS; i++) {
b = &Buttons[i][gr_screen.res];
b->button.create(&Ui_window, "", b->x, b->y, 60, 30, (i < 2), 1);
// set up callback for when a mouse first goes over a button
b->button.set_highlight_action(common_play_highlight_sound);
b->button.set_bmaps(b->filename);
b->button.link_hotspot(b->hotspot);
}
// add some text
Ui_window.add_XSTR("Technical Database", 1055, Buttons[TECH_DATABASE_BUTTON][gr_screen.res].xt, Buttons[TECH_DATABASE_BUTTON][gr_screen.res].yt, &Buttons[TECH_DATABASE_BUTTON][gr_screen.res].button, UI_XSTR_COLOR_GREEN);
Ui_window.add_XSTR("Mission Simulator", 1056, Buttons[SIMULATOR_BUTTON][gr_screen.res].xt, Buttons[SIMULATOR_BUTTON][gr_screen.res].yt, &Buttons[SIMULATOR_BUTTON][gr_screen.res].button, UI_XSTR_COLOR_GREEN);
Ui_window.add_XSTR("Cutscenes", 1057, Buttons[CUTSCENES_BUTTON][gr_screen.res].xt, Buttons[CUTSCENES_BUTTON][gr_screen.res].yt, &Buttons[CUTSCENES_BUTTON][gr_screen.res].button, UI_XSTR_COLOR_GREEN);
Ui_window.add_XSTR("Credits", 1058, Buttons[CREDITS_BUTTON][gr_screen.res].xt, Buttons[CREDITS_BUTTON][gr_screen.res].yt, &Buttons[CREDITS_BUTTON][gr_screen.res].button, UI_XSTR_COLOR_GREEN);
Ui_window.add_XSTR("Exit", 1420, Buttons[EXIT_BUTTON][gr_screen.res].xt, Buttons[EXIT_BUTTON][gr_screen.res].yt, &Buttons[EXIT_BUTTON][gr_screen.res].button, UI_XSTR_COLOR_PINK);
if (Player->flags & PLAYER_FLAGS_IS_MULTI) {
Buttons[SIMULATOR_BUTTON][gr_screen.res].button.disable();
Buttons[CUTSCENES_BUTTON][gr_screen.res].button.disable();
}
Buttons[EXIT_BUTTON][gr_screen.res].button.set_hotkey(KEY_CTRLED | KEY_ENTER);
Background_bitmap = bm_load(Credits_bitmap_fname[gr_screen.res]);
Credits_bmps.resize(Credits_num_images);
for (i=0; i<Credits_num_images; i++) {
Credits_bmps[i] = -1;
}
}
示例14: techroom_init
void techroom_init()
{
int i, idx;
techroom_buttons *b;
Ships_loaded = 0;
Weapons_loaded = 0;
Intel_loaded = 0;
Techroom_show_all = 0;
// set up UI stuff
Ui_window.create(0, 0, gr_screen.max_w_unscaled, gr_screen.max_h_unscaled, 0);
Ui_window.set_mask_bmap(Tech_mask_filename[gr_screen.res]);
Tech_background_bitmap = bm_load(Tech_background_filename[gr_screen.res]);
if (Tech_background_bitmap < 0) {
// failed to load bitmap, not a good thing
Error(LOCATION,"Couldn't load techroom background bitmap");
}
for (i=0; i<NUM_BUTTONS; i++) {
b = &Buttons[gr_screen.res][i];
b->button.create(&Ui_window, "", b->x, b->y, 60, 30, b->flags & REPEAT, 1);
// set up callback for when a mouse first goes over a button
if (b->filename) {
b->button.set_bmaps(b->filename);
b->button.set_highlight_action(common_play_highlight_sound);
} else {
b->button.hide();
}
b->button.link_hotspot(b->hotspot);
}
// common tab button text
Ui_window.add_XSTR("Technical Database", 1055, Buttons[gr_screen.res][TECH_DATABASE_TAB].xt, Buttons[gr_screen.res][TECH_DATABASE_TAB].yt, &Buttons[gr_screen.res][TECH_DATABASE_TAB].button, UI_XSTR_COLOR_GREEN);
Ui_window.add_XSTR("Mission Simulator", 1056, Buttons[gr_screen.res][SIMULATOR_TAB].xt, Buttons[gr_screen.res][SIMULATOR_TAB].yt, &Buttons[gr_screen.res][SIMULATOR_TAB].button, UI_XSTR_COLOR_GREEN);
Ui_window.add_XSTR("Cutscenes", 1057, Buttons[gr_screen.res][CUTSCENES_TAB].xt, Buttons[gr_screen.res][CUTSCENES_TAB].yt, &Buttons[gr_screen.res][CUTSCENES_TAB].button, UI_XSTR_COLOR_GREEN);
Ui_window.add_XSTR("Credits", 1058, Buttons[gr_screen.res][CREDITS_TAB].xt, Buttons[gr_screen.res][CREDITS_TAB].yt, &Buttons[gr_screen.res][CREDITS_TAB].button, UI_XSTR_COLOR_GREEN);
// common ship/weapon/intel text
Ui_window.add_XSTR("Ships", 293, Buttons[gr_screen.res][SHIPS_DATA_TAB].xt, Buttons[gr_screen.res][SHIPS_DATA_TAB].yt, &Buttons[gr_screen.res][SHIPS_DATA_TAB].button, UI_XSTR_COLOR_GREEN);
Ui_window.add_XSTR("Weapons", 1553, Buttons[gr_screen.res][WEAPONS_DATA_TAB].xt, Buttons[gr_screen.res][WEAPONS_DATA_TAB].yt, &Buttons[gr_screen.res][WEAPONS_DATA_TAB].button, UI_XSTR_COLOR_GREEN);
Ui_window.add_XSTR("Intelligence", 1066, Buttons[gr_screen.res][INTEL_DATA_TAB].xt, Buttons[gr_screen.res][INTEL_DATA_TAB].yt, &Buttons[gr_screen.res][INTEL_DATA_TAB].button, UI_XSTR_COLOR_GREEN);
// common help/options/commit text
Ui_window.add_XSTR("Exit", 1418, Buttons[gr_screen.res][EXIT_BUTTON].xt, Buttons[gr_screen.res][EXIT_BUTTON].yt, &Buttons[gr_screen.res][EXIT_BUTTON].button, UI_XSTR_COLOR_PINK);
if (Player->flags & PLAYER_FLAGS_IS_MULTI) {
Buttons[gr_screen.res][SIMULATOR_TAB].button.disable();
Buttons[gr_screen.res][CUTSCENES_TAB].button.disable();
}
// set some hotkeys
Buttons[gr_screen.res][PREV_ENTRY_BUTTON].button.set_hotkey(KEY_LEFT);
Buttons[gr_screen.res][NEXT_ENTRY_BUTTON].button.set_hotkey(KEY_RIGHT);
Buttons[gr_screen.res][SCROLL_INFO_UP].button.set_hotkey(KEY_UP);
Buttons[gr_screen.res][SCROLL_INFO_DOWN].button.set_hotkey(KEY_DOWN);
for (i=0; i<LIST_BUTTONS_MAX; i++) {
List_buttons[i].create(&Ui_window, "", 0, 0, 60, 30, 0, 1);
List_buttons[i].hide();
List_buttons[i].disable();
}
View_window.create(&Ui_window, "", Tech_ship_display_coords[gr_screen.res][SHIP_X_COORD], Tech_ship_display_coords[gr_screen.res][SHIP_Y_COORD], Tech_ship_display_coords[gr_screen.res][SHIP_W_COORD], Tech_ship_display_coords[gr_screen.res][SHIP_H_COORD], 1, 1);
View_window.hide();
Buttons[gr_screen.res][HELP_BUTTON].button.set_hotkey(KEY_F1);
Buttons[gr_screen.res][EXIT_BUTTON].button.set_hotkey(KEY_CTRLED | KEY_ENTER);
Buttons[gr_screen.res][SCROLL_LIST_UP].button.set_hotkey(KEY_PAGEUP);
Buttons[gr_screen.res][SCROLL_LIST_DOWN].button.set_hotkey(KEY_PAGEDOWN);
// init help overlay states
Techroom_overlay_id = help_overlay_get_index(TECH_ROOM_OVERLAY);
help_overlay_set_state(Techroom_overlay_id, gr_screen.res, 0);
// setup slider
Tech_slider.create(&Ui_window, Tech_slider_coords[gr_screen.res][SHIP_X_COORD], Tech_slider_coords[gr_screen.res][SHIP_Y_COORD], Tech_slider_coords[gr_screen.res][SHIP_W_COORD], Tech_slider_coords[gr_screen.res][SHIP_H_COORD], Ship_info.size(), Tech_slider_filename[gr_screen.res], &tech_scroll_list_up, &tech_scroll_list_down, &tech_ship_scroll_capture);
// zero intel anim/bitmap stuff
for(idx=0; idx<MAX_INTEL_ENTRIES; idx++){
Intel_list[idx].animation.num_frames = 0;
Intel_list[idx].bitmap = -1;
}
mprintf(("Techroom successfully initialized, now changing tab...\n"));
techroom_change_tab(Tab);
}
示例15: 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;
}
}