sdljava

Class SDLMain

public class SDLMain extends Object

Wrapping of the SDL_main functions.

Version: $Id: SDLMain.java,v 1.8 2005/02/19 02:26:01 ivan_ganza Exp $

Author: Ivan Z. Ganza

Field Summary
static longstart_time
Time in milliseconds of the SDL library initialization
static intSDL_INIT_AUDIO
Initializes the audio subsystem
static intSDL_INIT_CDROM
Initializes the cdrom subsystem
static intSDL_INIT_EVENTTHREAD
static intSDL_INIT_EVERYTHING
Initialize all
static intSDL_INIT_JOYSTICK
Initializes the joystick subsystem
static intSDL_INIT_NOPARACHUTE
Prevents SDL from catching fatal signals
static intSDL_INIT_TIMER
Initializes the timer subsystem
static intSDL_INIT_VIDEO
Initializes the video subsystem
Method Summary
static StringgetError()
Gets SDL error string about the last internal SDL error
static SDLVersiongetSDLVersion()
get a version structure with the compile-time version of the SDL library.
static longgetStartedTime()
Get time of the SDL library initialization.
static voidinit(long flags)
Initializes SDL.
static voidinitSubSystem(int flags)
Initialize subsystems

After SDL has been initialized with SDL_Init you may initialize uninitialized subsystems with SDL_InitSubSystem.

static voidquit()
SDL_Quit shuts down all SDL subsystems and frees the resources allocated to them.
static voidquitSubSystem(int flags)
Shut down a subsystem

SDL_QuitSubSystem allows you to shut down a subsystem that has been previously initialized by SDL_Init or SDL_InitSubSystem.

static longwasInit(long flags)
Checks which subsystems are initialized

Field Detail

start_time

private static long start_time
Time in milliseconds of the SDL library initialization

SDL_INIT_AUDIO

public static final int SDL_INIT_AUDIO
Initializes the audio subsystem

SDL_INIT_CDROM

public static final int SDL_INIT_CDROM
Initializes the cdrom subsystem

SDL_INIT_EVENTTHREAD

public static final int SDL_INIT_EVENTTHREAD

SDL_INIT_EVERYTHING

public static final int SDL_INIT_EVERYTHING
Initialize all

SDL_INIT_JOYSTICK

public static final int SDL_INIT_JOYSTICK
Initializes the joystick subsystem

SDL_INIT_NOPARACHUTE

public static final int SDL_INIT_NOPARACHUTE
Prevents SDL from catching fatal signals

SDL_INIT_TIMER

public static final int SDL_INIT_TIMER
Initializes the timer subsystem

SDL_INIT_VIDEO

public static final int SDL_INIT_VIDEO
Initializes the video subsystem

Method Detail

getError

public static String getError()
Gets SDL error string about the last internal SDL error

Returns: returns string containing information about the last internal SDL error.

getSDLVersion

public static SDLVersion getSDLVersion()
get a version structure with the compile-time version of the SDL library.

Returns: the compile-time version of the SDL library.

getStartedTime

public static long getStartedTime()
Get time of the SDL library initialization.

Returns: returns long represent time of the SDL library initialization.

init

public static void init(long flags)
Initializes SDL. This should be called before all other SDL functions. The flags parameter specifies what part(s) of SDL to initialize.

SDL_INIT_TIMER Initializes the timer subsystem.
SDL_INIT_AUDIO Initializes the audio subsystem.
SDL_INIT_VIDEO Initializes the video subsystem.
SDL_INIT_CDROM Initializes the cdrom subsystem.
SDL_INIT_JOYSTICK Initializes the joystick subsystem.
SDL_INIT_EVERYTHING Initialize all of the above.
SDL_INIT_NOPARACHUTE Prevents SDL from catching fatal signals.
SDL_INIT_EVENTTHREAD

Parameters: flags an int value

Throws: SDLException if an error occurs

initSubSystem

public static void initSubSystem(int flags)
Initialize subsystems

After SDL has been initialized with SDL_Init you may initialize uninitialized subsystems with SDL_InitSubSystem. The flags parameter is the same as that used in SDL_Init.

Parameters: flags an int value

Throws: SDLException if an error occurs

quit

public static void quit()
SDL_Quit shuts down all SDL subsystems and frees the resources allocated to them.

quitSubSystem

public static void quitSubSystem(int flags)
Shut down a subsystem

SDL_QuitSubSystem allows you to shut down a subsystem that has been previously initialized by SDL_Init or SDL_InitSubSystem. The flags tells SDL_QuitSubSystem which subsystems to shut down, it uses the same values that are passed to SDL_Init.

Parameters: flags an int value

wasInit

public static long wasInit(long flags)
Checks which subsystems are initialized

Parameters: flags bitwise OR'd combination of the subsystems you wish to check

Returns: Returns a bitwised OR'd combination of the initialized subsystems.

Throws: SDLException if an error occurs