[Add] Basic map support, Added gl_drawCircle and gl_drawCircleInRect

This commit is contained in:
Allanis 2013-03-09 22:07:28 +00:00
parent 51d2abe73e
commit c6ffaaed20
12 changed files with 283 additions and 88 deletions

View File

@ -1,21 +1,22 @@
#include "colour.h"
// Default colors.
glColour cWhite = { .r = 1.00, .g = 1.00, .b = 1.00, .a = 1 };
glColour cGrey90 = { .r = 0.90, .g = 0.90, .b = 0.90, .a = 1 };
glColour cGrey80 = { .r = 0.80, .g = 0.80, .b = 0.80, .a = 1 };
glColour cGrey70 = { .r = 0.70, .g = 0.70, .b = 0.70, .a = 1 };
glColour cGrey60 = { .r = 0.60, .g = 0.60, .b = 0.60, .a = 1 };
glColour cGrey50 = { .r = 0.50, .g = 0.50, .b = 0.50, .a = 1 };
glColour cGrey40 = { .r = 0.40, .g = 0.40, .b = 0.40, .a = 1 };
glColour cGrey30 = { .r = 0.30, .g = 0.30, .b = 0.30, .a = 1 };
glColour cGrey20 = { .r = 0.20, .g = 0.20, .b = 0.20, .a = 1 };
glColour cGrey10 = { .r = 0.10, .g = 0.10, .b = 0.10, .a = 1 };
glColour cBlack = { .r = 0.00, .g = 0.00, .b = 0.00, .a = 1 };
glColour cWhite = { .r = 1.00, .g = 1.00, .b = 1.00, .a = 1. };
glColour cGrey90 = { .r = 0.90, .g = 0.90, .b = 0.90, .a = 1. };
glColour cGrey80 = { .r = 0.80, .g = 0.80, .b = 0.80, .a = 1. };
glColour cGrey70 = { .r = 0.70, .g = 0.70, .b = 0.70, .a = 1. };
glColour cGrey60 = { .r = 0.60, .g = 0.60, .b = 0.60, .a = 1. };
glColour cGrey50 = { .r = 0.50, .g = 0.50, .b = 0.50, .a = 1. };
glColour cGrey40 = { .r = 0.40, .g = 0.40, .b = 0.40, .a = 1. };
glColour cGrey30 = { .r = 0.30, .g = 0.30, .b = 0.30, .a = 1. };
glColour cGrey20 = { .r = 0.20, .g = 0.20, .b = 0.20, .a = 1. };
glColour cGrey10 = { .r = 0.10, .g = 0.10, .b = 0.10, .a = 1. };
glColour cBlack = { .r = 0.00, .g = 0.00, .b = 0.00, .a = 1. };
glColour cGreen = { .r = 0.20, .g = 0.80, .b = 0.20, .a = 1 };
glColour cDarkRed = { .r = 0.60, .g = 0.10, .b = 0.10, .a = 1 };
glColour cRed = { .r = 0.80, .g = 0.20, .b = 0.20, .a = 1 };
glColour cGreen = { .r = 0.20, .g = 0.80, .b = 0.20, .a = 1. };
glColour cDarkRed = { .r = 0.60, .g = 0.10, .b = 0.10, .a = 1. };
glColour cRed = { .r = 0.80, .g = 0.20, .b = 0.20, .a = 1. };
glColour cYellow = { .r = 0.80, .g = 0.80, .b = 0.00, .a = 1. };
// Game specific.
glColour cConsole = { .r = 0.1, .g = 0.9, .b = 0.1, .a = 1. };

View File

@ -25,6 +25,7 @@ extern glColour cGrey10;
extern glColour cGreen;
extern glColour cDarkRed;
extern glColour cRed;
extern glColour cYellow;
// Game specific.
extern glColour cConsole;

View File

