Lephisto/src/land.c
2013-02-19 00:41:47 +00:00

39 lines
847 B
C

#include "toolkit.h"
#include "pause.h"
#include "land.h"
#define LAND_WIDTH 700
#define LAND_HEIGHT 600
#define BUTTON_WIDTH 80
#define BUTTON_HEIGHT 40
int landed = 0;
static int land_wid = 0;
static Planet* planet = NULL;
// Land the player.
void land(Planet* p) {
if(landed) return;
planet = p;
land_wid = window_create(-1, -1, LAND_WIDTH, LAND_HEIGHT);
// Pretty display.
window_addText(land_wid, 0., -20., LAND_WIDTH, 1, "txtPlanet", NULL, &cBlack, p->name);
window_addImage(land_wid, 20., -440, "imgPlanet", p->gfx_exterior);
// Buttons.
window_addButton(land_wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT,
"btnTakeoff", "Takeoff", (void(*)(char*))takeoff);
landed = 1;
}
// Takeoff from the planet.
void takeoff(void) {
if(!landed) return;
planet = NULL;
window_destroy(land_wid);
landed = 0;
}