naev 0.12.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 <math.h> // IWYU pragma: export
26
27#include "SDL_stdinc.h"
29
30#define APPNAME "Naev"
31
32#define ABS( x ) \
33 ( ( ( x ) < 0 ) ? -( x ) : ( x ) )
34#define FABS( x ) \
35 ( ( ( x ) < 0. ) ? -( x ) : ( x ) )
36
37#define MAX( x, y ) \
38 ( ( ( x ) > ( y ) ) ? ( x ) : ( y ) )
39#define MIN( x, y ) \
40 ( ( ( x ) > ( y ) ) ? ( y ) : ( x ) )
41#define CLAMP( a, b, x ) \
42 ( ( x ) < ( a ) \
43 ? ( a ) \
44 : ( ( x ) > ( b ) \
45 ? ( b ) \
46 : ( x ) ) )
47
48#define SIGN( x ) \
49 ( ( ( x ) > 0 ) ? 1 : -1 )
50#define FSIGN( x ) \
51 ( ( ( x ) > 0. ) ? 1. : -1. )
52
53#define pow2( x ) ( ( x ) * ( x ) )
54
55/* maximum filename path */
56#ifndef PATH_MAX
57#define PATH_MAX 256
58#endif /* PATH_MAX */
59
60/* Default maximum string length */
61#define STRMAX 4096
62#define STRMAX_SHORT 1024
63
64#define DOUBLE_TOL 1e-6
65
66/*
67 * Misc stuff.
68 */
69extern Uint32 SDL_LOOPDONE;
70extern const double fps_min;
71extern double elapsed_time_mod;
72void fps_setPos( double x, double y );
73void fps_display( double dt );
74double fps_current( void );
75void naev_resize( void );
76void naev_toggleFullscreen( void );
77void update_routine( double dt, int dohooks );
78const char *naev_version( int long_version );
79int naev_versionCompare( const char *version );
80int naev_versionCompareTarget( const char *version, const char *target );
81void naev_quit( void );
82int naev_isQuit( void );
83double naev_getrealdt( void );
84
86void naev_doRenderLoadscreen( void );
87void naev_renderLoadscreen( void );
double elapsed_time_mod
Definition naev.c:117
const double fps_min
Definition naev.c:116
Uint32 SDL_LOOPDONE
Definition naev.c:99
void naev_renderLoadscreen(void)
Renders the loadscreen if necessary.
Definition naev.c:640
int naev_versionCompare(const char *version)
Compares the version against the current naev version.
Definition naev.c:1151
const char * naev_version(int long_version)
Returns the version in a human readable string.
void update_routine(double dt, int dohooks)
Actually runs the updates.
Definition naev.c:1056
int naev_shouldRenderLoadscreen(void)
Whether or not we want to render the loadscreen.
Definition naev.c:596
void fps_display(double dt)
Displays FPS on the screen.
Definition naev.c:955
void naev_quit(void)
Flags naev to quit.
Definition naev.c:145
double fps_current(void)
Gets the current FPS.
Definition naev.c:995
void naev_resize(void)
Wrapper for gl_resize that handles non-GL reinitialization.
Definition naev.c:874
int naev_versionCompareTarget(const char *version, const char *target)
Does a comparison with a specific target.
Definition naev.c:1175
int naev_isQuit(void)
Get if Naev is trying to quit.
Definition naev.c:153
double naev_getrealdt(void)
Gets the last delta-tick.
Definition naev.c:1230
void fps_setPos(double x, double y)
Sets the position to display the FPS.
Definition naev.c:944