[Add] Rough outlines for shipyards and outfits.

This commit is contained in:
Allanis 2013-03-06 21:34:22 +00:00
parent 01a0324e79
commit 8b76e4613c
4 changed files with 59 additions and 10 deletions

View File

@ -10,7 +10,7 @@
<description>The surface of the planet is predominantly covered with water and the planetary climate is characterised by abundant precipitation and strong winds, yet tolerable enough to make special and expensive weather control measurements unnecessary. Habitable land is characterised by soft meadows, swamps and dense forests. The resource base of KonoSphere consits mainly of agriculture and biomass, with the locally bred and grown kono rice being its main export, and fishing a traditional source of sustenance for its people. Other traditional products include wine, and various livestock, most prominently cattle. Cuisine on KonoSphere is rather refined, with most dishes containing meat.</description> <description>The surface of the planet is predominantly covered with water and the planetary climate is characterised by abundant precipitation and strong winds, yet tolerable enough to make special and expensive weather control measurements unnecessary. Habitable land is characterised by soft meadows, swamps and dense forests. The resource base of KonoSphere consits mainly of agriculture and biomass, with the locally bred and grown kono rice being its main export, and fishing a traditional source of sustenance for its people. Other traditional products include wine, and various livestock, most prominently cattle. Cuisine on KonoSphere is rather refined, with most dishes containing meat.</description>
<bar>The bar is just off the starport with a fantastic view of the harbour. You could watch the fishermen run frantically about attending their duties for hours.</bar> <bar>The bar is just off the starport with a fantastic view of the harbour. You could watch the fishermen run frantically about attending their duties for hours.</bar>
<faction>Independent</faction> <faction>Independent</faction>
<services>7</services> <services>15</services>
<tech>0</tech> <tech>0</tech>
<commodities>1</commodities> <commodities>1</commodities>
</general> </general>

View File

@ -10,6 +10,20 @@
#define BUTTON_WIDTH 200 #define BUTTON_WIDTH 200
#define BUTTON_HEIGHT 40 #define BUTTON_HEIGHT 40
// Commodity window.
#define COMMODITY_WIDTH 400
#define COMMODITY_HEIGHT 400
// Outfits.
#define OUTFITS_WIDTH 600
#define OUTFITS_HEIGHT 500
// Shipyard.
#define SHIPYARD_WIDTH 700
#define SHIPYARD_HEIGHT 600
#define SHIPYARD_XPOS (gl_screen.w-SHIPYARD_WIDTH)/2+100
#define SHIPYARD_YPOS (gl_screen.h-SHIPYARD_HEIGHT)/2-25
// News window. // News window.
#define NEWS_WIDTH 400 #define NEWS_WIDTH 400
#define NEWS_HEIGHT 400 #define NEWS_HEIGHT 400
@ -18,10 +32,6 @@
#define BAR_WIDTH 600 #define BAR_WIDTH 600
#define BAR_HEIGHT 400 #define BAR_HEIGHT 400
// Commodity window.
#define COMMODITY_WIDTH 400
#define COMMODITY_HEIGHT 400
#define MUSIC_TAKEOFF "liftoff" #define MUSIC_TAKEOFF "liftoff"
#define MUSIC_LAND "agriculture" #define MUSIC_LAND "agriculture"
@ -34,7 +44,9 @@ static Planet* planet = NULL;
static void commodity_exchange(void); static void commodity_exchange(void);
static void commodity_exchange_close(char* str); static void commodity_exchange_close(char* str);
static void outfits(void); static void outfits(void);
static void outfits_close(char* str);
static void shipyard(void); static void shipyard(void);
static void shipyard_close(char* str);
static void spaceport_bar(void); static void spaceport_bar(void);
static void spaceport_bar_close(char* str); static void spaceport_bar_close(char* str);
static void news(void); static void news(void);
@ -67,11 +79,32 @@ static void commodity_exchange_close(char* str) {
} }
static void outfits(void) { static void outfits(void) {
secondary_wid = window_create("Outfits", -1, -1,
OUTFITS_WIDTH, OUTFITS_HEIGHT);
window_addButton(secondary_wid, -20, 20,
BUTTON_WIDTH, BUTTON_HEIGHT, "btnCloseOutfits",
"Close", outfits_close);
}
static void outfits_close(char* str) {
if(strcmp(str, "btnCloseOutfits")==0)
window_destroy(secondary_wid);
} }
static void shipyard(void) { static void shipyard(void) {
secondary_wid = window_create("Shipyard",
SHIPYARD_XPOS, SHIPYARD_YPOS,
SHIPYARD_WIDTH, SHIPYARD_HEIGHT);
window_addButton(secondary_wid, -20, 20,
BUTTON_WIDTH, BUTTON_HEIGHT, "btnCloseShipyard",
"Close", shipyard_close);
}
static void shipyard_close(char* str) {
if(strcmp(str, "btnCloseShipyard")==0)
window_destroy(secondary_wid);
} }
// Spaceport bar. // Spaceport bar.

View File

@ -284,14 +284,20 @@ unsigned int window_create(char* name, const int x, const int y, const int w, co
windows[nwindows].w = (double) w; windows[nwindows].w = (double) w;
windows[nwindows].h = (double) h; windows[nwindows].h = (double) h;
if((x == -1) && (y == -1)) { // x pos.
if(x == -1)
// Center. // Center.
windows[nwindows].x = gl_screen.w/2. - windows[nwindows].w/2.; windows[nwindows].x = gl_screen.w/2. - windows[nwindows].w/2.;
else if(x < 0)
windows[nwindows].x = gl_screen.w - windows[nwindows].w + (double)x;
else windows[nwindows].x = (double)x;
// y pos.
if(y == -1)
// Center.
windows[nwindows].y = gl_screen.h/2. - windows[nwindows].h/2.; windows[nwindows].y = gl_screen.h/2. - windows[nwindows].h/2.;
} else { else if(y < 0)
windows[nwindows].x = (double) x; windows[nwindows].x = gl_screen.h - windows[nwindows].h + (double)y;
windows[nwindows].y = (double) y; else windows[nwindows].y = (double)y;
}
windows[nwindows].widgets = NULL; windows[nwindows].widgets = NULL;
windows[nwindows].nwidgets = 0; windows[nwindows].nwidgets = 0;
@ -961,6 +967,15 @@ static void toolkit_listFocus(Widget* lst, double bx, double by) {
toolkit_listScroll(lst, 0); // Check boundaries and trigger callback. toolkit_listScroll(lst, 0); // Check boundaries and trigger callback.
} }
char* toolkit_getList(const unsigned int wid, char* name) {
Widget* wgt = window_getwgt(wid, name);
if((wgt->type != WIDGET_LIST) || (wgt->dat.lst.selected != -1))
return NULL;
return wgt->dat.lst.options[wgt->dat.lst.selected];
}
// Return the focused widget. // Return the focused widget.
static Widget* toolkit_getFocus(void) { static Widget* toolkit_getFocus(void) {
Window* wdw; Window* wdw;

View File

@ -32,6 +32,7 @@ void window_modifyImage(const unsigned int wid, char* name, glTexture* image);
// Get the window by name. // Get the window by name.
int window_exists(const char* wdwname); int window_exists(const char* wdwname);
unsigned int window_get(const char* wdwname); unsigned int window_get(const char* wdwname);
char* toolkit_getList(const unsigned int wid, char* name);
// Destroy window. // Destroy window.
void window_destroy(const unsigned int wid); void window_destroy(const unsigned int wid);