SDL Library
Embed:
(wiki syntax)
Show/hide line numbers
SDL_main.h
Go to the documentation of this file.
00001 /* 00002 Simple DirectMedia Layer 00003 Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> 00004 00005 This software is provided 'as-is', without any express or implied 00006 warranty. In no event will the authors be held liable for any damages 00007 arising from the use of this software. 00008 00009 Permission is granted to anyone to use this software for any purpose, 00010 including commercial applications, and to alter it and redistribute it 00011 freely, subject to the following restrictions: 00012 00013 1. The origin of this software must not be misrepresented; you must not 00014 claim that you wrote the original software. If you use this software 00015 in a product, an acknowledgment in the product documentation would be 00016 appreciated but is not required. 00017 2. Altered source versions must be plainly marked as such, and must not be 00018 misrepresented as being the original software. 00019 3. This notice may not be removed or altered from any source distribution. 00020 */ 00021 00022 #ifndef _SDL_main_h 00023 #define _SDL_main_h 00024 00025 #include "SDL_stdinc.h" 00026 00027 /** 00028 * \file SDL_main.h 00029 * 00030 * Redefine main() on some platforms so that it is called by SDL. 00031 */ 00032 00033 #ifndef SDL_MAIN_HANDLED 00034 #if defined(__WIN32__) 00035 /* On Windows SDL provides WinMain(), which parses the command line and passes 00036 the arguments to your main function. 00037 00038 If you provide your own WinMain(), you may define SDL_MAIN_HANDLED 00039 */ 00040 #define SDL_MAIN_AVAILABLE 00041 00042 #elif defined(__IPHONEOS__) 00043 /* On iOS SDL provides a main function that creates an application delegate 00044 and starts the iOS application run loop. 00045 00046 See src/video/uikit/SDL_uikitappdelegate.m for more details. 00047 */ 00048 #define SDL_MAIN_NEEDED 00049 00050 #elif defined(__ANDROID__) 00051 /* On Android SDL provides a Java class in SDLActivity.java that is the 00052 main activity entry point. 00053 00054 See README-android.txt for more details on extending that class. 00055 */ 00056 #define SDL_MAIN_NEEDED 00057 00058 #endif 00059 #endif /* SDL_MAIN_HANDLED */ 00060 00061 #ifdef __cplusplus 00062 #define C_LINKAGE "C" 00063 #else 00064 #define C_LINKAGE 00065 #endif /* __cplusplus */ 00066 00067 /** 00068 * \file SDL_main.h 00069 * 00070 * The application's main() function must be called with C linkage, 00071 * and should be declared like this: 00072 * \code 00073 * #ifdef __cplusplus 00074 * extern "C" 00075 * #endif 00076 * int main(int argc, char *argv[]) 00077 * { 00078 * } 00079 * \endcode 00080 */ 00081 00082 #if defined(SDL_MAIN_NEEDED) || defined(SDL_MAIN_AVAILABLE) 00083 #define main SDL_main 00084 #endif 00085 00086 /** 00087 * The prototype for the application's main() function 00088 */ 00089 extern C_LINKAGE int SDL_main(int argc, char *argv[]); 00090 00091 00092 #include "begin_code.h" 00093 #ifdef __cplusplus 00094 extern "C" { 00095 #endif 00096 00097 /** 00098 * This is called by the real SDL main function to let the rest of the 00099 * library know that initialization was done properly. 00100 * 00101 * Calling this yourself without knowing what you're doing can cause 00102 * crashes and hard to diagnose problems with your application. 00103 */ 00104 extern DECLSPEC void SDLCALL SDL_SetMainReady(void); 00105 00106 #ifdef __WIN32__ 00107 00108 /** 00109 * This can be called to set the application class at startup 00110 */ 00111 extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style, 00112 void *hInst); 00113 extern DECLSPEC void SDLCALL SDL_UnregisterApp(void); 00114 00115 #endif /* __WIN32__ */ 00116 00117 00118 #ifdef __cplusplus 00119 } 00120 #endif 00121 #include "close_code.h" 00122 00123 #endif /* _SDL_main_h */ 00124 00125 /* vi: set ts=4 sw=4 expandtab: */
Generated on Tue Jul 12 2022 15:10:19 by 1.7.2