/** * @brief Opens the console. */ void cli_open (void) { unsigned int wid; /* Lazy loading. */ if (cli_state == NULL) if (cli_init()) return; /* Must not be already open. */ if (window_exists( "Lua Console" )) return; /* Create the window. */ wid = window_create( "Lua Console", -1, -1, cli_width, cli_height ); /* Window settings. */ window_setAccept( wid, cli_input ); window_setCancel( wid, window_close ); window_handleKeys( wid, cli_keyhandler ); /* Input box. */ window_addInput( wid, 20, 20, cli_width-60-BUTTON_WIDTH, BUTTON_HEIGHT, "inpInput", LINE_LENGTH, 1 ); /* Buttons. */ window_addButton( wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT, "btnClose", "Close", window_close ); /* Custom console widget. */ window_addCust( wid, 20, -40, cli_width-40, cli_height-80-BUTTON_HEIGHT, "cstConsole", 0, cli_render, NULL ); }
/** * @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 ); }
/** * @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); }
/** * @brief Opens the console. */ void cli_open (void) { unsigned int wid; /* Lazy loading. */ if (cli_state == NULL) if (cli_init()) return; /* Make sure main menu isn't open. */ if (menu_isOpen(MENU_MAIN)) return; /* Must not be already open. */ if (window_exists( "Lua Console" )) return; /* Put a friendly message at first. */ if (cli_firstOpen) { char buf[256]; cli_addMessage( "" ); cli_addMessage( "\egWelcome to the Lua console!" ); nsnprintf( buf, sizeof(buf), "\eg "APPNAME" v%s", naev_version(0) ); cli_addMessage( buf ); cli_addMessage( "" ); cli_firstOpen = 0; } /* Create the window. */ wid = window_create( "Lua Console", -1, -1, CLI_WIDTH, CLI_HEIGHT ); /* Window settings. */ window_setAccept( wid, cli_input ); window_setCancel( wid, window_close ); window_handleKeys( wid, cli_keyhandler ); /* Input box. */ window_addInput( wid, 20, 20, CLI_WIDTH-60-BUTTON_WIDTH, BUTTON_HEIGHT, "inpInput", LINE_LENGTH, 1, cli_font ); /* Buttons. */ window_addButton( wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT, "btnClose", "Close", window_close ); /* Custom console widget. */ window_addCust( wid, 20, -40, CLI_WIDTH-40, CLI_HEIGHT-80-BUTTON_HEIGHT, "cstConsole", 0, cli_render, NULL, NULL ); /* Cache current height in case the window is resized. */ cli_height = CLI_HEIGHT; }
/** * @brief Shows a map at x, y (relative to wid) with size w,h. * * @param wid Window to show map on. * @param x X position to put map at. * @param y Y position to put map at. * @param w Width of map to open. * @param h Height of map to open. * @param zoom Default zoom to use. */ void map_show( int wid, int x, int y, int w, int h, double zoom ) { /* mark systems as needed */ mission_sysMark(); /* Set position to focus on current system. */ map_xpos = cur_system->pos.x * zoom; map_ypos = cur_system->pos.y * zoom; /* Set zoom. */ map_zoom = zoom; window_addCust( wid, x, y, w, h, "cstMap", 1, map_render, map_mouse); }
/** * @brief Creates a news widget. * * @param wid Window to create news widget on. * @param x X position of the widget to create. * @param y Y position of the widget to create. * @param w Width of the widget. * @param h Height of the widget. */ void news_widget( unsigned int wid, int x, int y, int w, int h ) { int i, p, len; char buf[4096]; /* Sane defaults. */ news_pos = h/3; news_tick = SDL_GetTicks(); /* Clean news lines. */ news_cleanLines(); /* Load up the news in a string. */ p = 0; for (i=0; i<news_nbuf; i++) { p += snprintf( &buf[p], 2048-p, "%s\n\n" "%s\n\n\n\n" , news_buf[i].title, news_buf[i].desc ); } len = p; /* Now load up the text. */ p = 0; news_nlines = 0; while (p < len) { /* Get the length. */ i = gl_printWidthForText( NULL, &buf[p], w-40 ); /* Copy the line. */ if (news_nlines+1 > news_mlines) { news_mlines += 128; news_lines = realloc( news_lines, sizeof(char*) * news_mlines ); } news_lines[news_nlines] = malloc( i + 1 ); strncpy( news_lines[news_nlines], &buf[p], i ); news_lines[news_nlines][i] = '\0'; p += i + 1; /* Move pointer. */ news_nlines++; /* New line. */ } /* Create the custom widget. */ window_addCust( wid, x, y, w, h, "cstNews", 1, news_render, news_mouse, NULL ); }
/** * @brief Shows a map at x, y (relative to wid) with size w,h. * * @param wid Window to show map on. * @param x X position to put map at. * @param y Y position to put map at. * @param w Width of map to open. * @param h Height of map to open. * @param zoom Default zoom to use. */ void map_show( int wid, int x, int y, int w, int h, double zoom ) { StarSystem *sys; /* mark systems as needed */ mission_sysMark(); /* Set position to focus on current system. */ map_xpos = cur_system->pos.x * zoom; map_ypos = cur_system->pos.y * zoom; /* Set zoom. */ map_setZoom(zoom); /* Make sure selected is sane. */ sys = system_getIndex( map_selected ); if (!(sys_isFlag(sys, SYSTEM_MARKED | SYSTEM_CMARKED)) && !sys_isKnown(sys) && !space_sysReachable(sys)) map_selectCur(); window_addCust( wid, x, y, w, h, "cstMap", 1, map_render, map_mouse, NULL ); }
/** * @brief Opens the shipyard window. */ void shipyard_open( unsigned int wid ) { int i; Ship **ships; char **sships; glTexture **tships; int nships; int w, h; int iw, ih; int bw, bh, padding, off; int th; int y; const char *buf; /* Mark as generated. */ land_tabGenerate(LAND_WINDOW_SHIPYARD); /* Init vars. */ shipyard_selected = NULL; /* Get window dimensions. */ window_dimWindow( wid, &w, &h ); /* Calculate image array dimensions. */ iw = 310 + (w-800); ih = h - 60; /* Left padding + per-button padding * nbuttons */ padding = 40 + 20 * 4; /* Calculate button dimensions. */ bw = (w - iw - padding) / 4; bh = LAND_BUTTON_HEIGHT; /* buttons */ window_addButtonKey( wid, off = -20, 20, bw, bh, "btnCloseShipyard", "Take Off", land_buttonTakeoff, SDLK_t ); window_addButtonKey( wid, off -= 20+bw, 20, bw, bh, "btnTradeShip", "Trade-In", shipyard_trade, SDLK_r ); window_addButtonKey( wid, off -= 20+bw, 20, bw, bh, "btnBuyShip", "Buy", shipyard_buy, SDLK_b ); window_addButtonKey( wid, off -= 20+bw, 20, bw, bh, "btnFindShips", "Find Ships", shipyard_find, SDLK_f ); /* target gfx */ window_addRect( wid, -41, -50, SHIP_TARGET_W, SHIP_TARGET_H, "rctTarget", &cBlack, 0 ); window_addImage( wid, -40, -50, SHIP_TARGET_W, SHIP_TARGET_H, "imgTarget", NULL, 1 ); /* slot types */ window_addCust( wid, -20, -160, 148, 70, "cstSlots", 0., shipyard_renderSlots, NULL, NULL ); /* stat text */ window_addText( wid, -40, -240, 128, 200, 0, "txtStats", &gl_smallFont, &cBlack, NULL ); /* text */ buf = "Model:\n" "Class:\n" "Fabricator:\n" "Crew:\n" "\n" "CPU:\n" "Mass:\n" "Thrust:\n" "Speed:\n" "Turn:\n" "\n" "Absorption:\n" "Shield:\n" "Armour:\n" "Energy:\n" "Cargo Space:\n" "Fuel:\n" "Fuel Use:\n" "Price:\n" "Money:\n" "License:\n"; th = gl_printHeightRaw( &gl_smallFont, 100, buf ); y = -55; window_addText( wid, 40+iw+20, y, 100, th, 0, "txtSDesc", &gl_smallFont, &cDConsole, buf ); window_addText( wid, 40+iw+20+100, y, w-(40+iw+20+100)-20, th, 0, "txtDDesc", &gl_smallFont, &cBlack, NULL ); y -= th; window_addText( wid, 20+iw+40, y, w-(20+iw+40) - 180, 185, 0, "txtDescription", &gl_smallFont, NULL, NULL ); /* set up the ships to buy/sell */ ships = tech_getShip( land_planet->tech, &nships ); if (nships <= 0) { sships = malloc(sizeof(char*)); sships[0] = strdup("None"); tships = malloc(sizeof(glTexture*)); tships[0] = NULL; nships = 1; } else { sships = malloc(sizeof(char*)*nships); tships = malloc(sizeof(glTexture*)*nships); for (i=0; i<nships; i++) { sships[i] = strdup(ships[i]->name); tships[i] = ships[i]->gfx_store; } free(ships); } window_addImageArray( wid, 20, 20, iw, ih, "iarShipyard", 64./96.*128., 64., tships, sships, nships, shipyard_update, shipyard_rmouse ); /* write the shipyard stuff */ shipyard_update(wid, NULL); /* Set default keyboard focuse to the list */ window_setFocus( wid , "iarShipyard" ); }
/** * @brief Opens the main menu (titlescreen). */ void menu_main (void) { int offset_logo, offset_wdw, freespace; unsigned int bwid, wid; glTexture *tex; /* Play load music. */ music_choose("load"); /* Load background and friends. */ tex = gl_newImage( "gfx/NAEV.png", 0 ); main_naevLogo = tex; nebu_prep( 300., 0. ); /* Needed for nebula to not spaz out */ /* Calculate Logo and window offset. */ freespace = SCREEN_H - tex->sh - MAIN_HEIGHT; if (freespace < 0) { /* Not enough freespace, this can get ugly. */ offset_logo = SCREEN_W - tex->sh; offset_wdw = 0; } else { /* We'll want a maximum seperation of 30 between logo and text. */ if (freespace/3 > 25) { freespace -= 25; offset_logo = -25; offset_wdw = -25 - tex->sh - 25; } /* Otherwise space evenly. */ else { offset_logo = -freespace/3; offset_wdw = freespace/3; } } /* create background image window */ bwid = window_create( "BG", -1, -1, SCREEN_W, SCREEN_H ); window_onClose( bwid, menu_main_cleanBG ); window_addRect( bwid, 0, 0, SCREEN_W, SCREEN_H, "rctBG", &cBlack, 0 ); window_addCust( bwid, 0, 0, SCREEN_W, SCREEN_H, "cstBG", 0, menu_main_nebu, NULL, &menu_main_lasttick ); window_addImage( bwid, (SCREEN_W-tex->sw)/2., offset_logo, "imgLogo", tex, 0 ); window_addText( bwid, 0., 10, SCREEN_W, 30., 1, "txtBG", NULL, &cWhite, naev_version(1) ); /* create menu window */ wid = window_create( "Main Menu", -1, offset_wdw, MAIN_WIDTH, MAIN_HEIGHT ); window_addButton( wid, 20, 20 + (BUTTON_HEIGHT+20)*4, BUTTON_WIDTH, BUTTON_HEIGHT, "btnLoad", "Load Game", menu_main_load ); window_addButton( wid, 20, 20 + (BUTTON_HEIGHT+20)*3, BUTTON_WIDTH, BUTTON_HEIGHT, "btnNew", "New Game", menu_main_new ); window_addButton( wid, 20, 20 + (BUTTON_HEIGHT+20)*2, BUTTON_WIDTH, BUTTON_HEIGHT, "btnOptions", "Options", menu_options_button ); window_addButton( wid, 20, 20 + (BUTTON_HEIGHT+20), BUTTON_WIDTH, BUTTON_HEIGHT, "btnCredits", "Credits", menu_main_credits ); window_addButton( wid, 20, 20, BUTTON_WIDTH, BUTTON_HEIGHT, "btnExit", "Exit", menu_exit ); /* Make the background window a parent of the menu. */ window_setParent( bwid, wid ); /* Reset timer. */ menu_main_lasttick = SDL_GetTicks(); menu_Open(MENU_MAIN); }
/** * @brief Opens the outfit exchange center window. */ void outfits_open( unsigned int wid ) { int i; Outfit **outfits; char **soutfits; glTexture **toutfits; int noutfits; int w, h; int iw, ih; int bw, bh; glColour *bg, blend; const glColour *c; char **slottype; const char *slotname; /* Get dimensions. */ outfits_getSize( wid, &w, &h, &iw, &ih, &bw, &bh ); /* will allow buying from keyboard */ window_setAccept( wid, outfits_buy ); /* buttons */ window_addButton( wid, -20, 20, bw, bh, "btnCloseOutfits", "Takeoff", land_buttonTakeoff ); window_addButton( wid, -40-bw, 20, bw, bh, "btnSellOutfit", "Sell", outfits_sell ); window_addButton( wid, -60-bw*2, 20, bw, bh, "btnBuyOutfit", "Buy", outfits_buy ); /* fancy 128x128 image */ window_addRect( wid, 19 + iw + 20, -50, 128, 129, "rctImage", &cBlack, 0 ); window_addImage( wid, 20 + iw + 20, -50-128, 0, 0, "imgOutfit", NULL, 1 ); /* cust draws the modifier */ window_addCust( wid, -40-bw, 60+2*bh, bw, bh, "cstMod", 0, outfits_renderMod, NULL, NULL ); /* the descriptive text */ window_addText( wid, 20 + iw + 20 + 128 + 20, -60, 320, 160, 0, "txtOutfitName", &gl_defFont, &cBlack, NULL ); window_addText( wid, 20 + iw + 20 + 128 + 20, -60 - gl_defFont.h - 20, 320, 160, 0, "txtDescShort", &gl_smallFont, &cBlack, NULL ); window_addText( wid, 20 + iw + 20, -60-128-10, 60, 160, 0, "txtSDesc", &gl_smallFont, &cDConsole, "Owned:\n" "\n" "Slot:\n" "Size:\n" "Mass:\n" "\n" "Price:\n" "Money:\n" "License:\n" ); window_addText( wid, 20 + iw + 20 + 60, -60-128-10, 250, 160, 0, "txtDDesc", &gl_smallFont, &cBlack, NULL ); window_addText( wid, 20 + iw + 20, -60-128-10-160, w-(iw+80), 180, 0, "txtDescription", &gl_smallFont, NULL, NULL ); /* set up the outfits to buy/sell */ outfits = tech_getOutfit( land_planet->tech, &noutfits ); if (noutfits <= 0) { /* No outfits */ soutfits = malloc(sizeof(char*)); soutfits[0] = strdup("None"); toutfits = malloc(sizeof(glTexture*)); toutfits[0] = NULL; noutfits = 1; bg = NULL; slottype = NULL; } else { /* Create the outfit arrays. */ soutfits = malloc(sizeof(char*)*noutfits); toutfits = malloc(sizeof(glTexture*)*noutfits); bg = malloc(sizeof(glColour)*noutfits); slottype = malloc(sizeof(char*)*noutfits ); for (i=0; i<noutfits; i++) { soutfits[i] = strdup(outfits[i]->name); toutfits[i] = outfits[i]->gfx_store; /* Background colour. */ c = outfit_slotSizeColour( &outfits[i]->slot ); if (c == NULL) c = &cBlack; col_blend( &blend, c, &cGrey70, 0.4 ); memcpy( &bg[i], &blend, sizeof(glColour) ); /* Get slot name. */ slotname = outfit_slotName(outfits[i]); if ((strcmp(slotname,"NA") != 0) && (strcmp(slotname,"NULL") != 0)) { slottype[i] = malloc( 2 ); slottype[i][0] = outfit_slotName(outfits[i])[0]; slottype[i][1] = '\0'; } else slottype[i] = NULL; } free(outfits); } window_addImageArray( wid, 20, 20, iw, ih, "iarOutfits", 64, 64, toutfits, soutfits, noutfits, outfits_update, outfits_rmouse ); /* write the outfits stuff */ outfits_update( wid, NULL ); outfits_updateQuantities( wid ); toolkit_setImageArraySlotType( wid, "iarOutfits", slottype ); toolkit_setImageArrayBackground( wid, "iarOutfits", bg ); }
/** * @brief Opens the map window. */ void map_open (void) { unsigned int wid; StarSystem *cur; int w,h; /* Destroy window if exists. */ wid = window_get(MAP_WDWNAME); if (wid > 0) { window_destroy( wid ); return; } /* set position to focus on current system */ map_xpos = cur_system->pos.x; map_ypos = cur_system->pos.y; /* reset zoom. */ map_zoom = 1.; /* mark systems as needed */ mission_sysMark(); /* Attempt to select current map if none is selected */ if (map_selected == -1) map_selectCur(); /* get the selected system. */ cur = system_getIndex( map_selected ); /* Set up window size. */ w = MAX(600, SCREEN_W - 100); h = MAX(540, SCREEN_H - 100); /* create the window. */ wid = window_create( MAP_WDWNAME, -1, -1, w, h ); /* * SIDE TEXT * * $System * * Faction: * $Faction (or Multiple) * * Status: * $Status * * Planets: * $Planet1, $Planet2, ... * * Services: * $Services * * ... * * [Close] */ /* System Name */ window_addText( wid, -20, -20, 100, 20, 1, "txtSysname", &gl_defFont, &cDConsole, cur->name ); /* Faction */ window_addText( wid, -20, -60, 90, 20, 0, "txtSFaction", &gl_smallFont, &cDConsole, "Faction:" ); window_addText( wid, -20, -60-gl_smallFont.h-5, 80, 100, 0, "txtFaction", &gl_smallFont, &cBlack, NULL ); /* Standing */ window_addText( wid, -20, -100, 90, 20, 0, "txtSStanding", &gl_smallFont, &cDConsole, "Standing:" ); window_addText( wid, -20, -100-gl_smallFont.h-5, 80, 100, 0, "txtStanding", &gl_smallFont, &cBlack, NULL ); /* Planets */ window_addText( wid, -20, -140, 90, 20, 0, "txtSPlanets", &gl_smallFont, &cDConsole, "Planets:" ); window_addText( wid, -20, -140-gl_smallFont.h-5, 80, 100, 0, "txtPlanets", &gl_smallFont, &cBlack, NULL ); /* Services */ window_addText( wid, -20, -180, 90, 20, 0, "txtSServices", &gl_smallFont, &cDConsole, "Services:" ); window_addText( wid, -20, -180-gl_smallFont.h-5, 80, 100, 0, "txtServices", &gl_smallFont, &cBlack, NULL ); /* Close button */ window_addButton( wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT, "btnClose", "Close", window_close ); /* * The map itself. */ window_addCust( wid, 20, -40, w-150, h-100, "cstMap", 1, map_render, map_mouse ); /* * Bottom stuff * * [+] [-] Nebulae, Asteroids, Interference */ /* Zoom buttons */ window_addButton( wid, 40, 20, 30, 30, "btnZoomIn", "+", map_buttonZoom ); window_addButton( wid, 80, 20, 30, 30, "btnZoomOut", "-", map_buttonZoom ); /* Situation text */ window_addText( wid, 140, 10, w - 80 - 30 - 30, 30, 0, "txtSystemStatus", &gl_smallFont, &cBlack, NULL ); map_update( wid ); }
/** * @brief Opens the system editor interface. */ void uniedit_open( unsigned int wid_unused, char *unused ) { (void) wid_unused; (void) unused; unsigned int wid; /* Pause. */ pause_game(); /* Needed to generate faction disk. */ map_setZoom( 1. ); /* Must have no diffs applied. */ diff_clear(); /* Reset some variables. */ uniedit_mode = UNIEDIT_DEFAULT; uniedit_drag = 0; uniedit_dragSys = 0; uniedit_tsys = NULL; uniedit_tadd = 0; uniedit_zoom = 1.; uniedit_xpos = 0.; uniedit_ypos = 0.; /* Create the window. */ wid = window_create( "Universe Editor", -1, -1, -1, -1 ); window_handleKeys( wid, uniedit_keys ); uniedit_wid = wid; /* Close button. */ window_addButton( wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT, "btnClose", "Close", uniedit_close ); /* Jump toggle. */ window_addButton( wid, -20, 20+(BUTTON_HEIGHT+20)*3, BUTTON_WIDTH, BUTTON_HEIGHT, "btnJump", "Jump", uniedit_btnJump ); /* Rename system. */ window_addButton( wid, -20, 20+(BUTTON_HEIGHT+20)*4, BUTTON_WIDTH, BUTTON_HEIGHT, "btnRename", "Rename", uniedit_btnRename ); /* Edit system. */ window_addButton( wid, -20, 20+(BUTTON_HEIGHT+20)*5, BUTTON_WIDTH, BUTTON_HEIGHT, "btnEdit", "Edit", uniedit_btnEdit ); /* New system. */ window_addButton( wid, -20, 20+(BUTTON_HEIGHT+20)*6, BUTTON_WIDTH, BUTTON_HEIGHT, "btnNew", "New Sys", uniedit_btnNew ); /* Open a system. */ window_addButton( wid, -20, 20+(BUTTON_HEIGHT+20)*7, BUTTON_WIDTH, BUTTON_HEIGHT, "btnOpen", "Open", uniedit_btnOpen ); /* Zoom buttons */ window_addButton( wid, 40, 20, 30, 30, "btnZoomIn", "+", uniedit_buttonZoom ); window_addButton( wid, 80, 20, 30, 30, "btnZoomOut", "-", uniedit_buttonZoom ); /* Presence. */ window_addText( wid, -20, -140, 90, 20, 0, "txtSPresence", &gl_smallFont, &cDConsole, "Presence:" ); window_addText( wid, -20, -140-gl_smallFont.h-5, 80, 100, 0, "txtPresence", &gl_smallFont, &cBlack, "N/A" ); /* Selected text. */ window_addText( wid, 140, 10, SCREEN_W - 80 - 30 - 30 - BUTTON_WIDTH - 20, 30, 0, "txtSelected", &gl_smallFont, &cBlack, NULL ); /* Actual viewport. */ window_addCust( wid, 20, -40, SCREEN_W - 150, SCREEN_H - 100, "cstSysEdit", 1, uniedit_render, uniedit_mouse, NULL ); window_custSetOverlay( wid, "cstSysEdit", uniedit_renderOverlay ); /* Deselect everything. */ uniedit_deselect(); }