19682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* 29682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL - Simple DirectMedia Layer 39682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Copyright (C) 1997-2012 Sam Lantinga 49682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 59682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall This library is free software; you can redistribute it and/or 69682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall modify it under the terms of the GNU Lesser General Public 79682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall License as published by the Free Software Foundation; either 89682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall version 2.1 of the License, or (at your option) any later version. 99682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall This library is distributed in the hope that it will be useful, 119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall but WITHOUT ANY WARRANTY; without even the implied warranty of 129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Lesser General Public License for more details. 149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall You should have received a copy of the GNU Lesser General Public 169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall License along with this library; if not, write to the Free Software 179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Sam Lantinga 209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall slouken@libsdl.org 219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall*/ 229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#ifndef _SDL_main_h 249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define _SDL_main_h 259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "SDL_stdinc.h" 279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** @file SDL_main.h 299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Redefine main() on Win32 and MacOS so that it is called by winmain.c 309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#if defined(__WIN32__) || \ 339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (defined(__MWERKS__) && !defined(__BEOS__)) || \ 349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall defined(__MACOS__) || defined(__MACOSX__) || \ 359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall defined(__SYMBIAN32__) || defined(QWS) 369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#ifdef __cplusplus 389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define C_LINKAGE "C" 399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#else 409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define C_LINKAGE 419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif /* __cplusplus */ 429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** The application's main() function must be called with C linkage, 449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * and should be declared like this: 459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * @code 469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * #ifdef __cplusplus 479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * extern "C" 489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * #endif 499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * int main(int argc, char *argv[]) 509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * { 519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * } 529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * @endcode 539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define main SDL_main 559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** The prototype for the application's main() function */ 579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern C_LINKAGE int SDL_main(int argc, char *argv[]); 589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** @name From the SDL library code -- needed for registering the app on Win32 */ 619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/*@{*/ 629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#ifdef __WIN32__ 639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "begin_code.h" 659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#ifdef __cplusplus 669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern "C" { 679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif 689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** This should be called from your WinMain() function, if any */ 709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC void SDLCALL SDL_SetModuleHandle(void *hInst); 719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** This can also be called, but is no longer necessary */ 729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style, void *hInst); 739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** This can also be called, but is no longer necessary (SDL_Quit calls it) */ 749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC void SDLCALL SDL_UnregisterApp(void); 759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#ifdef __cplusplus 769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif 789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "close_code.h" 799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif 809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/*@}*/ 819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** @name From the SDL library code -- needed for registering QuickDraw on MacOS */ 839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/*@{*/ 849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#if defined(__MACOS__) 859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "begin_code.h" 879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#ifdef __cplusplus 889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern "C" { 899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif 909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** Forward declaration so we don't need to include QuickDraw.h */ 929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstruct QDGlobals; 939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** This should be called from your main() function, if any */ 959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC void SDLCALL SDL_InitQuickDraw(struct QDGlobals *the_qd); 969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#ifdef __cplusplus 989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif 1009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "close_code.h" 1019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif 1029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/*@}*/ 1039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif /* Need to redefine main()? */ 1059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif /* _SDL_main_h */ 107