sdljava
Class SDLMain

java.lang.Object
  extended by sdljava.SDLMain

public class SDLMain
extends java.lang.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 int SDL_INIT_AUDIO
          Initializes the audio subsystem
static int SDL_INIT_CDROM
          Initializes the cdrom subsystem
static int SDL_INIT_EVENTTHREAD
           
static int SDL_INIT_EVERYTHING
          Initialize all
static int SDL_INIT_JOYSTICK
          Initializes the joystick subsystem
static int SDL_INIT_NOPARACHUTE
          Prevents SDL from catching fatal signals
static int SDL_INIT_TIMER
          Initializes the timer subsystem
static int SDL_INIT_VIDEO
          Initializes the video subsystem
private static long start_time
          Time in milliseconds of the SDL library initialization
 
Constructor Summary
SDLMain()
           
 
Method Summary
static java.lang.String getError()
          Gets SDL error string about the last internal SDL error
static SDLVersion getSDLVersion()
          get a version structure with the compile-time version of the SDL library.
static long getStartedTime()
          Get time of the SDL library initialization.
static void init(long flags)
          Initializes SDL.
static void initSubSystem(int flags)
          Initialize subsystems
static void quit()
          SDL_Quit shuts down all SDL subsystems and frees the resources allocated to them.
static void quitSubSystem(int flags)
          Shut down a subsystem
static long wasInit(long flags)
          Checks which subsystems are initialized
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SDL_INIT_TIMER

public static final int SDL_INIT_TIMER
Initializes the timer subsystem

See Also:
Constant Field Values

SDL_INIT_AUDIO

public static final int SDL_INIT_AUDIO
Initializes the audio subsystem

See Also:
Constant Field Values

SDL_INIT_VIDEO

public static final int SDL_INIT_VIDEO
Initializes the video subsystem

See Also:
Constant Field Values

SDL_INIT_CDROM

public static final int SDL_INIT_CDROM
Initializes the cdrom subsystem

See Also:
Constant Field Values

SDL_INIT_JOYSTICK

public static final int SDL_INIT_JOYSTICK
Initializes the joystick subsystem

See Also:
Constant Field Values

SDL_INIT_NOPARACHUTE

public static final int SDL_INIT_NOPARACHUTE
Prevents SDL from catching fatal signals

See Also:
Constant Field Values

SDL_INIT_EVENTTHREAD

public static final int SDL_INIT_EVENTTHREAD
See Also:
Constant Field Values

SDL_INIT_EVERYTHING

public static final int SDL_INIT_EVERYTHING
Initialize all

See Also:
Constant Field Values

start_time

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

Constructor Detail

SDLMain

public SDLMain()
Method Detail

init

public static void init(long flags)
                 throws SDLException
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)
                          throws SDLException
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

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

quit

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


wasInit

public static long wasInit(long flags)
                    throws SDLException
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

getError

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

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

getStartedTime

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

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

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.