35#include "map_overlay.h"
67#define XML_GUI_ID "GUIs"
68#define XML_GUI_TAG "gui"
70#define RADAR_BLINK_PILOT 0.5
71#define RADAR_BLINK_SPOB 1.
79static gl_vbo *gui_radar_select_vbo = NULL;
107typedef struct Radar_ {
116#define RADAR_RES_MAX 300.
117#define RADAR_RES_REF 100.
118#define RADAR_RES_MIN 10.
119#define RADAR_RES_INTERVAL 10.
120static Radar gui_radar;
136typedef struct Mesg_ {
158static int gui_lua_create = LUA_NOREF;
159static int gui_lua_render = LUA_NOREF;
160static int gui_lua_render_cooldown = LUA_NOREF;
161static int gui_lua_cooldown_end = LUA_NOREF;
162static int gui_lua_mouse_move = LUA_NOREF;
163static int gui_lua_mouse_click = LUA_NOREF;
164static int gui_lua_update_cargo = LUA_NOREF;
165static int gui_lua_update_nav = LUA_NOREF;
166static int gui_lua_update_target = LUA_NOREF;
167static int gui_lua_update_ship = LUA_NOREF;
168static int gui_lua_update_system = LUA_NOREF;
169static int gui_lua_update_faction = LUA_NOREF;
170static int gui_lua_update_effects = LUA_NOREF;
178extern void weapon_minimap(
const double res,
const double w,
const double h,
179 const RadarShape shape,
double alpha );
184static void gui_renderTargetReticles(
const SimpleShader *shd,
double x,
double y,
double radius,
double angle,
const glColour*
c );
193static void gui_blink(
double cx,
double cy,
double vr,
const glColour *col,
double blinkInterval,
double blinkVar );
197static int gui_doFunc(
int func_ref,
const char *func_name );
198static int gui_prepFunc(
int func_ref,
const char *func_name );
199static int gui_runFunc(
const char *func,
int nargs,
int nret );
315 if (iter.l_begin == 0) {
347 SDL_vasprintf( &buf, fmt, ap );
362 if (player_isFlag(PLAYER_DESTROYED) || player_isFlag(PLAYER_CREATING) ||
382 if (jp_isKnown(jp)) {
405 r = ast->
gfx->
sw * 0.5;
430 glUseProgram(shd->program);
432 glUniform1f(shd->paramf, radius);
454 if ((p==NULL) || pilot_isFlag(p,PILOT_DEAD)) {
468 if (pilot_isDisabled(p))
477 gui_renderTargetReticles( &shaders.targetship, p->solid.pos.x, p->solid.pos.y, p->ship->gfx_space->sw * 0.5, p->solid.dir,
c );
549 gl_renderRect( SCREEN_W - 15., 0., 15., SCREEN_H, &cBlackHilight );
550 gl_renderRect( 15., 0., SCREEN_W - 30., 15., &cBlackHilight );
551 gl_renderRect( 15., SCREEN_H - 15., SCREEN_W - 30., 15., &cBlackHilight );
558 if (!spob_isKnown( pnt ))
577 if (!jp_isUsable( jp ))
643 cw = SCREEN_W/2 + tex->
sw/2;
644 ch = SCREEN_H/2 + tex->
sh/2;
646 if ((
ABS(*rx) > cw) || (
ABS(*ry) > ch))
692 if ((
ABS(*rx) > cw) || (
ABS(*ry) > ch))
712 if (player_isFlag(PLAYER_CINEMATICS))
727 double fade, direction;
731 (player_isFlag(PLAYER_DESTROYED) || player_isFlag(PLAYER_CREATING) ||
744 if (player_isFlag( PLAYER_CINEMATICS_GUI ))
767 lua_pushnumber( naevL, dt );
768 lua_pushnumber( naevL,
dt_mod );
771 if (pilot_isFlag(
player.
p, PILOT_COOLDOWN)) {
772 if (
gui_prepFunc( gui_lua_render_cooldown,
"render_cooldown" )==0) {
791 if (!pilot_isFlag(
player.
p, PILOT_HYPERSPACE))
797 fade = direction = 0.;
798 if (pilot_isFlag(
player.
p, PILOT_HYPERSPACE) &&
800 fade = (HYPERSPACE_FADEOUT-
player.
p->
ptimer) / HYPERSPACE_FADEOUT;
803 else if (pilot_isFlag(
player.
p, PILOT_HYP_END) &&
810 mat4 projection = gl_view_matrix;
813 glUseProgram( shaders.jump.program );
814 glEnableVertexAttribArray( shaders.jump.vertex );
821 gl_uniformMat4( shaders.jump.projection, &projection );
822 glUniform1f( shaders.jump.progress, fade );
823 glUniform1f( shaders.jump.direction, direction );
828 if (gl_has( OPENGL_SUBROUTINES )) {
830 glUniformSubroutinesuiv( GL_FRAGMENT_SHADER, 1, &shaders.jump.jump_func.jump_nebula );
832 glUniformSubroutinesuiv( GL_FRAGMENT_SHADER, 1, &shaders.jump.jump_func.jump_wind );
836 glDrawArrays( GL_TRIANGLE_STRIP, 0, 4 );
839 glDisableVertexAttribArray( shaders.jump.vertex );
858 gui_doFunc( gui_lua_cooldown_end,
"cooldown_end" );
870 gui_radar.
shape = circle ? RADAR_CIRCLE : RADAR_RECT;
887 mat4 view_matrix_prev;
900 view_matrix_prev = gl_view_matrix;
901 if (radar->
shape==RADAR_RECT) {
904 x + radar->
w/2., y + radar->
h/2., 0 );
906 else if (radar->
shape==RADAR_CIRCLE)
957 asteroid_collideQueryIL( ast, &
gui_qtquery, ax-r, ay-r, ax+r, ay+r );
968 gl_view_matrix = view_matrix_prev;
969 if (radar->
shape==RADAR_RECT)
980 *res = gui_radar.
res;
1000 double x, y, h, hs, vx, vy, dy;
1002 glColour
c = {.r=1., .g=1., .b=1.};
1003 const glColour msgc = {.r=0., .g=0., .b=0., .a=0.6};
1087 const glColour *col;
1090 col = &cRadar_tPilot;
1109 double x, y, scale, ssize;
1110 const glColour *col;
1119 x = (p->solid.pos.x / res);
1120 y = (p->solid.pos.y / res);
1127 ssize = sqrt( (
double)
ship_size( p->ship ) );
1131 if ( ((shape==RADAR_RECT) &&
1132 ((
ABS(x) > (w+scale)/2.) || (
ABS(y) > (h+scale)/2.)) ) ||
1133 ((shape==RADAR_CIRCLE) &&
1145 ovr_center( &ox, &oy );
1151 col = &cRadar_hilight;
1155 scale =
MAX(scale+2.0, 3.5+ssize);
1156 scanning = (pilot_isFlag(p,PILOT_SCANNING) && (p->target==PLAYER_ID));
1158 if (pilot_isFlag(p, PILOT_HILIGHT) || scanning) {
1159 glColour highlighted = cRadar_hilight;
1160 highlighted.a = 0.3;
1161 glUseProgram( shaders.hilight.program );
1163 gl_renderShader( x, y, scale*2.0, scale*2.0, 0., &shaders.hilight, &highlighted, 1 );
1166 glUseProgram(shaders.pilotmarker.program);
1167 gl_renderShader( x, y, scale, scale, p->solid.dir, &shaders.pilotmarker, col, 1 );
1174 if (overlay && pilot_isFlag(p, PILOT_HILIGHT)) {
1178 glUseProgram( shaders.pilotscanning.program );
1185 glUseProgram( shaders.pilotscanning.program );
1203 double x, y, r, sx, sy;
1205 const glColour *col;
1208 if (a->state != ASTEROID_FG)
1221 x = (a->sol.pos.x / res);
1222 y = (a->sol.pos.y / res);
1236 ovr_center( &ox, &oy );
1256 r = (sx+sy)/2.0+1.5;
1257 glUseProgram(shaders.asteroidmarker.program);
1277 ovr_center( &ox, &oy );
1286 glUseProgram(shaders.playermarker.program);
1298 const glColour *col;
1302 col = &cRadar_tSpob;
1321static void gui_blink(
double cx,
double cy,
double vr,
const glColour *col,
double blinkInterval,
double blinkVar )
1323 if (blinkVar > blinkInterval/2.)
1325 glUseProgram(shaders.blinkmarker.program);
1334 double a, x, y, x2, y2;
1338 if (sh == RADAR_CIRCLE) {
1348 x = w/2. * (cx*1./cy);
1350 }
else if (cx >= cya) {
1352 y = h/2. * (cy*1./cx);
1353 }
else if (cya >= cxa) {
1354 x = -w/2. * (cx*1./cy);
1358 y = -h/2. * (cy*1./cx);
1361 x2 = x - .15 * w * cos(a);
1362 y2 = y - .15 * w * sin(a);
1372void gui_renderSpob(
int ind, RadarShape shape,
double w,
double h,
double res,
double alpha,
int overlay )
1374 GLfloat cx, cy, x, y, r, vr;
1377 const SimpleShader *shd;
1378 char buf[STRMAX_SHORT];
1390 cx = spob->
pos.
x / res;
1391 cy = spob->
pos.
y / res;
1399 if (shape == RADAR_CIRCLE) {
1403 if (x*x + y*y >
pow2(w-2*r)) {
1410 if (shape == RADAR_RECT) {
1412 if ((
ABS(cx) - r > w/2.) || (
ABS(cy) - r > h/2.)) {
1422 ovr_center( &ox, &oy );
1434 if (spob_isKnown( spob ) && spob_isFlag( spob, SPOB_MARKED )) {
1435 glColour highlighted = cRadar_hilight;
1436 highlighted.a = 0.3;
1437 glUseProgram( shaders.hilight.program );
1439 gl_renderShader( cx, cy, vr*3.0, vr*3.0, 0., &shaders.hilight, &highlighted, 1 );
1450 if (spob->
marker != NULL)
1452 else if (spob_hasService(spob,SPOB_SERVICE_LAND))
1453 shd = &shaders.spobmarker_earth;
1455 shd = &shaders.spobmarker_empty;
1457 glUseProgram(shd->program);
1477void gui_renderJumpPoint(
int ind, RadarShape shape,
double w,
double h,
double res,
double alpha,
int overlay )
1479 GLfloat cx, cy, x, y, r, vr;
1481 char buf[STRMAX_SHORT];
1486 if (!jp_isUsable(jp))
1491 vr = overlay ? jp->mo.radius :
MAX( r, 5. );
1493 cx = jp->pos.x / res;
1494 cy = jp->pos.y / res;
1502 if (shape == RADAR_RECT) {
1504 if ((
ABS(cx) - r > w/2.) || (
ABS(cy) - r > h/2.)) {
1510 else if (shape == RADAR_CIRCLE) {
1514 if (x*x + y*y >
pow2(w-2*r)) {
1523 ovr_center( &ox, &oy );
1531 if (sys_isMarked(s)) {
1532 glColour highlighted = cRadar_hilight;
1533 highlighted.a = 0.3;
1534 glUseProgram( shaders.hilight.program );
1536 gl_renderShader( cx, cy, vr*3.0, vr*3.0, 0., &shaders.hilight, &highlighted, 1 );
1541 else if (jp_isFlag(jp, JP_HIDDEN))
1547 glUseProgram(shaders.jumpmarker.program);
1548 gl_renderShader( cx, cy, vr*1.5, vr*1.5, M_PI-jp->angle, &shaders.jumpmarker, &col, 1 );
1558 sys_isKnown(jp->target) ? _(jp->target->name) : _(
"Unknown") );
1604 gui_tl = atan2( +h, -w );
1607 gui_tr = atan2( +h, +w );
1610 gui_bl = atan2( -h, -w );
1613 gui_br = atan2( -h, +w );
1635 ERR(_(
"Out of Memory"));
1641 if (gui_radar_select_vbo == NULL) {
1663 osd_setup( 30., SCREEN_H-90., 150., 300. );
1708 WARN( _(
"GUI '%s': Trying to run GUI func '%s' but no GUI is loaded!"),
gui_name, func_name );
1714 if (player_isFlag(PLAYER_DESTROYED) || player_isFlag(PLAYER_CREATING) ||
1720 lua_rawgeti( naevL, LUA_REGISTRYINDEX, func_ref );
1722 if (lua_isnil( naevL, -1 )) {
1723 WARN(_(
"GUI '%s': no function '%s' defined!"),
gui_name, func_name );
1741 int ret = nlua_pcall(
gui_env, nargs, nret );
1743 const char *err = (lua_isstring(naevL,-1)) ? lua_tostring(naevL,-1) : NULL;
1744 WARN(_(
"GUI '%s' Lua -> '%s': %s"),
gui_name,
1745 func, (err) ? err : _(
"unknown error"));
1769 gui_doFunc( gui_lua_update_cargo,
"update_cargo" );
1777 gui_doFunc( gui_lua_update_nav,
"update_nav" );
1785 gui_doFunc( gui_lua_update_target,
"update_target" );
1793 gui_doFunc( gui_lua_update_ship,
"update_ship" );
1801 gui_doFunc( gui_lua_update_system,
"update_system" );
1810 gui_doFunc( gui_lua_update_faction,
"update_faction" );
1813void gui_updateEffects (
void)
1816 gui_doFunc( gui_lua_update_effects,
"update_effects" );
1829 if (player_isFlag(PLAYER_DESTROYED) || player_isFlag(PLAYER_CREATING) ||
1835 else if (pilot_isPlayer(pilot)) {
1866 snprintf( path,
sizeof(path), GUI_PATH
"%s.lua", name );
1867 return PHYSFS_exists( path );
1888 snprintf( path,
sizeof(path), GUI_PATH
"%s.lua", name );
1891 WARN(_(
"Unable to find GUI '%s'."), path );
1907 if (nlua_dobufenv(
gui_env, buf, bufsize, path ) != 0) {
1908 WARN(_(
"Failed to load GUI Lua: %s\n"
1910 "Most likely Lua file has improper syntax, please check"),
1911 path, lua_tostring(naevL,-1));
1920#define LUA_FUNC(funcname) gui_lua_##funcname = nlua_refenvtype( gui_env, #funcname, LUA_TFUNCTION );
1923 LUA_FUNC( render_cooldown );
1924 LUA_FUNC( cooldown_end );
1925 LUA_FUNC( mouse_move );
1926 LUA_FUNC( mouse_click );
1927 LUA_FUNC( update_cargo );
1928 LUA_FUNC( update_nav );
1929 LUA_FUNC( update_target );
1930 LUA_FUNC( update_ship );
1931 LUA_FUNC( update_system );
1932 LUA_FUNC( update_faction );
1933 LUA_FUNC( update_effects );
1937 if (
gui_doFunc( gui_lua_create,
"create" )) {
1964 ovr_boundsSet( 0, 0, 0, 0 );
1978 omsg_position( SCREEN_W/2., SCREEN_H*2./3., SCREEN_W*2./3. );
1988#define LUA_CLEANUP( varname ) if (varname!=LUA_NOREF) luaL_unref(naevL, LUA_REGISTRYINDEX, varname ); varname = LUA_NOREF
1989 LUA_CLEANUP( gui_lua_create );
1990 LUA_CLEANUP( gui_lua_render );
1991 LUA_CLEANUP( gui_lua_render_cooldown );
1992 LUA_CLEANUP( gui_lua_cooldown_end );
1993 LUA_CLEANUP( gui_lua_mouse_move );
1994 LUA_CLEANUP( gui_lua_mouse_click );
1995 LUA_CLEANUP( gui_lua_update_cargo );
1996 LUA_CLEANUP( gui_lua_update_nav );
1997 LUA_CLEANUP( gui_lua_update_target );
1998 LUA_CLEANUP( gui_lua_update_ship );
1999 LUA_CLEANUP( gui_lua_update_system );
2000 LUA_CLEANUP( gui_lua_update_faction );
2001 LUA_CLEANUP( gui_lua_update_effects );
2018 gui_radar_select_vbo = NULL;
2110 int mxr, myr, in_bounds;
2111 double x, y, cx, cy;
2114 if (gui_radar.
shape == RADAR_RECT) {
2115 cx = gui_radar.
x + gui_radar.
w / 2.;
2116 cy = gui_radar.
y + gui_radar.
h / 2.;
2117 in_bounds = (2*
ABS( mxr-cx ) <= gui_radar.
w && 2*
ABS( myr-cy ) <= gui_radar.
h);
2122 in_bounds = (
pow2( mxr-cx ) +
pow2( myr-cy ) <=
pow2( gui_radar.
w ));
2140 double ang, angp, mouseang;
2142 int pntid, jpid, astid, fieid;
2144 int autonav = (
event->button.button == SDL_BUTTON_RIGHT) ? 1 : 0;
2159 mouseang = atan2(py - y, px - x);
2163 if ((
ABS(angle_diff(mouseang, angp)) > M_PI / 64) ||
2164 ABS(angle_diff(mouseang, ang)) <
ABS(angle_diff(mouseang, angp)))
2166 if (
ABS(angle_diff(mouseang, ang)) > M_PI / 64 )
2167 jpid = pntid = astid = fieid = -1;
2169 if (pid != PLAYER_ID) {
2173 else if (pntid >= 0) {
2177 else if (jpid >= 0) {
2181 else if (astid >= 0) {
2199 if ((evt->type == SDL_MOUSEBUTTONDOWN) &&
2200 (pilot_isFlag(
player.
p,PILOT_HYP_PREP) ||
2201 pilot_isFlag(
player.
p,PILOT_HYP_BEGIN) ||
2202 pilot_isFlag(
player.
p,PILOT_HYPERSPACE)))
2206 switch (evt->type) {
2208 case SDL_MOUSEMOTION:
2211 if (
gui_prepFunc( gui_lua_mouse_move,
"mouse_move" )==0) {
2213 lua_pushnumber( naevL, x );
2214 lua_pushnumber( naevL, y );
2220 case SDL_MOUSEBUTTONDOWN:
2221 case SDL_MOUSEBUTTONUP:
2224 if (
gui_prepFunc( gui_lua_mouse_click,
"mouse_click" )==0) {
2225 lua_pushnumber( naevL, evt->button.button+1 );
2227 lua_pushnumber( naevL, x );
2228 lua_pushnumber( naevL, y );
2229 lua_pushboolean( naevL, (evt->type==SDL_MOUSEBUTTONDOWN) );
2231 ret = lua_toboolean( naevL, -1 );
2232 lua_pop( naevL, 1 );
static ALWAYS_INLINE int array_size(const void *array)
Returns number of elements in the array.
double cam_getZoom(void)
Gets the camera zoom.
int gl_printHeightRaw(const glFont *ft_font, const int width, const char *text)
Gets the height of a non-formatted string.
void gl_printRestoreInit(glFontRestore *restore)
Initializes a restore structure.
int gl_printLineIteratorNext(glPrintLineIterator *iter)
Updates iter with the next line's information.
void gl_printRestore(const glFontRestore *restore)
Restores last colour from a restore structure.
void gl_printLineIteratorInit(glPrintLineIterator *iter, const glFont *ft_font, const char *text, int width)
Initialize an iterator object for breaking text into lines.
int gl_printMaxRaw(const glFont *ft_font, const int max, double x, double y, const glColour *c, double outlineR, const char *text)
Behaves like gl_printRaw but stops displaying text after a certain distance.
void gl_printStoreMax(glFontRestore *restore, const char *text, int max)
Stores the colour information from a piece of text limited to max characters.
void gl_printMarkerRaw(const glFont *ft_font, double x, double y, const glColour *c, const char *text)
Wrapper for gl_printRaw for map overlay markers.
static void gui_borderIntersection(double *cx, double *cy, double rx, double ry, double hw, double hh)
Gets the intersection with the border.
#define RADAR_BLINK_PILOT
static const int mesg_max
static void gui_renderSpobTarget(void)
Sets up rendering of spob and jump point targeting reticles.
void gui_renderSpob(int ind, RadarShape shape, double w, double h, double res, double alpha, int overlay)
Draws the spobs in the minimap.
int gui_radarClickEvent(SDL_Event *event)
Handles a click at a position in the current system.
void gui_clearMessages(void)
Clears the GUI messages.
int gui_init(void)
Initializes the GUI system.
static glTexture * gui_ico_hail
int gui_radarInit(int circle, int w, int h)
Initializes the radar.
void gui_setTarget(void)
Player just changed their pilot target.
void gui_renderPlayer(double res, int overlay)
Renders the player cross on the radar or whatever.
int gui_handleEvent(SDL_Event *evt)
Handles GUI events.
static void gui_renderBorder(double dt)
Renders the ships/spobs in the border.
void gui_messageScrollDown(int lines)
Scrolls up the message box.
static int gui_prepFunc(int func_ref, const char *func_name)
Prepares to run a function.
glTexture * gui_hailIcon(void)
Gets the hail icon texture.
void gui_setDefaults(void)
int gui_borderClickEvent(SDL_Event *event)
Handles clicks on the GUI border icons.
void gui_setSystem(void)
Player just changed their system.
static IntList gui_qtquery
const char * gui_pick(void)
Determines which GUI should be used.
void gui_radarRender(double x, double y)
Renders the GUI radar.
void gui_setRadarRel(int mod)
Modifies the radar resolution.
static void gui_eventToScreenPos(int *sx, int *sy, int ex, int ey)
Translates a mouse position from an SDL_Event to GUI coordinates.
static void gui_renderRadarOutOfRange(RadarShape sh, int w, int h, int cx, int cy, const glColour *col)
Renders an out of range marker for the spob.
void gui_renderAsteroid(const Asteroid *a, double w, double h, double res, int overlay)
Renders an asteroid in the GUI radar.
#define RADAR_RES_INTERVAL
int gui_exists(const char *name)
Checks to see if a GUI exists.
void gui_mouseMoveEnable(int enable)
Enables the mouse movement callback.
void gui_messageScrollUp(int lines)
Scrolls up the message box.
static int mesg_viewpoint
void gui_mouseClickEnable(int enable)
Enables the mouse click callback.
static const double mesg_timeout
void gui_updateFaction(void)
Player's relationship with a faction was modified.
static void gui_renderMessages(double dt)
Renders the player's messages on screen.
int gui_load(const char *name)
Attempts to load the actual GUI.
void gui_getOffset(double *x, double *y)
Gets the GUI offset.
void weapon_minimap(const double res, const double w, const double h, const RadarShape shape, double alpha)
Draws the minimap weapons (used in player.c).
static const glColour * gui_getSpobColour(int i)
Gets the colour of a spob.
void gui_targetPilotGFX(glTexture *gfx)
Sets the pilot target GFX.
void gui_setShip(void)
Player just upgraded their ship or modified it.
void gui_free(void)
Frees the gui stuff.
void gui_messageInit(int width, int x, int y)
Initializes the message system.
void gui_clearViewport(void)
Resets the viewport.
void gui_radarGetRes(double *res)
Outputs the radar's resolution.
void gui_reload(void)
Reloads the GUI.
void gui_forceBlink(void)
Force sets the spob and pilot radar blink.
int gui_onScreenPilot(double *rx, double *ry, const Pilot *pilot)
Takes a pilot and returns whether it's on screen, plus its relative position.
static double blink_pilot
static int gui_doFunc(int func_ref, const char *func_name)
Runs a GUI Lua function.
static void gui_renderPilotTarget(void)
Renders the players pilot target.
void gui_cooldownEnd(void)
Notifies GUI scripts that the player broke out of cooldown.
static const glColour * gui_getPilotColour(const Pilot *p)
Gets a pilot's colour, with a special colour for targets.
void gui_renderJumpPoint(int ind, RadarShape shape, double w, double h, double res, double alpha, int overlay)
Renders a jump point on the minimap.
int gui_onScreenSpob(double *rx, double *ry, const JumpPoint *jp, const Spob *pnt)
Takes a spob or jump point and returns whether it's on screen, plus its relative position.
void gui_cleanup(void)
Cleans up the GUI.
void gui_renderPilot(const Pilot *p, RadarShape shape, double w, double h, double res, int overlay)
Renders a pilot in the GUI radar.
static void gui_calcBorders(void)
Calculates and sets the GUI borders.
static double gui_viewport_y
static int gui_runFunc(const char *func, int nargs, int nret)
Runs a function.
void player_messageRaw(const char *str)
Adds a mesg to the queue to be displayed on screen.
static int gui_getMessage
static void gui_blink(double cx, double cy, double vr, const glColour *col, double blinkInterval, double blinkVar)
Renders the spob blink around a position on the minimap.
void gui_setNav(void)
Player just changed their nav computer target.
void gui_renderReticles(double dt)
Renders the gui targeting reticles.
void gui_render(double dt)
Renders the player's GUI.
void gui_setGeneric(const Pilot *pilot)
Calls trigger functions depending on who the pilot is.
static glTexture * gui_target_spob
void gui_targetSpobGFX(glTexture *gfx)
Sets the spob target GFX.
static double gui_viewport_w
void gui_setViewport(double x, double y, double w, double h)
Sets the viewport.
static void gui_renderTargetReticles(const SimpleShader *shd, double x, double y, double radius, double angle, const glColour *c)
Renders spob and jump point targeting reticles.
void player_message(const char *fmt,...)
Adds a mesg to the queue to be displayed on screen.
void gui_setRadarResolution(double res)
Sets the radar resolution.
static double gui_viewport_x
static double animation_dt
void gui_setCargo(void)
Player just changed their cargo.
static double gui_viewport_h
void player_messageToggle(int enable)
Toggles if player should receive messages.
static glTexture * gui_target_pilot
void land_genWindows(int load)
Recreates the land windows.
void mat4_translate(mat4 *m, double x, double y, double z)
Translates a homogenous transformation matrix.
void mat4_scale(mat4 *m, double x, double y, double z)
Scales a homogeneous transformation matrix.
void fps_setPos(double x, double y)
Sets the position to display the FPS.
Header file with generic functions and naev-specifics.
void * ndata_read(const char *path, size_t *filesize)
Reads a file from the ndata (will be NUL terminated).
int nlua_loadStandard(nlua_env env)
Loads the standard Naev Lua API.
int nlua_loadGFX(nlua_env env)
Loads the graphics library.
int nlua_loadGUI(nlua_env env)
Loads the GUI library.
int nlua_loadTk(nlua_env env)
Loads the Toolkit Lua library.
char * strndup(const char *s, size_t n)
Return a pointer to a new string, which is a duplicate of the string s (or, if necessary,...
void gl_setDefViewport(int x, int y, int w, int h)
Sets the default viewport.
void gl_defViewport(void)
Resets viewport to default.
void gl_viewport(int x, int y, int w, int h)
Sets the opengl viewport.
void gl_windowToScreenPos(int *sx, int *sy, int wx, int wy)
Translates the window position to screen position.
void gl_renderShader(double x, double y, double w, double h, double r, const SimpleShader *shd, const glColour *c, int center)
Renders a simple shader.
void gl_renderRect(double x, double y, double w, double h, const glColour *c)
Renders a rectangle.
void gl_renderLine(double x1, double y1, double x2, double y2, const glColour *c)
Draws a line.
void gl_gameToScreenCoords(double *nx, double *ny, double bx, double by)
Converts in-game coordinates to screen coordinates.
void gl_renderTriangleEmpty(double x, double y, double a, double s, double length, const glColour *c)
Renders a triangle at a given position.
void gl_unclipRect(void)
Clears the 2d clipping planes.
void gl_renderRectEmpty(double x, double y, double w, double h, const glColour *c)
Renders a rectangle.
void gl_clipRect(int x, int y, int w, int h)
Sets up 2d clipping planes around a rectangle.
void gl_renderCircle(double cx, double cy, double r, const glColour *c, int filled)
Draws a circle.
glTexture * gl_dupTexture(const glTexture *texture)
Duplicates a texture.
glTexture * gl_newSprite(const char *path, const int sx, const int sy, const unsigned int flags)
Loads the texture immediately, but also sets it as a sprite.
void gl_freeTexture(glTexture *texture)
Frees a texture.
void gl_vboDestroy(gl_vbo *vbo)
Destroys a VBO.
void gl_vboActivateAttribOffset(gl_vbo *vbo, GLuint index, GLuint offset, GLint size, GLenum type, GLsizei stride)
Activates a VBO's offset.
gl_vbo * gl_vboCreateStatic(GLsizei size, const void *data)
Creates a stream vbo.
int pilot_isHostile(const Pilot *p)
Checks to see if pilot is hostile to the player.
int pilot_validTarget(const Pilot *p, const Pilot *target)
Checks to see if a pilot is a valid target for another pilot.
int pilot_isFriendly(const Pilot *p)
Checks to see if pilot is friendly to the player.
Pilot * pilot_get(unsigned int id)
Pulls a pilot out of the pilot_stack based on ID.
const glColour * pilot_getColour(const Pilot *p)
Gets a pilot's colour.
static Pilot ** pilot_stack
Pilot *const * pilot_getAll(void)
Gets the pilot stack.
double pilot_getNearestAng(const Pilot *p, unsigned int *tp, double ang, int disabled)
Get the pilot closest to an angle extending from another pilot.
void pilot_setTarget(Pilot *p, unsigned int id)
Sets the target of the pilot.
int pilot_inRangePilot(const Pilot *p, const Pilot *target, double *dist2)
Check to see if a pilot is in sensor range of another.
int pilot_inRangeSpob(const Pilot *p, int target)
Check to see if a spob is in sensor range of the pilot.
int pilot_inRangeAsteroid(const Pilot *p, int ast, int fie)
Check to see if an asteroid is in sensor range of the pilot.
void player_targetSpobSet(int id)
Sets the player's target spob.
void player_soundPlayGUI(int sound, int once)
Plays a GUI sound (unaffected by time accel).
int ship_size(const Ship *s)
Gets the size of the ship.
double system_getClosestAng(const StarSystem *sys, int *pnt, int *jp, int *ast, int *fie, double x, double y, double ang)
Gets the feature nearest to directly ahead of a position in the system.
int space_canHyperspace(const Pilot *p)
Checks to make sure if pilot is far enough away to hyperspace.
const glColour * spob_getColour(const Spob *p)
Gets the spob colour.
const char * jump_getSymbol(const JumpPoint *jp)
Gets the jump point symbol.
const char * spob_getSymbol(const Spob *p)
Gets the spob symbol.
const char * spob_name(const Spob *p)
Gets the translated name of a spob.
glTexture * jumppoint_gfx
void spfx_cinematic(void)
Sets the cinematic mode.
const char * start_gui(void)
Gets the module's starting ship was acquired.
Represents an asteroid field anchor.
Represents a single asteroid.
On screen player message.
The representation of an in-game pilot.
Represents the player's radar.
Represents a Space Object (SPOB), including and not limited to planets, stations, wormholes,...
const SimpleShader * marker
Evil hack to allow restoring, yes it makes me cry myself to sleep.
The state of a line iteration. This matches the process of rendering text into an on-screen box: An e...
Abstraction for rendering sprite sheets.