这篇教程C++ window_addText函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中window_addText函数的典型用法代码示例。如果您正苦于以下问题:C++ window_addText函数的具体用法?C++ window_addText怎么用?C++ window_addText使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了window_addText函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: info_openMissions/** * @brief Shows the player's active missions. * * @param parent Unused. * @param str Unused. */static void info_openMissions( unsigned int wid ){ int w, h; /* Get the dimensions. */ window_dimWindow( wid, &w, &h ); /* buttons */ window_addButton( wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT, "closeMissions", "Close", info_close ); window_addButton( wid, -20, 40 + BUTTON_HEIGHT, BUTTON_WIDTH, BUTTON_HEIGHT, "btnAbortMission", "Abort", mission_menu_abort ); /* text */ window_addText( wid, 300+40, -60, 200, 40, 0, "txtSReward", &gl_smallFont, &cDConsole, "Reward:" ); window_addText( wid, 300+100, -60, 140, 40, 0, "txtReward", &gl_smallFont, &cBlack, NULL ); window_addText( wid, 300+40, -100, w - (300+40+40), h - BUTTON_HEIGHT - 120, 0, "txtDesc", &gl_smallFont, &cBlack, NULL ); /* Put a map. */ map_show( wid, 20, 20, 300, 260, 0.75 ); /* list */ mission_menu_genList(wid ,1);}
开发者ID:Jazzkovsky,项目名称:naev,代码行数:36,
示例2: opt_menuKeybinds/** * @brief Opens the keybindings menu. */void opt_menuKeybinds (void){ unsigned int wid; int w, h; int bw, bh; int lw; /* Dimensions. */ w = 500; h = 300; /* Create the window. */ wid = window_create( "Keybindings", -1, -1, w, h ); menuKeybinds_getDim( wid, &w, &h, &lw, NULL, &bw, &bh ); /* Close button. */ window_addButton( wid, -20, 20, bw, bh, "btnClose", "Close", window_close ); /* Set button. */ window_addButton( wid, -20 - bw - 20, 20, bw, bh, "btnSet", "Set Key", opt_setKey ); /* Text stuff. */ window_addText( wid, 20+lw+20, -40, w-(20+lw+20), 30, 1, "txtName", NULL, &cDConsole, NULL ); window_addText( wid, 20+lw+20, -90, w-(20+lw+20), h-70-60-bh, 0, "txtDesc", &gl_smallFont, NULL, NULL ); /* Generate the list. */ menuKeybinds_genList( wid );}
开发者ID:zid,项目名称:naev,代码行数:35,
示例3: info_outfits_menu/** * @brief Shows the player what outfits he has. * * @param str Unused. */static void info_outfits_menu( unsigned int parent, char* str ){ (void) str; char *buf; unsigned int wid; /* Create window */ wid = window_create( "Outfits", -1, -1, OUTFITS_WIDTH, OUTFITS_HEIGHT ); window_setParent( wid, parent ); /* Text */ window_addText( wid, 20, -40, 100, OUTFITS_HEIGHT-40, 0, "txtLabel", &gl_smallFont, &cDConsole, "Ship Outfits:" ); buf = pilot_getOutfits( player ); window_addText( wid, 20, -45-gl_smallFont.h, OUTFITS_WIDTH-40, OUTFITS_HEIGHT-60, 0, "txtOutfits", &gl_smallFont, &cBlack, buf ); free(buf); /* Buttons */ window_addButton( wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT, "closeOutfits", "Close", window_close ); window_addButton( wid, -20-BUTTON_WIDTH-20, 20, BUTTON_WIDTH, BUTTON_HEIGHT, "btnLicenses", "Licenses", info_licenses_menu );}
开发者ID:pegue,项目名称:naev,代码行数:33,
示例4: opt_menuAudio/** * @brief Opens the audio settings menu. */void opt_menuAudio (void){ unsigned int wid; /* Create the window. */ wid = window_create( "Audio", -1, -1, AUDIO_WIDTH, AUDIO_HEIGHT ); /* Sound fader. */ if (!sound_disabled) { window_addFader( wid, 20, -40, 160, 20, "fadSound", 0., 1., sound_getVolume(), opt_setSFXLevel ); window_addText( wid, 200, -40, AUDIO_WIDTH-220, 20, 1, "txtSound", NULL, NULL, "Sound Volume" ); } else window_addText( wid, 200, -40, AUDIO_WIDTH-220, 20, 1, "txtSound", NULL, NULL, "Sound Disabled" ); /* Music fader. */ if (!music_disabled) { window_addFader( wid, 20, -80, 160, 20, "fadMusic", 0., 1., music_getVolume(), opt_setMusicLevel ); window_addText( wid, 200, -80, AUDIO_WIDTH-220, 20, 1, "txtMusic", NULL, NULL, "Music Volume" ); } else window_addText( wid, 200, -80, AUDIO_WIDTH-220, 20, 1, "txtMusic", NULL, NULL, "Music Disabled" ); /* Close button */ window_addButton( wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT, "btnClose", "Close", window_close );}
开发者ID:zid,项目名称:naev,代码行数:36,
示例5: land_checkAddRefuel/** * @brief Checks if should add the refuel button and does if needed. */void land_checkAddRefuel (void){ char buf[ECON_CRED_STRLEN], cred[ECON_CRED_STRLEN]; unsigned int w; /* Check to see if fuel conditions are met. */ if (!planet_hasService(land_planet, PLANET_SERVICE_REFUEL)) { if (!widget_exists( land_windows[0], "txtRefuel" )) window_addText( land_windows[0], -20, 20 + (LAND_BUTTON_HEIGHT + 20) + 20, 200, gl_defFont.h, 1, "txtRefuel", &gl_defFont, &cBlack, "No refueling services." ); return; } /* Full fuel. */ if (player.p->fuel >= player.p->fuel_max) { if (widget_exists( land_windows[0], "btnRefuel" )) window_destroyWidget( land_windows[0], "btnRefuel" ); if (widget_exists( land_windows[0], "txtRefuel" )) window_destroyWidget( land_windows[0], "txtRefuel" ); return; } /* Autorefuel. */ if (conf.autorefuel) { spaceport_refuel( land_windows[0], "btnRefuel" ); w = land_getWid( LAND_WINDOW_EQUIPMENT ); if (w > 0) equipment_updateShips( w, NULL ); /* Must update counter. */ if (player.p->fuel >= player.p->fuel_max) return; } /* Just enable button if it exists. */ if (widget_exists( land_windows[0], "btnRefuel" )) { window_enableButton( land_windows[0], "btnRefuel"); credits2str( cred, player.p->credits, 2 ); snprintf( buf, sizeof(buf), "Credits: %s", cred ); window_modifyText( land_windows[0], "txtRefuel", buf ); } /* Else create it. */ else { /* Refuel button. */ credits2str( cred, refuel_price(), 2 ); snprintf( buf, sizeof(buf), "Refuel %s", cred ); window_addButton( land_windows[0], -20, 20 + (LAND_BUTTON_HEIGHT + 20), LAND_BUTTON_WIDTH,LAND_BUTTON_HEIGHT, "btnRefuel", buf, spaceport_refuel ); /* Player credits. */ credits2str( cred, player.p->credits, 2 ); snprintf( buf, sizeof(buf), "Credits: %s", cred ); window_addText( land_windows[0], -20, 20 + 2*(LAND_BUTTON_HEIGHT + 20), LAND_BUTTON_WIDTH, gl_smallFont.h, 1, "txtRefuel", &gl_smallFont, &cBlack, buf ); } /* Make sure player can click it. */ if (!player_hasCredits( refuel_price() )) window_disableButton( land_windows[0], "btnRefuel" );}
开发者ID:Dinth,项目名称:naev,代码行数:63,
示例6: info_missions_menu/** * @brief Shows the player's active missions. * * @param parent Unused. * @param str Unused. */static void info_missions_menu( unsigned int parent, char* str ){ (void) str; unsigned int wid; /* create the window */ wid = window_create( "Missions", -1, -1, MISSIONS_WIDTH, MISSIONS_HEIGHT ); window_setParent( wid, parent ); /* buttons */ window_addButton( wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT, "closeMissions", "Back", window_close ); window_addButton( wid, -20, 40 + BUTTON_HEIGHT, BUTTON_WIDTH, BUTTON_HEIGHT, "btnAbortMission", "Abort", mission_menu_abort ); /* text */ window_addText( wid, 300+40, -60, 200, 40, 0, "txtSReward", &gl_smallFont, &cDConsole, "Reward:" ); window_addText( wid, 300+100, -60, 140, 40, 0, "txtReward", &gl_smallFont, &cBlack, NULL ); window_addText( wid, 300+40, -100, 200, MISSIONS_HEIGHT - BUTTON_WIDTH - 120, 0, "txtDesc", &gl_smallFont, &cBlack, NULL ); /* Put a map. */ map_show( wid, 20, 20, 300, 260, 0.75 ); /* list */ mission_menu_genList(wid ,1);}
开发者ID:pegue,项目名称:naev,代码行数:38,
示例7: menu_info/** * @brief Opens the information menu. */void menu_info (void){ char str[128]; char *nt; unsigned int wid; /* Can't open menu twice. */ if (menu_isOpen(MENU_INFO) || dialogue_isOpen()) return; /* Pauses the player's sounds. */ player_soundPause(); wid = window_create( "Info", -1, -1, INFO_WIDTH, INFO_HEIGHT ); /* pilot generics */ nt = ntime_pretty( ntime_get() ); window_addText( wid, 20, 20, 120, INFO_HEIGHT-60, 0, "txtDPilot", &gl_smallFont, &cDConsole, "Pilot:/n" "Date:/n" "Combat/n" " Rating:/n" "/n" "Ship:/n" "Fuel:/n" ); snprintf( str, 128, "%s/n" "%s/n" "/n" "%s/n" "/n" "%s/n" "%d (%d jumps)" , player_name, nt, player_rating(), player->name, (int)player->fuel, pilot_getJumps(player) ); window_addText( wid, 80, 20, INFO_WIDTH-120-BUTTON_WIDTH, INFO_HEIGHT-60, 0, "txtPilot", &gl_smallFont, &cBlack, str ); free(nt); /* menu */ window_addButton( wid, -20, (20 + BUTTON_HEIGHT)*4 + 20, BUTTON_WIDTH, BUTTON_HEIGHT, player->ship->name, "Ship", ship_view ); window_addButton( wid, -20, (20 + BUTTON_HEIGHT)*3 + 20, BUTTON_WIDTH, BUTTON_HEIGHT, "btnOutfits", "Outfts", info_outfits_menu ); window_addButton( wid, -20, (20 + BUTTON_HEIGHT)*2 + 20, BUTTON_WIDTH, BUTTON_HEIGHT, "btnCargo", "Cargo", info_cargo_menu ); window_addButton( wid, -20, 20 + BUTTON_HEIGHT + 20, BUTTON_WIDTH, BUTTON_HEIGHT, "btnMissions", "Missions", info_missions_menu ); window_addButton( wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT, "btnClose", "Close", menu_info_close ); menu_Open(MENU_INFO);}
开发者ID:pegue,项目名称:naev,代码行数:63,
示例8: opt_keybinds/** * @brief Opens the keybindings menu. */static void opt_keybinds( unsigned int wid ){ int w, h, lw, bw, bh; /* Get dimensions. */ menuKeybinds_getDim( wid, &w, &h, &lw, NULL, &bw, &bh ); /* Close button. */ window_addButton( wid, -20, 20, bw, bh, "btnClose", "Close", opt_close ); /* Set button. */ window_addButton( wid, -20 - bw - 20, 20, bw, bh, "btnSet", "Set Key", opt_setKey ); /* Restore deafaults button. */ window_addButton( wid, -20, 20+bh+20, bw, bh, "btnDefaults", "Defaults", opt_keyDefaults ); /* Text stuff. */ window_addText( wid, 20+lw+20, -40, w-(20+lw+20), 30, 1, "txtName", NULL, &cDConsole, NULL ); window_addText( wid, 20+lw+20, -90, w-(20+lw+20), h-70-60-bh, 0, "txtDesc", &gl_smallFont, NULL, NULL ); /* Generate the list. */ menuKeybinds_genList( wid );}
开发者ID:s0be,项目名称:naev,代码行数:29,
示例9: info_openMain/** * @brief Opens the main info window. */static void info_openMain( unsigned int wid ){ char str[128], **buf, creds[ECON_CRED_STRLEN]; char **licenses; int nlicenses; int i; char *nt; int w, h; /* Get the dimensions. */ window_dimWindow( wid, &w, &h ); /* pilot generics */ nt = ntime_pretty( ntime_get(), 2 ); window_addText( wid, 40, 20, 120, h-80, 0, "txtDPilot", &gl_smallFont, &cDConsole, "Pilot:/n" "Date:/n" "Combat Rating:/n" "/n" "Money:/n" "Ship:/n" "Fuel:" ); credits2str( creds, player.p->credits, 2 ); snprintf( str, 128, "%s/n" "%s/n" "%s/n" "/n" "%s Credits/n" "%s/n" "%.0f (%d Jumps)", player.name, nt, player_rating(), creds, player.p->name, player.p->fuel, pilot_getJumps(player.p) ); window_addText( wid, 140, 20, 200, h-80, 0, "txtPilot", &gl_smallFont, &cBlack, str ); free(nt); /* menu */ window_addButton( wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT, "btnClose", "Close", info_close ); /* List. */ buf = player_getLicenses( &nlicenses ); licenses = malloc(sizeof(char*)*nlicenses); for (i=0; i<nlicenses; i++) licenses[i] = strdup(buf[i]); window_addText( wid, -20, -40, w-80-200-40, 20, 1, "txtList", NULL, &cDConsole, "Licenses" ); window_addList( wid, -20, -70, w-80-200-40, h-110-BUTTON_HEIGHT, "lstLicenses", licenses, nlicenses, 0, NULL );}
开发者ID:AvanWolf,项目名称:naev,代码行数:62,
示例10: commodity_exchange_open/** * @brief Opens the local market window. */static void commodity_exchange_open( unsigned int wid ){ int i, ngoods; char **goods; int w, h; /* Get window dimensions. */ window_dimWindow( wid, &w, &h ); /* buttons */ window_addButton( wid, -20, 20, LAND_BUTTON_WIDTH, LAND_BUTTON_HEIGHT, "btnCommodityClose", "Takeoff", land_buttonTakeoff ); window_addButton( wid, -40-((LAND_BUTTON_WIDTH-20)/2), 20*2 + LAND_BUTTON_HEIGHT, (LAND_BUTTON_WIDTH-20)/2, LAND_BUTTON_HEIGHT, "btnCommodityBuy", "Buy", commodity_buy ); window_addButton( wid, -20, 20*2 + LAND_BUTTON_HEIGHT, (LAND_BUTTON_WIDTH-20)/2, LAND_BUTTON_HEIGHT, "btnCommoditySell", "Sell", commodity_sell ); /* cust draws the modifier */ window_addCust( wid, -40-((LAND_BUTTON_WIDTH-20)/2), 60+ 2*LAND_BUTTON_HEIGHT, (LAND_BUTTON_WIDTH-20)/2, LAND_BUTTON_HEIGHT, "cstMod", 0, commodity_renderMod, NULL, NULL ); /* text */ window_addText( wid, -20, -40, LAND_BUTTON_WIDTH, 60, 0, "txtSInfo", &gl_smallFont, &cDConsole, "You have:/n" "Market price:/n" "/n" "Free Space:/n" ); window_addText( wid, -20, -40, LAND_BUTTON_WIDTH/2, 60, 0, "txtDInfo", &gl_smallFont, &cBlack, NULL ); window_addText( wid, -40, -120, LAND_BUTTON_WIDTH-20, h-140-LAND_BUTTON_HEIGHT, 0, "txtDesc", &gl_smallFont, &cBlack, NULL ); /* goods list */ if (land_planet->ncommodities > 0) { goods = malloc(sizeof(char*) * land_planet->ncommodities); for (i=0; i<land_planet->ncommodities; i++) goods[i] = strdup(land_planet->commodities[i]->name); ngoods = land_planet->ncommodities; } else { goods = malloc( sizeof(char*) ); goods[0] = strdup("None"); ngoods = 1; } window_addList( wid, 20, -40, w-LAND_BUTTON_WIDTH-60, h-80-LAND_BUTTON_HEIGHT, "lstGoods", goods, ngoods, 0, commodity_update ); /* update */ commodity_update(wid, NULL);}
开发者ID:Dinth,项目名称:naev,代码行数:59,
示例11: misn_open/** * @brief Opens the mission computer window. */static void misn_open( unsigned int wid ){ int w, h; int y; /* Mark as generated. */ land_tabGenerate(LAND_WINDOW_MISSION); /* Get window dimensions. */ window_dimWindow( wid, &w, &h ); /* Set window functions. */ window_onClose( wid, misn_close ); /* buttons */ window_addButtonKey( wid, -20, 20, LAND_BUTTON_WIDTH,LAND_BUTTON_HEIGHT, "btnCloseMission", "Take Off", land_buttonTakeoff, SDLK_t ); window_addButtonKey( wid, -20, 40+LAND_BUTTON_HEIGHT, LAND_BUTTON_WIDTH,LAND_BUTTON_HEIGHT, "btnAcceptMission", "Accept Mission", misn_accept, SDLK_a ); /* text */ y = -60; window_addText( wid, w/2 + 10, y, w/2 - 30, 40, 0, "txtSDate", NULL, &cDConsole, "Date:/n" "Free Space:"); window_addText( wid, w/2 + 110, y, w/2 - 90, 40, 0, "txtDate", NULL, &cBlack, NULL ); y -= 2 * gl_defFont.h + 50; window_addText( wid, w/2 + 10, y, w/2 - 30, 20, 0, "txtSReward", &gl_smallFont, &cDConsole, "Reward:" ); window_addText( wid, w/2 + 70, y, w/2 - 90, 20, 0, "txtReward", &gl_smallFont, &cBlack, NULL ); y -= 20; window_addText( wid, w/2 + 10, y, w/2 - 30, h/2-90, 0, "txtDesc", &gl_smallFont, &cBlack, NULL ); /* map */ map_show( wid, 20, 20, w/2 - 30, h/2 - 35, 0.75 ); misn_genList(wid, 1); /* Set default keyboard focuse to the list */ window_setFocus( wid , "lstMission" );}
开发者ID:Kinniken,项目名称:naev,代码行数:55,
示例12: bar_open/** * @brief Opens the spaceport bar window. */static void bar_open( unsigned int wid ){ int w, h, iw, ih, bw, bh, dh, th; /* Mark as generated. */ land_tabGenerate(LAND_WINDOW_BAR); /* Set window functions. */ window_onClose( wid, bar_close ); /* Get dimensions. */ bar_getDim( wid, &w, &h, &iw, &ih, &bw, &bh ); dh = gl_printHeightRaw( &gl_smallFont, w - iw - 60, land_planet->bar_description ); /* Approach when pressing enter */ window_setAccept( wid, bar_approach ); /* Buttons */ window_addButtonKey( wid, -20, 20, bw, bh, "btnCloseBar", "Take Off", land_buttonTakeoff, SDLK_t ); window_addButtonKey( wid, -20 - bw - 20, 20, bw, bh, "btnApproach", "Approach", bar_approach, SDLK_a ); /* Bar description. */ window_addText( wid, iw + 40, -40, w - iw - 60, dh, 0, "txtDescription", &gl_smallFont, &cBlack, land_planet->bar_description ); /* Add portrait text. */ th = -40 - dh - 40; window_addText( wid, iw + 40, th, w - iw - 60, gl_defFont.h, 1, "txtPortrait", &gl_defFont, &cDConsole, NULL ); /* Add mission description text. */ th -= 20 + PORTRAIT_HEIGHT + 20 + 20; window_addText( wid, iw + 60, th, w - iw - 100, h + th - (2*bh+60), 0, "txtMission", &gl_smallFont, &cBlack, NULL ); /* Generate the mission list. */ bar_genList( wid ); /* Set default keyboard focuse to the list */ window_setFocus( wid , "iarMissions" );}
开发者ID:Kinniken,项目名称:naev,代码行数:51,
示例13: opt_setKey/** * @brief Rebinds a key. */static void opt_setKey( unsigned int wid, char *str ){ (void) wid; (void) str; unsigned int new_wid; int w, h; /* Reset key. */ opt_lastKeyPress = 0; /* Create new window. */ w = 20 + 2*(BUTTON_WIDTH + 20); h = 20 + BUTTON_HEIGHT + 20 + 20 + 80 + 40; new_wid = window_create( "Set Keybinding", -1, -1, w, h ); window_handleEvents( new_wid, opt_setKeyEvent ); window_setParent( new_wid, wid ); /* Set text. */ window_addText( new_wid, 20, -40, w-40, 60, 0, "txtInfo", &gl_smallFont, &cBlack, "To use a modifier key hit that key twice in a row, otherwise it " "will register as a modifier. To set with any modifier click the checkbox." ); /* Create button to cancel. */ window_addButton( new_wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT, "btnCancel", "Cancel", window_close ); /* Button to unset. */ window_addButton( new_wid, 20, 20, BUTTON_WIDTH, BUTTON_HEIGHT, "btnUnset", "Unset", opt_unsetKey ); /* Checkbox to set any modifier. */ window_addCheckbox( new_wid, -20, 20 + BUTTON_HEIGHT + 20, w-40, 20, "chkAny", "Set any modifier", NULL, 0 );}
开发者ID:s0be,项目名称:naev,代码行数:38,
示例14: dialogue_YesNoRaw/** * @brief Runs a dialogue with both yes and no options. * * @param caption Caption to use for the dialogue. * @param msg Message to display. * @return 1 if yes is clicked or 0 if no is clicked. */int dialogue_YesNoRaw( const char* caption, const char *msg ){ unsigned int wid; int w,h; glFont* font; int done[2]; font = dialogue_getSize( caption, msg, &w, &h ); /* create window */ wid = window_create( caption, -1, -1, w, h+110 ); window_setData( wid, &done ); /* text */ window_addText( wid, 20, -40, w-40, h, 0, "txtYesNo", font, &cBlack, msg ); /* buttons */ window_addButton( wid, w/2-50-10, 20, 50, 30, "btnYes", "Yes", dialogue_YesNoClose ); window_addButton( wid, w/2+10, 20, 50, 30, "btnNo", "No", dialogue_YesNoClose ); /* tricky secondary loop */ dialogue_open++; done[1] = -1; /* Default to negative. */ toolkit_loop( done ); /* Close the dialogue. */ dialogue_close( wid, NULL ); /* return the result */ return done[1];}
开发者ID:Superkoop,项目名称:naev,代码行数:39,
示例15: dialogue_alert/** * @brief Displays an alert popup with only an ok button and a message. * * @param fmt Printf style message to display. */void dialogue_alert( const char *fmt, ... ){ char msg[512]; va_list ap; unsigned int wdw; int h, done; if (fmt == NULL) return; else { /* get the message */ va_start(ap, fmt); vsnprintf(msg, 512, fmt, ap); va_end(ap); } h = gl_printHeightRaw( &gl_smallFont, 260, msg ); /* create the window */ wdw = window_create( "Warning", -1, -1, 300, 90 + h ); window_setData( wdw, &done ); window_addText( wdw, 20, -30, 260, h, 0, "txtAlert", &gl_smallFont, &cBlack, msg ); window_addButton( wdw, 135, 20, 50, 30, "btnOK", "OK", dialogue_close ); dialogue_open++; toolkit_loop( &done );}
开发者ID:Superkoop,项目名称:naev,代码行数:32,
示例16: misn_open/** * @brief Opens the mission computer window. */static void misn_open( unsigned int wid ){ int w, h; int y; /* Get window dimensions. */ window_dimWindow( wid, &w, &h ); /* Set window functions. */ window_onClose( wid, misn_close ); /* buttons */ window_addButton( wid, -20, 20, LAND_BUTTON_WIDTH,LAND_BUTTON_HEIGHT, "btnCloseMission", "Takeoff", land_buttonTakeoff ); window_addButton( wid, -20, 40+LAND_BUTTON_HEIGHT, LAND_BUTTON_WIDTH,LAND_BUTTON_HEIGHT, "btnAcceptMission", "Accept Mission", misn_accept ); /* text */ y = -60; window_addText( wid, w/2 + 10, y, w/2 - 30, 40, 0, "txtSDate", NULL, &cDConsole, "Date:/n" "Free Space:"); window_addText( wid, w/2 + 110, y, w/2 - 90, 40, 0, "txtDate", NULL, &cBlack, NULL ); y -= 2 * gl_defFont.h + 50; window_addText( wid, w/2 + 10, y, w/2 - 30, 20, 0, "txtSReward", &gl_smallFont, &cDConsole, "Reward:" ); window_addText( wid, w/2 + 70, y, w/2 - 90, 20, 0, "txtReward", &gl_smallFont, &cBlack, NULL ); y -= 20; window_addText( wid, w/2 + 10, y, w/2 - 30, h/2-90, 0, "txtDesc", &gl_smallFont, &cBlack, NULL ); /* map */ map_show( wid, 20, 20, w/2 - 30, h/2 - 35, 0.75 ); misn_genList(wid, 1);}
开发者ID:Dinth,项目名称:naev,代码行数:50,
示例17: info_openShip/** * @brief Shows the player what outfits he has. * * @param str Unused. */static void info_openShip( unsigned int wid ){ int w, h; /* Get the dimensions. */ window_dimWindow( wid, &w, &h ); /* Buttons */ window_addButton( wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT, "closeOutfits", _("Close"), info_close ); /* Text. */ window_addText( wid, 40, -60, 100, h-60, 0, "txtSDesc", &gl_smallFont, &cDConsole, _("Name:/n" "Model:/n" "Class:/n" "Crew:/n" "/n" "Total CPU:/n" "Mass:/n" "Jump Time:/n" "Thrust:/n" "Speed:/n" "Turn:/n" "/n" "Absorption:/n" "Shield:/n" "Armour:/n" "Energy:/n" "Cargo Space:/n" "Fuel:/n" "/n" "Stats:/n") ); window_addText( wid, 140, -60, w-300., h-60, 0, "txtDDesc", &gl_smallFont, &cBlack, NULL ); /* Custom widget. */ equipment_slotWidget( wid, -20, -40, 180, h-60, &info_eq ); info_eq.selected = player.p; info_eq.canmodify = 0; /* Update ship. */ ship_update( wid );}
开发者ID:nenau,项目名称:naev,代码行数:52,
示例18: dialogue_inputRaw/** * @brief Creates a dialogue that allows the player to write a message. * * You must free the result if it's not null. * * @param title Title of the dialogue window. * @param min Minimum length of the message (must be non-zero). * @param max Maximum length of the message (must be non-zero). * @param msg Message to be displayed. * @return The message the player typed or NULL if it was cancelled. */char* dialogue_inputRaw( const char* title, int min, int max, const char *msg ){ char *input; int h, done; /* get text height */ h = gl_printHeightRaw( &gl_smallFont, 200, msg ); /* create window */ input_dialogue.input_wid = window_create( title, -1, -1, 240, h+140 ); window_setData( input_dialogue.input_wid, &done ); window_setAccept( input_dialogue.input_wid, dialogue_inputClose ); window_setCancel( input_dialogue.input_wid, dialogue_cancel ); /* text */ window_addText( input_dialogue.input_wid, 30, -30, 200, h, 0, "txtInput", &gl_smallFont, &cDConsole, msg ); /* input */ window_addInput( input_dialogue.input_wid, 20, -50-h, 200, 20, "inpInput", max, 1, NULL ); window_setInputFilter( input_dialogue.input_wid, "inpInput", "/" ); /* Remove illegal stuff. */ /* button */ window_addButton( input_dialogue.input_wid, -20, 20, 80, 30, "btnClose", "Done", dialogue_inputClose ); /* tricky secondary loop */ dialogue_open++; done = 0; input = NULL; while ((done >= 0) && (!input || ((int)strlen(input) < min))) { /* must be longer than min */ if (input) { dialogue_alert( "Input must be at least %d character%s long!", min, (min==1) ? "s" : "" ); free(input); input = NULL; } if (toolkit_loop( &done ) != 0) /* error in loop -> quit */ return NULL; /* save the input */ if (done < 0) input = NULL; else input = strdup( window_getInput( input_dialogue.input_wid, "inpInput" ) ); } /* cleanup */ if (input != NULL) { window_destroy( input_dialogue.input_wid ); dialogue_open--; } input_dialogue.input_wid = 0; /* return the result */ return input;}
开发者ID:Superkoop,项目名称:naev,代码行数:69,
示例19: land_createMainTab/** * @brief Creates the main tab. * * @param wid Window to create main tab. */static void land_createMainTab( unsigned int wid ){ glTexture *logo; int offset; int w,h; /* Get window dimensions. */ window_dimWindow( wid, &w, &h ); /* * Faction logo. */ offset = 20; if (land_planet->faction != -1) { logo = faction_logoSmall(land_planet->faction); if (logo != NULL) { window_addImage( wid, 440 + (w-460-logo->w)/2, -20, 0, 0, "imgFaction", logo, 0 ); offset = 84; } } /* * Pretty display. */ window_addImage( wid, 20, -40, 0, 0, "imgPlanet", gfx_exterior, 1 ); window_addText( wid, 440, -20-offset, w-460, h-20-offset-60-LAND_BUTTON_HEIGHT*2, 0, "txtPlanetDesc", &gl_smallFont, &cBlack, land_planet->description); /* * buttons */ /* first column */ window_addButtonKey( wid, -20, 20, LAND_BUTTON_WIDTH, LAND_BUTTON_HEIGHT, "btnTakeoff", "Take Off", land_buttonTakeoff, SDLK_t ); /* Add "no refueling" notice if needed. */ if (!planet_hasService(land_planet, PLANET_SERVICE_REFUEL)) { window_addText( land_windows[0], -20, 20 + (LAND_BUTTON_HEIGHT + 20) + 20, 200, gl_defFont.h, 1, "txtRefuel", &gl_defFont, &cBlack, "No refueling services." ); }}
开发者ID:Kinniken,项目名称:naev,代码行数:50,
示例20: info_openStandings/** * @brief Displays the player's standings. */static void info_openStandings( unsigned int wid ){ int i; int n, m; char **str; int w, h, lw; /* Get dimensions. */ info_getDim( wid, &w, &h, &lw ); /* On close. */ window_onClose( wid, standings_close ); /* Buttons */ window_addButton( wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT, "closeMissions", "Close", info_close ); /* Graphics. */ window_addImage( wid, 0, 0, 0, 0, "imgLogo", NULL, 0 ); /* Text. */ window_addText( wid, lw+40, 0, (w-(lw+60)), 20, 1, "txtName", &gl_defFont, &cDConsole, NULL ); window_addText( wid, lw+40, 0, (w-(lw+60)), 20, 1, "txtStanding", &gl_smallFont, &cBlack, NULL ); /* Gets the faction standings. */ info_factions = faction_getAll( &n ); str = malloc( sizeof(char*) * n ); /* Create list. */ for (i=0; i<n; i++) { str[i] = malloc( 256 ); m = round( faction_getPlayer( info_factions[i] ) ); snprintf( str[i], 256, "%s [ %+d%% ]", faction_name( info_factions[i] ), m ); } /* Display list. */ window_addList( wid, 20, -40, lw, h-60, "lstStandings", str, n, 0, standings_update ); standings_update( wid , NULL );}
开发者ID:AvanWolf,项目名称:naev,代码行数:47,
示例21: bar_open/** * @brief Opens the spaceport bar window. */static void bar_open( unsigned int wid ){ int w, h, iw, ih, bw, bh, dh, th; /* Set window functions. */ window_onClose( wid, bar_close ); /* Get dimensions. */ bar_getDim( wid, &w, &h, &iw, &ih, &bw, &bh ); dh = gl_printHeightRaw( &gl_smallFont, w - iw - 60, land_planet->bar_description ); /* Buttons */ window_addButton( wid, -20, 20, bw, bh, "btnCloseBar", "Takeoff", land_buttonTakeoff ); window_addButton( wid, -20 - bw - 20, 20, bw, bh, "btnApproach", "Approach", bar_approach ); /* Bar description. */ window_addText( wid, iw + 40, -40, w - iw - 60, dh, 0, "txtDescription", &gl_smallFont, &cBlack, land_planet->bar_description ); /* Add portrait text. */ th = -40 - dh - 40; window_addText( wid, iw + 40, th, w - iw - 60, gl_defFont.h, 1, "txtPortrait", &gl_defFont, &cDConsole, NULL ); /* Add mission description text. */ th -= 20 + PORTRAIT_HEIGHT + 20 + 20; window_addText( wid, iw + 60, th, w - iw - 100, h + th - (2*bh+60), 0, "txtMission", &gl_smallFont, &cBlack, NULL ); /* Generate the mission list. */ bar_genList( wid );}
开发者ID:Dinth,项目名称:naev,代码行数:43,
示例22: dialogue_makeChoice/** * @brief Create the choice dialog. Need to add choices with below method. * * @param caption Caption to use for the dialogue. * @param msg Message to display. * @param opts The number of options. */void dialogue_makeChoice( const char *caption, const char *msg, int opts ){ int w,h; glFont* font; choice_result = NULL; choice_nopts = opts; font = dialogue_getSize( caption, msg, &w, &h ); /* create window */ choice_wid = window_create( caption, -1, -1, w, h+100+40*choice_nopts ); /* text */ window_addText( choice_wid, 20, -40, w-40, h, 0, "txtChoice", font, &cBlack, msg );}
开发者ID:Superkoop,项目名称:naev,代码行数:22,
示例23: land_createMainTab/** * @brief Creates the main tab. * * @param wid Window to create main tab. */static void land_createMainTab( unsigned int wid ){ glTexture *logo; int offset; int w,h; /* Get window dimensions. */ window_dimWindow( wid, &w, &h ); /* * Faction logo. */ offset = 20; if (land_planet->faction != -1) { logo = faction_logoSmall(land_planet->faction); if (logo != NULL) { window_addImage( wid, 440 + (w-460-logo->w)/2, -20, 0, 0, "imgFaction", logo, 0 ); offset = 84; } } /* * Pretty display. */ window_addImage( wid, 20, -40, 0, 0, "imgPlanet", gfx_exterior, 1 ); window_addText( wid, 440, -20-offset, w-460, h-20-offset-60-LAND_BUTTON_HEIGHT*2, 0, "txtPlanetDesc", &gl_smallFont, &cBlack, land_planet->description); /* * buttons */ /* first column */ window_addButton( wid, -20, 20, LAND_BUTTON_WIDTH, LAND_BUTTON_HEIGHT, "btnTakeoff", "Takeoff", land_buttonTakeoff ); /* * Checkboxes. */ window_addCheckbox( wid, -20, 20 + 2*(LAND_BUTTON_HEIGHT + 20) + 40, 175, 20, "chkRefuel", "Automatic Refuel", land_toggleRefuel, conf.autorefuel ); land_toggleRefuel( wid, "chkRefuel" );}
开发者ID:Dinth,项目名称:naev,代码行数:51,
示例24: dialogue_msgRaw/** * @brief Opens a dialogue window with an ok button and a fixed message. * * @param caption Window title. * @param msg Message to display. */void dialogue_msgRaw( const char* caption, const char *msg ){ int w,h; glFont* font; unsigned int msg_wid; int done; font = dialogue_getSize( caption, msg, &w, &h ); /* create the window */ msg_wid = window_create( caption, -1, -1, w, 110 + h ); window_setData( msg_wid, &done ); window_addText( msg_wid, 20, -40, w-40, h, 0, "txtMsg", font, &cBlack, msg ); window_addButton( msg_wid, (w-50)/2, 20, 50, 30, "btnOK", "OK", dialogue_close ); dialogue_open++; toolkit_loop( &done );}
开发者ID:Superkoop,项目名称:naev,代码行数:26,
示例25: opt_audio/** * @brief Opens the audio settings menu. */static void opt_audio( unsigned int wid ){ (void) wid; int i, j; int cw; int w, h, y, x, l; char buf[32], **s; const char *str; /* Get size. */ window_dimWindow( wid, &w, &h ); /* Close button */ window_addButton( wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT, "btnClose", "Close", opt_close ); window_addButton( wid, -20 - 1*(BUTTON_WIDTH+20), 20, BUTTON_WIDTH, BUTTON_HEIGHT, "btnApply", "Apply", opt_audioSave ); window_addButton( wid, -20 - 2*(BUTTON_WIDTH+20), 20, BUTTON_WIDTH, BUTTON_HEIGHT, "btnDefaults", "Defaults", opt_audioDefaults ); /* General options. */ cw = (w-60)/2; x = 20; y = -60; window_addText( wid, x+20, y, cw, 20, 0, "txtSGeneral", NULL, &cDConsole, "General" ); y -= 30; window_addCheckbox( wid, x, y, cw, 20, "chkNosound", "Disable all sound/music", NULL, conf.nosound ); y -= 30; str = "Backends"; l = gl_printWidthRaw( NULL, str ); window_addText( wid, x, y, l, 40, 0, "txtSBackends", NULL, NULL, str ); l += 10; i = 0; j = 0; s = malloc(sizeof(char*)*2);#if USE_OPENAL if (strcmp(conf.sound_backend,"openal")==0) j = i; s[i++] = strdup("openal");#endif /* USE_OPENAL */#if USE_SDLMIX if (strcmp(conf.sound_backend,"sdlmix")==0) j = i; s[i++] = strdup("sdlmix");#endif /* USE_SDLMIX */ if (i==0) s[i++] = strdup("none"); window_addList( wid, x+l, y, cw-(x+l), 40, "lstSound", s, i, j, NULL ); y -= 50; /* OpenAL options. */ window_addText( wid, x+20, y, cw, 20, 0, "txtSOpenal", NULL, &cDConsole, "OpenAL" ); y -= 30; window_addCheckbox( wid, x, y, cw, 20, "chkEFX", "EFX (More CPU)", NULL, conf.al_efx ); y -= 20; /* Sound levels. */ x = 20 + cw + 20; y = -60; window_addText( wid, x+20, y, 100, 20, 0, "txtSVolume", NULL, &cDConsole, "Volume Levels" ); y -= 30; /* Sound fader. */ opt_audioLevelStr( buf, sizeof(buf), 0, sound_getVolume() ); window_addText( wid, x, y, cw, 20, 1, "txtSound", NULL, NULL, buf ); y -= 20; window_addFader( wid, x, y, cw, 20, "fadSound", 0., 1., sound_getVolume(), opt_setAudioLevel ); window_faderScrollDone( wid, "fadSound", opt_beep ); y -= 40; /* Music fader. */ opt_audioLevelStr( buf, sizeof(buf), 1, music_getVolume() ); window_addText( wid, x, y, cw, 20, 1, "txtMusic", NULL, NULL, buf ); y -= 20; window_addFader( wid, x, y, cw, 20, "fadMusic", 0., 1., music_getVolume(), opt_setAudioLevel ); y -= 20; /* Restart text. */ window_addText( wid, 20, 10, 3*(BUTTON_WIDTH + 20), 30, 0, "txtRestart", &gl_smallFont, &cBlack, NULL );}
开发者ID:s0be,项目名称:naev,代码行数:98,
示例26: opt_gameplay/** * @brief Opens the gameplay menu. */static void opt_gameplay( unsigned int wid ){ (void) wid; char buf[PATH_MAX]; const char *path; int cw; int w, h, y, x, by, l; char *s; /* Get size. */ window_dimWindow( wid, &w, &h ); /* Close button */ window_addButton( wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT, "btnClose", "Close", opt_close ); window_addButton( wid, -20 - 1*(BUTTON_WIDTH+20), 20, BUTTON_WIDTH, BUTTON_HEIGHT, "btnApply", "Apply", opt_gameplaySave ); window_addButton( wid, -20 - 2*(BUTTON_WIDTH+20), 20, BUTTON_WIDTH, BUTTON_HEIGHT, "btnDefaults", "Defaults", opt_gameplayDefaults ); /* Information. */ cw = (w-40); x = 20; y = -60; window_addText( wid, x, y, cw, 20, 1, "txtVersion", NULL, NULL, naev_version(1) ); y -= 20;#ifdef GIT_COMMIT window_addText( wid, x, y, cw, 20, 1, "txtCommit", NULL, NULL, "Commit: "GIT_COMMIT );#endif /* GIT_COMMIT */ y -= 20; path = ndata_getPath(); if (path == NULL) snprintf( buf, sizeof(buf), "not using ndata" ); else snprintf( buf, sizeof(buf), "ndata: %s", path); window_addText( wid, x, y, cw, 20, 1, "txtNdata", NULL, NULL, buf ); y -= 40; by = y; /* Compiletime stuff. */ cw = (w-60)/2; y = by; x = 20; window_addText( wid, x+20, y, cw, 20, 0, "txtCompile", NULL, &cDConsole, "Compilation Flags" ); y -= 30; window_addText( wid, x, y, cw, h+y-20, 0, "txtFlags", NULL, NULL, ""#ifdef DEBUGGING#ifdef DEBUG_PARANOID "Debug Paranoid/n"#else /* DEBUG_PARANOID */ "Debug/n"#endif /* DEBUG_PARANOID */#endif /* DEBUGGING */#if defined(LINUX) "Linux/n"#elif defined(FREEBSD) "FreeBSD/n"#elif defined(MACOSX) "Mac OS X/n"#elif defined(WIN32) "Windows/n"#else "Unknown OS/n"#endif#ifdef USE_OPENAL "With OpenAL/n"#endif /* USE_OPENAL */#ifdef USE_SDLMIX "With SDL_mixer/n"#endif#ifdef HAVE_LUAJIT "Using Lua JIT/n"#endif#ifdef NDATA_DEF "ndata: "NDATA_DEF"/n"#endif /* NDATA_DEF */#ifdef PREFSDIR_DEF "preference directory: "PREFSDIR_DEF"/n"#endif /* PREFSDIR_DEF */ ); /* Options. */ y = by; x += cw; /* Autonav abort. *///.........这里部分代码省略.........
开发者ID:s0be,项目名称:naev,代码行数:101,
示例27: opt_video/** * @brief Initializes the video window. */static void opt_video( unsigned int wid ){ (void) wid; int i, j, nres, res_def; char buf[16]; int cw; int w, h, y, x, l; SDL_Rect** modes; char **res; const char *s; /* Get size. */ window_dimWindow( wid, &w, &h ); /* Close button */ window_addButton( wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT, "btnClose", "Close", opt_close ); window_addButton( wid, -20 - 1*(BUTTON_WIDTH+20), 20, BUTTON_WIDTH, BUTTON_HEIGHT, "btnApply", "Apply", opt_videoSave ); window_addButton( wid, -20 - 2*(BUTTON_WIDTH+20), 20, BUTTON_WIDTH, BUTTON_HEIGHT, "btnDefaults", "Defaults", opt_videoDefaults ); /* Resolution bits. */ cw = (w-60)/2; x = 20; y = -60; window_addText( wid, x+20, y, 100, 20, 0, "txtSRes", NULL, &cDConsole, "Resolution" ); y -= 40; window_addInput( wid, x, y, 100, 20, "inpRes", 16, 1, NULL ); snprintf( buf, sizeof(buf), "%dx%d", conf.width, conf.height ); window_setInput( wid, "inpRes", buf ); window_setInputFilter( wid, "inpRes", "abcdefghijklmnopqrstuvwyzABCDEFGHIJKLMNOPQRSTUVWXYZ[]{}()-=*///'/"~<>[email C++ window_close函数代码示例 C++ window_addButton函数代码示例
|