1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
|
/*
* Copyright (C) Volition, Inc. 1999. All rights reserved.
*
* All source code herein is the property of Volition, Inc. You may not sell
* or otherwise commercially exploit the source or things you created based on the
* source.
*
*/
#ifndef _OSAPI_H
#define _OSAPI_H
#include "globalincs/pstypes.h"
#include "osapi/osregistry.h"
// --------------------------------------------------------------------------------------------------
// OSAPI DEFINES/VARS
//
// set if running under MsDev - done after os_init(...) has returned
extern int Os_debugger_running;
// game-wide
//#define THREADED
#ifdef THREADED
#ifdef _WIN32
#define INITIALIZE_CRITICAL_SECTION(csc) do { InitializeCriticalSection(&csc); } while(0)
#define DELETE_CRITICAL_SECTION(csc) do { DeleteCriticalSection(&csc); } while(0)
#define ENTER_CRITICAL_SECTION(csc) do { EnterCriticalSection(&csc); } while(0)
#define LEAVE_CRITICAL_SECTION(csc) do { LeaveCriticalSection(&csc); } while(0)
#else
#define INITIALIZE_CRITICAL_SECTION(csc) do { csc = SDL_CreateMutex(); } while(0)
#define DELETE_CRITICAL_SECTION(csc) do { SDL_DestroyMutex(csc); } while(0)
#define ENTER_CRITICAL_SECTION(csc) do { SDL_LockMutex(csc); } while(0)
#define LEAVE_CRITICAL_SECTION(csc) do { SDL_UnlockMutex(csc); } while(0)
#endif // _WIN32
#else
#define INITIALIZE_CRITICAL_SECTION(csc) do { } while(0)
#define DELETE_CRITICAL_SECTION(csc) do { } while(0)
#define ENTER_CRITICAL_SECTION(csc) do { } while(0)
#define LEAVE_CRITICAL_SECTION(csc) do { } while(0)
#endif
// --------------------------------------------------------------------------------------------------
// OSAPI FUNCTIONS
//
// initialization/shutdown functions -----------------------------------------------
// detect the home/base/writable directory to use
extern const char *detect_home(void);
// If app_name is NULL or ommited, then TITLE is used
// for the app name, which is where registry keys are stored.
void os_init(char * wclass, char * title, char *app_name=NULL, char *version_string=NULL );
// set the main window title
void os_set_title( char * title );
// call at program end
void os_cleanup();
// window management ---------------------------------------------------------------
// toggle window size between full screen and windowed
void os_toggle_fullscreen();
// Returns 1 if app is not the foreground app.
int os_foreground();
// Returns the handle to the main window
#ifdef _WIN32
uint os_get_window();
#else
#define os_get_window() NULL
#endif // _WIN32
void os_set_window(uint new_handle);
// process management --------------------------------------------------------------
// call to process windows messages. only does something in non THREADED mode
void os_poll();
// Sleeps for n milliseconds or until app becomes active.
void os_sleep(int ms);
// Used to stop message processing
void os_suspend();
// resume message processing
void os_resume();
#endif // _OSAPI_H
// Goober5000
#ifdef _WIN32
void disableWindowsKey();
void enableWindowsKey();
#endif // _WIN32
|