forked from KolibriOS/kolibrios
SDL: Added CD-ROM and Joystick stubs for easer porting
git-svn-id: svn://kolibrios.org@9956 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
75cc884573
commit
9ab6a07ce2
@ -30,6 +30,8 @@ static char rcsid =
|
||||
#ifndef _SDL_cdrom_h
|
||||
#define _SDL_cdrom_h
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "SDL_types.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
@ -43,6 +45,8 @@ extern "C" {
|
||||
for CD-ROM drives, and load appropriate drivers.
|
||||
*/
|
||||
|
||||
#warning "CD-ROM support in SDL is not implemented for KolibriOS. All functions are stubs!"
|
||||
|
||||
/* The maximum number of CD-ROM tracks on a disk */
|
||||
#define SDL_MAX_TRACKS 99
|
||||
|
||||
@ -99,7 +103,10 @@ typedef struct SDL_CD {
|
||||
/* Returns the number of CD-ROM drives on the system, or -1 if
|
||||
SDL_Init() has not been called with the SDL_INIT_CDROM flag.
|
||||
*/
|
||||
extern DECLSPEC int SDL_CDNumDrives(void);
|
||||
static inline DECLSPEC int SDL_CDNumDrives(void)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Returns a human-readable, system-dependent identifier for the CD-ROM.
|
||||
Example:
|
||||
@ -107,7 +114,10 @@ extern DECLSPEC int SDL_CDNumDrives(void);
|
||||
"E:"
|
||||
"/dev/disk/ide/1/master"
|
||||
*/
|
||||
extern DECLSPEC const char * SDL_CDName(int drive);
|
||||
static inline DECLSPEC const char * SDL_CDName(int drive)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Opens a CD-ROM drive for access. It returns a drive handle on success,
|
||||
or NULL if the drive was invalid or busy. This newly opened CD-ROM
|
||||
@ -115,13 +125,19 @@ extern DECLSPEC const char * SDL_CDName(int drive);
|
||||
CD-ROM handle.
|
||||
Drives are numbered starting with 0. Drive 0 is the system default CD-ROM.
|
||||
*/
|
||||
extern DECLSPEC SDL_CD * SDL_CDOpen(int drive);
|
||||
static inline DECLSPEC SDL_CD * SDL_CDOpen(int drive)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* This function returns the current status of the given drive.
|
||||
If the drive has a CD in it, the table of contents of the CD and current
|
||||
play position of the CD will be stored in the SDL_CD structure.
|
||||
*/
|
||||
extern DECLSPEC CDstatus SDL_CDStatus(SDL_CD *cdrom);
|
||||
static inline DECLSPEC CDstatus SDL_CDStatus(SDL_CD *cdrom)
|
||||
{
|
||||
return CD_ERROR;
|
||||
}
|
||||
|
||||
/* Play the given CD starting at 'start_track' and 'start_frame' for 'ntracks'
|
||||
tracks and 'nframes' frames. If both 'ntrack' and 'nframe' are 0, play
|
||||
@ -142,29 +158,49 @@ extern DECLSPEC CDstatus SDL_CDStatus(SDL_CD *cdrom);
|
||||
|
||||
This function returns 0, or -1 if there was an error.
|
||||
*/
|
||||
extern DECLSPEC int SDL_CDPlayTracks(SDL_CD *cdrom,
|
||||
int start_track, int start_frame, int ntracks, int nframes);
|
||||
static inline DECLSPEC int SDL_CDPlayTracks(SDL_CD *cdrom,
|
||||
int start_track, int start_frame, int ntracks, int nframes)
|
||||
{
|
||||
return CD_ERROR;
|
||||
}
|
||||
|
||||
/* Play the given CD starting at 'start' frame for 'length' frames.
|
||||
It returns 0, or -1 if there was an error.
|
||||
*/
|
||||
extern DECLSPEC int SDL_CDPlay(SDL_CD *cdrom, int start, int length);
|
||||
static inline DECLSPEC int SDL_CDPlay(SDL_CD *cdrom, int start, int length)
|
||||
{
|
||||
return CD_ERROR;
|
||||
}
|
||||
|
||||
/* Pause play -- returns 0, or -1 on error */
|
||||
extern DECLSPEC int SDL_CDPause(SDL_CD *cdrom);
|
||||
static inline DECLSPEC int SDL_CDPause(SDL_CD *cdrom)
|
||||
{
|
||||
return CD_ERROR;
|
||||
}
|
||||
|
||||
/* Resume play -- returns 0, or -1 on error */
|
||||
extern DECLSPEC int SDL_CDResume(SDL_CD *cdrom);
|
||||
static inline DECLSPEC int SDL_CDResume(SDL_CD *cdrom)
|
||||
{
|
||||
return CD_ERROR;
|
||||
}
|
||||
|
||||
/* Stop play -- returns 0, or -1 on error */
|
||||
extern DECLSPEC int SDL_CDStop(SDL_CD *cdrom);
|
||||
static inline DECLSPEC int SDL_CDStop(SDL_CD *cdrom)
|
||||
{
|
||||
return CD_ERROR;
|
||||
}
|
||||
|
||||
/* Eject CD-ROM -- returns 0, or -1 on error */
|
||||
extern DECLSPEC int SDL_CDEject(SDL_CD *cdrom);
|
||||
static inline DECLSPEC int SDL_CDEject(SDL_CD *cdrom)
|
||||
{
|
||||
return CD_ERROR;
|
||||
}
|
||||
|
||||
/* Closes the handle for the CD-ROM drive */
|
||||
extern DECLSPEC void SDL_CDClose(SDL_CD *cdrom);
|
||||
|
||||
static inline DECLSPEC void SDL_CDClose(SDL_CD *cdrom)
|
||||
{
|
||||
/* STUB! */
|
||||
}
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
|
@ -43,11 +43,13 @@ extern DECLSPEC void SDL_ClearError(void);
|
||||
|
||||
/* Private error message function - used internally */
|
||||
#define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM)
|
||||
#define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED)
|
||||
typedef enum {
|
||||
SDL_ENOMEM,
|
||||
SDL_EFREAD,
|
||||
SDL_EFWRITE,
|
||||
SDL_EFSEEK,
|
||||
SDL_UNSUPPORTED,
|
||||
SDL_LASTERROR
|
||||
} SDL_errorcode;
|
||||
extern void SDL_Error(SDL_errorcode code);
|
||||
|
@ -34,7 +34,6 @@ static char rcsid =
|
||||
#include "SDL_active.h"
|
||||
#include "SDL_keyboard.h"
|
||||
#include "SDL_mouse.h"
|
||||
#include "SDL_joystick.h"
|
||||
#include "SDL_quit.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
|
@ -30,7 +30,11 @@ static char rcsid =
|
||||
#ifndef _SDL_joystick_h
|
||||
#define _SDL_joystick_h
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "SDL_types.h"
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_events.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
@ -47,19 +51,26 @@ extern "C" {
|
||||
struct _SDL_Joystick;
|
||||
typedef struct _SDL_Joystick SDL_Joystick;
|
||||
|
||||
#warning "Joysticks are not supported in KolibriOS. All functions are stubs!"
|
||||
|
||||
/* Function prototypes */
|
||||
/*
|
||||
* Count the number of joysticks attached to the system
|
||||
*/
|
||||
extern DECLSPEC int SDL_NumJoysticks(void);
|
||||
static inline DECLSPEC int SDL_NumJoysticks(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the implementation dependent name of a joystick.
|
||||
* This can be called before any joysticks are opened.
|
||||
* If no name can be found, this function returns NULL.
|
||||
*/
|
||||
extern DECLSPEC const char *SDL_JoystickName(int device_index);
|
||||
static inline DECLSPEC const char *SDL_JoystickName(int device_index)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Open a joystick for use - the index passed as an argument refers to
|
||||
@ -68,46 +79,70 @@ extern DECLSPEC const char *SDL_JoystickName(int device_index);
|
||||
*
|
||||
* This function returns a joystick identifier, or NULL if an error occurred.
|
||||
*/
|
||||
extern DECLSPEC SDL_Joystick *SDL_JoystickOpen(int device_index);
|
||||
static inline DECLSPEC SDL_Joystick *SDL_JoystickOpen(int device_index)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns 1 if the joystick has been opened, or 0 if it has not.
|
||||
*/
|
||||
extern DECLSPEC int SDL_JoystickOpened(int device_index);
|
||||
static inline DECLSPEC int SDL_JoystickOpened(int device_index)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the device index of an opened joystick.
|
||||
*/
|
||||
extern DECLSPEC int SDL_JoystickIndex(SDL_Joystick *joystick);
|
||||
static inline DECLSPEC int SDL_JoystickIndex(SDL_Joystick *joystick)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the number of general axis controls on a joystick
|
||||
*/
|
||||
extern DECLSPEC int SDL_JoystickNumAxes(SDL_Joystick *joystick);
|
||||
static inline DECLSPEC int SDL_JoystickNumAxes(SDL_Joystick *joystick)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the number of trackballs on a joystick
|
||||
* Joystick trackballs have only relative motion events associated
|
||||
* with them and their state cannot be polled.
|
||||
*/
|
||||
extern DECLSPEC int SDL_JoystickNumBalls(SDL_Joystick *joystick);
|
||||
static inline DECLSPEC int SDL_JoystickNumBalls(SDL_Joystick *joystick)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the number of POV hats on a joystick
|
||||
*/
|
||||
extern DECLSPEC int SDL_JoystickNumHats(SDL_Joystick *joystick);
|
||||
static inline DECLSPEC int SDL_JoystickNumHats(SDL_Joystick *joystick)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the number of buttons on a joystick
|
||||
*/
|
||||
extern DECLSPEC int SDL_JoystickNumButtons(SDL_Joystick *joystick);
|
||||
static inline DECLSPEC int SDL_JoystickNumButtons(SDL_Joystick *joystick)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Update the current state of the open joysticks.
|
||||
* This is called automatically by the event loop if any joystick
|
||||
* events are enabled.
|
||||
*/
|
||||
extern DECLSPEC void SDL_JoystickUpdate(void);
|
||||
static inline DECLSPEC void SDL_JoystickUpdate(void)
|
||||
{
|
||||
/* STUB! */
|
||||
}
|
||||
|
||||
/*
|
||||
* Enable/disable joystick event polling.
|
||||
@ -116,14 +151,20 @@ extern DECLSPEC void SDL_JoystickUpdate(void);
|
||||
* information.
|
||||
* The state can be one of SDL_QUERY, SDL_ENABLE or SDL_IGNORE.
|
||||
*/
|
||||
extern DECLSPEC int SDL_JoystickEventState(int state);
|
||||
static inline DECLSPEC int SDL_JoystickEventState(int state)
|
||||
{
|
||||
return SDL_IGNORE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the current state of an axis control on a joystick
|
||||
* The state is a value ranging from -32768 to 32767.
|
||||
* The axis indices start at index 0.
|
||||
*/
|
||||
extern DECLSPEC Sint16 SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis);
|
||||
static inline DECLSPEC Sint16 SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the current state of a POV hat on a joystick
|
||||
@ -141,26 +182,36 @@ extern DECLSPEC Sint16 SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis);
|
||||
/*
|
||||
* The hat indices start at index 0.
|
||||
*/
|
||||
extern DECLSPEC Uint8 SDL_JoystickGetHat(SDL_Joystick *joystick, int hat);
|
||||
static inline DECLSPEC Uint8 SDL_JoystickGetHat(SDL_Joystick *joystick, int hat)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the ball axis change since the last poll
|
||||
* This returns 0, or -1 if you passed it invalid parameters.
|
||||
* The ball indices start at index 0.
|
||||
*/
|
||||
extern DECLSPEC int SDL_JoystickGetBall(SDL_Joystick *joystick, int ball, int *dx, int *dy);
|
||||
|
||||
static inline DECLSPEC int SDL_JoystickGetBall(SDL_Joystick *joystick, int ball, int *dx, int *dy)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
/*
|
||||
* Get the current state of a button on a joystick
|
||||
* The button indices start at index 0.
|
||||
*/
|
||||
extern DECLSPEC Uint8 SDL_JoystickGetButton(SDL_Joystick *joystick, int button);
|
||||
static inline DECLSPEC Uint8 SDL_JoystickGetButton(SDL_Joystick *joystick, int button)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Close a joystick previously opened with SDL_JoystickOpen()
|
||||
*/
|
||||
extern DECLSPEC void SDL_JoystickClose(SDL_Joystick *joystick);
|
||||
|
||||
static inline DECLSPEC void SDL_JoystickClose(SDL_Joystick *joystick)
|
||||
{
|
||||
/* STUB! */
|
||||
}
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
|
Loading…
Reference in New Issue
Block a user