DarkPlaces
Game engine based on the Quake 1 engine by id Software, developed by LadyHavoc
 
sys_sdl.c File Reference
#include <SDL.h>
#include "darkplaces.h"
+ Include dependency graph for sys_sdl.c:

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 
void Sys_SDL_Delay (unsigned int milliseconds)
 
void Sys_SDL_Dialog (const char *title, const char *string)
 
char * Sys_SDL_GetClipboardData (void)
 
unsigned int Sys_SDL_GetTicks (void)
 
void Sys_SDL_Init (void)
 
void Sys_SDL_Shutdown (void)
 INFO: This is only called by Host_Shutdown so we dont need testing for recursion.
 

Variables

static qbool nocrashdialog = true
 
qbool sys_supportsdlgetticks = true
 

Function Documentation

◆ main()

int main ( int argc,
char * argv[] )

Definition at line 73 of file sys_sdl.c.

74{
75 return Sys_Main(argc, argv);
76}
string argv(float n)
int Sys_Main(int argc, char *argv[])
main() but renamed so we can wrap it in sys_sdl.c and sys_null.c to avoid needing to include SDL....

References argv(), and Sys_Main().

◆ Sys_SDL_Delay()

void Sys_SDL_Delay ( unsigned int milliseconds)

Definition at line 68 of file sys_sdl.c.

69{
70 SDL_Delay(milliseconds);
71}

◆ Sys_SDL_Dialog()

void Sys_SDL_Dialog ( const char * title,
const char * string )

Definition at line 29 of file sys_sdl.c.

30{
31 if(!nocrashdialog)
32 SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, title, string, NULL);
33}
#define NULL
Definition qtypes.h:12
static qbool nocrashdialog
Definition sys_sdl.c:28

References nocrashdialog, and NULL.

◆ Sys_SDL_GetClipboardData()

char * Sys_SDL_GetClipboardData ( void )

Definition at line 35 of file sys_sdl.c.

36{
37 char *data = NULL;
38 char *cliptext;
39
40 cliptext = SDL_GetClipboardText();
41 if (cliptext != NULL) {
42 size_t allocsize;
43 allocsize = min(MAX_INPUTLINE, strlen(cliptext) + 1);
44 data = (char *)Z_Malloc (allocsize);
45 dp_strlcpy (data, cliptext, allocsize);
46 SDL_free(cliptext);
47 }
48
49 return data;
50}
#define dp_strlcpy(dst, src, dsize)
Definition common.h:303
GLsizeiptr const GLvoid * data
Definition glquake.h:639
#define min(A, B)
Definition mathlib.h:37
float strlen(string s)
#define MAX_INPUTLINE
maximum size of console commandline, QuakeC strings, and many other text processing buffers
Definition qdefs.h:94
#define Z_Malloc(size)
Definition zone.h:161

References data, dp_strlcpy, MAX_INPUTLINE, min, NULL, strlen(), and Z_Malloc.

◆ Sys_SDL_GetTicks()

unsigned int Sys_SDL_GetTicks ( void )

Definition at line 64 of file sys_sdl.c.

65{
66 return SDL_GetTicks();
67}

◆ Sys_SDL_Init()

void Sys_SDL_Init ( void )

Definition at line 52 of file sys_sdl.c.

53{
54 // we don't know which systems we'll want to init, yet...
55 if (SDL_Init(0) < 0)
56 Sys_Error("SDL_Init failed: %s\n", SDL_GetError());
57
58 // COMMANDLINEOPTION: sdl: -nocrashdialog disables "Engine Error" crash dialog boxes
59 if(!Sys_CheckParm("-nocrashdialog"))
60 nocrashdialog = false;
61}
void Sys_Error(const char *error,...) DP_FUNC_PRINTF(1) DP_FUNC_NORETURN
Causes the entire program to exit ASAP.
Definition sys_shared.c:724
int Sys_CheckParm(const char *parm)
Definition sys_shared.c:327

References nocrashdialog, Sys_CheckParm(), and Sys_Error().

◆ Sys_SDL_Shutdown()

void Sys_SDL_Shutdown ( void )

INFO: This is only called by Host_Shutdown so we dont need testing for recursion.

Definition at line 21 of file sys_sdl.c.

22{
23 SDL_Quit();
24}

Variable Documentation

◆ nocrashdialog

qbool nocrashdialog = true
static

Definition at line 28 of file sys_sdl.c.

Referenced by Sys_SDL_Dialog(), and Sys_SDL_Init().

◆ sys_supportsdlgetticks

qbool sys_supportsdlgetticks = true

Definition at line 63 of file sys_sdl.c.