[Change] Ripped out all the GUI code and gave it, its own file.
This commit is contained in:
parent
e37d373214
commit
0573336e27
27
src/gui.h
Normal file
27
src/gui.h
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
/* Enums. */
|
||||||
|
typedef enum RadarShape_ {
|
||||||
|
RADAR_RECT, /**< Rectangular radar. */
|
||||||
|
RADAR_CIRCLE /**< Circular radar. */
|
||||||
|
} RadarShape; /**< Plaers radar shape. */
|
||||||
|
|
||||||
|
extern double gui_xoff; /**< GUI X center offset. */
|
||||||
|
extern double gui_yoff; /**< GUI Y center offset. */
|
||||||
|
|
||||||
|
/* Loading/cleaning up. */
|
||||||
|
int gui_init(void);
|
||||||
|
void gui_free(void);
|
||||||
|
int gui_load(const char* name);
|
||||||
|
void gui_cleanup(void);
|
||||||
|
|
||||||
|
/* Render. */
|
||||||
|
void gui_renderBG(double dt);
|
||||||
|
void gui_renderTarget(double dt);
|
||||||
|
void gui_render(double dt);
|
||||||
|
|
||||||
|
/* Misc. */
|
||||||
|
void gui_setDefaults(void);
|
||||||
|
void player_message(const char* fmt, ...);
|
||||||
|
void gui_setRadarRel(int mod);
|
||||||
|
|
@ -15,6 +15,7 @@
|
|||||||
#include "escort.h"
|
#include "escort.h"
|
||||||
#include "land.h"
|
#include "land.h"
|
||||||
#include "lstd.h"
|
#include "lstd.h"
|
||||||
|
#include "gui.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
|
||||||
#define KEY_PRESS ( 1.) /**< Key is pressed. */
|
#define KEY_PRESS ( 1.) /**< Key is pressed. */
|
||||||
@ -552,11 +553,11 @@ static void input_key(int keynum, double value, double kabs) {
|
|||||||
}
|
}
|
||||||
/* Zoom in. */
|
/* Zoom in. */
|
||||||
else if(KEY("mapzoomin") && INGAME()) {
|
else if(KEY("mapzoomin") && INGAME()) {
|
||||||
if(value == KEY_PRESS) player_setRadarRel(1);
|
if(value == KEY_PRESS) gui_setRadarRel(1);
|
||||||
}
|
}
|
||||||
/* Zoom out. */
|
/* Zoom out. */
|
||||||
else if(KEY("mapzoomout") && INGAME()) {
|
else if(KEY("mapzoomout") && INGAME()) {
|
||||||
if(value == KEY_PRESS) player_setRadarRel(-1);
|
if(value == KEY_PRESS) gui_setRadarRel(-1);
|
||||||
}
|
}
|
||||||
/* Take a screenshot. */
|
/* Take a screenshot. */
|
||||||
else if(KEY("screenshot") && INGAME()) {
|
else if(KEY("screenshot") && INGAME()) {
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
#include "llua_misn.h"
|
#include "llua_misn.h"
|
||||||
#include "lfile.h"
|
#include "lfile.h"
|
||||||
#include "unidiff.h"
|
#include "unidiff.h"
|
||||||
|
#include "gui.h"
|
||||||
#include "nebulae.h"
|
#include "nebulae.h"
|
||||||
|
|
||||||
|
|
||||||
@ -512,22 +513,23 @@ static void render_all(void) {
|
|||||||
double dt;
|
double dt;
|
||||||
|
|
||||||
dt = (paused) ? 0. : cur_dt;
|
dt = (paused) ? 0. : cur_dt;
|
||||||
|
|
||||||
/* Setup. */
|
/* Setup. */
|
||||||
spfx_start(dt);
|
spfx_start(dt);
|
||||||
/* BG. */
|
/* BG. */
|
||||||
space_render(dt);
|
space_render(dt);
|
||||||
planets_render();
|
planets_render();
|
||||||
player_renderBG();
|
gui_renderBG(dt);
|
||||||
weapons_render(WEAPON_LAYER_BG, dt);
|
weapons_render(WEAPON_LAYER_BG, dt);
|
||||||
/* N. */
|
/* N. */
|
||||||
pilots_render();
|
pilots_render();
|
||||||
weapons_render(WEAPON_LAYER_FG, dt);
|
weapons_render(WEAPON_LAYER_FG, dt);
|
||||||
spfx_render(SPFX_LAYER_BACK);
|
spfx_render(SPFX_LAYER_BACK);
|
||||||
/* FG. */
|
/* FG. */
|
||||||
player_render();
|
player_render(dt);
|
||||||
spfx_render(SPFX_LAYER_FRONT);
|
spfx_render(SPFX_LAYER_FRONT);
|
||||||
space_renderOverlay(dt);
|
space_renderOverlay(dt);
|
||||||
player_renderGUI(dt);
|
gui_render(dt);
|
||||||
display_fps(dt); /* Exception. */
|
display_fps(dt); /* Exception. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include "opengl.h"
|
#include "opengl.h"
|
||||||
#include "mission.h"
|
#include "mission.h"
|
||||||
#include "colour.h"
|
#include "colour.h"
|
||||||
|
#include "player.h"
|
||||||
#include "map.h"
|
#include "map.h"
|
||||||
|
|
||||||
#define MAP_WDWNAME "Star Map" /**< Map window name. */
|
#define MAP_WDWNAME "Star Map" /**< Map window name. */
|
||||||
@ -37,9 +38,6 @@ static int map_drag = 0; /**< Is the user dragging the map? */
|
|||||||
/* space.c */
|
/* space.c */
|
||||||
extern StarSystem* systems_stack;
|
extern StarSystem* systems_stack;
|
||||||
extern int systems_nstack;
|
extern int systems_nstack;
|
||||||
/* player.c */
|
|
||||||
extern int planet_target;
|
|
||||||
extern int hyperspace_target;
|
|
||||||
|
|
||||||
static void map_update(unsigned int wid);
|
static void map_update(unsigned int wid);
|
||||||
static int map_inPath(StarSystem* sys);
|
static int map_inPath(StarSystem* sys);
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
#include "pause.h"
|
#include "pause.h"
|
||||||
|
#include "gui.h"
|
||||||
#include "perlin.h"
|
#include "perlin.h"
|
||||||
|
|
||||||
#define NEBULAE_Z 16 /**< Z plane. */
|
#define NEBULAE_Z 16 /**< Z plane. */
|
||||||
@ -26,7 +27,6 @@
|
|||||||
#define NEBULAE_PUFF_BUFFER 300 /**< Nebulae buffer. */
|
#define NEBULAE_PUFF_BUFFER 300 /**< Nebulae buffer. */
|
||||||
|
|
||||||
/* Extern. */
|
/* Extern. */
|
||||||
extern double gui_xoff, gui_yoff; /**< From player.c */
|
|
||||||
extern Vec2 shake_pos; /**< From spfx.c. */
|
extern Vec2 shake_pos; /**< From spfx.c. */
|
||||||
extern void loadscreen_render(double done, const char* msg); /**< From lephisto.c. */
|
extern void loadscreen_render(double done, const char* msg); /**< From lephisto.c. */
|
||||||
|
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include "lephisto.h"
|
#include "lephisto.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "ldata.h"
|
#include "ldata.h"
|
||||||
|
#include "gui.h"
|
||||||
#include "opengl.h"
|
#include "opengl.h"
|
||||||
|
|
||||||
/* Requirements. */
|
/* Requirements. */
|
||||||
@ -48,13 +49,6 @@
|
|||||||
glInfo gl_screen; /**< Give data of current opengl settings. */
|
glInfo gl_screen; /**< Give data of current opengl settings. */
|
||||||
Vec2* gl_camera; /**< Camera we are using. */
|
Vec2* gl_camera; /**< Camera we are using. */
|
||||||
|
|
||||||
/*
|
|
||||||
* Used to adjust the pilots place onscreen to be in the middle
|
|
||||||
* even with the GUI.
|
|
||||||
*/
|
|
||||||
extern double gui_xoff; /**< GUI X offset. */
|
|
||||||
extern double gui_yoff; /**< GUI Y offset. */
|
|
||||||
|
|
||||||
/* Graphic list. */
|
/* Graphic list. */
|
||||||
/**
|
/**
|
||||||
* @brief Represents a node in the texture list.
|
* @brief Represents a node in the texture list.
|
||||||
|
1165
src/player.c
1165
src/player.c
File diff suppressed because it is too large
Load Diff
17
src/player.h
17
src/player.h
@ -28,10 +28,14 @@ extern unsigned int player_flags; /**< Player's flags. */
|
|||||||
extern double player_crating; /**< Player's combat rating. */
|
extern double player_crating; /**< Player's combat rating. */
|
||||||
extern int player_enemies; /**< Amount of enemies player has. */
|
extern int player_enemies; /**< Amount of enemies player has. */
|
||||||
|
|
||||||
/* Enums. */
|
/* Targetting. */
|
||||||
|
extern int planet_target; /**< Targetted planet. -1 is none. */
|
||||||
|
extern int hyperspace_target; /**< Targetted hyperspace route. -1 is none. */
|
||||||
|
|
||||||
/* For render functions. */
|
/* Common player sounds. */
|
||||||
typedef enum RadarShape_ { RADAR_RECT, RADAR_CIRCLE } RadarShape; /**< Player's radar shape. */
|
extern int snd_target; /**< Sound when targetting. */
|
||||||
|
extern int snd_jump; /**< Sound when can jump. */
|
||||||
|
extern int snd_nav; /**< Sound when changing nav computer. */
|
||||||
|
|
||||||
/* Creation/Cleanup. */
|
/* Creation/Cleanup. */
|
||||||
void player_new(void);
|
void player_new(void);
|
||||||
@ -41,11 +45,7 @@ void player_cleanup(void);
|
|||||||
int gui_load(const char* name);
|
int gui_load(const char* name);
|
||||||
|
|
||||||
/* Render. */
|
/* Render. */
|
||||||
int gui_init(void);
|
void player_render(double dt);
|
||||||
void gui_free(void);
|
|
||||||
void player_render(void);
|
|
||||||
void player_renderBG(void); /* Render BG layer. */
|
|
||||||
void player_renderGUI(double dt); /* Render the GUI stuff. */
|
|
||||||
|
|
||||||
/* Misc. */
|
/* Misc. */
|
||||||
void player_message(const char* fmt, ...);
|
void player_message(const char* fmt, ...);
|
||||||
@ -85,7 +85,6 @@ void player_targetHostile(void);
|
|||||||
void player_targetNext(void);
|
void player_targetNext(void);
|
||||||
void player_targetPrev(void);
|
void player_targetPrev(void);
|
||||||
void player_targetNearest(void);
|
void player_targetNearest(void);
|
||||||
void player_setRadarRel(int mod);
|
|
||||||
void player_secondaryNext(void);
|
void player_secondaryNext(void);
|
||||||
void player_secondaryPrev(void);
|
void player_secondaryPrev(void);
|
||||||
void player_targetPlanet(void);
|
void player_targetPlanet(void);
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include "ltime.h"
|
#include "ltime.h"
|
||||||
#include "nebulae.h"
|
#include "nebulae.h"
|
||||||
#include "music.h"
|
#include "music.h"
|
||||||
|
#include "gui.h"
|
||||||
#include "space.h"
|
#include "space.h"
|
||||||
|
|
||||||
#define XML_PLANET_ID "Planets"
|
#define XML_PLANET_ID "Planets"
|
||||||
@ -80,12 +81,10 @@ static int nstars = 0; /* Total stars. */
|
|||||||
static int mstars = 0; /* Memory stars are taking. */
|
static int mstars = 0; /* Memory stars are taking. */
|
||||||
|
|
||||||
/* Interference. */
|
/* Interference. */
|
||||||
extern double interference_alpha; /* player.c */
|
extern double interference_alpha; /* gui.c */
|
||||||
static double interference_target; /**< Target alpha level .*/
|
static double interference_target; /**< Target alpha level .*/
|
||||||
static double interference_timer = 0.; /**< Interference timer. */
|
static double interference_timer = 0.; /**< Interference timer. */
|
||||||
|
|
||||||
extern int planet_target; /* player.c */
|
|
||||||
|
|
||||||
/* Intern. */
|
/* Intern. */
|
||||||
/* Planet load. */
|
/* Planet load. */
|
||||||
static int planet_parse(Planet* planet, const xmlNodePtr parent);
|
static int planet_parse(Planet* planet, const xmlNodePtr parent);
|
||||||
@ -98,8 +97,6 @@ static void system_setFaction(StarSystem* sys);
|
|||||||
static void space_renderStars(const double dt);
|
static void space_renderStars(const double dt);
|
||||||
static void space_addFleet(Fleet* fleet, int init);
|
static void space_addFleet(Fleet* fleet, int init);
|
||||||
static PlanetClass planetclass_get(const char a);
|
static PlanetClass planetclass_get(const char a);
|
||||||
/* Extern. */
|
|
||||||
extern void player_message(const char* fmt, ...);
|
|
||||||
|
|
||||||
void planets_minimap(const double res, const double w,
|
void planets_minimap(const double res, const double w,
|
||||||
const double h, const RadarShape shape, double alpha);
|
const double h, const RadarShape shape, double alpha);
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "spfx.h"
|
#include "spfx.h"
|
||||||
#include "opengl.h"
|
#include "opengl.h"
|
||||||
#include "explosion.h"
|
#include "explosion.h"
|
||||||
|
#include "gui.h"
|
||||||
#include "weapon.h"
|
#include "weapon.h"
|
||||||
|
|
||||||
#define weapon_isSmart(w) (w->think != NULL) /**< Checks if the weapon w is smart. */
|
#define weapon_isSmart(w) (w->think != NULL) /**< Checks if the weapon w is smart. */
|
||||||
|
Loading…
Reference in New Issue
Block a user