您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ window_dimWindow函数代码示例

51自学网 2021-06-03 09:57:48
  C++
这篇教程C++ window_dimWindow函数代码示例写得很实用,希望能帮到您。

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

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

示例1: weapons_genList

/** * @brief Generates the weapons list. */static void weapons_genList( unsigned int wid ){   const char *str;   char **buf;   int i;   int w, h;   /* Get the dimensions. */   window_dimWindow( wid, &w, &h );   /* Destroy widget if needed. */   if (widget_exists( wid, "lstWeapSets" ))      window_destroyWidget( wid, "lstWeapSets" );   /* List */   buf = malloc( sizeof(char*) * PILOT_WEAPON_SETS );   for (i=0; i<PILOT_WEAPON_SETS; i++) {      str = pilot_weapSetName( info_eq_weaps.selected, i );      if (str == NULL) {         buf[i] = malloc( sizeof(char) * PATH_MAX );         snprintf( buf[i], PATH_MAX, "Weapon Set %d", (i+1)%10 );      }      else {         buf[i] = strdup( str );      }   }   window_addList( wid, 20+180+20, -40,         w - (20+180+20+20), 160,         "lstWeapSets", buf, PILOT_WEAPON_SETS,         0, weapons_update );   /* Update. */   weapons_update( wid, NULL );}
开发者ID:AvanWolf,项目名称:naev,代码行数:37,


示例2: info_openWeapons

/** * @brief Opens the weapons window. */static void info_openWeapons( unsigned int wid ){   int w, h;   /* Get the dimensions. */   window_dimWindow( wid, &w, &h );   /* Buttons */   window_addButton( wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT,         "closeCargo", "Close", info_close );   /* Checkboxes. */   window_addCheckbox( wid, 220, 20+2*(BUTTON_HEIGHT+20)-40, 250, BUTTON_HEIGHT,         "chkAutoweap", "Automatically handle weapons", weapons_autoweap, player.p->autoweap );   window_addCheckbox( wid, 220, 20+2*(BUTTON_HEIGHT+20)-10, 300, BUTTON_HEIGHT,         "chkFire", "Enable instant mode (only for weapons)", weapons_fire,         (pilot_weapSetTypeCheck( player.p, info_eq_weaps.weapons )==WEAPSET_TYPE_WEAPON) );   window_addCheckbox( wid, 220, 20+2*(BUTTON_HEIGHT+20)+20, 300, BUTTON_HEIGHT,         "chkInrange", "Only shoot weapons that are in range", weapons_inrange,         pilot_weapSetInrangeCheck( player.p, info_eq_weaps.weapons ) );   /* Custom widget. */   equipment_slotWidget( wid, 20, -40, 180, h-60, &info_eq_weaps );   info_eq_weaps.selected  = player.p;   info_eq_weaps.canmodify = 0;   /* Custom widget for legend. */   window_addCust( wid, 220, -220, w-200-60, 100, "cstLegend", 0,         weapons_renderLegend, NULL, NULL );   /* List. */   weapons_genList( wid );}
开发者ID:Jazzkovsky,项目名称:naev,代码行数:36,


示例3: 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,


示例4: mission_menu_genList

/** * @brief Creates the current mission list for the mission menu. *    @param first 1 if it's the first time run. */static void mission_menu_genList( unsigned int wid, int first ){   int i,j;   char** misn_names;   int w, h;   if (!first)      window_destroyWidget( wid, "lstMission" );   /* Get the dimensions. */   window_dimWindow( wid, &w, &h );   /* list */   misn_names = malloc(sizeof(char*) * MISSION_MAX);   j = 0;   for (i=0; i<MISSION_MAX; i++)      if (player_missions[i].id != 0)         misn_names[j++] = (player_missions[i].title!=NULL) ? strdup(player_missions[i].title) : NULL;   if (j==0) { /* no missions */      misn_names[0] = strdup("No Missions");      j = 1;   }   window_addList( wid, 20, -40,         300, h-340,         "lstMission", misn_names, j, 0, mission_menu_update );}
开发者ID:Jazzkovsky,项目名称:naev,代码行数:30,


示例5: 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,


示例6: 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,


示例7: menu_main_resize

/** * @brief Resizes the main menu and its background. * * This is a one-off function that ensures the main menu's appearance * is consistent regardless of window resizing. */void menu_main_resize (void){   int w, h, bgw, bgh, tw, th;   int offset_logo, offset_wdw, freespace;   int menu_id, bg_id;   Widget *wgt;   if (!menu_isOpen(MENU_MAIN))      return;   menu_id = window_get("Main Menu");   bg_id   = window_get("BG");   window_dimWindow( menu_id, &w, &h );   window_dimWindow( bg_id, &bgw, &bgh );   freespace = SCREEN_H - main_naevLogo->sh - h;   if (freespace < 0) {      offset_logo = SCREEN_H - main_naevLogo->sh;      offset_wdw  = 0;   }   else {      offset_logo = -freespace/4;      offset_wdw  = freespace/2;   }   window_moveWidget( bg_id, "imgLogo",         (bgw - main_naevLogo->sw)/2., offset_logo );   window_dimWidget( bg_id, "txtBG", &tw, &th );   if (tw > SCREEN_W) {      /* RIP abstractions. X must be set manually because window_moveWidget       * transforms negative coordinates. */      wgt = window_getwgt( bg_id, "txtBG" );      if (wgt)         wgt->x = (SCREEN_W - tw) / 2;   }   else      window_moveWidget( bg_id, "txtBG", (SCREEN_W - tw)/2, 10. );   window_move( menu_id, -1, offset_wdw );}
开发者ID:naev,项目名称:naev,代码行数:49,