@ -5,6 +5,7 @@
#include "toolkit.h"
#include "menu.h"
#include "board.h"
#include "map.h"
#include "input.h"
#define KEY_PRESS ( 1.)
@ -25,7 +26,8 @@ static Keybind** input_keybinds; // Contains the players keybindings.
const char* keybindNames[] = { "accel", "left", "right", "reverse", // Movement.
"primary", "target", "target_nearest", "face", "board", // Combat.
"secondary", "secondary_next", // Secondary weapons.
"target_planet", "land", "thyperspace", "jump", // Navigation.
"target_planet", "land", "thyperspace","starmap",
"jump", // Navigation.
"mapzoomin", "mapzoomout", "screenshot", "pause", "menu",
"info", // Misc.
"end" }; // Must terminate at the end.
@ -58,6 +60,7 @@ void input_setDefault(void) {
input_setKeybind("target_planet", KEYBIND_KEYBOARD, SDLK_p, 0);
input_setKeybind("land", KEYBIND_KEYBOARD, SDLK_l, 0);
input_setKeybind("thyperspace", KEYBIND_KEYBOARD, SDLK_h, 0);
input_setKeybind("starmap", KEYBIND_KEYBOARD, SDLK_m, 0);
input_setKeybind("jump", KEYBIND_KEYBOARD, SDLK_j, 0);
// Misc.
@ -201,6 +204,9 @@ static void input_key(int keynum, double value, int abs) {
else if(KEY("thyperspace") && INGAME()) {
if(value == KEY_PRESS) player_targetHyperspace();
}
else if(KEY("starmap")) {
if(value == KEY_PRESS) map_open();
}
else if(KEY("jump") && INGAME()) {
if(value == KEY_PRESS) player_jump();
}

View File

@ -111,7 +111,7 @@ static void outfits(void) {
"Sell", outfits_sell);
window_addCust(secondary_wid, -40-BUTTON_WIDTH, 60+2*BUTTON_HEIGHT,
BUTTON_WIDTH, BUTTON_HEIGHT, "cstMod", outfits_renderMod);
BUTTON_WIDTH, BUTTON_HEIGHT, "cstMod", 0, outfits_renderMod);
window_addText(secondary_wid, 40+200+20, -60,
80, 96, 0, "txtSDesc", &gl_smallFont, &cDConsole,

66
src/map.c Normal file
View File

@ -0,0 +1,66 @@
#include "log.h"
#include "lephisto.h"
#include "toolkit.h"
#include "space.h"
#include "opengl.h"
#include "map.h"
#define MAP_WIDTH 500
#define MAP_HEIGHT 400
#define BUTTON_WIDTH 60
#define BUTTON_HEIGHT 40
static int map_wid = 0;
static double map_xpos = 0.;
static double map_ypos = 0.;
// Extern.
extern StarSystem* systems_stack;
extern int systems_nstack;
void map_render(double bx, double by, double w, double h);
void map_close(char* str);
// Open the map window.
void map_open(void) {
if(map_wid) map_close(NULL);
// Set the position to focus on current system.
map_xpos = cur_system->pos.x + (MAP_WIDTH-120)/2;
map_ypos = cur_system->pos.y + (MAP_HEIGHT-60)/2;
map_wid = window_create("Star Map", -1, -1, MAP_WIDTH, MAP_HEIGHT);
window_addCust(map_wid, 20, 20, MAP_WIDTH - 120, MAP_HEIGHT - 60,
"cstMap", 1, map_render);
window_addButton(map_wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT,
"btnClose", "Close", map_close);
}
void map_close(char* str) {
(void)str;
if(map_wid) {
window_destroy(map_wid);
map_wid = 0;
}
}
// Render the map as a custom widget.
void map_render(double bx, double by, double w, double h) {
int i;
// Background
COLOUR(cBlack);
glBegin(GL_QUADS);
glVertex2d(bx, by);
glVertex2d(bx, by+h);
glVertex2d(bx+w, by+h);
glVertex2d(bx+w, by);
glEnd();
COLOUR(cYellow);
for(i = 0; i < systems_nstack; i++)
gl_drawCircleInRect(systems_stack[i].pos.x, systems_stack[i].pos.y,
5, bx, by, w, h);
}

4
src/map.h Normal file
View File

@ -0,0 +1,4 @@
#pragma once
void map_open(void);

View File

@ -419,6 +419,111 @@ void gl_bindCamera(const Vec2* pos) {
gl_camera = (Vec2*)pos;
}
// Draw circles.
void gl_drawCircle(const double cx, const double cy, const double r) {
double x, y, p;
x = 0;
y = r;
p = (5. - (r*4.)) / 4.;
glBegin(GL_POINTS);
glVertex2d(cx, cy+y);
glVertex2d(cx, cy-y);
glVertex2d(cx+y, cy);
glVertex2d(cx-y, cy);
while(x < y) {
x++;
if(p < 0) p += 2*(double)(x)+1;
else p += 2*(double)(x-(--y))+1;
if(x == 0) {
glVertex2d(cx, cy+y);
glVertex2d(cx, cy-y);
glVertex2d(cx+y, cy);
glVertex2d(cx-y, cy);
}
else if(x == y) {
glVertex2d(cx+x, cy+y);
glVertex2d(cx-x, cy+y);
glVertex2d(cx+x, cy-y);
glVertex2d(cx-x, cy-y);
}
else if(x < y) {
glVertex2d(cx+x, cy+y);
glVertex2d(cx-x, cy+y);
glVertex2d(cx+x, cy-y);
glVertex2d(cx-x, cy-y);
glVertex2d(cx+y, cy+x);
glVertex2d(cx-y, cy+x);
glVertex2d(cx+y, cy-x);
glVertex2d(cx-y, cy-x);
}
}
glEnd();
}
// Draw a cirlce in a rect.
#define PIXEL(x,y) \
if((x>rx) && (y>ry) && (x<rxw) && (y<ryh)) \
glVertex2d(x,y)
void gl_drawCircleInRect(const double cx, const double cy, const double r,
const double rx, const double ry, const double rw, const double rh) {
double rxw, ryh, x, y, p;
rxw = rx+rw;
ryh = ry+rh;
// Can be drawn normally.
if((x-r > rx) && (y-r > ry) && (x+r < rxw) && (y+r < ryh)) {
gl_drawCircle(cx, cy, r);
return;
}
x = 0;
y = r;
p = (5. - (r*4.)) / 4.;
glBegin(GL_POINTS);
PIXEL(cx, cy+y);
PIXEL(cx, cy-y);
PIXEL(cx+y, cy);
PIXEL(cx-y, cy);
while(x < y) {
x++;
if(p < 0) p += 2*(double)(x)+1;
else p += 2*(double)(x-(--y))+1;
if(x == 0) {
PIXEL(cx, cy+y);
PIXEL(cx, cy-y);
PIXEL(cx+y, cy);
PIXEL(cx-y, cy);
}
else if(x == y) {
PIXEL(cx+x, cy+y);
PIXEL(cx-x, cy+y);
PIXEL(cx+x, cy-y);
PIXEL(cx-x, cy-y);
}
else if(x < y) {
PIXEL(cx+x, cy+y);
PIXEL(cx-x, cy+y);
PIXEL(cx+x, cy-y);
PIXEL(cx-x, cy-y);
PIXEL(cx+y, cy+x);
PIXEL(cx-y, cy+x);
PIXEL(cx+y, cy-x);
PIXEL(cx-y, cy-x);
}
}
glEnd();
}
// ================
// GLOBAL.
// ================

View File

@ -63,6 +63,11 @@ void gl_blitStatic(const glTexture* texture, const double bx, const double by,
// Bind the camera to a vector.
void gl_bindCamera(const Vec2* pos);
// Circle drawing.
void gl_drawCircle(const double x, const double y, const double r);
void gl_drawCircleInRect(const double x, const double y, const double r,
const double rc, const double ry, const double rw, const double rh);
// Initialize/cleanup.
int gl_init(void);
void gl_exit(void);

View File

@ -44,7 +44,7 @@ extern Pilot** pilot_stack;
extern int pilots;
// Space stuff for GUI.
extern StarSystem* systems;
extern StarSystem* systems_nstack;
// GUI crap.
typedef struct Radar_ {
@ -392,7 +392,7 @@ void player_render(void) {
c, "Hyperspace");
gl_printMid(&gl_smallFont, (int)gui.nav.w, gui.nav.x, gui.nav.y - 10 - gl_smallFont.h,
NULL, "%s", systems[cur_system->jumps[hyperspace_target]].name);
NULL, "%s", systems_nstack[cur_system->jumps[hyperspace_target]].name);
}
else {
// No NAV target.
@ -971,7 +971,7 @@ void player_jump(void) {
// Player actually broke hyperspace (Let's enter a new system).
void player_brokeHyperspace(void) {
// Enter the new system.
space_init(systems[cur_system->jumps[hyperspace_target]].name);
space_init(systems_nstack[cur_system->jumps[hyperspace_target]].name);
// Set position, pilot_update will handle the lowering of velocity.
player_warp(-cos(player->solid->dir) * MIN_HYPERSPACE_DIST * 1.5,

View File

@ -37,8 +37,8 @@
#define FLAG_INTEFERENCESET (1<<3)
// Star system stack and co.
StarSystem* systems = NULL; // Star system stack.
static int nsystems = 0; // Number of star systems.
StarSystem* systems_stack = NULL; // Star system stack.
int systems_nstack = 0; // Number of star systems.
static int nplanets = 0; // Total number of loaded planets - A little silly.
StarSystem* cur_system = NULL; // Current star system.
@ -81,7 +81,6 @@ void planets_minimap(const double res, const double w, const double h, const Rad
if(shape == RADAR_CIRCLE) rc = (int)(w*w);
glBegin(GL_POINTS);
glMatrixMode(GL_PROJECTION);
for(i = 0; i < cur_system->nplanets; i++) {
r = (int)(cur_system->planets[i].gfx_space->sw / res);
cx = (int)((cur_system->planets[i].pos.x - player->solid->pos.x) / res);
@ -125,7 +124,6 @@ void planets_minimap(const double res, const double w, const double h, const Rad
}
}
}
if(ABS(x) < w/2. && ABS(y) < h/2.) {}
glEnd();
}
#undef PIXEL
@ -252,11 +250,11 @@ void space_init(const char* sysname) {
if((sysname == NULL) && (cur_system == NULL))
ERR("Cannot reinit system if there is no system previously loaded");
else if(sysname != NULL) {
for(i = 0; i < nsystems; i++)
if(strcmp(sysname, systems[i].name)==0)
for(i = 0; i < systems_nstack; i++)
if(strcmp(sysname, systems_stack[i].name)==0)
break;
if(i == nsystems) ERR("System %s not found in stack", sysname);
cur_system = systems+i;
if(i == systems_nstack) ERR("System %s not found in stack", sysname);
cur_system = systems_stack+i;
player_message("Entering System %s on %s", sysname, stardate);
@ -491,12 +489,12 @@ static void system_parseJumps(const xmlNodePtr parent) {
xmlNodePtr cur, node;
name = xml_nodeProp(parent, "name"); // Already mallocs.
for(i = 0; i < nsystems; i++)
if(strcmp(systems[i].name, name)==0) {
system = &systems[i];
for(i = 0; i < systems_nstack; i++)
if(strcmp(systems_stack[i].name, name)==0) {
system = &systems_stack[i];
break;
}
if(i == nsystems) WARN("System '%s' was not found in the stack for some reason", name);
if(i == systems_nstack) WARN("System '%s' was not found in the stack for some reason", name);
free(name); // No need for it now.
node = parent->xmlChildrenNode;
@ -507,14 +505,14 @@ static void system_parseJumps(const xmlNodePtr parent) {
cur = node->children;
do {
if(xml_isNode(cur, "jump")) {
for(i = 0; i < nsystems; i++)
if(strcmp(systems[i].name, xml_get(cur))==0) {
for(i = 0; i < systems_nstack; i++)
if(strcmp(systems_stack[i].name, xml_get(cur))==0) {
system->njumps++;
system->jumps = realloc(system->jumps, system->njumps*sizeof(int));
system->jumps[system->njumps-1] = i;
break;
}
if(i == nsystems)
if(i == systems_nstack)
WARN("System '%s' not found for jump linking", xml_get(cur));
}
} while((cur = cur->next));
@ -522,8 +520,8 @@ static void system_parseJumps(const xmlNodePtr parent) {
} while((node = node->next));
}
// Load the ENTIRE universe into RAM. -- WOAH! -- Wasn't that bad. :P
// -- Used a two system pass to first load the star systems and then set jump routes.
// Load the ENTIRE universe into RAM. -- WOAH!
// -- Used a two system pass to first load the star systems_stack and then set jump routes.
int space_load(void) {
uint32_t bufsize;
char* buf = pack_readfile(DATA, SYSTEM_DATA, &bufsize);
@ -543,12 +541,12 @@ int space_load(void) {
ERR("Malformed "SYSTEM_DATA" file: does not contain elements");
return -1;
}
// Fist pass - Load all the star systems.
// Fist pass - Load all the star systems_stack.
do {
if(xml_isNode(node, XML_SYSTEM_TAG)) {
tmp = system_parse(node);
systems = realloc(systems, sizeof(StarSystem)*(++nsystems));
memcpy(systems+nsystems-1, tmp, sizeof(StarSystem));
systems_stack = realloc(systems_stack, sizeof(StarSystem)*(++systems_nstack));
memcpy(systems_stack+systems_nstack-1, tmp, sizeof(StarSystem));
free(tmp);
}
} while((node = node->next));
@ -566,7 +564,7 @@ int space_load(void) {
xmlCleanupParser();
DEBUG("Loaded %d star system%s with %d planet%s",
nsystems, (nsystems==1) ? "" : "s",
systems_nstack, (systems_nstack==1) ? "" : "s",
nplanets, (nplanets==1) ? "" : "s");
return 0;
@ -639,29 +637,29 @@ void planets_render(void) {
// Clean up the system.
void space_exit(void) {
int i,j;
for(i = 0; i < nsystems; i++) {
free(systems[i].name);
if(systems[i].fleets)
free(systems[i].fleets);
if(systems[i].jumps)
free(systems[i].jumps);
for(i = 0; i < systems_nstack; i++) {
free(systems_stack[i].name);
if(systems_stack[i].fleets)
free(systems_stack[i].fleets);
if(systems_stack[i].jumps)
free(systems_stack[i].jumps);
for(j = 0; j < systems[i].nplanets; j++) {
free(systems[i].planets[j].name);
if(systems[i].planets[j].description)
free(systems[i].planets[j].description);
if(systems[i].planets[j].bar_description)
free(systems[i].planets[j].bar_description);
for(j = 0; j < systems_stack[i].nplanets; j++) {
free(systems_stack[i].planets[j].name);
if(systems_stack[i].planets[j].description)
free(systems_stack[i].planets[j].description);
if(systems_stack[i].planets[j].bar_description)
free(systems_stack[i].planets[j].bar_description);
// Graphics.
if(systems[i].planets[j].gfx_space)
gl_freeTexture(systems[i].planets[j].gfx_space);
if(systems[i].planets[j].gfx_exterior)
gl_freeTexture(systems[i].planets[j].gfx_exterior);
if(systems_stack[i].planets[j].gfx_space)
gl_freeTexture(systems_stack[i].planets[j].gfx_space);
if(systems_stack[i].planets[j].gfx_exterior)
gl_freeTexture(systems_stack[i].planets[j].gfx_exterior);
}
free(systems[i].planets);
free(systems_stack[i].planets);
}
free(systems);
free(systems_stack);
if(stars) free(stars);
}

View File

@ -64,6 +64,7 @@ typedef struct Widget_ {
} rct;
// Widget cust.
struct {
int border;
void(*render) (double bx, double by, double bw, double bh);
} cst;
} dat;
@ -83,7 +84,7 @@ typedef struct Window_ {
int nwidgets; // Total number of widgets.
} Window;
static unsigned int genwid = 0; // Generate unique id.
static unsigned int genwid = 0; // Generate unique id > 0.
int toolkit = 0;
@ -92,6 +93,11 @@ static Window* windows = NULL;
static int nwindows = 0;
static int mwindows = 0;
// Default outline colours.
static glColour* toolkit_colLight = &cGrey90;
static glColour* toolkit_col = &cGrey70;
static glColour* toolkit_colDark = &cGrey30;
static Widget* window_newWidget(Window* w);
static void widget_cleanup(Widget* widget);
static Window* window_wget(const unsigned int wid);
@ -113,6 +119,7 @@ static void toolkit_renderText(Widget* txt, double bx, double by);
static void toolkit_renderImage(Widget* img, double bx, double by);
static void toolkit_renderList(Widget* lst, double bx, double by);
static void toolkit_renderRect(Widget* rct, double bx, double by);
static void toolkit_renderCust(Widget* cst, double bx, double by);
static void toolkit_drawOutline(double x, double y, double w,
double h, double b, glColour* c, glColour* lc);
static void toolkit_drawRect(double x, double y, double w, double h,
@ -240,7 +247,7 @@ void window_addRect(const unsigned int wid, const int x, const int y, const int
}
void window_addCust(const unsigned int wid, const int x, const int y,
const int w, const int h, char* name,
const int w, const int h, char* name, const int border,
void(*render) (double x, double y, double w, double h)) {
Window* wdw = window_wget(wid);
@ -251,6 +258,7 @@ void window_addCust(const unsigned int wid, const int x, const int y,
wgt->name = strdup(name);
// Specific.
wgt->dat.cst.border = border;
wgt->dat.cst.render = render;
// Position/size.
@ -659,9 +667,7 @@ static void window_render(Window* w) {
toolkit_renderRect(&w->widgets[i], x, y);
break;
case WIDGET_CUST:
(*w->widgets[i].dat.cst.render)
(x+w->widgets[i].x, y+w->widgets[i].y,
w->widgets[i].w, w->widgets[i].h);
toolkit_renderCust(&w->widgets[i], x, y);
break;
}
}
@ -740,7 +746,6 @@ static void toolkit_renderText(Widget* txt, double bx, double by) {
// Render the image.
static void toolkit_renderImage(Widget* img, double bx, double by) {
glColour* lc, *c, *oc;
double x, y;
if(img->dat.img.image == NULL) return;
@ -748,10 +753,6 @@ static void toolkit_renderImage(Widget* img, double bx, double by) {
x = bx + img->x;
y = by + img->y;
lc = &cGrey90;
c = &cGrey70;
oc = &cGrey30;
// Image.
gl_blitStatic(img->dat.img.image,
x + (double)gl_screen.w/2.,
@ -759,32 +760,27 @@ static void toolkit_renderImage(Widget* img, double bx, double by) {
// Inner outline (outwards).
toolkit_drawOutline(x, y+1, img->dat.img.image->sw-1,
img->dat.img.image->sh-1, 1., lc, c);
img->dat.img.image->sh-1, 1., toolkit_colLight, toolkit_col);
// Outter outline.
toolkit_drawOutline(x, y+1, img->dat.img.image->sw-1,
img->dat.img.image->sh-1, 2., oc, NULL);
img->dat.img.image->sh-1, 2., toolkit_colDark, NULL);
}
// Render the list.
static void toolkit_renderList(Widget* lst, double bx, double by) {
int i;
double x, y, tx, ty;
glColour* lc, *c, *oc;
x = bx + lst->x;
y = by + lst->y;
lc = &cGrey90;
c = &cGrey70;
oc = &cGrey30;
// List bg.
toolkit_drawRect(x, y, lst->w, lst->h, &cWhite, NULL);
// Inner outline.
toolkit_drawOutline(x, y, lst->w, lst->h, 0., lc, c);
toolkit_drawOutline(x, y, lst->w, lst->h, 0., toolkit_colLight, toolkit_col);
// Outter outline.
toolkit_drawOutline(x, y, lst->w, lst->h, 1., oc, NULL);
toolkit_drawOutline(x, y, lst->w, lst->h, 1., toolkit_colDark, NULL);
// Draw selected.
toolkit_drawRect(x, y-1.+lst->h-(1+lst->dat.lst.selected-lst->dat.lst.pos)*(gl_defFont.h+2.),
@ -807,27 +803,40 @@ static void toolkit_renderList(Widget* lst, double bx, double by) {
// Render a rectangle.
static void toolkit_renderRect(Widget* rct, double bx, double by) {
double x, y;
glColour* lc, *c, *oc;
x = bx + rct->x;
y = by + rct->y;
lc = &cGrey90;
c = &cGrey70;
oc = &cGrey30;
if(rct->dat.rct.colour)
// Draw rect only if it exists.
toolkit_drawRect(x, y, rct->w, rct->h, rct->dat.rct.colour, NULL);
if(rct->dat.rct.border) {
// Inner outline.
toolkit_drawOutline(x, y, rct->w, rct->h, 0., lc, c);
toolkit_drawOutline(x, y, rct->w, rct->h, 0., toolkit_colLight, toolkit_col);
// Outter outline.
toolkit_drawOutline(x, y, rct->w, rct->h, 1., oc, NULL);
toolkit_drawOutline(x, y, rct->w, rct->h, 1., toolkit_colDark, NULL);
}
}
// Render a customg widget.
static void toolkit_renderCust(Widget* cst, double bx, double by) {
double x, y;
x = bx + cst->x;
y = by + cst->y;
if(cst->dat.cst.border) {
// Inner outline.
toolkit_drawOutline(x, y, cst->w, cst->h, 0.,
toolkit_colLight, toolkit_col);
// Outter outline.
toolkit_drawOutline(x, y, cst->w, cst->h, 2.,
toolkit_colDark, NULL);
}
(*cst->dat.cst.render) (x, y, cst->w, cst->h);
}
// Render the window.
void toolkit_render(void) {
int i;

View File

@ -33,7 +33,7 @@ void window_addRect(const unsigned int wid,
void window_addCust(const unsigned int wid,
const int x, const int y, // Position.
const int w, const int h, // Size.
char* name,
char* name, const int border,
void(*render) (double x, double y, double w, double h));
// Popups and alerts.