]> icculus.org git repositories - taylor/freespace2.git/blob - include/osapi.h
Initial revision
[taylor/freespace2.git] / include / osapi.h
1 #ifndef _OSAPI_H
2 #define _OSAPI_H
3
4 #include <stdlib.h>
5 // --------------------------------------------------------------------------------------------------
6 // OSAPI DEFINES/VARS
7 //
8
9 // set if running under MsDev - done after os_init(...) has returned
10 extern int Os_debugger_running;
11
12 // game-wide
13 // #define THREADED
14
15 #ifdef THREADED
16         #define ENTER_CRITICAL_SECTION(csc)             do { EnterCriticalSection(csc); } while(0);
17         #define LEAVE_CRITICAL_SECTION(csc)             do { LeaveCriticalSection(csc); } while(0);
18 #else
19         #define ENTER_CRITICAL_SECTION(csc)             do { } while(0);
20         #define LEAVE_CRITICAL_SECTION(csc)             do { } while(0);
21 #endif
22
23 // --------------------------------------------------------------------------------------------------
24 // OSAPI FUNCTIONS
25 //
26
27 // initialization/shutdown functions -----------------------------------------------
28
29 // If app_name is NULL or ommited, then TITLE is used
30 // for the app name, which is where registry keys are stored.
31 void os_init(char * wclass, char * title, char *app_name=NULL, char *version_string=NULL );
32
33 // set the main window title
34 void os_set_title( char * title );
35
36 // call at program end
37 void os_cleanup();
38
39
40 // window management ---------------------------------------------------------------
41
42 // toggle window size between full screen and windowed
43 void os_toggle_fullscreen();
44
45 // Returns 1 if app is not the foreground app.
46 int os_foreground();
47
48 // Returns the handle to the main window
49 uint os_get_window();
50
51
52 // process management --------------------------------------------------------------
53
54 // call to process windows messages. only does something in non THREADED mode
55 void os_poll();
56
57 // Sleeps for n milliseconds or until app becomes active.
58 void os_sleep(int ms);
59
60 // Used to stop message processing
61 void os_suspend();
62
63 // resume message processing
64 void os_resume();
65
66 #endif
67