示例8: 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,


示例9: bar_getDim

/** * @brief Gets the dimensions of the spaceport bar window. */static void bar_getDim( int wid,      int *w, int *h, int *iw, int *ih, int *bw, int *bh ){   /* Get window dimensions. */   window_dimWindow( wid, w, h );   /* Calculate dimensions of portraits. */   *iw = 300 + (*w - 800);   *ih = *h - 60;   /* Calculate button dimensions. */   *bw = (*w - *iw - 80)/2;   *bh = LAND_BUTTON_HEIGHT;}
开发者ID:Dinth,项目名称:naev,代码行数:17,


示例10: 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,


示例11: 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,


示例12: 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,


示例13: 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,


示例14: outfits_getSize

/** * @brief Gets the size of the outfits window. */static void outfits_getSize( unsigned int wid, int *w, int *h,      int *iw, int *ih, int *bw, int *bh ){   /* Get window dimensions. */   window_dimWindow( wid, w, h );   /* Calculate image array dimensions. */   if (iw != NULL)      *iw = 310 + (*w-800);   if (ih != NULL)      *ih = *h - 60;   /* Calculate button dimensions. */   if (bw != NULL)      *bw = (*w - (iw!=NULL?*iw:0) - 100) / 3;   if (bh != NULL)      *bh = LAND_BUTTON_HEIGHT;}
开发者ID:GunioRobot,项目名称:naev,代码行数:21,


示例15: menuKeybinds_getDim

/** * @brief Gets the keybind menu dimensions. */static void menuKeybinds_getDim( unsigned int wid, int *w, int *h,      int *lw, int *lh, int *bw, int *bh ){   /* Get window dimensions. */   window_dimWindow( wid, w, h );   /* Get button dimensions. */   if (bw != NULL)      *bw = BUTTON_WIDTH;   if (bh != NULL)      *bh = BUTTON_HEIGHT;   /* Get list dimensions. */   if (lw != NULL)      *lw = *w - 2*BUTTON_WIDTH - 80;   if (lh != NULL)      *lh = *h - 60;}
开发者ID:s0be,项目名称:naev,代码行数:21,


示例16: info_openCargo

/** * @brief Shows the player his cargo. * *    @param str Unused. */static void info_openCargo( unsigned int wid ){   int w, h;   /* Get the dimensions. */   window_dimWindow( wid, &w, &h );   /* Buttons */   window_addButton( wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT,         "closeCargo", "Close", info_close );   window_addButton( wid, -40 - BUTTON_WIDTH, 20,         BUTTON_WIDTH, BUTTON_HEIGHT, "btnJettisonCargo", "Jettison",         cargo_jettison );   window_disableButton( wid, "btnJettisonCargo" );   /* Generate the list. */   cargo_genList( wid );}
开发者ID:Jazzkovsky,项目名称:naev,代码行数:23,


示例17: misn_genList

/** * @brief Generates the mission list. *    @param wid Window to generate the mission list for. *    @param first Is it the first time generated? */static void misn_genList( unsigned int wid, int first ){   int i,j;   char** misn_names, *focused;   int w,h;   /* Save focus. */   focused = strdup(window_getFocus(wid));   if (!first)      window_destroyWidget( wid, "lstMission" );   /* Get window dimensions. */   window_dimWindow( wid, &w, &h );   /* list */   j = 1; /* make sure we don't accidentally free the memory twice. */   misn_names = NULL;   if (mission_ncomputer > 0) { /* there are missions */      misn_names = malloc(sizeof(char*) * mission_ncomputer);      j = 0;      for (i=0; i<mission_ncomputer; i++)         if (mission_computer[i].title != NULL)            misn_names[j++] = strdup(mission_computer[i].title);   }   if ((misn_names==NULL) || (mission_ncomputer==0) || (j==0)) { /* no missions. */      if (j==0)         free(misn_names);      misn_names = malloc(sizeof(char*));      misn_names[0] = strdup("No Missions");      j = 1;   }   window_addList( wid, 20, -40,         w/2 - 30, h/2 - 35,         "lstMission", misn_names, j, 0, misn_update );   /* Restore focus. */   window_setFocus( wid, focused );   free(focused);   /* duplicateed the save focus functionaility from the bar */}
开发者ID:KennethWilke,项目名称:naev,代码行数:46,


