[Change] Some cosmetic changes to landing windows.

This commit is contained in:
Allanis 2013-03-17 15:44:50 +00:00
parent 36812733fd
commit 299841d012
2 changed files with 32 additions and 16 deletions

View File

@ -27,11 +27,11 @@
// News window. // News window.
#define NEWS_WIDTH 400 #define NEWS_WIDTH 400
#define NEWS_HEIGHT 400 #define NEWS_HEIGHT 500
// Bar window. // Bar window.
#define BAR_WIDTH 600 #define BAR_WIDTH 460
#define BAR_HEIGHT 400 #define BAR_HEIGHT 300
#define MUSIC_TAKEOFF "liftoff" #define MUSIC_TAKEOFF "liftoff"
#define MUSIC_LAND "agriculture" #define MUSIC_LAND "agriculture"
@ -178,8 +178,10 @@ static void commodity_sell(char* str) {
static void outfits(void) { static void outfits(void) {
char** outfits; char** outfits;
int noutfits; int noutfits;
char buf[128];
secondary_wid = window_create("Outfits", -1, -1, snprintf(buf, 128, "%s - Outfits", planet->name);
secondary_wid = window_create(buf, -1, -1,
OUTFITS_WIDTH, OUTFITS_HEIGHT); OUTFITS_WIDTH, OUTFITS_HEIGHT);
window_addButton(secondary_wid, -20, 20, window_addButton(secondary_wid, -20, 20,
@ -350,8 +352,10 @@ static void outfits_renderMod(double bx, double by, double w, double h) {
static void shipyard(void) { static void shipyard(void) {
char** ships; char** ships;
int nships; int nships;
char buf[128];
secondary_wid = window_create("Shipyard", snprintf(buf, 128, "%s - Shipyard", planet->name);
secondary_wid = window_create(buf,
-1, -1, SHIPYARD_WIDTH, SHIPYARD_HEIGHT); -1, -1, SHIPYARD_WIDTH, SHIPYARD_HEIGHT);
window_addButton(secondary_wid, -20, 20, window_addButton(secondary_wid, -20, 20,
@ -458,13 +462,17 @@ static void shipyard_buy(char* str) {
static void spaceport_bar(void) { static void spaceport_bar(void) {
secondary_wid = window_create("SpacePort Bar", -1, -1, BAR_WIDTH, BAR_HEIGHT); secondary_wid = window_create("SpacePort Bar", -1, -1, BAR_WIDTH, BAR_HEIGHT);
window_addText(secondary_wid, 20, 20 + BUTTON_HEIGHT + 20, window_addText(secondary_wid, 20, -30,
BAR_WIDTH-140, BAR_HEIGHT - 40 - BUTTON_HEIGHT - 60, BAR_WIDTH-140, BAR_HEIGHT - 40 - BUTTON_HEIGHT, 0,
0, "txtDescription", &gl_smallFont, &cBlack, planet->bar_description); "txtDescription", &gl_smallFont, &cBlack, planet->bar_description);
window_addButton(secondary_wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT, window_addButton(secondary_wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT,
"btnCloseBar", "Close", spaceport_bar_close); "btnCloseBar", "Close", spaceport_bar_close);
window_addButton(secondary_wid, 20, 20,
BUTTON_WIDTH, BUTTON_HEIGHT, "btnNews",
"News", (void(*)(char*))news);
} }
static void spaceport_bar_close(char* str) { static void spaceport_bar_close(char* str) {
if(strcmp(str, "btnCloseBar")==0) if(strcmp(str, "btnCloseBar")==0)
@ -473,20 +481,23 @@ static void spaceport_bar_close(char* str) {
// Planet news reports. // Planet news reports.
static void news(void) { static void news(void) {
secondary_wid = window_create("New Reports", -1, -1, NEWS_WIDTH, NEWS_HEIGHT); unsigned int news_wid;
news_wid = window_create("News Reports",
-1, -1, NEWS_WIDTH, NEWS_HEIGHT);
window_addText(secondary_wid, 20, 20 + BUTTON_HEIGHT + 20, window_addText(news_wid, 20, 20 + BUTTON_HEIGHT + 20,
NEWS_WIDTH-40, NEWS_HEIGHT - 20 - BUTTON_HEIGHT - 20 - 20 -20, NEWS_WIDTH-40, NEWS_HEIGHT - 20 - BUTTON_HEIGHT - 20 - 20 -20,
0, "txtNews", &gl_smallFont, &cBlack, 0, "txtNews", &gl_smallFont, &cBlack,
"News reporters report that they are on strike right now! D:"); "News reporters report that they are on strike right now! D:");
window_addButton(secondary_wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT, window_addButton(news_wid, -20, 20,
BUTTON_WIDTH, BUTTON_HEIGHT,
"btnCloseNews", "Close", news_close); "btnCloseNews", "Close", news_close);
} }
static void news_close(char* str) { static void news_close(char* str) {
if(strcmp(str, "btnCloseNews")==0) if(strcmp(str, "btnCloseNews")==0)
window_destroy(secondary_wid); window_destroy(window_get("News Reports"));
} }
// Land the player. // Land the player.
@ -523,13 +534,14 @@ void land(Planet* p) {
BUTTON_WIDTH, BUTTON_HEIGHT, "btnOutfits", BUTTON_WIDTH, BUTTON_HEIGHT, "btnOutfits",
"Outfits", (void(*)(char*))outfits); "Outfits", (void(*)(char*))outfits);
if(planet_hasService(planet, PLANET_SERVICE_BASIC)) if(planet_hasService(planet, PLANET_SERVICE_BASIC)) {
window_addButton(land_wid, 20, 20, window_addButton(land_wid, 20, 20,
BUTTON_WIDTH, BUTTON_HEIGHT, "btnNews", BUTTON_WIDTH, BUTTON_HEIGHT, "btnNews",
"News", (void(*)(char*))news); "Mission Terminal", NULL);
window_addButton(land_wid, 20, 20 + BUTTON_HEIGHT + 20, window_addButton(land_wid, 20, 20 + BUTTON_HEIGHT + 20,
BUTTON_WIDTH, BUTTON_HEIGHT, "btnBar", BUTTON_WIDTH, BUTTON_HEIGHT, "btnBar",
"SpaceBar", (void(*)(char*))spaceport_bar); "Spaceport Bar", (void(*)(char*))spaceport_bar);
}
landed = 1; landed = 1;

View File

@ -141,7 +141,7 @@ static void info_outfits_menu(char* str) {
unsigned int wid; unsigned int wid;
wid = window_create("Outfits", -1, -1, OUTFITS_WIDTH, OUTFITS_HEIGHT); wid = window_create("Outfits", -1, -1, OUTFITS_WIDTH, OUTFITS_HEIGHT);
window_addText(wid, 20, 0, 100, OUTFITS_HEIGHT-40, window_addText(wid, 20, -40, 100, OUTFITS_HEIGHT-40,
0, "txtLabel", &gl_smallFont, &cDConsole, 0, "txtLabel", &gl_smallFont, &cDConsole,
"Ship Outfits:"); "Ship Outfits:");
@ -156,6 +156,10 @@ static void info_outfits_menu(char* str) {
strcat(buf, buf2); strcat(buf, buf2);
} }
window_addText(wid, 20, -45-gl_smallFont.h,
OUTFITS_WIDTH-40, OUTFITS_HEIGHT-60,
0, "txtOutfits", &gl_smallFont, &cBlack, buf);
window_addButton(wid, -20, 20, window_addButton(wid, -20, 20,
BUTTON_WIDTH, BUTTON_HEIGHT, BUTTON_WIDTH, BUTTON_HEIGHT,
"closeOutfits", "Close", info_outfits_menu_close); "closeOutfits", "Close", info_outfits_menu_close);