naev 0.11.5
naev.h
Go to the documentation of this file.
1/*
2 * Copyright 2006-2021 Naev DevTeam
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
22#pragma once
23
25#include <inttypes.h>
26#include <limits.h>
27#include <math.h>
28
29#include "SDL.h"
32#include "ncompat.h"
33
34#define APPNAME "Naev"
36#define ABS(x) (((x)<0)?-(x):(x))
37#define FABS(x) (((x)<0.)?-(x):(x))
39#define MAX(x,y) (((x)>(y))?(x):(y))
40#define MIN(x,y) (((x)>(y))?(y):(x))
41#define CLAMP(a, b, x) ((x)<(a)?(a):((x)>(b)?(b):(x)))
43#define SIGN(x) (((x)>0)?1:-1)
44#define FSIGN(x) (((x)>0.)?1.:-1.)
46#define pow2(x) ((x)*(x))
48/* maximum filename path */
49#ifndef PATH_MAX
50# define PATH_MAX 256
51#endif /* PATH_MAX */
52
53/* Default maximum string length */
54#define STRMAX 4096
55#define STRMAX_SHORT 1024
56
57/* For inferior OS. */
58#ifndef M_PI
59# define M_PI 3.14159265358979323846
60#endif /* M_PI */
61#ifndef M_SQRT1_2
62# define M_SQRT1_2 0.70710678118654752440
63#endif
64#ifndef M_SQRT2
65# define M_SQRT2 1.41421356237309504880
66#endif
67
68/*
69 * Misc stuff.
70 */
71extern Uint32 SDL_LOOPDONE;
72extern const double fps_min;
73extern double elapsed_time_mod;
74void fps_setPos( double x, double y );
75void fps_display( double dt );
76double fps_current (void);
77void naev_resize (void);
78void naev_toggleFullscreen (void);
79void update_routine( double dt, int dohooks );
80const char *naev_version( int long_version );
81int naev_versionCompare( const char *version );
82void naev_quit (void);
83int naev_isQuit (void);
84double naev_getrealdt (void);
85
87void naev_doRenderLoadscreen (void);
88void naev_renderLoadscreen (void);
void naev_renderLoadscreen(void)
Renders the loadscreen if necessary.
Definition naev.c:597
int naev_versionCompare(const char *version)
Compares the version against the current naev version.
Definition naev.c:1120
const char * naev_version(int long_version)
Returns the version in a human readable string.
double elapsed_time_mod
Definition naev.c:121
void update_routine(double dt, int dohooks)
Actually runs the updates.
Definition naev.c:1038
int naev_shouldRenderLoadscreen(void)
Whether or not we want to render the loadscreen.
Definition naev.c:556
void fps_display(double dt)
Displays FPS on the screen.
Definition naev.c:945
void naev_quit(void)
Flags naev to quit.
Definition naev.c:150
double fps_current(void)
Gets the current FPS.
Definition naev.c:984
void naev_resize(void)
Wrapper for gl_resize that handles non-GL reinitialization.
Definition naev.c:790
int naev_isQuit(void)
Get if Naev is trying to quit.
Definition naev.c:158
const double fps_min
Definition naev.c:118
double naev_getrealdt(void)
Gets the last delta-tick.
Definition naev.c:1174
Uint32 SDL_LOOPDONE
Definition naev.c:101
void fps_setPos(double x, double y)
Sets the position to display the FPS.
Definition naev.c:934