示例18: cargo_genList

/** * @brief Generates the cargo list. */static void cargo_genList( unsigned int wid ){   char **buf;   int nbuf;   int i;   int w, h;   /* Get the dimensions. */   window_dimWindow( wid, &w, &h );   /* Destroy widget if needed. */   if (widget_exists( wid, "lstCargo" ))      window_destroyWidget( wid, "lstCargo" );   /* List */   if (player.p->ncommodities==0) {      /* No cargo */      buf = malloc(sizeof(char*));      buf[0] = strdup("None");      nbuf = 1;   }   else {      /* List the player's cargo */      buf = malloc(sizeof(char*)*player.p->ncommodities);      for (i=0; i<player.p->ncommodities; i++) {         buf[i] = malloc(sizeof(char)*128);         snprintf(buf[i],128, "%s%s %d",               player.p->commodities[i].commodity->name,               (player.p->commodities[i].id != 0) ? "*" : "",               player.p->commodities[i].quantity);      }      nbuf = player.p->ncommodities;   }   window_addList( wid, 20, -40,         w - 40, h - BUTTON_HEIGHT - 80,         "lstCargo", buf, nbuf, 0, cargo_update );   cargo_update(wid, NULL);}
开发者ID:AvanWolf,项目名称:naev,代码行数:42,


示例19: outfits_getSize

/** * @brief Gets the size of the outfits window. */static void outfits_getSize( unsigned int wid, int *w, int *h,      int *iw, int *ih, int *bw, int *bh ){   int padding;   /* Get window dimensions. */   window_dimWindow( wid, w, h );   /* Calculate image array dimensions. */   if (iw != NULL)      *iw = 310 + (*w-800);   if (ih != NULL)      *ih = *h - 60;   /* Left padding + per-button padding * nbuttons */   padding = 40 + 20 * 4;   /* Calculate button dimensions. */   if (bw != NULL)      *bw = (*w - (iw!=NULL?*iw:0) - padding) / 4;   if (bh != NULL)      *bh = LAND_BUTTON_HEIGHT;}
开发者ID:Crockadavin,项目名称:naev,代码行数:26,


示例20: weapons_genList

/** * @brief Generates the weapons list. */static void weapons_genList( unsigned int wid ){   const char *str;   char **buf, tbuf[256];   int i, n;   int w, h;   /* Get the dimensions. */   window_dimWindow( wid, &w, &h );   /* Destroy widget if needed. */   if (widget_exists( wid, "lstWeapSets" )) {      window_destroyWidget( wid, "lstWeapSets" );      n = toolkit_getListPos( wid, "lstWeapSets" );   }   else      n = -1;   /* List */   buf = malloc( sizeof(char*) * PILOT_WEAPON_SETS );   for (i=0; i<PILOT_WEAPON_SETS; i++) {      str = pilot_weapSetName( info_eq_weaps.selected, i );      if (str == NULL)         snprintf( tbuf, sizeof(tbuf), "%d - ??", (i+1)%10 );      else         snprintf( tbuf, sizeof(tbuf), "%d - %s", (i+1)%10, str );      buf[i] = strdup( tbuf );   }   window_addList( wid, 20+180+20, -40,         w - (20+180+20+20), 160,         "lstWeapSets", buf, PILOT_WEAPON_SETS,         0, weapons_update );   /* Restore position. */   if (n >= 0)      toolkit_setListPos( wid, "lstWeapSets", n );}
开发者ID:Jazzkovsky,项目名称:naev,代码行数:40,


示例21: misn_genList

/** * @brief Generates the mission list. *    @param wid Window to generate the mission list for. *    @param first Is it the first time generated? */static void misn_genList( unsigned int wid, int first ){   int i,j;   char** misn_names;   int w,h;   if (!first)      window_destroyWidget( wid, "lstMission" );   /* Get window dimensions. */   window_dimWindow( wid, &w, &h );   /* list */   j = 1; /* make sure we don't accidentally free the memory twice. */   misn_names = NULL;   if (mission_ncomputer > 0) { /* there are missions */      misn_names = malloc(sizeof(char*) * mission_ncomputer);      j = 0;      for (i=0; i<mission_ncomputer; i++)         if (mission_computer[i].title != NULL)            misn_names[j++] = strdup(mission_computer[i].title);   }   if ((misn_names==NULL) || (mission_ncomputer==0) || (j==0)) { /* no missions. */      if (j==0)         free(misn_names);      misn_names = malloc(sizeof(char*));      misn_names[0] = strdup("No Missions");      j = 1;   }   window_addList( wid, 20, -40,         w/2 - 30, h/2 - 35,         "lstMission", misn_names, j, 0, misn_update );   /* Update the list. */   misn_update( wid, NULL );}
开发者ID:Dinth,项目名称:naev,代码行数:41,


示例22: 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,


示例23: 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,


示例24: 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_draw_widgets函数代码示例
C++ window_destroy函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。