mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-07-02 22:14:37 +00:00
initial commit. This is icculus version 5542b94cae02a6333845854bbbd1abe0a259f1a4
This commit is contained in:
commit
3096eaf5e2
2519 changed files with 816064 additions and 0 deletions
724
ExternalLibs/AL/include/al.h
Normal file
724
ExternalLibs/AL/include/al.h
Normal file
|
@ -0,0 +1,724 @@
|
|||
#ifndef AL_AL_H
|
||||
#define AL_AL_H
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
/* _OPENAL32LIB is deprecated */
|
||||
#if defined(AL_BUILD_LIBRARY) || defined (_OPENAL32LIB)
|
||||
#define AL_API __declspec(dllexport)
|
||||
#else
|
||||
#define AL_API __declspec(dllimport)
|
||||
#endif
|
||||
#else
|
||||
#if defined(AL_BUILD_LIBRARY) && defined(HAVE_GCC_VISIBILITY)
|
||||
#define AL_API __attribute__((visibility("default")))
|
||||
#else
|
||||
#define AL_API extern
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define AL_APIENTRY __cdecl
|
||||
#else
|
||||
#define AL_APIENTRY
|
||||
#endif
|
||||
|
||||
#if defined(TARGET_OS_MAC) && TARGET_OS_MAC
|
||||
#pragma export on
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The OPENAL, ALAPI, ALAPIENTRY, AL_INVALID, AL_ILLEGAL_ENUM, and
|
||||
* AL_ILLEGAL_COMMAND macros are deprecated, but are included for
|
||||
* applications porting code from AL 1.0
|
||||
*/
|
||||
#define OPENAL
|
||||
#define ALAPI AL_API
|
||||
#define ALAPIENTRY AL_APIENTRY
|
||||
#define AL_INVALID (-1)
|
||||
#define AL_ILLEGAL_ENUM AL_INVALID_ENUM
|
||||
#define AL_ILLEGAL_COMMAND AL_INVALID_OPERATION
|
||||
|
||||
#define AL_VERSION_1_0
|
||||
#define AL_VERSION_1_1
|
||||
|
||||
|
||||
/** 8-bit boolean */
|
||||
typedef char ALboolean;
|
||||
|
||||
/** character */
|
||||
typedef char ALchar;
|
||||
|
||||
/** signed 8-bit 2's complement integer */
|
||||
typedef char ALbyte;
|
||||
|
||||
/** unsigned 8-bit integer */
|
||||
typedef unsigned char ALubyte;
|
||||
|
||||
/** signed 16-bit 2's complement integer */
|
||||
typedef short ALshort;
|
||||
|
||||
/** unsigned 16-bit integer */
|
||||
typedef unsigned short ALushort;
|
||||
|
||||
/** signed 32-bit 2's complement integer */
|
||||
typedef int ALint;
|
||||
|
||||
/** unsigned 32-bit integer */
|
||||
typedef unsigned int ALuint;
|
||||
|
||||
/** non-negative 32-bit binary integer size */
|
||||
typedef int ALsizei;
|
||||
|
||||
/** enumerated 32-bit value */
|
||||
typedef int ALenum;
|
||||
|
||||
/** 32-bit IEEE754 floating-point */
|
||||
typedef float ALfloat;
|
||||
|
||||
/** 64-bit IEEE754 floating-point */
|
||||
typedef double ALdouble;
|
||||
|
||||
/** void type (for opaque pointers only) */
|
||||
typedef void ALvoid;
|
||||
|
||||
|
||||
/* Enumerant values begin at column 50. No tabs. */
|
||||
|
||||
/* "no distance model" or "no buffer" */
|
||||
#define AL_NONE 0
|
||||
|
||||
/* Boolean False. */
|
||||
#define AL_FALSE 0
|
||||
|
||||
/** Boolean True. */
|
||||
#define AL_TRUE 1
|
||||
|
||||
/** Indicate Source has relative coordinates. */
|
||||
#define AL_SOURCE_RELATIVE 0x202
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Directional source, inner cone angle, in degrees.
|
||||
* Range: [0-360]
|
||||
* Default: 360
|
||||
*/
|
||||
#define AL_CONE_INNER_ANGLE 0x1001
|
||||
|
||||
/**
|
||||
* Directional source, outer cone angle, in degrees.
|
||||
* Range: [0-360]
|
||||
* Default: 360
|
||||
*/
|
||||
#define AL_CONE_OUTER_ANGLE 0x1002
|
||||
|
||||
/**
|
||||
* Specify the pitch to be applied, either at source,
|
||||
* or on mixer results, at listener.
|
||||
* Range: [0.5-2.0]
|
||||
* Default: 1.0
|
||||
*/
|
||||
#define AL_PITCH 0x1003
|
||||
|
||||
/**
|
||||
* Specify the current location in three dimensional space.
|
||||
* OpenAL, like OpenGL, uses a right handed coordinate system,
|
||||
* where in a frontal default view X (thumb) points right,
|
||||
* Y points up (index finger), and Z points towards the
|
||||
* viewer/camera (middle finger).
|
||||
* To switch from a left handed coordinate system, flip the
|
||||
* sign on the Z coordinate.
|
||||
* Listener position is always in the world coordinate system.
|
||||
*/
|
||||
#define AL_POSITION 0x1004
|
||||
|
||||
/** Specify the current direction. */
|
||||
#define AL_DIRECTION 0x1005
|
||||
|
||||
/** Specify the current velocity in three dimensional space. */
|
||||
#define AL_VELOCITY 0x1006
|
||||
|
||||
/**
|
||||
* Indicate whether source is looping.
|
||||
* Type: ALboolean?
|
||||
* Range: [AL_TRUE, AL_FALSE]
|
||||
* Default: FALSE.
|
||||
*/
|
||||
#define AL_LOOPING 0x1007
|
||||
|
||||
/**
|
||||
* Indicate the buffer to provide sound samples.
|
||||
* Type: ALuint.
|
||||
* Range: any valid Buffer id.
|
||||
*/
|
||||
#define AL_BUFFER 0x1009
|
||||
|
||||
/**
|
||||
* Indicate the gain (volume amplification) applied.
|
||||
* Type: ALfloat.
|
||||
* Range: ]0.0- ]
|
||||
* A value of 1.0 means un-attenuated/unchanged.
|
||||
* Each division by 2 equals an attenuation of -6dB.
|
||||
* Each multiplicaton with 2 equals an amplification of +6dB.
|
||||
* A value of 0.0 is meaningless with respect to a logarithmic
|
||||
* scale; it is interpreted as zero volume - the channel
|
||||
* is effectively disabled.
|
||||
*/
|
||||
#define AL_GAIN 0x100A
|
||||
|
||||
/*
|
||||
* Indicate minimum source attenuation
|
||||
* Type: ALfloat
|
||||
* Range: [0.0 - 1.0]
|
||||
*
|
||||
* Logarthmic
|
||||
*/
|
||||
#define AL_MIN_GAIN 0x100D
|
||||
|
||||
/**
|
||||
* Indicate maximum source attenuation
|
||||
* Type: ALfloat
|
||||
* Range: [0.0 - 1.0]
|
||||
*
|
||||
* Logarthmic
|
||||
*/
|
||||
#define AL_MAX_GAIN 0x100E
|
||||
|
||||
/**
|
||||
* Indicate listener orientation.
|
||||
*
|
||||
* at/up
|
||||
*/
|
||||
#define AL_ORIENTATION 0x100F
|
||||
|
||||
/**
|
||||
* Source state information.
|
||||
*/
|
||||
#define AL_SOURCE_STATE 0x1010
|
||||
#define AL_INITIAL 0x1011
|
||||
#define AL_PLAYING 0x1012
|
||||
#define AL_PAUSED 0x1013
|
||||
#define AL_STOPPED 0x1014
|
||||
|
||||
/**
|
||||
* Buffer Queue params
|
||||
*/
|
||||
#define AL_BUFFERS_QUEUED 0x1015
|
||||
#define AL_BUFFERS_PROCESSED 0x1016
|
||||
|
||||
/**
|
||||
* Source buffer position information
|
||||
*/
|
||||
#define AL_SEC_OFFSET 0x1024
|
||||
#define AL_SAMPLE_OFFSET 0x1025
|
||||
#define AL_BYTE_OFFSET 0x1026
|
||||
|
||||
/*
|
||||
* Source type (Static, Streaming or undetermined)
|
||||
* Source is Static if a Buffer has been attached using AL_BUFFER
|
||||
* Source is Streaming if one or more Buffers have been attached using alSourceQueueBuffers
|
||||
* Source is undetermined when it has the NULL buffer attached
|
||||
*/
|
||||
#define AL_SOURCE_TYPE 0x1027
|
||||
#define AL_STATIC 0x1028
|
||||
#define AL_STREAMING 0x1029
|
||||
#define AL_UNDETERMINED 0x1030
|
||||
|
||||
/** Sound samples: format specifier. */
|
||||
#define AL_FORMAT_MONO8 0x1100
|
||||
#define AL_FORMAT_MONO16 0x1101
|
||||
#define AL_FORMAT_STEREO8 0x1102
|
||||
#define AL_FORMAT_STEREO16 0x1103
|
||||
|
||||
/**
|
||||
* source specific reference distance
|
||||
* Type: ALfloat
|
||||
* Range: 0.0 - +inf
|
||||
*
|
||||
* At 0.0, no distance attenuation occurs. Default is
|
||||
* 1.0.
|
||||
*/
|
||||
#define AL_REFERENCE_DISTANCE 0x1020
|
||||
|
||||
/**
|
||||
* source specific rolloff factor
|
||||
* Type: ALfloat
|
||||
* Range: 0.0 - +inf
|
||||
*
|
||||
*/
|
||||
#define AL_ROLLOFF_FACTOR 0x1021
|
||||
|
||||
/**
|
||||
* Directional source, outer cone gain.
|
||||
*
|
||||
* Default: 0.0
|
||||
* Range: [0.0 - 1.0]
|
||||
* Logarithmic
|
||||
*/
|
||||
#define AL_CONE_OUTER_GAIN 0x1022
|
||||
|
||||
/**
|
||||
* Indicate distance above which sources are not
|
||||
* attenuated using the inverse clamped distance model.
|
||||
*
|
||||
* Default: +inf
|
||||
* Type: ALfloat
|
||||
* Range: 0.0 - +inf
|
||||
*/
|
||||
#define AL_MAX_DISTANCE 0x1023
|
||||
|
||||
/**
|
||||
* Sound samples: frequency, in units of Hertz [Hz].
|
||||
* This is the number of samples per second. Half of the
|
||||
* sample frequency marks the maximum significant
|
||||
* frequency component.
|
||||
*/
|
||||
#define AL_FREQUENCY 0x2001
|
||||
#define AL_BITS 0x2002
|
||||
#define AL_CHANNELS 0x2003
|
||||
#define AL_SIZE 0x2004
|
||||
|
||||
/**
|
||||
* Buffer state.
|
||||
*
|
||||
* Not supported for public use (yet).
|
||||
*/
|
||||
#define AL_UNUSED 0x2010
|
||||
#define AL_PENDING 0x2011
|
||||
#define AL_PROCESSED 0x2012
|
||||
|
||||
|
||||
/** Errors: No Error. */
|
||||
#define AL_NO_ERROR AL_FALSE
|
||||
|
||||
/**
|
||||
* Invalid Name paramater passed to AL call.
|
||||
*/
|
||||
#define AL_INVALID_NAME 0xA001
|
||||
|
||||
/**
|
||||
* Invalid parameter passed to AL call.
|
||||
*/
|
||||
#define AL_INVALID_ENUM 0xA002
|
||||
|
||||
/**
|
||||
* Invalid enum parameter value.
|
||||
*/
|
||||
#define AL_INVALID_VALUE 0xA003
|
||||
|
||||
/**
|
||||
* Illegal call.
|
||||
*/
|
||||
#define AL_INVALID_OPERATION 0xA004
|
||||
|
||||
|
||||
/**
|
||||
* No mojo.
|
||||
*/
|
||||
#define AL_OUT_OF_MEMORY 0xA005
|
||||
|
||||
|
||||
/** Context strings: Vendor Name. */
|
||||
#define AL_VENDOR 0xB001
|
||||
#define AL_VERSION 0xB002
|
||||
#define AL_RENDERER 0xB003
|
||||
#define AL_EXTENSIONS 0xB004
|
||||
|
||||
/** Global tweakage. */
|
||||
|
||||
/**
|
||||
* Doppler scale. Default 1.0
|
||||
*/
|
||||
#define AL_DOPPLER_FACTOR 0xC000
|
||||
|
||||
/**
|
||||
* Tweaks speed of propagation.
|
||||
*/
|
||||
#define AL_DOPPLER_VELOCITY 0xC001
|
||||
|
||||
/**
|
||||
* Speed of Sound in units per second
|
||||
*/
|
||||
#define AL_SPEED_OF_SOUND 0xC003
|
||||
|
||||
/**
|
||||
* Distance models
|
||||
*
|
||||
* used in conjunction with DistanceModel
|
||||
*
|
||||
* implicit: NONE, which disances distance attenuation.
|
||||
*/
|
||||
#define AL_DISTANCE_MODEL 0xD000
|
||||
#define AL_INVERSE_DISTANCE 0xD001
|
||||
#define AL_INVERSE_DISTANCE_CLAMPED 0xD002
|
||||
#define AL_LINEAR_DISTANCE 0xD003
|
||||
#define AL_LINEAR_DISTANCE_CLAMPED 0xD004
|
||||
#define AL_EXPONENT_DISTANCE 0xD005
|
||||
#define AL_EXPONENT_DISTANCE_CLAMPED 0xD006
|
||||
|
||||
/*
|
||||
* Renderer State management
|
||||
*/
|
||||
AL_API void AL_APIENTRY alEnable( ALenum capability );
|
||||
|
||||
AL_API void AL_APIENTRY alDisable( ALenum capability );
|
||||
|
||||
AL_API ALboolean AL_APIENTRY alIsEnabled( ALenum capability );
|
||||
|
||||
|
||||
/*
|
||||
* State retrieval
|
||||
*/
|
||||
AL_API const ALchar* AL_APIENTRY alGetString( ALenum param );
|
||||
|
||||
AL_API void AL_APIENTRY alGetBooleanv( ALenum param, ALboolean* data );
|
||||
|
||||
AL_API void AL_APIENTRY alGetIntegerv( ALenum param, ALint* data );
|
||||
|
||||
AL_API void AL_APIENTRY alGetFloatv( ALenum param, ALfloat* data );
|
||||
|
||||
AL_API void AL_APIENTRY alGetDoublev( ALenum param, ALdouble* data );
|
||||
|
||||
AL_API ALboolean AL_APIENTRY alGetBoolean( ALenum param );
|
||||
|
||||
AL_API ALint AL_APIENTRY alGetInteger( ALenum param );
|
||||
|
||||
AL_API ALfloat AL_APIENTRY alGetFloat( ALenum param );
|
||||
|
||||
AL_API ALdouble AL_APIENTRY alGetDouble( ALenum param );
|
||||
|
||||
|
||||
/*
|
||||
* Error support.
|
||||
* Obtain the most recent error generated in the AL state machine.
|
||||
*/
|
||||
AL_API ALenum AL_APIENTRY alGetError( void );
|
||||
|
||||
|
||||
/*
|
||||
* Extension support.
|
||||
* Query for the presence of an extension, and obtain any appropriate
|
||||
* function pointers and enum values.
|
||||
*/
|
||||
AL_API ALboolean AL_APIENTRY alIsExtensionPresent( const ALchar* extname );
|
||||
|
||||
AL_API void* AL_APIENTRY alGetProcAddress( const ALchar* fname );
|
||||
|
||||
AL_API ALenum AL_APIENTRY alGetEnumValue( const ALchar* ename );
|
||||
|
||||
|
||||
/*
|
||||
* LISTENER
|
||||
* Listener represents the location and orientation of the
|
||||
* 'user' in 3D-space.
|
||||
*
|
||||
* Properties include: -
|
||||
*
|
||||
* Gain AL_GAIN ALfloat
|
||||
* Position AL_POSITION ALfloat[3]
|
||||
* Velocity AL_VELOCITY ALfloat[3]
|
||||
* Orientation AL_ORIENTATION ALfloat[6] (Forward then Up vectors)
|
||||
*/
|
||||
|
||||
/*
|
||||
* Set Listener parameters
|
||||
*/
|
||||
AL_API void AL_APIENTRY alListenerf( ALenum param, ALfloat value );
|
||||
|
||||
AL_API void AL_APIENTRY alListener3f( ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
|
||||
|
||||
AL_API void AL_APIENTRY alListenerfv( ALenum param, const ALfloat* values );
|
||||
|
||||
AL_API void AL_APIENTRY alListeneri( ALenum param, ALint value );
|
||||
|
||||
AL_API void AL_APIENTRY alListener3i( ALenum param, ALint value1, ALint value2, ALint value3 );
|
||||
|
||||
AL_API void AL_APIENTRY alListeneriv( ALenum param, const ALint* values );
|
||||
|
||||
/*
|
||||
* Get Listener parameters
|
||||
*/
|
||||
AL_API void AL_APIENTRY alGetListenerf( ALenum param, ALfloat* value );
|
||||
|
||||
AL_API void AL_APIENTRY alGetListener3f( ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3 );
|
||||
|
||||
AL_API void AL_APIENTRY alGetListenerfv( ALenum param, ALfloat* values );
|
||||
|
||||
AL_API void AL_APIENTRY alGetListeneri( ALenum param, ALint* value );
|
||||
|
||||
AL_API void AL_APIENTRY alGetListener3i( ALenum param, ALint *value1, ALint *value2, ALint *value3 );
|
||||
|
||||
AL_API void AL_APIENTRY alGetListeneriv( ALenum param, ALint* values );
|
||||
|
||||
|
||||
/**
|
||||
* SOURCE
|
||||
* Sources represent individual sound objects in 3D-space.
|
||||
* Sources take the PCM data provided in the specified Buffer,
|
||||
* apply Source-specific modifications, and then
|
||||
* submit them to be mixed according to spatial arrangement etc.
|
||||
*
|
||||
* Properties include: -
|
||||
*
|
||||
* Gain AL_GAIN ALfloat
|
||||
* Min Gain AL_MIN_GAIN ALfloat
|
||||
* Max Gain AL_MAX_GAIN ALfloat
|
||||
* Position AL_POSITION ALfloat[3]
|
||||
* Velocity AL_VELOCITY ALfloat[3]
|
||||
* Direction AL_DIRECTION ALfloat[3]
|
||||
* Head Relative Mode AL_SOURCE_RELATIVE ALint (AL_TRUE or AL_FALSE)
|
||||
* Reference Distance AL_REFERENCE_DISTANCE ALfloat
|
||||
* Max Distance AL_MAX_DISTANCE ALfloat
|
||||
* RollOff Factor AL_ROLLOFF_FACTOR ALfloat
|
||||
* Inner Angle AL_CONE_INNER_ANGLE ALint or ALfloat
|
||||
* Outer Angle AL_CONE_OUTER_ANGLE ALint or ALfloat
|
||||
* Cone Outer Gain AL_CONE_OUTER_GAIN ALint or ALfloat
|
||||
* Pitch AL_PITCH ALfloat
|
||||
* Looping AL_LOOPING ALint (AL_TRUE or AL_FALSE)
|
||||
* MS Offset AL_MSEC_OFFSET ALint or ALfloat
|
||||
* Byte Offset AL_BYTE_OFFSET ALint or ALfloat
|
||||
* Sample Offset AL_SAMPLE_OFFSET ALint or ALfloat
|
||||
* Attached Buffer AL_BUFFER ALint
|
||||
* State (Query only) AL_SOURCE_STATE ALint
|
||||
* Buffers Queued (Query only) AL_BUFFERS_QUEUED ALint
|
||||
* Buffers Processed (Query only) AL_BUFFERS_PROCESSED ALint
|
||||
*/
|
||||
|
||||
/* Create Source objects */
|
||||
AL_API void AL_APIENTRY alGenSources( ALsizei n, ALuint* sources );
|
||||
|
||||
/* Delete Source objects */
|
||||
AL_API void AL_APIENTRY alDeleteSources( ALsizei n, const ALuint* sources );
|
||||
|
||||
/* Verify a handle is a valid Source */
|
||||
AL_API ALboolean AL_APIENTRY alIsSource( ALuint sid );
|
||||
|
||||
/*
|
||||
* Set Source parameters
|
||||
*/
|
||||
AL_API void AL_APIENTRY alSourcef( ALuint sid, ALenum param, ALfloat value );
|
||||
|
||||
AL_API void AL_APIENTRY alSource3f( ALuint sid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
|
||||
|
||||
AL_API void AL_APIENTRY alSourcefv( ALuint sid, ALenum param, const ALfloat* values );
|
||||
|
||||
AL_API void AL_APIENTRY alSourcei( ALuint sid, ALenum param, ALint value );
|
||||
|
||||
AL_API void AL_APIENTRY alSource3i( ALuint sid, ALenum param, ALint value1, ALint value2, ALint value3 );
|
||||
|
||||
AL_API void AL_APIENTRY alSourceiv( ALuint sid, ALenum param, const ALint* values );
|
||||
|
||||
/*
|
||||
* Get Source parameters
|
||||
*/
|
||||
AL_API void AL_APIENTRY alGetSourcef( ALuint sid, ALenum param, ALfloat* value );
|
||||
|
||||
AL_API void AL_APIENTRY alGetSource3f( ALuint sid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
|
||||
|
||||
AL_API void AL_APIENTRY alGetSourcefv( ALuint sid, ALenum param, ALfloat* values );
|
||||
|
||||
AL_API void AL_APIENTRY alGetSourcei( ALuint sid, ALenum param, ALint* value );
|
||||
|
||||
AL_API void AL_APIENTRY alGetSource3i( ALuint sid, ALenum param, ALint* value1, ALint* value2, ALint* value3);
|
||||
|
||||
AL_API void AL_APIENTRY alGetSourceiv( ALuint sid, ALenum param, ALint* values );
|
||||
|
||||
|
||||
/*
|
||||
* Source vector based playback calls
|
||||
*/
|
||||
|
||||
/* Play, replay, or resume (if paused) a list of Sources */
|
||||
AL_API void AL_APIENTRY alSourcePlayv( ALsizei ns, const ALuint *sids );
|
||||
|
||||
/* Stop a list of Sources */
|
||||
AL_API void AL_APIENTRY alSourceStopv( ALsizei ns, const ALuint *sids );
|
||||
|
||||
/* Rewind a list of Sources */
|
||||
AL_API void AL_APIENTRY alSourceRewindv( ALsizei ns, const ALuint *sids );
|
||||
|
||||
/* Pause a list of Sources */
|
||||
AL_API void AL_APIENTRY alSourcePausev( ALsizei ns, const ALuint *sids );
|
||||
|
||||
/*
|
||||
* Source based playback calls
|
||||
*/
|
||||
|
||||
/* Play, replay, or resume a Source */
|
||||
AL_API void AL_APIENTRY alSourcePlay( ALuint sid );
|
||||
|
||||
/* Stop a Source */
|
||||
AL_API void AL_APIENTRY alSourceStop( ALuint sid );
|
||||
|
||||
/* Rewind a Source (set playback postiton to beginning) */
|
||||
AL_API void AL_APIENTRY alSourceRewind( ALuint sid );
|
||||
|
||||
/* Pause a Source */
|
||||
AL_API void AL_APIENTRY alSourcePause( ALuint sid );
|
||||
|
||||
/*
|
||||
* Source Queuing
|
||||
*/
|
||||
AL_API void AL_APIENTRY alSourceQueueBuffers( ALuint sid, ALsizei numEntries, const ALuint *bids );
|
||||
|
||||
AL_API void AL_APIENTRY alSourceUnqueueBuffers( ALuint sid, ALsizei numEntries, ALuint *bids );
|
||||
|
||||
|
||||
/**
|
||||
* BUFFER
|
||||
* Buffer objects are storage space for sample data.
|
||||
* Buffers are referred to by Sources. One Buffer can be used
|
||||
* by multiple Sources.
|
||||
*
|
||||
* Properties include: -
|
||||
*
|
||||
* Frequency (Query only) AL_FREQUENCY ALint
|
||||
* Size (Query only) AL_SIZE ALint
|
||||
* Bits (Query only) AL_BITS ALint
|
||||
* Channels (Query only) AL_CHANNELS ALint
|
||||
*/
|
||||
|
||||
/* Create Buffer objects */
|
||||
AL_API void AL_APIENTRY alGenBuffers( ALsizei n, ALuint* buffers );
|
||||
|
||||
/* Delete Buffer objects */
|
||||
AL_API void AL_APIENTRY alDeleteBuffers( ALsizei n, const ALuint* buffers );
|
||||
|
||||
/* Verify a handle is a valid Buffer */
|
||||
AL_API ALboolean AL_APIENTRY alIsBuffer( ALuint bid );
|
||||
|
||||
/* Specify the data to be copied into a buffer */
|
||||
AL_API void AL_APIENTRY alBufferData( ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq );
|
||||
|
||||
/*
|
||||
* Set Buffer parameters
|
||||
*/
|
||||
AL_API void AL_APIENTRY alBufferf( ALuint bid, ALenum param, ALfloat value );
|
||||
|
||||
AL_API void AL_APIENTRY alBuffer3f( ALuint bid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
|
||||
|
||||
AL_API void AL_APIENTRY alBufferfv( ALuint bid, ALenum param, const ALfloat* values );
|
||||
|
||||
AL_API void AL_APIENTRY alBufferi( ALuint bid, ALenum param, ALint value );
|
||||
|
||||
AL_API void AL_APIENTRY alBuffer3i( ALuint bid, ALenum param, ALint value1, ALint value2, ALint value3 );
|
||||
|
||||
AL_API void AL_APIENTRY alBufferiv( ALuint bid, ALenum param, const ALint* values );
|
||||
|
||||
/*
|
||||
* Get Buffer parameters
|
||||
*/
|
||||
AL_API void AL_APIENTRY alGetBufferf( ALuint bid, ALenum param, ALfloat* value );
|
||||
|
||||
AL_API void AL_APIENTRY alGetBuffer3f( ALuint bid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
|
||||
|
||||
AL_API void AL_APIENTRY alGetBufferfv( ALuint bid, ALenum param, ALfloat* values );
|
||||
|
||||
AL_API void AL_APIENTRY alGetBufferi( ALuint bid, ALenum param, ALint* value );
|
||||
|
||||
AL_API void AL_APIENTRY alGetBuffer3i( ALuint bid, ALenum param, ALint* value1, ALint* value2, ALint* value3);
|
||||
|
||||
AL_API void AL_APIENTRY alGetBufferiv( ALuint bid, ALenum param, ALint* values );
|
||||
|
||||
|
||||
/*
|
||||
* Global Parameters
|
||||
*/
|
||||
AL_API void AL_APIENTRY alDopplerFactor( ALfloat value );
|
||||
|
||||
AL_API void AL_APIENTRY alDopplerVelocity( ALfloat value );
|
||||
|
||||
AL_API void AL_APIENTRY alSpeedOfSound( ALfloat value );
|
||||
|
||||
AL_API void AL_APIENTRY alDistanceModel( ALenum distanceModel );
|
||||
|
||||
/*
|
||||
* Pointer-to-function types, useful for dynamically getting AL entry points.
|
||||
*/
|
||||
typedef void (AL_APIENTRY *LPALENABLE)( ALenum capability );
|
||||
typedef void (AL_APIENTRY *LPALDISABLE)( ALenum capability );
|
||||
typedef ALboolean (AL_APIENTRY *LPALISENABLED)( ALenum capability );
|
||||
typedef const ALchar* (AL_APIENTRY *LPALGETSTRING)( ALenum param );
|
||||
typedef void (AL_APIENTRY *LPALGETBOOLEANV)( ALenum param, ALboolean* data );
|
||||
typedef void (AL_APIENTRY *LPALGETINTEGERV)( ALenum param, ALint* data );
|
||||
typedef void (AL_APIENTRY *LPALGETFLOATV)( ALenum param, ALfloat* data );
|
||||
typedef void (AL_APIENTRY *LPALGETDOUBLEV)( ALenum param, ALdouble* data );
|
||||
typedef ALboolean (AL_APIENTRY *LPALGETBOOLEAN)( ALenum param );
|
||||
typedef ALint (AL_APIENTRY *LPALGETINTEGER)( ALenum param );
|
||||
typedef ALfloat (AL_APIENTRY *LPALGETFLOAT)( ALenum param );
|
||||
typedef ALdouble (AL_APIENTRY *LPALGETDOUBLE)( ALenum param );
|
||||
typedef ALenum (AL_APIENTRY *LPALGETERROR)( void );
|
||||
typedef ALboolean (AL_APIENTRY *LPALISEXTENSIONPRESENT)(const ALchar* extname );
|
||||
typedef void* (AL_APIENTRY *LPALGETPROCADDRESS)( const ALchar* fname );
|
||||
typedef ALenum (AL_APIENTRY *LPALGETENUMVALUE)( const ALchar* ename );
|
||||
typedef void (AL_APIENTRY *LPALLISTENERF)( ALenum param, ALfloat value );
|
||||
typedef void (AL_APIENTRY *LPALLISTENER3F)( ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
|
||||
typedef void (AL_APIENTRY *LPALLISTENERFV)( ALenum param, const ALfloat* values );
|
||||
typedef void (AL_APIENTRY *LPALLISTENERI)( ALenum param, ALint value );
|
||||
typedef void (AL_APIENTRY *LPALLISTENER3I)( ALenum param, ALint value1, ALint value2, ALint value3 );
|
||||
typedef void (AL_APIENTRY *LPALLISTENERIV)( ALenum param, const ALint* values );
|
||||
typedef void (AL_APIENTRY *LPALGETLISTENERF)( ALenum param, ALfloat* value );
|
||||
typedef void (AL_APIENTRY *LPALGETLISTENER3F)( ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3 );
|
||||
typedef void (AL_APIENTRY *LPALGETLISTENERFV)( ALenum param, ALfloat* values );
|
||||
typedef void (AL_APIENTRY *LPALGETLISTENERI)( ALenum param, ALint* value );
|
||||
typedef void (AL_APIENTRY *LPALGETLISTENER3I)( ALenum param, ALint *value1, ALint *value2, ALint *value3 );
|
||||
typedef void (AL_APIENTRY *LPALGETLISTENERIV)( ALenum param, ALint* values );
|
||||
typedef void (AL_APIENTRY *LPALGENSOURCES)( ALsizei n, ALuint* sources );
|
||||
typedef void (AL_APIENTRY *LPALDELETESOURCES)( ALsizei n, const ALuint* sources );
|
||||
typedef ALboolean (AL_APIENTRY *LPALISSOURCE)( ALuint sid );
|
||||
typedef void (AL_APIENTRY *LPALSOURCEF)( ALuint sid, ALenum param, ALfloat value);
|
||||
typedef void (AL_APIENTRY *LPALSOURCE3F)( ALuint sid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
|
||||
typedef void (AL_APIENTRY *LPALSOURCEFV)( ALuint sid, ALenum param, const ALfloat* values );
|
||||
typedef void (AL_APIENTRY *LPALSOURCEI)( ALuint sid, ALenum param, ALint value);
|
||||
typedef void (AL_APIENTRY *LPALSOURCE3I)( ALuint sid, ALenum param, ALint value1, ALint value2, ALint value3 );
|
||||
typedef void (AL_APIENTRY *LPALSOURCEIV)( ALuint sid, ALenum param, const ALint* values );
|
||||
typedef void (AL_APIENTRY *LPALGETSOURCEF)( ALuint sid, ALenum param, ALfloat* value );
|
||||
typedef void (AL_APIENTRY *LPALGETSOURCE3F)( ALuint sid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
|
||||
typedef void (AL_APIENTRY *LPALGETSOURCEFV)( ALuint sid, ALenum param, ALfloat* values );
|
||||
typedef void (AL_APIENTRY *LPALGETSOURCEI)( ALuint sid, ALenum param, ALint* value );
|
||||
typedef void (AL_APIENTRY *LPALGETSOURCE3I)( ALuint sid, ALenum param, ALint* value1, ALint* value2, ALint* value3);
|
||||
typedef void (AL_APIENTRY *LPALGETSOURCEIV)( ALuint sid, ALenum param, ALint* values );
|
||||
typedef void (AL_APIENTRY *LPALSOURCEPLAYV)( ALsizei ns, const ALuint *sids );
|
||||
typedef void (AL_APIENTRY *LPALSOURCESTOPV)( ALsizei ns, const ALuint *sids );
|
||||
typedef void (AL_APIENTRY *LPALSOURCEREWINDV)( ALsizei ns, const ALuint *sids );
|
||||
typedef void (AL_APIENTRY *LPALSOURCEPAUSEV)( ALsizei ns, const ALuint *sids );
|
||||
typedef void (AL_APIENTRY *LPALSOURCEPLAY)( ALuint sid );
|
||||
typedef void (AL_APIENTRY *LPALSOURCESTOP)( ALuint sid );
|
||||
typedef void (AL_APIENTRY *LPALSOURCEREWIND)( ALuint sid );
|
||||
typedef void (AL_APIENTRY *LPALSOURCEPAUSE)( ALuint sid );
|
||||
typedef void (AL_APIENTRY *LPALSOURCEQUEUEBUFFERS)(ALuint sid, ALsizei numEntries, const ALuint *bids );
|
||||
typedef void (AL_APIENTRY *LPALSOURCEUNQUEUEBUFFERS)(ALuint sid, ALsizei numEntries, ALuint *bids );
|
||||
typedef void (AL_APIENTRY *LPALGENBUFFERS)( ALsizei n, ALuint* buffers );
|
||||
typedef void (AL_APIENTRY *LPALDELETEBUFFERS)( ALsizei n, const ALuint* buffers );
|
||||
typedef ALboolean (AL_APIENTRY *LPALISBUFFER)( ALuint bid );
|
||||
typedef void (AL_APIENTRY *LPALBUFFERDATA)( ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq );
|
||||
typedef void (AL_APIENTRY *LPALBUFFERF)( ALuint bid, ALenum param, ALfloat value);
|
||||
typedef void (AL_APIENTRY *LPALBUFFER3F)( ALuint bid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
|
||||
typedef void (AL_APIENTRY *LPALBUFFERFV)( ALuint bid, ALenum param, const ALfloat* values );
|
||||
typedef void (AL_APIENTRY *LPALBUFFERI)( ALuint bid, ALenum param, ALint value);
|
||||
typedef void (AL_APIENTRY *LPALBUFFER3I)( ALuint bid, ALenum param, ALint value1, ALint value2, ALint value3 );
|
||||
typedef void (AL_APIENTRY *LPALBUFFERIV)( ALuint bid, ALenum param, const ALint* values );
|
||||
typedef void (AL_APIENTRY *LPALGETBUFFERF)( ALuint bid, ALenum param, ALfloat* value );
|
||||
typedef void (AL_APIENTRY *LPALGETBUFFER3F)( ALuint bid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
|
||||
typedef void (AL_APIENTRY *LPALGETBUFFERFV)( ALuint bid, ALenum param, ALfloat* values );
|
||||
typedef void (AL_APIENTRY *LPALGETBUFFERI)( ALuint bid, ALenum param, ALint* value );
|
||||
typedef void (AL_APIENTRY *LPALGETBUFFER3I)( ALuint bid, ALenum param, ALint* value1, ALint* value2, ALint* value3);
|
||||
typedef void (AL_APIENTRY *LPALGETBUFFERIV)( ALuint bid, ALenum param, ALint* values );
|
||||
typedef void (AL_APIENTRY *LPALDOPPLERFACTOR)( ALfloat value );
|
||||
typedef void (AL_APIENTRY *LPALDOPPLERVELOCITY)( ALfloat value );
|
||||
typedef void (AL_APIENTRY *LPALSPEEDOFSOUND)( ALfloat value );
|
||||
typedef void (AL_APIENTRY *LPALDISTANCEMODEL)( ALenum distanceModel );
|
||||
|
||||
#if defined(TARGET_OS_MAC) && TARGET_OS_MAC
|
||||
#pragma export off
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* AL_AL_H */
|
281
ExternalLibs/AL/include/alc.h
Normal file
281
ExternalLibs/AL/include/alc.h
Normal file
|
@ -0,0 +1,281 @@
|
|||
#ifndef AL_ALC_H
|
||||
#define AL_ALC_H
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
/* _OPENAL32LIB is deprecated */
|
||||
#if defined(AL_BUILD_LIBRARY) || defined (_OPENAL32LIB)
|
||||
#define ALC_API __declspec(dllexport)
|
||||
#else
|
||||
#define ALC_API __declspec(dllimport)
|
||||
#endif
|
||||
#else
|
||||
#if defined(AL_BUILD_LIBRARY) && defined(HAVE_GCC_VISIBILITY)
|
||||
#define ALC_API __attribute__((visibility("default")))
|
||||
#else
|
||||
#define ALC_API extern
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define ALC_APIENTRY __cdecl
|
||||
#else
|
||||
#define ALC_APIENTRY
|
||||
#endif
|
||||
|
||||
#if defined(TARGET_OS_MAC) && TARGET_OS_MAC
|
||||
#pragma export on
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The ALCAPI, ALCAPIENTRY, and ALC_INVALID macros are deprecated, but are
|
||||
* included for applications porting code from AL 1.0
|
||||
*/
|
||||
#define ALCAPI ALC_API
|
||||
#define ALCAPIENTRY ALC_APIENTRY
|
||||
#define ALC_INVALID 0
|
||||
|
||||
|
||||
#define ALC_VERSION_0_1 1
|
||||
|
||||
typedef struct ALCdevice_struct ALCdevice;
|
||||
typedef struct ALCcontext_struct ALCcontext;
|
||||
|
||||
|
||||
/** 8-bit boolean */
|
||||
typedef char ALCboolean;
|
||||
|
||||
/** character */
|
||||
typedef char ALCchar;
|
||||
|
||||
/** signed 8-bit 2's complement integer */
|
||||
typedef char ALCbyte;
|
||||
|
||||
/** unsigned 8-bit integer */
|
||||
typedef unsigned char ALCubyte;
|
||||
|
||||
/** signed 16-bit 2's complement integer */
|
||||
typedef short ALCshort;
|
||||
|
||||
/** unsigned 16-bit integer */
|
||||
typedef unsigned short ALCushort;
|
||||
|
||||
/** signed 32-bit 2's complement integer */
|
||||
typedef int ALCint;
|
||||
|
||||
/** unsigned 32-bit integer */
|
||||
typedef unsigned int ALCuint;
|
||||
|
||||
/** non-negative 32-bit binary integer size */
|
||||
typedef int ALCsizei;
|
||||
|
||||
/** enumerated 32-bit value */
|
||||
typedef int ALCenum;
|
||||
|
||||
/** 32-bit IEEE754 floating-point */
|
||||
typedef float ALCfloat;
|
||||
|
||||
/** 64-bit IEEE754 floating-point */
|
||||
typedef double ALCdouble;
|
||||
|
||||
/** void type (for opaque pointers only) */
|
||||
typedef void ALCvoid;
|
||||
|
||||
|
||||
/* Enumerant values begin at column 50. No tabs. */
|
||||
|
||||
/* Boolean False. */
|
||||
#define ALC_FALSE 0
|
||||
|
||||
/* Boolean True. */
|
||||
#define ALC_TRUE 1
|
||||
|
||||
/**
|
||||
* followed by <int> Hz
|
||||
*/
|
||||
#define ALC_FREQUENCY 0x1007
|
||||
|
||||
/**
|
||||
* followed by <int> Hz
|
||||
*/
|
||||
#define ALC_REFRESH 0x1008
|
||||
|
||||
/**
|
||||
* followed by AL_TRUE, AL_FALSE
|
||||
*/
|
||||
#define ALC_SYNC 0x1009
|
||||
|
||||
/**
|
||||
* followed by <int> Num of requested Mono (3D) Sources
|
||||
*/
|
||||
#define ALC_MONO_SOURCES 0x1010
|
||||
|
||||
/**
|
||||
* followed by <int> Num of requested Stereo Sources
|
||||
*/
|
||||
#define ALC_STEREO_SOURCES 0x1011
|
||||
|
||||
/**
|
||||
* errors
|
||||
*/
|
||||
|
||||
/**
|
||||
* No error
|
||||
*/
|
||||
#define ALC_NO_ERROR ALC_FALSE
|
||||
|
||||
/**
|
||||
* No device
|
||||
*/
|
||||
#define ALC_INVALID_DEVICE 0xA001
|
||||
|
||||
/**
|
||||
* invalid context ID
|
||||
*/
|
||||
#define ALC_INVALID_CONTEXT 0xA002
|
||||
|
||||
/**
|
||||
* bad enum
|
||||
*/
|
||||
#define ALC_INVALID_ENUM 0xA003
|
||||
|
||||
/**
|
||||
* bad value
|
||||
*/
|
||||
#define ALC_INVALID_VALUE 0xA004
|
||||
|
||||
/**
|
||||
* Out of memory.
|
||||
*/
|
||||
#define ALC_OUT_OF_MEMORY 0xA005
|
||||
|
||||
|
||||
/**
|
||||
* The Specifier string for default device
|
||||
*/
|
||||
#define ALC_DEFAULT_DEVICE_SPECIFIER 0x1004
|
||||
#define ALC_DEVICE_SPECIFIER 0x1005
|
||||
#define ALC_EXTENSIONS 0x1006
|
||||
|
||||
#define ALC_MAJOR_VERSION 0x1000
|
||||
#define ALC_MINOR_VERSION 0x1001
|
||||
|
||||
#define ALC_ATTRIBUTES_SIZE 0x1002
|
||||
#define ALC_ALL_ATTRIBUTES 0x1003
|
||||
|
||||
/**
|
||||
* ALC_ENUMERATE_ALL_EXT enums
|
||||
*/
|
||||
#define ALC_DEFAULT_ALL_DEVICES_SPECIFIER 0x1012
|
||||
#define ALC_ALL_DEVICES_SPECIFIER 0x1013
|
||||
|
||||
/**
|
||||
* Capture extension
|
||||
*/
|
||||
#define ALC_CAPTURE_DEVICE_SPECIFIER 0x310
|
||||
#define ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER 0x311
|
||||
#define ALC_CAPTURE_SAMPLES 0x312
|
||||
|
||||
|
||||
/*
|
||||
* Context Management
|
||||
*/
|
||||
ALC_API ALCcontext * ALC_APIENTRY alcCreateContext( ALCdevice *device, const ALCint* attrlist );
|
||||
|
||||
ALC_API ALCboolean ALC_APIENTRY alcMakeContextCurrent( ALCcontext *context );
|
||||
|
||||
ALC_API void ALC_APIENTRY alcProcessContext( ALCcontext *context );
|
||||
|
||||
ALC_API void ALC_APIENTRY alcSuspendContext( ALCcontext *context );
|
||||
|
||||
ALC_API void ALC_APIENTRY alcDestroyContext( ALCcontext *context );
|
||||
|
||||
ALC_API ALCcontext * ALC_APIENTRY alcGetCurrentContext( void );
|
||||
|
||||
ALC_API ALCdevice* ALC_APIENTRY alcGetContextsDevice( ALCcontext *context );
|
||||
|
||||
|
||||
/*
|
||||
* Device Management
|
||||
*/
|
||||
ALC_API ALCdevice * ALC_APIENTRY alcOpenDevice( const ALCchar *devicename );
|
||||
|
||||
ALC_API ALCboolean ALC_APIENTRY alcCloseDevice( ALCdevice *device );
|
||||
|
||||
|
||||
/*
|
||||
* Error support.
|
||||
* Obtain the most recent Context error
|
||||
*/
|
||||
ALC_API ALCenum ALC_APIENTRY alcGetError( ALCdevice *device );
|
||||
|
||||
|
||||
/*
|
||||
* Extension support.
|
||||
* Query for the presence of an extension, and obtain any appropriate
|
||||
* function pointers and enum values.
|
||||
*/
|
||||
ALC_API ALCboolean ALC_APIENTRY alcIsExtensionPresent( ALCdevice *device, const ALCchar *extname );
|
||||
|
||||
ALC_API void * ALC_APIENTRY alcGetProcAddress( ALCdevice *device, const ALCchar *funcname );
|
||||
|
||||
ALC_API ALCenum ALC_APIENTRY alcGetEnumValue( ALCdevice *device, const ALCchar *enumname );
|
||||
|
||||
|
||||
/*
|
||||
* Query functions
|
||||
*/
|
||||
ALC_API const ALCchar * ALC_APIENTRY alcGetString( ALCdevice *device, ALCenum param );
|
||||
|
||||
ALC_API void ALC_APIENTRY alcGetIntegerv( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *data );
|
||||
|
||||
|
||||
/*
|
||||
* Capture functions
|
||||
*/
|
||||
ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize );
|
||||
|
||||
ALC_API ALCboolean ALC_APIENTRY alcCaptureCloseDevice( ALCdevice *device );
|
||||
|
||||
ALC_API void ALC_APIENTRY alcCaptureStart( ALCdevice *device );
|
||||
|
||||
ALC_API void ALC_APIENTRY alcCaptureStop( ALCdevice *device );
|
||||
|
||||
ALC_API void ALC_APIENTRY alcCaptureSamples( ALCdevice *device, ALCvoid *buffer, ALCsizei samples );
|
||||
|
||||
/*
|
||||
* Pointer-to-function types, useful for dynamically getting ALC entry points.
|
||||
*/
|
||||
typedef ALCcontext * (ALC_APIENTRY *LPALCCREATECONTEXT) (ALCdevice *device, const ALCint *attrlist);
|
||||
typedef ALCboolean (ALC_APIENTRY *LPALCMAKECONTEXTCURRENT)( ALCcontext *context );
|
||||
typedef void (ALC_APIENTRY *LPALCPROCESSCONTEXT)( ALCcontext *context );
|
||||
typedef void (ALC_APIENTRY *LPALCSUSPENDCONTEXT)( ALCcontext *context );
|
||||
typedef void (ALC_APIENTRY *LPALCDESTROYCONTEXT)( ALCcontext *context );
|
||||
typedef ALCcontext * (ALC_APIENTRY *LPALCGETCURRENTCONTEXT)( void );
|
||||
typedef ALCdevice * (ALC_APIENTRY *LPALCGETCONTEXTSDEVICE)( ALCcontext *context );
|
||||
typedef ALCdevice * (ALC_APIENTRY *LPALCOPENDEVICE)( const ALCchar *devicename );
|
||||
typedef ALCboolean (ALC_APIENTRY *LPALCCLOSEDEVICE)( ALCdevice *device );
|
||||
typedef ALCenum (ALC_APIENTRY *LPALCGETERROR)( ALCdevice *device );
|
||||
typedef ALCboolean (ALC_APIENTRY *LPALCISEXTENSIONPRESENT)( ALCdevice *device, const ALCchar *extname );
|
||||
typedef void * (ALC_APIENTRY *LPALCGETPROCADDRESS)(ALCdevice *device, const ALCchar *funcname );
|
||||
typedef ALCenum (ALC_APIENTRY *LPALCGETENUMVALUE)(ALCdevice *device, const ALCchar *enumname );
|
||||
typedef const ALCchar* (ALC_APIENTRY *LPALCGETSTRING)( ALCdevice *device, ALCenum param );
|
||||
typedef void (ALC_APIENTRY *LPALCGETINTEGERV)( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *dest );
|
||||
typedef ALCdevice * (ALC_APIENTRY *LPALCCAPTUREOPENDEVICE)( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize );
|
||||
typedef ALCboolean (ALC_APIENTRY *LPALCCAPTURECLOSEDEVICE)( ALCdevice *device );
|
||||
typedef void (ALC_APIENTRY *LPALCCAPTURESTART)( ALCdevice *device );
|
||||
typedef void (ALC_APIENTRY *LPALCCAPTURESTOP)( ALCdevice *device );
|
||||
typedef void (ALC_APIENTRY *LPALCCAPTURESAMPLES)( ALCdevice *device, ALCvoid *buffer, ALCsizei samples );
|
||||
|
||||
#if defined(TARGET_OS_MAC) && TARGET_OS_MAC
|
||||
#pragma export off
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* AL_ALC_H */
|
BIN
ExternalLibs/AL/lib/linux-x86/libopenal.so.1
Normal file
BIN
ExternalLibs/AL/lib/linux-x86/libopenal.so.1
Normal file
Binary file not shown.
BIN
ExternalLibs/AL/lib/win32/OpenAL32.lib
Normal file
BIN
ExternalLibs/AL/lib/win32/OpenAL32.lib
Normal file
Binary file not shown.
51
ExternalLibs/FTGL/README.txt
Normal file
51
ExternalLibs/FTGL/README.txt
Normal file
|
@ -0,0 +1,51 @@
|
|||
FTGL 2.1
|
||||
5 December 2004
|
||||
|
||||
DESCRIPTION:
|
||||
|
||||
FTGL is a free open source library to enable developers to use arbitrary
|
||||
fonts in their OpenGL (www.opengl.org) applications.
|
||||
Unlike other OpenGL font libraries FTGL uses standard font file formats
|
||||
so doesn't need a preprocessing step to convert the high quality font data
|
||||
into a lesser quality, proprietary format.
|
||||
FTGL uses the Freetype (www.freetype.org) font library to open and 'decode'
|
||||
the fonts. It then takes that output and stores it in a format most efficient
|
||||
for OpenGL rendering.
|
||||
|
||||
Rendering modes supported are
|
||||
- Bit maps
|
||||
- Antialiased Pix maps
|
||||
- Texture maps
|
||||
- Outlines
|
||||
- Polygon meshes
|
||||
- Extruded polygon meshes
|
||||
|
||||
FTGL is designed to be used in commercial quality software. It has been
|
||||
written with performance, robustness and simplicity in mind.
|
||||
|
||||
USAGE:
|
||||
|
||||
FTGLPixmapFont font( "Fonts:Arial");
|
||||
|
||||
font.FaceSize( 72);
|
||||
|
||||
font.render( "Hello World!");
|
||||
|
||||
This library was inspired by gltt, Copyright (C) 1998-1999 Stephane Rehel
|
||||
(http://gltt.sourceforge.net)
|
||||
Bezier curve code contributed by Jed Soane.
|
||||
Demo, Linux port, extrusion code and gltt maintainance by Gerard Lanois.
|
||||
Linux port by Matthias Kretz.
|
||||
Windows port by Andrew Ellerton & Max Rheiner.
|
||||
Bug fixes by Robert Osfield, Marcelo E. Magallon, Markku Rontu, Mark A. Fox,
|
||||
Patrick Rogers, Kai Huettemann.
|
||||
Containers and optimisations by Sebastien Barre.
|
||||
Autoconf Marcelo E. Magallon.
|
||||
Pixmap font modifications by Robert Bell.
|
||||
|
||||
Please contact me if you have any suggestions, feature requests, or problems.
|
||||
|
||||
Henry Maddocks
|
||||
ftgl@opengl.geek.nz
|
||||
http://homepages.paradise.net.nz/henryj/
|
||||
|
124
ExternalLibs/FTGL/include/FTBBox.h
Normal file
124
ExternalLibs/FTGL/include/FTBBox.h
Normal file
|
@ -0,0 +1,124 @@
|
|||
#ifndef __FTBBox__
|
||||
#define __FTBBox__
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
//#include FT_GLYPH_H
|
||||
#include FT_OUTLINE_H
|
||||
|
||||
#include "FTGL.h"
|
||||
#include "FTPoint.h"
|
||||
|
||||
|
||||
/**
|
||||
* FTBBox is a convenience class for handling bounding boxes.
|
||||
*/
|
||||
class FTGL_EXPORT FTBBox
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Default constructor. Bounding box is set to zero.
|
||||
*/
|
||||
FTBBox()
|
||||
: lowerX(0.0f),
|
||||
lowerY(0.0f),
|
||||
lowerZ(0.0f),
|
||||
upperX(0.0f),
|
||||
upperY(0.0f),
|
||||
upperZ(0.0f)
|
||||
{}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
FTBBox( float lx, float ly, float lz, float ux, float uy, float uz)
|
||||
: lowerX(lx),
|
||||
lowerY(ly),
|
||||
lowerZ(lz),
|
||||
upperX(ux),
|
||||
upperY(uy),
|
||||
upperZ(uz)
|
||||
{}
|
||||
|
||||
/**
|
||||
* Constructor. Extracts a bounding box from a freetype glyph. Uses
|
||||
* the control box for the glyph. <code>FT_Glyph_Get_CBox()</code>
|
||||
*
|
||||
* @param glyph A freetype glyph
|
||||
*/
|
||||
FTBBox( FT_GlyphSlot glyph)
|
||||
: lowerX(0.0f),
|
||||
lowerY(0.0f),
|
||||
lowerZ(0.0f),
|
||||
upperX(0.0f),
|
||||
upperY(0.0f),
|
||||
upperZ(0.0f)
|
||||
{
|
||||
FT_BBox bbox;
|
||||
FT_Outline_Get_CBox( &(glyph->outline), &bbox);
|
||||
|
||||
lowerX = static_cast<float>( bbox.xMin) / 64.0f;
|
||||
lowerY = static_cast<float>( bbox.yMin) / 64.0f;
|
||||
lowerZ = 0.0f;
|
||||
upperX = static_cast<float>( bbox.xMax) / 64.0f;
|
||||
upperY = static_cast<float>( bbox.yMax) / 64.0f;
|
||||
upperZ = 0.0f;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~FTBBox()
|
||||
{}
|
||||
|
||||
|
||||
/**
|
||||
* Move the Bounding Box by a vector.
|
||||
*
|
||||
* @param distance The distance to move the bbox in 3D space.
|
||||
*/
|
||||
FTBBox& Move( FTPoint distance)
|
||||
{
|
||||
lowerX += distance.X();
|
||||
lowerY += distance.Y();
|
||||
lowerZ += distance.Z();
|
||||
upperX += distance.X();
|
||||
upperY += distance.Y();
|
||||
upperZ += distance.Z();
|
||||
return *this;
|
||||
}
|
||||
|
||||
FTBBox& operator += ( const FTBBox& bbox)
|
||||
{
|
||||
lowerX = bbox.lowerX < lowerX? bbox.lowerX: lowerX;
|
||||
lowerY = bbox.lowerY < lowerY? bbox.lowerY: lowerY;
|
||||
lowerZ = bbox.lowerZ < lowerZ? bbox.lowerZ: lowerZ;
|
||||
upperX = bbox.upperX > upperX? bbox.upperX: upperX;
|
||||
upperY = bbox.upperY > upperY? bbox.upperY: upperY;
|
||||
upperZ = bbox.upperZ > upperZ? bbox.upperZ: upperZ;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
void SetDepth( float depth)
|
||||
{
|
||||
upperZ = lowerZ + depth;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The bounds of the box
|
||||
*/
|
||||
// Make these ftPoints & private
|
||||
float lowerX, lowerY, lowerZ, upperX, upperY, upperZ;
|
||||
protected:
|
||||
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // __FTBBox__
|
||||
|
76
ExternalLibs/FTGL/include/FTBitmapGlyph.h
Normal file
76
ExternalLibs/FTGL/include/FTBitmapGlyph.h
Normal file
|
@ -0,0 +1,76 @@
|
|||
#ifndef __FTBitmapGlyph__
|
||||
#define __FTBitmapGlyph__
|
||||
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#include FT_GLYPH_H
|
||||
|
||||
#include "FTGL.h"
|
||||
#include "FTGlyph.h"
|
||||
|
||||
|
||||
/**
|
||||
* FTBitmapGlyph is a specialisation of FTGlyph for creating bitmaps.
|
||||
*
|
||||
* It provides the interface between Freetype glyphs and their openGL
|
||||
* Renderable counterparts. This is an abstract class and derived classes
|
||||
* must implement the <code>Render</code> function.
|
||||
*
|
||||
* @see FTGlyphContainer
|
||||
*
|
||||
*/
|
||||
class FTGL_EXPORT FTBitmapGlyph : public FTGlyph
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param glyph The Freetype glyph to be processed
|
||||
*/
|
||||
FTBitmapGlyph( FT_GlyphSlot glyph);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~FTBitmapGlyph();
|
||||
|
||||
/**
|
||||
* Renders this glyph at the current pen position.
|
||||
*
|
||||
* @param pen The current pen position.
|
||||
* @return The advance distance for this glyph.
|
||||
*/
|
||||
virtual const FTPoint& Render( const FTPoint& pen);
|
||||
|
||||
private:
|
||||
/**
|
||||
* The width of the glyph 'image'
|
||||
*/
|
||||
unsigned int destWidth;
|
||||
|
||||
/**
|
||||
* The height of the glyph 'image'
|
||||
*/
|
||||
unsigned int destHeight;
|
||||
|
||||
/**
|
||||
* The pitch of the glyph 'image'
|
||||
*/
|
||||
unsigned int destPitch;
|
||||
|
||||
/**
|
||||
* Vector from the pen position to the topleft corner of the bitmap
|
||||
*/
|
||||
FTPoint pos;
|
||||
|
||||
/**
|
||||
* Pointer to the 'image' data
|
||||
*/
|
||||
unsigned char* data;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // __FTBitmapGlyph__
|
||||
|
130
ExternalLibs/FTGL/include/FTCharToGlyphIndexMap.h
Normal file
130
ExternalLibs/FTGL/include/FTCharToGlyphIndexMap.h
Normal file
|
@ -0,0 +1,130 @@
|
|||
#ifndef __FTCharToGlyphIndexMap__
|
||||
#define __FTCharToGlyphIndexMap__
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "FTGL.h"
|
||||
|
||||
/**
|
||||
* Provides a non-STL alternative to the STL map<unsigned long, unsigned long>
|
||||
* which maps character codes to glyph indices inside FTCharmap.
|
||||
*
|
||||
* Implementation:
|
||||
* - NumberOfBuckets buckets are considered.
|
||||
* - Each bucket has BucketSize entries.
|
||||
* - When the glyph index for the character code C has to be stored, the
|
||||
* bucket this character belongs to is found using 'C div BucketSize'.
|
||||
* If this bucket has not been allocated yet, do it now.
|
||||
* The entry in the bucked is found using 'C mod BucketSize'.
|
||||
* If it is set to IndexNotFound, then the glyph entry has not been set.
|
||||
* - Try to mimic the calls made to the STL map API.
|
||||
*
|
||||
* Caveats:
|
||||
* - The glyph index is now a signed long instead of unsigned long, so
|
||||
* the special value IndexNotFound (= -1) can be used to specify that the
|
||||
* glyph index has not been stored yet.
|
||||
*/
|
||||
class FTGL_EXPORT FTCharToGlyphIndexMap
|
||||
{
|
||||
public:
|
||||
|
||||
typedef unsigned long CharacterCode;
|
||||
typedef signed long GlyphIndex;
|
||||
|
||||
enum
|
||||
{
|
||||
NumberOfBuckets = 256,
|
||||
BucketSize = 256,
|
||||
IndexNotFound = -1
|
||||
};
|
||||
|
||||
FTCharToGlyphIndexMap()
|
||||
{
|
||||
this->Indices = 0;
|
||||
}
|
||||
|
||||
virtual ~FTCharToGlyphIndexMap()
|
||||
{
|
||||
if( this->Indices)
|
||||
{
|
||||
// Free all buckets
|
||||
this->clear();
|
||||
|
||||
// Free main structure
|
||||
delete [] this->Indices;
|
||||
this->Indices = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
if(this->Indices)
|
||||
{
|
||||
for( int i = 0; i < FTCharToGlyphIndexMap::NumberOfBuckets; i++)
|
||||
{
|
||||
if( this->Indices[i])
|
||||
{
|
||||
delete [] this->Indices[i];
|
||||
this->Indices[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const GlyphIndex find( CharacterCode c)
|
||||
{
|
||||
if( !this->Indices)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Find position of char code in buckets
|
||||
div_t pos = div( c, FTCharToGlyphIndexMap::BucketSize);
|
||||
|
||||
if( !this->Indices[pos.quot])
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
const FTCharToGlyphIndexMap::GlyphIndex *ptr = &this->Indices[pos.quot][pos.rem];
|
||||
if( *ptr == FTCharToGlyphIndexMap::IndexNotFound)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return *ptr;
|
||||
}
|
||||
|
||||
void insert( CharacterCode c, GlyphIndex g)
|
||||
{
|
||||
if( !this->Indices)
|
||||
{
|
||||
this->Indices = new GlyphIndex* [FTCharToGlyphIndexMap::NumberOfBuckets];
|
||||
for( int i = 0; i < FTCharToGlyphIndexMap::NumberOfBuckets; i++)
|
||||
{
|
||||
this->Indices[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Find position of char code in buckets
|
||||
div_t pos = div(c, FTCharToGlyphIndexMap::BucketSize);
|
||||
|
||||
// Allocate bucket if does not exist yet
|
||||
if( !this->Indices[pos.quot])
|
||||
{
|
||||
this->Indices[pos.quot] = new GlyphIndex [FTCharToGlyphIndexMap::BucketSize];
|
||||
for( int i = 0; i < FTCharToGlyphIndexMap::BucketSize; i++)
|
||||
{
|
||||
this->Indices[pos.quot][i] = FTCharToGlyphIndexMap::IndexNotFound;
|
||||
}
|
||||
}
|
||||
|
||||
this->Indices[pos.quot][pos.rem] = g;
|
||||
}
|
||||
|
||||
private:
|
||||
GlyphIndex** Indices;
|
||||
};
|
||||
|
||||
|
||||
#endif // __FTCharToGlyphIndexMap__
|
136
ExternalLibs/FTGL/include/FTCharmap.h
Normal file
136
ExternalLibs/FTGL/include/FTCharmap.h
Normal file
|
@ -0,0 +1,136 @@
|
|||
#ifndef __FTCharmap__
|
||||
#define __FTCharmap__
|
||||
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#include FT_GLYPH_H
|
||||
|
||||
#include "FTCharToGlyphIndexMap.h"
|
||||
|
||||
#include "FTGL.h"
|
||||
|
||||
|
||||
/**
|
||||
* FTCharmap takes care of specifying the encoding for a font and mapping
|
||||
* character codes to glyph indices.
|
||||
*
|
||||
* It doesn't preprocess all indices, only on an as needed basis. This may
|
||||
* seem like a performance penalty but it is quicker than using the 'raw'
|
||||
* freetype calls and will save significant amounts of memory when dealing
|
||||
* with unicode encoding
|
||||
*
|
||||
* @see "Freetype 2 Documentation"
|
||||
*
|
||||
*/
|
||||
|
||||
class FTFace;
|
||||
|
||||
class FTGL_EXPORT FTCharmap
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
FTCharmap( FTFace* face);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~FTCharmap();
|
||||
|
||||
/**
|
||||
* Queries for the current character map code.
|
||||
*
|
||||
* @return The current character map code.
|
||||
*/
|
||||
FT_Encoding Encoding() const { return ftEncoding;}
|
||||
|
||||
/**
|
||||
* Sets the character map for the face.
|
||||
* Valid encodings as at Freetype 2.0.4
|
||||
* ft_encoding_none
|
||||
* ft_encoding_symbol
|
||||
* ft_encoding_unicode
|
||||
* ft_encoding_latin_2
|
||||
* ft_encoding_sjis
|
||||
* ft_encoding_gb2312
|
||||
* ft_encoding_big5
|
||||
* ft_encoding_wansung
|
||||
* ft_encoding_johab
|
||||
* ft_encoding_adobe_standard
|
||||
* ft_encoding_adobe_expert
|
||||
* ft_encoding_adobe_custom
|
||||
* ft_encoding_apple_roman
|
||||
*
|
||||
* @param encoding the Freetype encoding symbol. See above.
|
||||
* @return <code>true</code> if charmap was valid and set
|
||||
* correctly. If the requested encoding is
|
||||
* unavailable it will be set to ft_encoding_none.
|
||||
*/
|
||||
bool CharMap( FT_Encoding encoding);
|
||||
|
||||
/**
|
||||
* Get the FTGlyphContainer index of the input character.
|
||||
*
|
||||
* @param characterCode The character code of the requested glyph in
|
||||
* the current encoding eg apple roman.
|
||||
* @return The FTGlyphContainer index for the character or zero
|
||||
* if it wasn't found
|
||||
*/
|
||||
unsigned int GlyphListIndex( const unsigned int characterCode);
|
||||
|
||||
/**
|
||||
* Get the font glyph index of the input character.
|
||||
*
|
||||
* @param characterCode The character code of the requested glyph in
|
||||
* the current encoding eg apple roman.
|
||||
* @return The glyph index for the character.
|
||||
*/
|
||||
unsigned int FontIndex( const unsigned int characterCode);
|
||||
|
||||
/**
|
||||
* Set the FTGlyphContainer index of the character code.
|
||||
*
|
||||
* @param characterCode The character code of the requested glyph in
|
||||
* the current encoding eg apple roman.
|
||||
* @param containerIndex The index into the FTGlyphContainer of the
|
||||
* character code.
|
||||
*/
|
||||
void InsertIndex( const unsigned int characterCode, const unsigned int containerIndex);
|
||||
|
||||
/**
|
||||
* Queries for errors.
|
||||
*
|
||||
* @return The current error code. Zero means no error.
|
||||
*/
|
||||
FT_Error Error() const { return err;}
|
||||
|
||||
private:
|
||||
/**
|
||||
* Current character map code.
|
||||
*/
|
||||
FT_Encoding ftEncoding;
|
||||
|
||||
/**
|
||||
* The current Freetype face.
|
||||
*/
|
||||
const FT_Face ftFace;
|
||||
|
||||
/**
|
||||
* A structure that maps glyph indices to character codes
|
||||
*
|
||||
* < character code, face glyph index>
|
||||
*/
|
||||
typedef FTCharToGlyphIndexMap CharacterMap;
|
||||
CharacterMap charMap;
|
||||
|
||||
/**
|
||||
* Current error code.
|
||||
*/
|
||||
FT_Error err;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // __FTCharmap__
|
88
ExternalLibs/FTGL/include/FTContour.h
Normal file
88
ExternalLibs/FTGL/include/FTContour.h
Normal file
|
@ -0,0 +1,88 @@
|
|||
#ifndef __FTContour__
|
||||
#define __FTContour__
|
||||
|
||||
#include "FTPoint.h"
|
||||
#include "FTVector.h"
|
||||
#include "FTGL.h"
|
||||
|
||||
|
||||
/**
|
||||
* FTContour class is a container of points that describe a vector font
|
||||
* outline. It is used as a container for the output of the bezier curve
|
||||
* evaluator in FTVectoriser.
|
||||
*
|
||||
* @see FTOutlineGlyph
|
||||
* @see FTPolyGlyph
|
||||
* @see FTPoint
|
||||
*/
|
||||
class FTGL_EXPORT FTContour
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param contour
|
||||
* @param pointTags
|
||||
* @param numberOfPoints
|
||||
*/
|
||||
FTContour( FT_Vector* contour, char* pointTags, unsigned int numberOfPoints);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~FTContour()
|
||||
{
|
||||
pointList.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a point at index.
|
||||
*
|
||||
* @param index of the point in the curve.
|
||||
* @return const point reference
|
||||
*/
|
||||
const FTPoint& Point( unsigned int index) const { return pointList[index];}
|
||||
|
||||
/**
|
||||
* How many points define this contour
|
||||
*
|
||||
* @return the number of points in this contour
|
||||
*/
|
||||
size_t PointCount() const { return pointList.size();}
|
||||
|
||||
private:
|
||||
/**
|
||||
* Add a point to this contour. This function tests for duplicate
|
||||
* points.
|
||||
*
|
||||
* @param point The point to be added to the contour.
|
||||
*/
|
||||
inline void AddPoint( FTPoint point);
|
||||
|
||||
inline void AddPoint( float x, float y);
|
||||
|
||||
/**
|
||||
* De Casteljau (bezier) algorithm contributed by Jed Soane
|
||||
* Evaluates a quadratic or conic (second degree) curve
|
||||
*/
|
||||
inline void evaluateQuadraticCurve();
|
||||
|
||||
/**
|
||||
* De Casteljau (bezier) algorithm contributed by Jed Soane
|
||||
* Evaluates a cubic (third degree) curve
|
||||
*/
|
||||
inline void evaluateCubicCurve();
|
||||
|
||||
/**
|
||||
* The list of points in this contour
|
||||
*/
|
||||
typedef FTVector<FTPoint> PointVector;
|
||||
PointVector pointList;
|
||||
|
||||
/**
|
||||
* 2D array storing values of de Casteljau algorithm.
|
||||
*/
|
||||
float controlPoints[4][2];
|
||||
};
|
||||
|
||||
#endif // __FTContour__
|
69
ExternalLibs/FTGL/include/FTExtrdGlyph.h
Normal file
69
ExternalLibs/FTGL/include/FTExtrdGlyph.h
Normal file
|
@ -0,0 +1,69 @@
|
|||
#ifndef __FTExtrdGlyph__
|
||||
#define __FTExtrdGlyph__
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#include FT_GLYPH_H
|
||||
|
||||
#include "FTGL.h"
|
||||
#include "FTGlyph.h"
|
||||
|
||||
class FTVectoriser;
|
||||
|
||||
/**
|
||||
* FTExtrdGlyph is a specialisation of FTGlyph for creating tessellated
|
||||
* extruded polygon glyphs.
|
||||
*
|
||||
* @see FTGlyphContainer
|
||||
* @see FTVectoriser
|
||||
*
|
||||
*/
|
||||
class FTGL_EXPORT FTExtrdGlyph : public FTGlyph
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor. Sets the Error to Invalid_Outline if the glyph isn't an outline.
|
||||
*
|
||||
* @param glyph The Freetype glyph to be processed
|
||||
* @param depth The distance along the z axis to extrude the glyph
|
||||
* @param useDisplayList Enable or disable the use of Display Lists for this glyph
|
||||
* <code>true</code> turns ON display lists.
|
||||
* <code>false</code> turns OFF display lists.
|
||||
*/
|
||||
FTExtrdGlyph( FT_GlyphSlot glyph, float depth, bool useDisplayList);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~FTExtrdGlyph();
|
||||
|
||||
/**
|
||||
* Renders this glyph at the current pen position.
|
||||
*
|
||||
* @param pen The current pen position.
|
||||
* @return The advance distance for this glyph.
|
||||
*/
|
||||
virtual const FTPoint& Render( const FTPoint& pen);
|
||||
|
||||
private:
|
||||
/**
|
||||
* Calculate the normal vector to 2 points. This is 2D and ignores
|
||||
* the z component. The normal will be normalised
|
||||
*
|
||||
* @param a
|
||||
* @param b
|
||||
* @return
|
||||
*/
|
||||
FTPoint GetNormal( const FTPoint &a, const FTPoint &b);
|
||||
|
||||
|
||||
/**
|
||||
* OpenGL display list
|
||||
*/
|
||||
GLuint glList;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // __FTExtrdGlyph__
|
||||
|
147
ExternalLibs/FTGL/include/FTFace.h
Normal file
147
ExternalLibs/FTGL/include/FTFace.h
Normal file
|
@ -0,0 +1,147 @@
|
|||
#ifndef __FTFace__
|
||||
#define __FTFace__
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#include FT_GLYPH_H
|
||||
|
||||
#include "FTGL.h"
|
||||
#include "FTPoint.h"
|
||||
#include "FTSize.h"
|
||||
|
||||
/**
|
||||
* FTFace class provides an abstraction layer for the Freetype Face.
|
||||
*
|
||||
* @see "Freetype 2 Documentation"
|
||||
*
|
||||
*/
|
||||
class FTGL_EXPORT FTFace
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Opens and reads a face file. Error is set.
|
||||
*
|
||||
* @param fontFilePath font file path.
|
||||
*/
|
||||
FTFace( const char* fontFilePath);
|
||||
|
||||
/**
|
||||
* Read face data from an in-memory buffer. Error is set.
|
||||
*
|
||||
* @param pBufferBytes the in-memory buffer
|
||||
* @param bufferSizeInBytes the length of the buffer in bytes
|
||||
*/
|
||||
FTFace( const unsigned char *pBufferBytes, size_t bufferSizeInBytes );
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
* Disposes of the current Freetype Face.
|
||||
*/
|
||||
virtual ~FTFace();
|
||||
|
||||
/**
|
||||
* Attach auxilliary file to font (e.g., font metrics).
|
||||
*
|
||||
* @param fontFilePath auxilliary font file path.
|
||||
* @return <code>true</code> if file has opened
|
||||
* successfully.
|
||||
*/
|
||||
bool Attach( const char* fontFilePath);
|
||||
|
||||
/**
|
||||
* Attach auxilliary data to font (e.g., font metrics) from memory
|
||||
*
|
||||
* @param pBufferBytes the in-memory buffer
|
||||
* @param bufferSizeInBytes the length of the buffer in bytes
|
||||
* @return <code>true</code> if file has opened
|
||||
* successfully.
|
||||
*/
|
||||
bool Attach( const unsigned char *pBufferBytes, size_t bufferSizeInBytes);
|
||||
|
||||
/**
|
||||
* Get the freetype face object..
|
||||
*
|
||||
* @return pointer to an FT_Face.
|
||||
*/
|
||||
FT_Face* Face() const { return ftFace;}
|
||||
|
||||
/**
|
||||
* Sets the char size for the current face.
|
||||
*
|
||||
* This doesn't guarantee that the size was set correctly. Clients
|
||||
* should check errors.
|
||||
*
|
||||
* @param size the face size in points (1/72 inch)
|
||||
* @param res the resolution of the target device.
|
||||
* @return <code>FTSize</code> object
|
||||
*/
|
||||
const FTSize& Size( const unsigned int size, const unsigned int res);
|
||||
|
||||
/**
|
||||
* Get the number of character maps in this face.
|
||||
*
|
||||
* @return character map count.
|
||||
*/
|
||||
unsigned int CharMapCount();
|
||||
|
||||
/**
|
||||
* Get a list of character maps in this face.
|
||||
*
|
||||
* @return pointer to the first encoding.
|
||||
*/
|
||||
FT_Encoding* CharMapList();
|
||||
|
||||
/**
|
||||
* Gets the kerning vector between two glyphs
|
||||
*/
|
||||
FTPoint KernAdvance( unsigned int index1, unsigned int index2);
|
||||
|
||||
/**
|
||||
* Loads and creates a Freetype glyph.
|
||||
*/
|
||||
FT_GlyphSlot Glyph( unsigned int index, FT_Int load_flags);
|
||||
|
||||
/**
|
||||
* Gets the number of glyphs in the current face.
|
||||
*/
|
||||
unsigned int GlyphCount() const { return numGlyphs;}
|
||||
|
||||
/**
|
||||
* Queries for errors.
|
||||
*
|
||||
* @return The current error code.
|
||||
*/
|
||||
FT_Error Error() const { return err; }
|
||||
|
||||
private:
|
||||
/**
|
||||
* The Freetype face
|
||||
*/
|
||||
FT_Face* ftFace;
|
||||
|
||||
/**
|
||||
* The size object associated with this face
|
||||
*/
|
||||
FTSize charSize;
|
||||
|
||||
/**
|
||||
* The number of glyphs in this face
|
||||
*/
|
||||
int numGlyphs;
|
||||
|
||||
FT_Encoding* fontEncodingList;
|
||||
|
||||
/**
|
||||
* This face has kerning tables
|
||||
*/
|
||||
bool hasKerningTable;
|
||||
|
||||
/**
|
||||
* Current error code. Zero means no error.
|
||||
*/
|
||||
FT_Error err;
|
||||
};
|
||||
|
||||
|
||||
#endif // __FTFace__
|
276
ExternalLibs/FTGL/include/FTFont.h
Normal file
276
ExternalLibs/FTGL/include/FTFont.h
Normal file
|
@ -0,0 +1,276 @@
|
|||
#ifndef __FTFont__
|
||||
#define __FTFont__
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
|
||||
#include "FTFace.h"
|
||||
#include "FTGL.h"
|
||||
|
||||
class FTGlyphContainer;
|
||||
class FTGlyph;
|
||||
|
||||
|
||||
/**
|
||||
* FTFont is the public interface for the FTGL library.
|
||||
*
|
||||
* Specific font classes are derived from this class. It uses the helper
|
||||
* classes FTFace and FTSize to access the Freetype library. This class
|
||||
* is abstract and deriving classes must implement the protected
|
||||
* <code>MakeGlyph</code> function to create glyphs of the
|
||||
* appropriate type.
|
||||
*
|
||||
* It is good practice after using these functions to test the error
|
||||
* code returned. <code>FT_Error Error()</code>. Check the freetype file fterrdef.h
|
||||
* for error definitions.
|
||||
*
|
||||
* @see FTFace
|
||||
* @see FTSize
|
||||
* @see FTGlyphContainer
|
||||
* @see FTGlyph
|
||||
*/
|
||||
class FTGL_EXPORT FTFont
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Open and read a font file. Sets Error flag.
|
||||
*
|
||||
* @param fontFilePath font file path.
|
||||
*/
|
||||
FTFont( const char* fontFilePath);
|
||||
|
||||
/**
|
||||
* Open and read a font from a buffer in memory. Sets Error flag.
|
||||
* The buffer is owned by the client and is NOT copied by FTGL. The
|
||||
* pointer must be valid while using FTGL.
|
||||
*
|
||||
* @param pBufferBytes the in-memory buffer
|
||||
* @param bufferSizeInBytes the length of the buffer in bytes
|
||||
*/
|
||||
FTFont( const unsigned char *pBufferBytes, size_t bufferSizeInBytes);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~FTFont();
|
||||
|
||||
/**
|
||||
* Attach auxilliary file to font e.g font metrics.
|
||||
*
|
||||
* Note: not all font formats implement this function.
|
||||
*
|
||||
* @param fontFilePath auxilliary font file path.
|
||||
* @return <code>true</code> if file has been attached
|
||||
* successfully.
|
||||
*/
|
||||
bool Attach( const char* fontFilePath);
|
||||
|
||||
/**
|
||||
* Attach auxilliary data to font e.g font metrics, from memory
|
||||
*
|
||||
* Note: not all font formats implement this function.
|
||||
*
|
||||
* @param pBufferBytes the in-memory buffer
|
||||
* @param bufferSizeInBytes the length of the buffer in bytes
|
||||
* @return <code>true</code> if file has been attached
|
||||
* successfully.
|
||||
*/
|
||||
bool Attach( const unsigned char *pBufferBytes, size_t bufferSizeInBytes);
|
||||
|
||||
/**
|
||||
* Set the character map for the face.
|
||||
*
|
||||
* @param encoding Freetype enumerate for char map code.
|
||||
* @return <code>true</code> if charmap was valid and
|
||||
* set correctly
|
||||
*/
|
||||
bool CharMap( FT_Encoding encoding );
|
||||
|
||||
/**
|
||||
* Get the number of character maps in this face.
|
||||
*
|
||||
* @return character map count.
|
||||
*/
|
||||
unsigned int CharMapCount();
|
||||
|
||||
/**
|
||||
* Get a list of character maps in this face.
|
||||
*
|
||||
* @return pointer to the first encoding.
|
||||
*/
|
||||
FT_Encoding* CharMapList();
|
||||
|
||||
/**
|
||||
* Set the char size for the current face.
|
||||
*
|
||||
* @param size the face size in points (1/72 inch)
|
||||
* @param res the resolution of the target device.
|
||||
* @return <code>true</code> if size was set correctly
|
||||
*/
|
||||
virtual bool FaceSize( const unsigned int size, const unsigned int res = 72);
|
||||
|
||||
/**
|
||||
* Get the current face size in points.
|
||||
*
|
||||
* @return face size
|
||||
*/
|
||||
unsigned int FaceSize() const;
|
||||
|
||||
/**
|
||||
* Set the extrusion distance for the font. Only implemented by
|
||||
* FTGLExtrdFont
|
||||
*
|
||||
* @param depth The extrusion distance.
|
||||
*/
|
||||
virtual void Depth( float depth){}
|
||||
|
||||
/**
|
||||
* Enable or disable the use of Display Lists inside FTGL
|
||||
*
|
||||
* @param useList <code>true</code> turns ON display lists.
|
||||
* <code>false</code> turns OFF display lists.
|
||||
*/
|
||||
void UseDisplayList( bool useList);
|
||||
|
||||
/**
|
||||
* Get the global ascender height for the face.
|
||||
*
|
||||
* @return Ascender height
|
||||
*/
|
||||
float Ascender() const;
|
||||
|
||||
/**
|
||||
* Gets the global descender height for the face.
|
||||
*
|
||||
* @return Descender height
|
||||
*/
|
||||
float Descender() const;
|
||||
|
||||
/**
|
||||
* Gets the line spacing for the font.
|
||||
*
|
||||
* @return Line height
|
||||
*/
|
||||
float LineHeight() const;
|
||||
|
||||
/**
|
||||
* Get the bounding box for a string.
|
||||
*
|
||||
* @param string a char string
|
||||
* @param llx lower left near x coord
|
||||
* @param lly lower left near y coord
|
||||
* @param llz lower left near z coord
|
||||
* @param urx upper right far x coord
|
||||
* @param ury upper right far y coord
|
||||
* @param urz upper right far z coord
|
||||
*/
|
||||
void BBox( const char* string, float& llx, float& lly, float& llz, float& urx, float& ury, float& urz);
|
||||
|
||||
/**
|
||||
* Get the bounding box for a string.
|
||||
*
|
||||
* @param string a wchar_t string
|
||||
* @param llx lower left near x coord
|
||||
* @param lly lower left near y coord
|
||||
* @param llz lower left near z coord
|
||||
* @param urx upper right far x coord
|
||||
* @param ury upper right far y coord
|
||||
* @param urz upper right far z coord
|
||||
*/
|
||||
void BBox( const wchar_t* string, float& llx, float& lly, float& llz, float& urx, float& ury, float& urz);
|
||||
|
||||
/**
|
||||
* Get the advance width for a string.
|
||||
*
|
||||
* @param string a wchar_t string
|
||||
* @return advance width
|
||||
*/
|
||||
float Advance( const wchar_t* string);
|
||||
|
||||
/**
|
||||
* Get the advance width for a string.
|
||||
*
|
||||
* @param string a char string
|
||||
* @return advance width
|
||||
*/
|
||||
float Advance( const char* string);
|
||||
|
||||
/**
|
||||
* Render a string of characters
|
||||
*
|
||||
* @param string 'C' style string to be output.
|
||||
*/
|
||||
virtual void Render( const char* string );
|
||||
|
||||
/**
|
||||
* Render a string of characters
|
||||
*
|
||||
* @param string wchar_t string to be output.
|
||||
*/
|
||||
virtual void Render( const wchar_t* string );
|
||||
|
||||
/**
|
||||
* Queries the Font for errors.
|
||||
*
|
||||
* @return The current error code.
|
||||
*/
|
||||
FT_Error Error() const { return err;}
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Construct a glyph of the correct type.
|
||||
*
|
||||
* Clients must overide the function and return their specialised
|
||||
* FTGlyph.
|
||||
*
|
||||
* @param g The glyph index NOT the char code.
|
||||
* @return An FT****Glyph or <code>null</code> on failure.
|
||||
*/
|
||||
virtual FTGlyph* MakeGlyph( unsigned int g) = 0;
|
||||
|
||||
/**
|
||||
* Current face object
|
||||
*/
|
||||
FTFace face;
|
||||
|
||||
/**
|
||||
* Current size object
|
||||
*/
|
||||
FTSize charSize;
|
||||
|
||||
/**
|
||||
* Flag to enable or disable the use of Display Lists inside FTGL
|
||||
* <code>true</code> turns ON display lists.
|
||||
* <code>false</code> turns OFF display lists.
|
||||
*/
|
||||
bool useDisplayLists;
|
||||
|
||||
/**
|
||||
* Current error code. Zero means no error.
|
||||
*/
|
||||
FT_Error err;
|
||||
|
||||
private:
|
||||
/**
|
||||
* Check that the glyph at <code>chr</code> exist. If not load it.
|
||||
*
|
||||
* @param chr character index
|
||||
* @return <code>true</code> if the glyph can be created.
|
||||
*/
|
||||
inline bool CheckGlyph( const unsigned int chr);
|
||||
|
||||
/**
|
||||
* An object that holds a list of glyphs
|
||||
*/
|
||||
FTGlyphContainer* glyphList;
|
||||
|
||||
/**
|
||||
* Current pen or cursor position;
|
||||
*/
|
||||
FTPoint pen;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // __FTFont__
|
||||
|
91
ExternalLibs/FTGL/include/FTGL.h
Normal file
91
ExternalLibs/FTGL/include/FTGL.h
Normal file
|
@ -0,0 +1,91 @@
|
|||
#ifndef __FTGL__
|
||||
#define __FTGL__
|
||||
|
||||
|
||||
typedef double FTGL_DOUBLE;
|
||||
typedef float FTGL_FLOAT;
|
||||
|
||||
// Fixes for deprecated identifiers in 2.1.5
|
||||
#ifndef FT_OPEN_MEMORY
|
||||
#define FT_OPEN_MEMORY (FT_Open_Flags)1
|
||||
#endif
|
||||
|
||||
#ifndef FT_RENDER_MODE_MONO
|
||||
#define FT_RENDER_MODE_MONO ft_render_mode_mono
|
||||
#endif
|
||||
|
||||
#ifndef FT_RENDER_MODE_NORMAL
|
||||
#define FT_RENDER_MODE_NORMAL ft_render_mode_normal
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
// Under windows avoid including <windows.h> is overrated.
|
||||
// Sure, it can be avoided and "name space pollution" can be
|
||||
// avoided, but why? It really doesn't make that much difference
|
||||
// these days.
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
#ifndef __gl_h_
|
||||
#include <GL/gl.h>
|
||||
//#include <GL/glu.h>
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
// Non windows platforms - don't require nonsense as seen above :-)
|
||||
#if 1
|
||||
#include "GL/gl.h"
|
||||
//#include "GL/glu.h"
|
||||
#else
|
||||
#ifndef __gl_h_
|
||||
#ifdef __APPLE_CC__
|
||||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glu.h>
|
||||
#else
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Required for compatibility with glext.h style function definitions of
|
||||
// OpenGL extensions, such as in src/osg/Point.cpp.
|
||||
#ifndef APIENTRY
|
||||
#define APIENTRY
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Compiler-specific conditional compilation
|
||||
#ifdef _MSC_VER // MS Visual C++
|
||||
|
||||
// Disable various warning.
|
||||
// 4786: template name too long
|
||||
#pragma warning( disable : 4251 )
|
||||
#pragma warning( disable : 4275 )
|
||||
#pragma warning( disable : 4786 )
|
||||
|
||||
// The following definitions control how symbols are exported.
|
||||
// If the target is a static library ensure that FTGL_LIBRARY_STATIC
|
||||
// is defined. If building a dynamic library (ie DLL) ensure the
|
||||
// FTGL_LIBRARY macro is defined, as it will mark symbols for
|
||||
// export. If compiling a project to _use_ the _dynamic_ library
|
||||
// version of the library, no definition is required.
|
||||
#ifdef FTGL_LIBRARY_STATIC // static lib - no special export required
|
||||
# define FTGL_EXPORT
|
||||
#elif FTGL_LIBRARY // dynamic lib - must export/import symbols appropriately.
|
||||
# define FTGL_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
# define FTGL_EXPORT __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#else
|
||||
// Compiler that is not MS Visual C++.
|
||||
// Ensure that the export symbol is defined (and blank)
|
||||
#define FTGL_EXPORT
|
||||
#endif
|
||||
|
||||
#endif // __FTGL__
|
65
ExternalLibs/FTGL/include/FTGLBitmapFont.h
Normal file
65
ExternalLibs/FTGL/include/FTGLBitmapFont.h
Normal file
|
@ -0,0 +1,65 @@
|
|||
#ifndef __FTGLBitmapFont__
|
||||
#define __FTGLBitmapFont__
|
||||
|
||||
#include "FTFont.h"
|
||||
#include "FTGL.h"
|
||||
|
||||
|
||||
class FTGlyph;
|
||||
|
||||
/**
|
||||
* FTGLBitmapFont is a specialisation of the FTFont class for handling
|
||||
* Bitmap fonts
|
||||
*
|
||||
* @see FTFont
|
||||
*/
|
||||
class FTGL_EXPORT FTGLBitmapFont : public FTFont
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Open and read a font file. Sets Error flag.
|
||||
*
|
||||
* @param fontFilePath font file path.
|
||||
*/
|
||||
FTGLBitmapFont( const char* fontFilePath);
|
||||
|
||||
/**
|
||||
* Open and read a font from a buffer in memory. Sets Error flag.
|
||||
*
|
||||
* @param pBufferBytes the in-memory buffer
|
||||
* @param bufferSizeInBytes the length of the buffer in bytes
|
||||
*/
|
||||
FTGLBitmapFont( const unsigned char *pBufferBytes, size_t bufferSizeInBytes);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~FTGLBitmapFont();
|
||||
|
||||
/**
|
||||
* Renders a string of characters
|
||||
*
|
||||
* @param string 'C' style string to be output.
|
||||
*/
|
||||
void Render( const char* string);
|
||||
|
||||
/**
|
||||
* Renders a string of characters
|
||||
*
|
||||
* @param string 'C' style wide string to be output.
|
||||
*/
|
||||
void Render( const wchar_t* string);
|
||||
|
||||
// attributes
|
||||
|
||||
private:
|
||||
/**
|
||||
* Construct a FTBitmapGlyph.
|
||||
*
|
||||
* @param g The glyph index NOT the char code.
|
||||
* @return An FTBitmapGlyph or <code>null</code> on failure.
|
||||
*/
|
||||
inline virtual FTGlyph* MakeGlyph( unsigned int g);
|
||||
|
||||
};
|
||||
#endif // __FTGLBitmapFont__
|
63
ExternalLibs/FTGL/include/FTGLExtrdFont.h
Normal file
63
ExternalLibs/FTGL/include/FTGLExtrdFont.h
Normal file
|
@ -0,0 +1,63 @@
|
|||
#ifndef __FTGLExtrdFont__
|
||||
#define __FTGLExtrdFont__
|
||||
|
||||
#include "FTFont.h"
|
||||
#include "FTGL.h"
|
||||
|
||||
class FTGlyph;
|
||||
|
||||
/**
|
||||
* FTGLExtrdFont is a specialisation of the FTFont class for handling
|
||||
* extruded Polygon fonts
|
||||
*
|
||||
* @see FTFont
|
||||
* @see FTGLPolygonFont
|
||||
*/
|
||||
class FTGL_EXPORT FTGLExtrdFont : public FTFont
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Open and read a font file. Sets Error flag.
|
||||
*
|
||||
* @param fontFilePath font file path.
|
||||
*/
|
||||
FTGLExtrdFont( const char* fontFilePath);
|
||||
|
||||
/**
|
||||
* Open and read a font from a buffer in memory. Sets Error flag.
|
||||
*
|
||||
* @param pBufferBytes the in-memory buffer
|
||||
* @param bufferSizeInBytes the length of the buffer in bytes
|
||||
*/
|
||||
FTGLExtrdFont( const unsigned char *pBufferBytes, size_t bufferSizeInBytes);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~FTGLExtrdFont();
|
||||
|
||||
/**
|
||||
* Set the extrusion distance for the font.
|
||||
*
|
||||
* @param d The extrusion distance.
|
||||
*/
|
||||
void Depth( float d) { depth = d;}
|
||||
|
||||
private:
|
||||
/**
|
||||
* Construct a FTPolyGlyph.
|
||||
*
|
||||
* @param glyphIndex The glyph index NOT the char code.
|
||||
* @return An FTExtrdGlyph or <code>null</code> on failure.
|
||||
*/
|
||||
inline virtual FTGlyph* MakeGlyph( unsigned int glyphIndex);
|
||||
|
||||
/**
|
||||
* The extrusion distance for the font.
|
||||
*/
|
||||
float depth;
|
||||
};
|
||||
|
||||
|
||||
#endif // __FTGLExtrdFont__
|
||||
|
64
ExternalLibs/FTGL/include/FTGLOutlineFont.h
Normal file
64
ExternalLibs/FTGL/include/FTGLOutlineFont.h
Normal file
|
@ -0,0 +1,64 @@
|
|||
#ifndef __FTGLOutlineFont__
|
||||
#define __FTGLOutlineFont__
|
||||
|
||||
|
||||
#include "FTFont.h"
|
||||
#include "FTGL.h"
|
||||
|
||||
class FTGlyph;
|
||||
|
||||
|
||||
/**
|
||||
* FTGLOutlineFont is a specialisation of the FTFont class for handling
|
||||
* Vector Outline fonts
|
||||
*
|
||||
* @see FTFont
|
||||
*/
|
||||
class FTGL_EXPORT FTGLOutlineFont : public FTFont
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Open and read a font file. Sets Error flag.
|
||||
*
|
||||
* @param fontFilePath font file path.
|
||||
*/
|
||||
FTGLOutlineFont( const char* fontFilePath);
|
||||
|
||||
/**
|
||||
* Open and read a font from a buffer in memory. Sets Error flag.
|
||||
*
|
||||
* @param pBufferBytes the in-memory buffer
|
||||
* @param bufferSizeInBytes the length of the buffer in bytes
|
||||
*/
|
||||
FTGLOutlineFont( const unsigned char *pBufferBytes, size_t bufferSizeInBytes);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~FTGLOutlineFont();
|
||||
|
||||
/**
|
||||
* Renders a string of characters
|
||||
*
|
||||
* @param string 'C' style string to be output.
|
||||
*/
|
||||
void Render( const char* string);
|
||||
|
||||
/**
|
||||
* Renders a string of characters
|
||||
*
|
||||
* @param string wchar_t string to be output.
|
||||
*/
|
||||
void Render( const wchar_t* string);
|
||||
|
||||
private:
|
||||
/**
|
||||
* Construct a FTOutlineGlyph.
|
||||
*
|
||||
* @param g The glyph index NOT the char code.
|
||||
* @return An FTOutlineGlyph or <code>null</code> on failure.
|
||||
*/
|
||||
inline virtual FTGlyph* MakeGlyph( unsigned int g);
|
||||
|
||||
};
|
||||
#endif // __FTGLOutlineFont__
|
68
ExternalLibs/FTGL/include/FTGLPixmapFont.h
Normal file
68
ExternalLibs/FTGL/include/FTGLPixmapFont.h
Normal file
|
@ -0,0 +1,68 @@
|
|||
#ifndef __FTGLPixmapFont__
|
||||
#define __FTGLPixmapFont__
|
||||
|
||||
|
||||
#include "FTFont.h"
|
||||
#include "FTGL.h"
|
||||
|
||||
|
||||
class FTGlyph;
|
||||
|
||||
|
||||
/**
|
||||
* FTGLPixmapFont is a specialisation of the FTFont class for handling
|
||||
* Pixmap (Grey Scale) fonts
|
||||
*
|
||||
* @see FTFont
|
||||
*/
|
||||
class FTGL_EXPORT FTGLPixmapFont : public FTFont
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Open and read a font file. Sets Error flag.
|
||||
*
|
||||
* @param fontFilePath font file path.
|
||||
*/
|
||||
FTGLPixmapFont( const char* fontFilePath);
|
||||
|
||||
/**
|
||||
* Open and read a font from a buffer in memory. Sets Error flag.
|
||||
*
|
||||
* @param pBufferBytes the in-memory buffer
|
||||
* @param bufferSizeInBytes the length of the buffer in bytes
|
||||
*/
|
||||
FTGLPixmapFont( const unsigned char *pBufferBytes, size_t bufferSizeInBytes);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~FTGLPixmapFont();
|
||||
|
||||
/**
|
||||
* Renders a string of characters
|
||||
*
|
||||
* @param string 'C' style string to be output.
|
||||
*/
|
||||
void Render( const char* string);
|
||||
|
||||
/**
|
||||
* Renders a string of characters
|
||||
*
|
||||
* @param string wchar_t string to be output.
|
||||
*/
|
||||
void Render( const wchar_t* string);
|
||||
|
||||
private:
|
||||
/**
|
||||
* Construct a FTPixmapGlyph.
|
||||
*
|
||||
* @param g The glyph index NOT the char code.
|
||||
* @return An FTPixmapGlyph or <code>null</code> on failure.
|
||||
*/
|
||||
inline virtual FTGlyph* MakeGlyph( unsigned int g);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // __FTGLPixmapFont__
|
||||
|
53
ExternalLibs/FTGL/include/FTGLPolygonFont.h
Normal file
53
ExternalLibs/FTGL/include/FTGLPolygonFont.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
#ifndef __FTGLPolygonFont__
|
||||
#define __FTGLPolygonFont__
|
||||
|
||||
|
||||
#include "FTFont.h"
|
||||
#include "FTGL.h"
|
||||
|
||||
class FTGlyph;
|
||||
|
||||
|
||||
/**
|
||||
* FTGLPolygonFont is a specialisation of the FTFont class for handling
|
||||
* tesselated Polygon Mesh fonts
|
||||
*
|
||||
* @see FTFont
|
||||
*/
|
||||
class FTGL_EXPORT FTGLPolygonFont : public FTFont
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Open and read a font file. Sets Error flag.
|
||||
*
|
||||
* @param fontFilePath font file path.
|
||||
*/
|
||||
FTGLPolygonFont( const char* fontFilePath);
|
||||
|
||||
/**
|
||||
* Open and read a font from a buffer in memory. Sets Error flag.
|
||||
*
|
||||
* @param pBufferBytes the in-memory buffer
|
||||
* @param bufferSizeInBytes the length of the buffer in bytes
|
||||
*/
|
||||
FTGLPolygonFont( const unsigned char *pBufferBytes, size_t bufferSizeInBytes);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~FTGLPolygonFont();
|
||||
|
||||
private:
|
||||
/**
|
||||
* Construct a FTPolyGlyph.
|
||||
*
|
||||
* @param g The glyph index NOT the char code.
|
||||
* @return An FTPolyGlyph or <code>null</code> on failure.
|
||||
*/
|
||||
inline virtual FTGlyph* MakeGlyph( unsigned int g);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // __FTGLPolygonFont__
|
||||
|
151
ExternalLibs/FTGL/include/FTGLTextureFont.h
Normal file
151
ExternalLibs/FTGL/include/FTGLTextureFont.h
Normal file
|
@ -0,0 +1,151 @@
|
|||
#ifndef __FTGLTextureFont__
|
||||
#define __FTGLTextureFont__
|
||||
|
||||
#include "FTFont.h"
|
||||
#include "FTVector.h"
|
||||
#include "FTGL.h"
|
||||
|
||||
class FTTextureGlyph;
|
||||
|
||||
|
||||
/**
|
||||
* FTGLTextureFont is a specialisation of the FTFont class for handling
|
||||
* Texture mapped fonts
|
||||
*
|
||||
* @see FTFont
|
||||
*/
|
||||
class FTGL_EXPORT FTGLTextureFont : public FTFont
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Open and read a font file. Sets Error flag.
|
||||
*
|
||||
* @param fontFilePath font file path.
|
||||
*/
|
||||
FTGLTextureFont( const char* fontFilePath);
|
||||
|
||||
/**
|
||||
* Open and read a font from a buffer in memory. Sets Error flag.
|
||||
*
|
||||
* @param pBufferBytes the in-memory buffer
|
||||
* @param bufferSizeInBytes the length of the buffer in bytes
|
||||
*/
|
||||
FTGLTextureFont( const unsigned char *pBufferBytes, size_t bufferSizeInBytes);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~FTGLTextureFont();
|
||||
|
||||
/**
|
||||
* Set the char size for the current face.
|
||||
*
|
||||
* @param size the face size in points (1/72 inch)
|
||||
* @param res the resolution of the target device.
|
||||
* @return <code>true</code> if size was set correctly
|
||||
*/
|
||||
virtual bool FaceSize( const unsigned int size, const unsigned int res = 72);
|
||||
|
||||
/**
|
||||
* Renders a string of characters
|
||||
*
|
||||
* @param string 'C' style string to be output.
|
||||
*/
|
||||
virtual void Render( const char* string);
|
||||
|
||||
/**
|
||||
* Renders a string of characters
|
||||
*
|
||||
* @param string wchar_t string to be output.
|
||||
*/
|
||||
virtual void Render( const wchar_t* string);
|
||||
|
||||
|
||||
private:
|
||||
/**
|
||||
* Construct a FTTextureGlyph.
|
||||
*
|
||||
* @param glyphIndex The glyph index NOT the char code.
|
||||
* @return An FTTextureGlyph or <code>null</code> on failure.
|
||||
*/
|
||||
inline virtual FTGlyph* MakeGlyph( unsigned int glyphIndex);
|
||||
|
||||
/**
|
||||
* Get the size of a block of memory required to layout the glyphs
|
||||
*
|
||||
* Calculates a width and height based on the glyph sizes and the
|
||||
* number of glyphs. It over estimates.
|
||||
*/
|
||||
inline void CalculateTextureSize();
|
||||
|
||||
/**
|
||||
* Creates a 'blank' OpenGL texture object.
|
||||
*
|
||||
* The format is GL_ALPHA and the params are
|
||||
* GL_TEXTURE_WRAP_S = GL_CLAMP
|
||||
* GL_TEXTURE_WRAP_T = GL_CLAMP
|
||||
* GL_TEXTURE_MAG_FILTER = GL_LINEAR
|
||||
* GL_TEXTURE_MIN_FILTER = GL_LINEAR
|
||||
* Note that mipmapping is NOT used
|
||||
*/
|
||||
inline GLuint CreateTexture();
|
||||
|
||||
/**
|
||||
* The maximum texture dimension on this OpenGL implemetation
|
||||
*/
|
||||
GLsizei maximumGLTextureSize;
|
||||
|
||||
/**
|
||||
* The minimum texture width required to hold the glyphs
|
||||
*/
|
||||
GLsizei textureWidth;
|
||||
|
||||
/**
|
||||
* The minimum texture height required to hold the glyphs
|
||||
*/
|
||||
GLsizei textureHeight;
|
||||
|
||||
/**
|
||||
*An array of texture ids
|
||||
*/
|
||||
FTVector<GLuint> textureIDList;
|
||||
|
||||
/**
|
||||
* The max height for glyphs in the current font
|
||||
*/
|
||||
int glyphHeight;
|
||||
|
||||
/**
|
||||
* The max width for glyphs in the current font
|
||||
*/
|
||||
int glyphWidth;
|
||||
|
||||
/**
|
||||
* A value to be added to the height and width to ensure that
|
||||
* glyphs don't overlap in the texture
|
||||
*/
|
||||
unsigned int padding;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
unsigned int numGlyphs;
|
||||
|
||||
/**
|
||||
*/
|
||||
unsigned int remGlyphs;
|
||||
|
||||
/**
|
||||
*/
|
||||
int xOffset;
|
||||
|
||||
/**
|
||||
*/
|
||||
int yOffset;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // __FTGLTextureFont__
|
||||
|
||||
|
101
ExternalLibs/FTGL/include/FTGlyph.h
Normal file
101
ExternalLibs/FTGL/include/FTGlyph.h
Normal file
|
@ -0,0 +1,101 @@
|
|||
#ifndef __FTGlyph__
|
||||
#define __FTGlyph__
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#include FT_GLYPH_H
|
||||
|
||||
#include "FTBBox.h"
|
||||
#include "FTPoint.h"
|
||||
#include "FTGL.h"
|
||||
|
||||
|
||||
/**
|
||||
* FTGlyph is the base class for FTGL glyphs.
|
||||
*
|
||||
* It provides the interface between Freetype glyphs and their openGL
|
||||
* renderable counterparts. This is an abstract class and derived classes
|
||||
* must implement the <code>render</code> function.
|
||||
*
|
||||
* @see FTGlyphContainer
|
||||
* @see FTBBox
|
||||
* @see FTPoint
|
||||
*
|
||||
*/
|
||||
class FTGL_EXPORT FTGlyph
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param glyph The Freetype glyph to be processed
|
||||
* @param useDisplayList Enable or disable the use of Display Lists for this glyph
|
||||
* <code>true</code> turns ON display lists.
|
||||
* <code>false</code> turns OFF display lists.
|
||||
*/
|
||||
FTGlyph( FT_GlyphSlot glyph, bool useDisplayList = true);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~FTGlyph();
|
||||
|
||||
/**
|
||||
* Renders this glyph at the current pen position.
|
||||
*
|
||||
* @param pen The current pen position.
|
||||
* @return The advance distance for this glyph.
|
||||
*/
|
||||
virtual const FTPoint& Render( const FTPoint& pen) = 0;
|
||||
|
||||
/**
|
||||
* Return the advance width for this glyph.
|
||||
*
|
||||
* @return advance width.
|
||||
*/
|
||||
const FTPoint& Advance() const { return advance;}
|
||||
|
||||
/**
|
||||
* Return the bounding box for this glyph.
|
||||
*
|
||||
* @return bounding box.
|
||||
*/
|
||||
const FTBBox& BBox() const { return bBox;}
|
||||
|
||||
/**
|
||||
* Queries for errors.
|
||||
*
|
||||
* @return The current error code.
|
||||
*/
|
||||
FT_Error Error() const { return err;}
|
||||
|
||||
protected:
|
||||
/**
|
||||
* The advance distance for this glyph
|
||||
*/
|
||||
FTPoint advance;
|
||||
|
||||
/**
|
||||
* The bounding box of this glyph.
|
||||
*/
|
||||
FTBBox bBox;
|
||||
|
||||
/**
|
||||
* Flag to enable or disable the use of Display Lists inside FTGL
|
||||
* <code>true</code> turns ON display lists.
|
||||
* <code>false</code> turns OFF display lists.
|
||||
*/
|
||||
bool useDisplayList;
|
||||
|
||||
/**
|
||||
* Current error code. Zero means no error.
|
||||
*/
|
||||
FT_Error err;
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // __FTGlyph__
|
||||
|
127
ExternalLibs/FTGL/include/FTGlyphContainer.h
Normal file
127
ExternalLibs/FTGL/include/FTGlyphContainer.h
Normal file
|
@ -0,0 +1,127 @@
|
|||
#ifndef __FTGlyphContainer__
|
||||
#define __FTGlyphContainer__
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#include FT_GLYPH_H
|
||||
|
||||
#include "FTGL.h"
|
||||
#include "FTBBox.h"
|
||||
#include "FTPoint.h"
|
||||
#include "FTVector.h"
|
||||
|
||||
class FTFace;
|
||||
class FTGlyph;
|
||||
class FTCharmap;
|
||||
|
||||
/**
|
||||
* FTGlyphContainer holds the post processed FTGlyph objects.
|
||||
*
|
||||
* @see FTGlyph
|
||||
*/
|
||||
class FTGL_EXPORT FTGlyphContainer
|
||||
{
|
||||
typedef FTVector<FTGlyph*> GlyphVector;
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param face The Freetype face
|
||||
*/
|
||||
FTGlyphContainer( FTFace* face);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~FTGlyphContainer();
|
||||
|
||||
/**
|
||||
* Sets the character map for the face.
|
||||
*
|
||||
* @param encoding the Freetype encoding symbol. See above.
|
||||
* @return <code>true</code> if charmap was valid
|
||||
* and set correctly
|
||||
*/
|
||||
bool CharMap( FT_Encoding encoding);
|
||||
|
||||
/**
|
||||
* Get the font index of the input character.
|
||||
*
|
||||
* @param characterCode The character code of the requested glyph in the
|
||||
* current encoding eg apple roman.
|
||||
* @return The font index for the character.
|
||||
*/
|
||||
unsigned int FontIndex( const unsigned int characterCode ) const;
|
||||
|
||||
/**
|
||||
* Adds a glyph to this glyph list.
|
||||
*
|
||||
* @param glyph The FTGlyph to be inserted into the container
|
||||
* @param characterCode The char code of the glyph NOT the glyph index.
|
||||
*/
|
||||
void Add( FTGlyph* glyph, const unsigned int characterCode);
|
||||
|
||||
/**
|
||||
* Get a glyph from the glyph list
|
||||
*
|
||||
* @param characterCode The char code of the glyph NOT the glyph index
|
||||
* @return An FTGlyph or <code>null</code> is it hasn't been
|
||||
* loaded.
|
||||
*/
|
||||
const FTGlyph* const Glyph( const unsigned int characterCode) const;
|
||||
|
||||
/**
|
||||
* Get the bounding box for a character.
|
||||
* @param characterCode The char code of the glyph NOT the glyph index
|
||||
*/
|
||||
FTBBox BBox( const unsigned int characterCode) const;
|
||||
|
||||
/**
|
||||
* Returns the kerned advance width for a glyph.
|
||||
*
|
||||
* @param characterCode glyph index of the character
|
||||
* @param nextCharacterCode the next glyph in a string
|
||||
* @return advance width
|
||||
*/
|
||||
float Advance( const unsigned int characterCode, const unsigned int nextCharacterCode);
|
||||
|
||||
/**
|
||||
* Renders a character
|
||||
* @param characterCode the glyph to be Rendered
|
||||
* @param nextCharacterCode the next glyph in the string. Used for kerning.
|
||||
* @param penPosition the position to Render the glyph
|
||||
* @return The distance to advance the pen position after Rendering
|
||||
*/
|
||||
FTPoint Render( const unsigned int characterCode, const unsigned int nextCharacterCode, FTPoint penPosition);
|
||||
|
||||
/**
|
||||
* Queries the Font for errors.
|
||||
*
|
||||
* @return The current error code.
|
||||
*/
|
||||
FT_Error Error() const { return err;}
|
||||
|
||||
private:
|
||||
/**
|
||||
* The FTGL face
|
||||
*/
|
||||
FTFace* face;
|
||||
|
||||
/**
|
||||
* The Character Map object associated with the current face
|
||||
*/
|
||||
FTCharmap* charMap;
|
||||
|
||||
/**
|
||||
* A structure to hold the glyphs
|
||||
*/
|
||||
GlyphVector glyphs;
|
||||
|
||||
/**
|
||||
* Current error code. Zero means no error.
|
||||
*/
|
||||
FT_Error err;
|
||||
};
|
||||
|
||||
|
||||
#endif // __FTGlyphContainer__
|
97
ExternalLibs/FTGL/include/FTLibrary.h
Normal file
97
ExternalLibs/FTGL/include/FTLibrary.h
Normal file
|
@ -0,0 +1,97 @@
|
|||
#ifndef __FTLibrary__
|
||||
#define __FTLibrary__
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
//#include FT_CACHE_H
|
||||
|
||||
#include "FTGL.h"
|
||||
|
||||
|
||||
/**
|
||||
* FTLibrary class is the global accessor for the Freetype library.
|
||||
*
|
||||
* This class encapsulates the Freetype Library. This is a singleton class
|
||||
* and ensures that only one FT_Library is in existence at any one time.
|
||||
* All constructors are private therefore clients cannot create or
|
||||
* instantiate this class themselves and must access it's methods via the
|
||||
* static <code>FTLibrary::Instance()</code> function.
|
||||
*
|
||||
* Just because this class returns a valid <code>FTLibrary</code> object
|
||||
* doesn't mean that the Freetype Library has been successfully initialised.
|
||||
* Clients should check for errors. You can initialse the library AND check
|
||||
* for errors using the following code...
|
||||
* <code>err = FTLibrary::Instance().Error();</code>
|
||||
*
|
||||
* @see "Freetype 2 Documentation"
|
||||
*
|
||||
*/
|
||||
class FTGL_EXPORT FTLibrary
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Global acces point to the single FTLibrary object.
|
||||
*
|
||||
* @return The global <code>FTLibrary</code> object.
|
||||
*/
|
||||
static const FTLibrary& Instance();
|
||||
|
||||
/**
|
||||
* Gets a pointer to the native Freetype library.
|
||||
*
|
||||
* @return A handle to a FreeType library instance.
|
||||
*/
|
||||
const FT_Library* const GetLibrary() const { return library;}
|
||||
|
||||
/**
|
||||
* Queries the library for errors.
|
||||
*
|
||||
* @return The current error code.
|
||||
*/
|
||||
FT_Error Error() const { return err;}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*
|
||||
* Disposes of the Freetype library
|
||||
*/
|
||||
~FTLibrary();
|
||||
|
||||
private:
|
||||
/**
|
||||
* Default constructors.
|
||||
*
|
||||
* Made private to stop clients creating there own FTLibrary
|
||||
* objects.
|
||||
*/
|
||||
FTLibrary();
|
||||
FTLibrary( const FT_Library&){}
|
||||
FTLibrary& operator=( const FT_Library&) { return *this; }
|
||||
|
||||
/**
|
||||
* Initialises the Freetype library
|
||||
*
|
||||
* Even though this function indicates success via the return value,
|
||||
* clients can't see this so must check the error codes. This function
|
||||
* is only ever called by the default c_stor
|
||||
*
|
||||
* @return <code>true</code> if the Freetype library was
|
||||
* successfully initialised, <code>false</code>
|
||||
* otherwise.
|
||||
*/
|
||||
bool Initialise();
|
||||
|
||||
/**
|
||||
* Freetype library handle.
|
||||
*/
|
||||
FT_Library* library;
|
||||
// FTC_Manager* manager;
|
||||
|
||||
/**
|
||||
* Current error code. Zero means no error.
|
||||
*/
|
||||
FT_Error err;
|
||||
|
||||
};
|
||||
|
||||
#endif // __FTLibrary__
|
112
ExternalLibs/FTGL/include/FTList.h
Normal file
112
ExternalLibs/FTGL/include/FTList.h
Normal file
|
@ -0,0 +1,112 @@
|
|||
#ifndef __FTList__
|
||||
#define __FTList__
|
||||
|
||||
#include "FTGL.h"
|
||||
|
||||
/**
|
||||
* Provides a non-STL alternative to the STL list
|
||||
*/
|
||||
template <typename FT_LIST_ITEM_TYPE>
|
||||
class FTGL_EXPORT FTList
|
||||
{
|
||||
public:
|
||||
typedef FT_LIST_ITEM_TYPE value_type;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
typedef size_t size_type;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
FTList()
|
||||
: listSize(0),
|
||||
tail(0)
|
||||
{
|
||||
tail = NULL;
|
||||
head = new Node;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~FTList()
|
||||
{
|
||||
Node* next;
|
||||
|
||||
for( Node *walk = head; walk; walk = next)
|
||||
{
|
||||
next = walk->next;
|
||||
delete walk;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of items in the list
|
||||
*/
|
||||
size_type size() const
|
||||
{
|
||||
return listSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an item to the end of the list
|
||||
*/
|
||||
void push_back( const value_type& item)
|
||||
{
|
||||
Node* node = new Node( item);
|
||||
|
||||
if( head->next == NULL)
|
||||
{
|
||||
head->next = node;
|
||||
}
|
||||
|
||||
if( tail)
|
||||
{
|
||||
tail->next = node;
|
||||
}
|
||||
tail = node;
|
||||
++listSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the item at the front of the list
|
||||
*/
|
||||
reference front() const
|
||||
{
|
||||
return head->next->payload;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the item at the end of the list
|
||||
*/
|
||||
reference back() const
|
||||
{
|
||||
return tail->payload;
|
||||
}
|
||||
|
||||
private:
|
||||
struct Node
|
||||
{
|
||||
Node()
|
||||
: next(NULL)
|
||||
{}
|
||||
|
||||
Node( const value_type& item)
|
||||
: next(NULL)
|
||||
{
|
||||
payload = item;
|
||||
}
|
||||
|
||||
Node* next;
|
||||
|
||||
value_type payload;
|
||||
};
|
||||
|
||||
size_type listSize;
|
||||
|
||||
Node* head;
|
||||
Node* tail;
|
||||
};
|
||||
|
||||
#endif // __FTList__
|
||||
|
57
ExternalLibs/FTGL/include/FTOutlineGlyph.h
Normal file
57
ExternalLibs/FTGL/include/FTOutlineGlyph.h
Normal file
|
@ -0,0 +1,57 @@
|
|||
#ifndef __FTOutlineGlyph__
|
||||
#define __FTOutlineGlyph__
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#include FT_GLYPH_H
|
||||
|
||||
#include "FTGL.h"
|
||||
#include "FTGlyph.h"
|
||||
|
||||
class FTVectoriser;
|
||||
|
||||
|
||||
/**
|
||||
* FTOutlineGlyph is a specialisation of FTGlyph for creating outlines.
|
||||
*
|
||||
* @see FTGlyphContainer
|
||||
* @see FTVectoriser
|
||||
*
|
||||
*/
|
||||
class FTGL_EXPORT FTOutlineGlyph : public FTGlyph
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor. Sets the Error to Invalid_Outline if the glyphs isn't an outline.
|
||||
*
|
||||
* @param glyph The Freetype glyph to be processed
|
||||
* @param useDisplayList Enable or disable the use of Display Lists for this glyph
|
||||
* <code>true</code> turns ON display lists.
|
||||
* <code>false</code> turns OFF display lists.
|
||||
*/
|
||||
FTOutlineGlyph( FT_GlyphSlot glyph, bool useDisplayList);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~FTOutlineGlyph();
|
||||
|
||||
/**
|
||||
* Renders this glyph at the current pen position.
|
||||
*
|
||||
* @param pen The current pen position.
|
||||
* @return The advance distance for this glyph.
|
||||
*/
|
||||
virtual const FTPoint& Render( const FTPoint& pen);
|
||||
|
||||
private:
|
||||
/**
|
||||
* OpenGL display list
|
||||
*/
|
||||
GLuint glList;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // __FTOutlineGlyph__
|
||||
|
68
ExternalLibs/FTGL/include/FTPixmapGlyph.h
Normal file
68
ExternalLibs/FTGL/include/FTPixmapGlyph.h
Normal file
|
@ -0,0 +1,68 @@
|
|||
#ifndef __FTPixmapGlyph__
|
||||
#define __FTPixmapGlyph__
|
||||
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#include FT_GLYPH_H
|
||||
|
||||
#include "FTGL.h"
|
||||
#include "FTGlyph.h"
|
||||
|
||||
|
||||
/**
|
||||
* FTPixmapGlyph is a specialisation of FTGlyph for creating pixmaps.
|
||||
*
|
||||
* @see FTGlyphContainer
|
||||
*
|
||||
*/
|
||||
class FTGL_EXPORT FTPixmapGlyph : public FTGlyph
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param glyph The Freetype glyph to be processed
|
||||
*/
|
||||
FTPixmapGlyph( FT_GlyphSlot glyph);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~FTPixmapGlyph();
|
||||
|
||||
/**
|
||||
* Renders this glyph at the current pen position.
|
||||
*
|
||||
* @param pen The current pen position.
|
||||
* @return The advance distance for this glyph.
|
||||
*/
|
||||
virtual const FTPoint& Render( const FTPoint& pen);
|
||||
|
||||
// attributes
|
||||
|
||||
private:
|
||||
/**
|
||||
* The width of the glyph 'image'
|
||||
*/
|
||||
int destWidth;
|
||||
|
||||
/**
|
||||
* The height of the glyph 'image'
|
||||
*/
|
||||
int destHeight;
|
||||
|
||||
/**
|
||||
* Vector from the pen position to the topleft corner of the pixmap
|
||||
*/
|
||||
FTPoint pos;
|
||||
|
||||
/**
|
||||
* Pointer to the 'image' data
|
||||
*/
|
||||
unsigned char* data;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // __FTPixmapGlyph__
|
162
ExternalLibs/FTGL/include/FTPoint.h
Normal file
162
ExternalLibs/FTGL/include/FTPoint.h
Normal file
|
@ -0,0 +1,162 @@
|
|||
#ifndef __FTPoint__
|
||||
#define __FTPoint__
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#include FT_GLYPH_H
|
||||
|
||||
#include "FTGL.h"
|
||||
|
||||
/**
|
||||
* FTPoint class is a basic 3 dimensional point or vector.
|
||||
*/
|
||||
class FTGL_EXPORT FTPoint
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Default constructor. Point is set to zero.
|
||||
*/
|
||||
FTPoint()
|
||||
{
|
||||
values[0] = 0;
|
||||
values[1] = 0;
|
||||
values[2] = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param x First component
|
||||
* @param y Second component
|
||||
* @param z Third component
|
||||
*/
|
||||
FTPoint( const FTGL_DOUBLE x, const FTGL_DOUBLE y, const FTGL_DOUBLE z)
|
||||
{
|
||||
values[0] = x;
|
||||
values[1] = y;
|
||||
values[2] = z;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor. This converts an FT_Vector to an FT_Point
|
||||
*
|
||||
* @param ft_vector A freetype vector
|
||||
*/
|
||||
FTPoint( const FT_Vector& ft_vector)
|
||||
{
|
||||
values[0] = ft_vector.x;
|
||||
values[1] = ft_vector.y;
|
||||
values[2] = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Operator += In Place Addition.
|
||||
*
|
||||
* @param point
|
||||
* @return this plus point.
|
||||
*/
|
||||
FTPoint& operator += ( const FTPoint& point)
|
||||
{
|
||||
values[0] += point.values[0];
|
||||
values[1] += point.values[1];
|
||||
values[2] += point.values[2];
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Operator +
|
||||
*
|
||||
* @param point
|
||||
* @return this plus point.
|
||||
*/
|
||||
FTPoint operator + ( const FTPoint& point)
|
||||
{
|
||||
FTPoint temp;
|
||||
temp.values[0] = values[0] + point.values[0];
|
||||
temp.values[1] = values[1] + point.values[1];
|
||||
temp.values[2] = values[2] + point.values[2];
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Operator *
|
||||
*
|
||||
* @param multiplier
|
||||
* @return <code>this</code> multiplied by <code>multiplier</code>.
|
||||
*/
|
||||
FTPoint operator * ( double multiplier)
|
||||
{
|
||||
FTPoint temp;
|
||||
temp.values[0] = values[0] * multiplier;
|
||||
temp.values[1] = values[1] * multiplier;
|
||||
temp.values[2] = values[2] * multiplier;
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Operator *
|
||||
*
|
||||
* @param point
|
||||
* @param multiplier
|
||||
* @return <code>multiplier</code> multiplied by <code>point</code>.
|
||||
*/
|
||||
friend FTPoint operator*( double multiplier, FTPoint& point);
|
||||
|
||||
|
||||
/**
|
||||
* Operator == Tests for eqaulity
|
||||
*
|
||||
* @param a
|
||||
* @param b
|
||||
* @return true if a & b are equal
|
||||
*/
|
||||
friend bool operator == ( const FTPoint &a, const FTPoint &b);
|
||||
|
||||
/**
|
||||
* Operator != Tests for non equality
|
||||
*
|
||||
* @param a
|
||||
* @param b
|
||||
* @return true if a & b are not equal
|
||||
*/
|
||||
friend bool operator != ( const FTPoint &a, const FTPoint &b);
|
||||
|
||||
|
||||
/**
|
||||
* Cast to FTGL_DOUBLE*
|
||||
*/
|
||||
operator const FTGL_DOUBLE*() const
|
||||
{
|
||||
return values;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Setters
|
||||
*/
|
||||
void X( FTGL_DOUBLE x) { values[0] = x;};
|
||||
void Y( FTGL_DOUBLE y) { values[1] = y;};
|
||||
void Z( FTGL_DOUBLE z) { values[2] = z;};
|
||||
|
||||
|
||||
/**
|
||||
* Getters
|
||||
*/
|
||||
FTGL_DOUBLE X() const { return values[0];};
|
||||
FTGL_DOUBLE Y() const { return values[1];};
|
||||
FTGL_DOUBLE Z() const { return values[2];};
|
||||
|
||||
private:
|
||||
/**
|
||||
* The point data
|
||||
*/
|
||||
FTGL_DOUBLE values[3];
|
||||
};
|
||||
|
||||
#endif // __FTPoint__
|
||||
|
59
ExternalLibs/FTGL/include/FTPolyGlyph.h
Normal file
59
ExternalLibs/FTGL/include/FTPolyGlyph.h
Normal file
|
@ -0,0 +1,59 @@
|
|||
#ifndef __FTPolyGlyph__
|
||||
#define __FTPolyGlyph__
|
||||
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#include FT_GLYPH_H
|
||||
|
||||
#include "FTGL.h"
|
||||
#include "FTGlyph.h"
|
||||
|
||||
class FTVectoriser;
|
||||
|
||||
/**
|
||||
* FTPolyGlyph is a specialisation of FTGlyph for creating tessellated
|
||||
* polygon glyphs.
|
||||
*
|
||||
* @see FTGlyphContainer
|
||||
* @see FTVectoriser
|
||||
*
|
||||
*/
|
||||
class FTGL_EXPORT FTPolyGlyph : public FTGlyph
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor. Sets the Error to Invalid_Outline if the glyphs isn't an outline.
|
||||
*
|
||||
* @param glyph The Freetype glyph to be processed
|
||||
* @param glyph The Freetype glyph to be processed
|
||||
* @param useDisplayList Enable or disable the use of Display Lists for this glyph
|
||||
* <code>true</code> turns ON display lists.
|
||||
* <code>false</code> turns OFF display lists.
|
||||
*/
|
||||
FTPolyGlyph( FT_GlyphSlot glyph, bool useDisplayList);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~FTPolyGlyph();
|
||||
|
||||
/**
|
||||
* Renders this glyph at the current pen position.
|
||||
*
|
||||
* @param pen The current pen position.
|
||||
* @return The advance distance for this glyph.
|
||||
*/
|
||||
virtual const FTPoint& Render( const FTPoint& pen);
|
||||
|
||||
private:
|
||||
/**
|
||||
* OpenGL display list
|
||||
*/
|
||||
GLuint glList;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // __FTPolyGlyph__
|
||||
|
138
ExternalLibs/FTGL/include/FTSize.h
Normal file
138
ExternalLibs/FTGL/include/FTSize.h
Normal file
|
@ -0,0 +1,138 @@
|
|||
#ifndef __FTSize__
|
||||
#define __FTSize__
|
||||
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
|
||||
#include "FTGL.h"
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* FTSize class provides an abstraction layer for the Freetype Size.
|
||||
*
|
||||
* @see "Freetype 2 Documentation"
|
||||
*
|
||||
*/
|
||||
class FTGL_EXPORT FTSize
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
FTSize();
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~FTSize();
|
||||
|
||||
/**
|
||||
* Sets the char size for the current face.
|
||||
*
|
||||
* This doesn't guarantee that the size was set correctly. Clients
|
||||
* should check errors.
|
||||
*
|
||||
* @param face Parent face for this size object
|
||||
* @param point_size the face size in points (1/72 inch)
|
||||
* @param x_resolution the horizontal resolution of the target device.
|
||||
* @param y_resolution the vertical resolution of the target device.
|
||||
* @return <code>true</code> if the size has been set. Clients should check Error() for more information if this function returns false()
|
||||
*/
|
||||
bool CharSize( FT_Face* face, unsigned int point_size, unsigned int x_resolution, unsigned int y_resolution);
|
||||
|
||||
/**
|
||||
* get the char size for the current face.
|
||||
*
|
||||
* @return The char size in points
|
||||
*/
|
||||
unsigned int CharSize() const;
|
||||
|
||||
/**
|
||||
* Gets the global ascender height for the face in pixels.
|
||||
*
|
||||
* @return Ascender height
|
||||
*/
|
||||
float Ascender() const;
|
||||
|
||||
/**
|
||||
* Gets the global descender height for the face in pixels.
|
||||
*
|
||||
* @return Ascender height
|
||||
*/
|
||||
float Descender() const;
|
||||
|
||||
/**
|
||||
* Gets the global face height for the face.
|
||||
*
|
||||
* If the face is scalable this returns the height of the global
|
||||
* bounding box which ensures that any glyph will be less than or
|
||||
* equal to this height. If the font isn't scalable there is no
|
||||
* guarantee that glyphs will not be taller than this value.
|
||||
*
|
||||
* @return height in pixels.
|
||||
*/
|
||||
float Height() const;
|
||||
|
||||
/**
|
||||
* Gets the global face width for the face.
|
||||
*
|
||||
* If the face is scalable this returns the width of the global
|
||||
* bounding box which ensures that any glyph will be less than or
|
||||
* equal to this width. If the font isn't scalable this value is
|
||||
* the max_advance for the face.
|
||||
*
|
||||
* @return width in pixels.
|
||||
*/
|
||||
float Width() const;
|
||||
|
||||
/**
|
||||
* Gets the underline position for the face.
|
||||
*
|
||||
* @return underline position in pixels
|
||||
*/
|
||||
float Underline() const;
|
||||
|
||||
/**
|
||||
* Queries for errors.
|
||||
*
|
||||
* @return The current error code.
|
||||
*/
|
||||
FT_Error Error() const { return err; }
|
||||
|
||||
private:
|
||||
/**
|
||||
* The current Freetype face that this FTSize object relates to.
|
||||
*/
|
||||
FT_Face* ftFace;
|
||||
|
||||
/**
|
||||
* The Freetype size.
|
||||
*/
|
||||
FT_Size ftSize;
|
||||
|
||||
/**
|
||||
* The size in points.
|
||||
*/
|
||||
unsigned int size;
|
||||
|
||||
/**
|
||||
* The horizontal resolution.
|
||||
*/
|
||||
unsigned int xResolution;
|
||||
|
||||
/**
|
||||
* The vertical resolution.
|
||||
*/
|
||||
unsigned int yResolution;
|
||||
|
||||
/**
|
||||
* Current error code. Zero means no error.
|
||||
*/
|
||||
FT_Error err;
|
||||
|
||||
};
|
||||
|
||||
#endif // __FTSize__
|
||||
|
94
ExternalLibs/FTGL/include/FTTextureGlyph.h
Normal file
94
ExternalLibs/FTGL/include/FTTextureGlyph.h
Normal file
|
@ -0,0 +1,94 @@
|
|||
#ifndef __FTTextureGlyph__
|
||||
#define __FTTextureGlyph__
|
||||
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#include FT_GLYPH_H
|
||||
|
||||
#include "FTGL.h"
|
||||
#include "FTGlyph.h"
|
||||
|
||||
|
||||
/**
|
||||
* FTTextureGlyph is a specialisation of FTGlyph for creating texture
|
||||
* glyphs.
|
||||
*
|
||||
* @see FTGlyphContainer
|
||||
*
|
||||
*/
|
||||
class FTGL_EXPORT FTTextureGlyph : public FTGlyph
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param glyph The Freetype glyph to be processed
|
||||
* @param id The id of the texture that this glyph will be
|
||||
* drawn in
|
||||
* @param xOffset The x offset into the parent texture to draw
|
||||
* this glyph
|
||||
* @param yOffset The y offset into the parent texture to draw
|
||||
* this glyph
|
||||
* @param width The width of the parent texture
|
||||
* @param height The height (number of rows) of the parent texture
|
||||
*/
|
||||
FTTextureGlyph( FT_GlyphSlot glyph, int id, int xOffset, int yOffset, GLsizei width, GLsizei height);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~FTTextureGlyph();
|
||||
|
||||
/**
|
||||
* Renders this glyph at the current pen position.
|
||||
*
|
||||
* @param pen The current pen position.
|
||||
* @return The advance distance for this glyph.
|
||||
*/
|
||||
virtual const FTPoint& Render( const FTPoint& pen);
|
||||
|
||||
/**
|
||||
* Reset the currently active texture to zero to get into a known state before
|
||||
* drawing a string. This is to get round possible threading issues.
|
||||
*/
|
||||
static void ResetActiveTexture(){ activeTextureID = 0;}
|
||||
|
||||
private:
|
||||
/**
|
||||
* The width of the glyph 'image'
|
||||
*/
|
||||
int destWidth;
|
||||
|
||||
/**
|
||||
* The height of the glyph 'image'
|
||||
*/
|
||||
int destHeight;
|
||||
|
||||
/**
|
||||
* Vector from the pen position to the topleft corner of the pixmap
|
||||
*/
|
||||
FTPoint pos;
|
||||
|
||||
/**
|
||||
* The texture co-ords of this glyph within the texture.
|
||||
*/
|
||||
FTPoint uv[2];
|
||||
|
||||
/**
|
||||
* The texture index that this glyph is contained in.
|
||||
*/
|
||||
int glTextureID;
|
||||
|
||||
/**
|
||||
* The texture index of the currently active texture
|
||||
*
|
||||
* We keep track of the currently active texture to try to reduce the number
|
||||
* of texture bind operations.
|
||||
*/
|
||||
static GLint activeTextureID;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // __FTTextureGlyph__
|
190
ExternalLibs/FTGL/include/FTVector.h
Normal file
190
ExternalLibs/FTGL/include/FTVector.h
Normal file
|
@ -0,0 +1,190 @@
|
|||
#ifndef __FTVector__
|
||||
#define __FTVector__
|
||||
|
||||
#include "FTGL.h"
|
||||
|
||||
/**
|
||||
* Provides a non-STL alternative to the STL vector
|
||||
*/
|
||||
template <typename FT_VECTOR_ITEM_TYPE>
|
||||
class FTGL_EXPORT FTVector
|
||||
{
|
||||
public:
|
||||
typedef FT_VECTOR_ITEM_TYPE value_type;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
typedef value_type* iterator;
|
||||
typedef const value_type* const_iterator;
|
||||
typedef size_t size_type;
|
||||
|
||||
FTVector()
|
||||
{
|
||||
Capacity = Size = 0;
|
||||
Items = 0;
|
||||
}
|
||||
|
||||
|
||||
virtual ~FTVector()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
FTVector& operator =(const FTVector& v)
|
||||
{
|
||||
reserve(v.capacity());
|
||||
|
||||
iterator ptr = begin();
|
||||
const_iterator vbegin = v.begin();
|
||||
const_iterator vend = v.end();
|
||||
|
||||
while( vbegin != vend)
|
||||
{
|
||||
*ptr++ = *vbegin++;
|
||||
}
|
||||
|
||||
Size = v.size();
|
||||
return *this;
|
||||
}
|
||||
|
||||
size_type size() const
|
||||
{
|
||||
return Size;
|
||||
}
|
||||
|
||||
size_type capacity() const
|
||||
{
|
||||
return Capacity;
|
||||
}
|
||||
|
||||
iterator begin()
|
||||
{
|
||||
return Items;
|
||||
}
|
||||
|
||||
const_iterator begin() const
|
||||
{
|
||||
return Items;
|
||||
}
|
||||
|
||||
iterator end()
|
||||
{
|
||||
return begin() + size();
|
||||
}
|
||||
|
||||
const_iterator end() const
|
||||
{
|
||||
return begin() + size();
|
||||
}
|
||||
|
||||
bool empty() const
|
||||
{
|
||||
return size() == 0;
|
||||
}
|
||||
|
||||
reference operator [](size_type pos)
|
||||
{
|
||||
return( *(begin() + pos));
|
||||
}
|
||||
|
||||
const_reference operator []( size_type pos) const
|
||||
{
|
||||
return( *(begin() + pos));
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
if( Capacity)
|
||||
{
|
||||
delete [] Items;
|
||||
Capacity = Size = 0;
|
||||
Items = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void reserve( size_type n)
|
||||
{
|
||||
if( capacity() < n)
|
||||
{
|
||||
expand(n);
|
||||
}
|
||||
}
|
||||
|
||||
void push_back(const value_type& x)
|
||||
{
|
||||
if( size() == capacity())
|
||||
{
|
||||
expand();
|
||||
}
|
||||
|
||||
( *this)[size()] = x;
|
||||
++Size;
|
||||
}
|
||||
|
||||
void resize(size_type n, value_type x)
|
||||
{
|
||||
if( n == size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
reserve(n);
|
||||
iterator begin, end;
|
||||
|
||||
if( n >= Size)
|
||||
{
|
||||
begin = this->end();
|
||||
end = this->begin() + n;
|
||||
}
|
||||
else
|
||||
{
|
||||
begin = this->begin() + n;
|
||||
end = this->end();
|
||||
}
|
||||
|
||||
while( begin != end)
|
||||
{
|
||||
*begin++ = x;
|
||||
}
|
||||
|
||||
Size = n;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
void expand(size_type capacity_hint = 0)
|
||||
{
|
||||
size_type new_capacity =( capacity() == 0) ? 256 : capacity()* 2;
|
||||
if( capacity_hint)
|
||||
{
|
||||
while( new_capacity < capacity_hint)
|
||||
{
|
||||
new_capacity *= 2;
|
||||
}
|
||||
}
|
||||
|
||||
value_type *new_items = new value_type[new_capacity];
|
||||
|
||||
iterator begin = this->begin();
|
||||
iterator end = this->end();
|
||||
value_type *ptr = new_items;
|
||||
|
||||
while( begin != end)
|
||||
{
|
||||
*ptr++ = *begin++;
|
||||
}
|
||||
|
||||
if( Capacity)
|
||||
{
|
||||
delete [] Items;
|
||||
}
|
||||
|
||||
Items = new_items;
|
||||
Capacity = new_capacity;
|
||||
}
|
||||
|
||||
size_type Capacity;
|
||||
size_type Size;
|
||||
value_type* Items;
|
||||
};
|
||||
|
||||
#endif // __FTVector__
|
275
ExternalLibs/FTGL/include/FTVectoriser.h
Normal file
275
ExternalLibs/FTGL/include/FTVectoriser.h
Normal file
|
@ -0,0 +1,275 @@
|
|||
#ifndef __FTVectoriser__
|
||||
#define __FTVectoriser__
|
||||
|
||||
|
||||
#include "FTContour.h"
|
||||
#include "FTList.h"
|
||||
#include "FTPoint.h"
|
||||
#include "FTVector.h"
|
||||
#include "FTGL.h"
|
||||
|
||||
|
||||
#ifndef CALLBACK
|
||||
#define CALLBACK
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* FTTesselation captures points that are output by OpenGL's gluTesselator.
|
||||
*/
|
||||
class FTGL_EXPORT FTTesselation
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
FTTesselation( GLenum m)
|
||||
: meshType(m)
|
||||
{
|
||||
pointList.reserve( 128);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~FTTesselation()
|
||||
{
|
||||
pointList.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a point to the mesh.
|
||||
*/
|
||||
void AddPoint( const FTGL_DOUBLE x, const FTGL_DOUBLE y, const FTGL_DOUBLE z)
|
||||
{
|
||||
pointList.push_back( FTPoint( x, y, z));
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of points in this mesh
|
||||
*/
|
||||
size_t PointCount() const { return pointList.size();}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
const FTPoint& Point( unsigned int index) const { return pointList[index];}
|
||||
|
||||
/**
|
||||
* Return the OpenGL polygon type.
|
||||
*/
|
||||
GLenum PolygonType() const { return meshType;}
|
||||
|
||||
private:
|
||||
/**
|
||||
* Points generated by gluTesselator.
|
||||
*/
|
||||
typedef FTVector<FTPoint> PointVector;
|
||||
PointVector pointList;
|
||||
|
||||
/**
|
||||
* OpenGL primitive type from gluTesselator.
|
||||
*/
|
||||
GLenum meshType;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* FTMesh is a container of FTTesselation's that make up a polygon glyph
|
||||
*/
|
||||
class FTGL_EXPORT FTMesh
|
||||
{
|
||||
typedef FTVector<FTTesselation*> TesselationVector;
|
||||
typedef FTList<FTPoint> PointList;
|
||||
|
||||
public:
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
FTMesh();
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~FTMesh();
|
||||
|
||||
/**
|
||||
* Add a point to the mesh
|
||||
*/
|
||||
void AddPoint( const FTGL_DOUBLE x, const FTGL_DOUBLE y, const FTGL_DOUBLE z);
|
||||
|
||||
/**
|
||||
* Create a combine point for the gluTesselator
|
||||
*/
|
||||
const FTGL_DOUBLE* Combine( const FTGL_DOUBLE x, const FTGL_DOUBLE y, const FTGL_DOUBLE z);
|
||||
|
||||
/**
|
||||
* Begin a new polygon
|
||||
*/
|
||||
void Begin( GLenum meshType);
|
||||
|
||||
/**
|
||||
* End a polygon
|
||||
*/
|
||||
void End();
|
||||
|
||||
/**
|
||||
* Record a gluTesselation error
|
||||
*/
|
||||
void Error( GLenum e) { err = e;}
|
||||
|
||||
/**
|
||||
* The number of tesselations in the mesh
|
||||
*/
|
||||
unsigned int TesselationCount() const { return tesselationList.size();}
|
||||
|
||||
/**
|
||||
* Get a tesselation by index
|
||||
*/
|
||||
const FTTesselation* const Tesselation( unsigned int index) const;
|
||||
|
||||
/**
|
||||
* Return the temporary point list. For testing only.
|
||||
*/
|
||||
const PointList& TempPointList() const { return tempPointList;}
|
||||
|
||||
/**
|
||||
* Get the GL ERROR returned by the glu tesselator
|
||||
*/
|
||||
GLenum Error() const { return err;}
|
||||
|
||||
private:
|
||||
/**
|
||||
* The current sub mesh that we are constructing.
|
||||
*/
|
||||
FTTesselation* currentTesselation;
|
||||
|
||||
/**
|
||||
* Holds each sub mesh that comprises this glyph.
|
||||
*/
|
||||
TesselationVector tesselationList;
|
||||
|
||||
/**
|
||||
* Holds extra points created by gluTesselator. See ftglCombine.
|
||||
*/
|
||||
PointList tempPointList;
|
||||
|
||||
/**
|
||||
* GL ERROR returned by the glu tesselator
|
||||
*/
|
||||
GLenum err;
|
||||
|
||||
};
|
||||
|
||||
const FTGL_DOUBLE FTGL_FRONT_FACING = 1.0;
|
||||
const FTGL_DOUBLE FTGL_BACK_FACING = -1.0;
|
||||
|
||||
/**
|
||||
* FTVectoriser class is a helper class that converts font outlines into
|
||||
* point data.
|
||||
*
|
||||
* @see FTExtrdGlyph
|
||||
* @see FTOutlineGlyph
|
||||
* @see FTPolyGlyph
|
||||
* @see FTContour
|
||||
* @see FTPoint
|
||||
*
|
||||
*/
|
||||
class FTGL_EXPORT FTVectoriser
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param glyph The freetype glyph to be processed
|
||||
*/
|
||||
FTVectoriser( const FT_GlyphSlot glyph);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~FTVectoriser();
|
||||
|
||||
/**
|
||||
* Build an FTMesh from the vector outline data.
|
||||
*
|
||||
* @param zNormal The direction of the z axis of the normal
|
||||
* for this mesh
|
||||
*/
|
||||
void MakeMesh( FTGL_DOUBLE zNormal = FTGL_FRONT_FACING);
|
||||
|
||||
/**
|
||||
* Get the current mesh.
|
||||
*/
|
||||
const FTMesh* const GetMesh() const { return mesh;}
|
||||
|
||||
/**
|
||||
* Get the total count of points in this outline
|
||||
*
|
||||
* @return the number of points
|
||||
*/
|
||||
size_t PointCount();
|
||||
|
||||
/**
|
||||
* Get the count of contours in this outline
|
||||
*
|
||||
* @return the number of contours
|
||||
*/
|
||||
size_t ContourCount() const { return ftContourCount;}
|
||||
|
||||
/**
|
||||
* Return a contour at index
|
||||
*
|
||||
* @return the number of contours
|
||||
*/
|
||||
const FTContour* const Contour( unsigned int index) const;
|
||||
|
||||
/**
|
||||
* Get the number of points in a specific contour in this outline
|
||||
*
|
||||
* @param c The contour index
|
||||
* @return the number of points in contour[c]
|
||||
*/
|
||||
size_t ContourSize( int c) const { return contourList[c]->PointCount();}
|
||||
|
||||
/**
|
||||
* Get the flag for the tesselation rule for this outline
|
||||
*
|
||||
* @return The contour flag
|
||||
*/
|
||||
int ContourFlag() const { return contourFlag;}
|
||||
|
||||
private:
|
||||
/**
|
||||
* Process the freetype outline data into contours of points
|
||||
*/
|
||||
void ProcessContours();
|
||||
|
||||
/**
|
||||
* The list of contours in the glyph
|
||||
*/
|
||||
FTContour** contourList;
|
||||
|
||||
/**
|
||||
* A Mesh for tesselations
|
||||
*/
|
||||
FTMesh* mesh;
|
||||
|
||||
/**
|
||||
* The number of contours reported by Freetype
|
||||
*/
|
||||
short ftContourCount;
|
||||
|
||||
/**
|
||||
* A flag indicating the tesselation rule for the glyph
|
||||
*/
|
||||
int contourFlag;
|
||||
|
||||
/**
|
||||
* A Freetype outline
|
||||
*/
|
||||
FT_Outline outline;
|
||||
};
|
||||
|
||||
|
||||
#endif // __FTVectoriser__
|
27
ExternalLibs/FTGL/license.txt
Normal file
27
ExternalLibs/FTGL/license.txt
Normal file
|
@ -0,0 +1,27 @@
|
|||
FTGL
|
||||
|
||||
Herewith is a license. I've also chucked in a gnu (see COPYING.txt) license
|
||||
for those that are that way inclined. Basically I want you to use this
|
||||
software and if you think this license is preventing you from doing so
|
||||
let me know.
|
||||
|
||||
Copyright (C) 2001-3 Henry Maddocks
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
66
ExternalLibs/FTGL/src/FTBitmapGlyph.cpp
Normal file
66
ExternalLibs/FTGL/src/FTBitmapGlyph.cpp
Normal file
|
@ -0,0 +1,66 @@
|
|||
#include <string>
|
||||
|
||||
#include "FTBitmapGlyph.h"
|
||||
|
||||
FTBitmapGlyph::FTBitmapGlyph( FT_GlyphSlot glyph)
|
||||
: FTGlyph( glyph),
|
||||
destWidth(0),
|
||||
destHeight(0),
|
||||
data(0)
|
||||
{
|
||||
err = FT_Render_Glyph( glyph, FT_RENDER_MODE_MONO);
|
||||
if( err || ft_glyph_format_bitmap != glyph->format)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
FT_Bitmap bitmap = glyph->bitmap;
|
||||
|
||||
unsigned int srcWidth = bitmap.width;
|
||||
unsigned int srcHeight = bitmap.rows;
|
||||
unsigned int srcPitch = bitmap.pitch;
|
||||
|
||||
destWidth = srcWidth;
|
||||
destHeight = srcHeight;
|
||||
destPitch = srcPitch;
|
||||
|
||||
if( destWidth && destHeight)
|
||||
{
|
||||
data = new unsigned char[destPitch * destHeight];
|
||||
unsigned char* dest = data + (( destHeight - 1) * destPitch);
|
||||
|
||||
unsigned char* src = bitmap.buffer;
|
||||
|
||||
for( unsigned int y = 0; y < srcHeight; ++y)
|
||||
{
|
||||
memcpy( dest, src, srcPitch);
|
||||
dest -= destPitch;
|
||||
src += srcPitch;
|
||||
}
|
||||
}
|
||||
|
||||
pos = FTPoint(glyph->bitmap_left, static_cast<int>(srcHeight) - glyph->bitmap_top, 0.0);
|
||||
}
|
||||
|
||||
|
||||
FTBitmapGlyph::~FTBitmapGlyph()
|
||||
{
|
||||
delete [] data;
|
||||
}
|
||||
|
||||
|
||||
const FTPoint& FTBitmapGlyph::Render( const FTPoint& pen)
|
||||
{
|
||||
glBitmap( 0, 0, 0.0f, 0.0f, pen.X() + pos.X(), pen.Y() - pos.Y(), (const GLubyte*)0 );
|
||||
|
||||
if( data)
|
||||
{
|
||||
glPixelStorei( GL_UNPACK_ROW_LENGTH, destPitch * 8);
|
||||
glBitmap( destWidth, destHeight, 0.0f, 0.0, 0.0, 0.0, (const GLubyte*)data);
|
||||
}
|
||||
|
||||
glBitmap( 0, 0, 0.0f, 0.0f, -pos.X(), pos.Y(), (const GLubyte*)0 );
|
||||
|
||||
return advance;
|
||||
}
|
||||
|
63
ExternalLibs/FTGL/src/FTCharmap.cpp
Normal file
63
ExternalLibs/FTGL/src/FTCharmap.cpp
Normal file
|
@ -0,0 +1,63 @@
|
|||
#include "FTFace.h"
|
||||
#include "FTCharmap.h"
|
||||
|
||||
|
||||
FTCharmap::FTCharmap( FTFace* face)
|
||||
: ftFace( *(face->Face())),
|
||||
err(0)
|
||||
{
|
||||
if( !ftFace->charmap)
|
||||
{
|
||||
err = FT_Set_Charmap( ftFace, ftFace->charmaps[0]);
|
||||
}
|
||||
|
||||
ftEncoding = ftFace->charmap->encoding;
|
||||
}
|
||||
|
||||
|
||||
FTCharmap::~FTCharmap()
|
||||
{
|
||||
charMap.clear();
|
||||
}
|
||||
|
||||
|
||||
bool FTCharmap::CharMap( FT_Encoding encoding)
|
||||
{
|
||||
if( ftEncoding == encoding)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
err = FT_Select_Charmap( ftFace, encoding );
|
||||
|
||||
if( !err)
|
||||
{
|
||||
ftEncoding = encoding;
|
||||
}
|
||||
else
|
||||
{
|
||||
ftEncoding = ft_encoding_none;
|
||||
}
|
||||
|
||||
charMap.clear();
|
||||
return !err;
|
||||
}
|
||||
|
||||
|
||||
unsigned int FTCharmap::GlyphListIndex( unsigned int characterCode )
|
||||
{
|
||||
return charMap.find( characterCode);
|
||||
}
|
||||
|
||||
|
||||
unsigned int FTCharmap::FontIndex( unsigned int characterCode )
|
||||
{
|
||||
return FT_Get_Char_Index( ftFace, characterCode);
|
||||
}
|
||||
|
||||
|
||||
void FTCharmap::InsertIndex( const unsigned int characterCode, const unsigned int containerIndex)
|
||||
{
|
||||
charMap.insert( characterCode, containerIndex);
|
||||
}
|
||||
|
148
ExternalLibs/FTGL/src/FTContour.cpp
Normal file
148
ExternalLibs/FTGL/src/FTContour.cpp
Normal file
|
@ -0,0 +1,148 @@
|
|||
#include "FTContour.h"
|
||||
|
||||
static const float BEZIER_STEP_SIZE = 0.2f;
|
||||
|
||||
|
||||
void FTContour::AddPoint( FTPoint point)
|
||||
{
|
||||
if( pointList.empty() || point != pointList[pointList.size() - 1])
|
||||
{
|
||||
pointList.push_back( point);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FTContour::AddPoint( float x, float y)
|
||||
{
|
||||
AddPoint( FTPoint( x, y, 0.0f));
|
||||
}
|
||||
|
||||
|
||||
void FTContour::evaluateQuadraticCurve()
|
||||
{
|
||||
for( unsigned int i = 0; i <= ( 1.0f / BEZIER_STEP_SIZE); i++)
|
||||
{
|
||||
float bezierValues[2][2];
|
||||
|
||||
float t = static_cast<float>(i) * BEZIER_STEP_SIZE;
|
||||
|
||||
bezierValues[0][0] = (1.0f - t) * controlPoints[0][0] + t * controlPoints[1][0];
|
||||
bezierValues[0][1] = (1.0f - t) * controlPoints[0][1] + t * controlPoints[1][1];
|
||||
|
||||
bezierValues[1][0] = (1.0f - t) * controlPoints[1][0] + t * controlPoints[2][0];
|
||||
bezierValues[1][1] = (1.0f - t) * controlPoints[1][1] + t * controlPoints[2][1];
|
||||
|
||||
bezierValues[0][0] = (1.0f - t) * bezierValues[0][0] + t * bezierValues[1][0];
|
||||
bezierValues[0][1] = (1.0f - t) * bezierValues[0][1] + t * bezierValues[1][1];
|
||||
|
||||
AddPoint( bezierValues[0][0], bezierValues[0][1]);
|
||||
}
|
||||
}
|
||||
|
||||
void FTContour::evaluateCubicCurve()
|
||||
{
|
||||
for( unsigned int i = 0; i <= ( 1.0f / BEZIER_STEP_SIZE); i++)
|
||||
{
|
||||
float bezierValues[3][2];
|
||||
|
||||
float t = static_cast<float>(i) * BEZIER_STEP_SIZE;
|
||||
|
||||
bezierValues[0][0] = (1.0f - t) * controlPoints[0][0] + t * controlPoints[1][0];
|
||||
bezierValues[0][1] = (1.0f - t) * controlPoints[0][1] + t * controlPoints[1][1];
|
||||
|
||||
bezierValues[1][0] = (1.0f - t) * controlPoints[1][0] + t * controlPoints[2][0];
|
||||
bezierValues[1][1] = (1.0f - t) * controlPoints[1][1] + t * controlPoints[2][1];
|
||||
|
||||
bezierValues[2][0] = (1.0f - t) * controlPoints[2][0] + t * controlPoints[3][0];
|
||||
bezierValues[2][1] = (1.0f - t) * controlPoints[2][1] + t * controlPoints[3][1];
|
||||
|
||||
bezierValues[0][0] = (1.0f - t) * bezierValues[0][0] + t * bezierValues[1][0];
|
||||
bezierValues[0][1] = (1.0f - t) * bezierValues[0][1] + t * bezierValues[1][1];
|
||||
|
||||
bezierValues[1][0] = (1.0f - t) * bezierValues[1][0] + t * bezierValues[2][0];
|
||||
bezierValues[1][1] = (1.0f - t) * bezierValues[1][1] + t * bezierValues[2][1];
|
||||
|
||||
bezierValues[0][0] = (1.0f - t) * bezierValues[0][0] + t * bezierValues[1][0];
|
||||
bezierValues[0][1] = (1.0f - t) * bezierValues[0][1] + t * bezierValues[1][1];
|
||||
|
||||
AddPoint( bezierValues[0][0], bezierValues[0][1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FTContour::FTContour( FT_Vector* contour, char* pointTags, unsigned int numberOfPoints)
|
||||
{
|
||||
for( unsigned int pointIndex = 0; pointIndex < numberOfPoints; ++ pointIndex)
|
||||
{
|
||||
char pointTag = pointTags[pointIndex];
|
||||
|
||||
if( pointTag == FT_Curve_Tag_On || numberOfPoints < 2)
|
||||
{
|
||||
AddPoint( contour[pointIndex].x, contour[pointIndex].y);
|
||||
continue;
|
||||
}
|
||||
|
||||
FTPoint controlPoint( contour[pointIndex]);
|
||||
FTPoint previousPoint = ( 0 == pointIndex)
|
||||
? FTPoint( contour[numberOfPoints - 1])
|
||||
: pointList[pointList.size() - 1];
|
||||
|
||||
FTPoint nextPoint = ( pointIndex == numberOfPoints - 1)
|
||||
? pointList[0]
|
||||
: FTPoint( contour[pointIndex + 1]);
|
||||
|
||||
if( pointTag == FT_Curve_Tag_Conic)
|
||||
{
|
||||
char nextPointTag = ( pointIndex == numberOfPoints - 1)
|
||||
? pointTags[0]
|
||||
: pointTags[pointIndex + 1];
|
||||
|
||||
while( nextPointTag == FT_Curve_Tag_Conic)
|
||||
{
|
||||
nextPoint = ( controlPoint + nextPoint) * 0.5f;
|
||||
|
||||
controlPoints[0][0] = previousPoint.X(); controlPoints[0][1] = previousPoint.Y();
|
||||
controlPoints[1][0] = controlPoint.X(); controlPoints[1][1] = controlPoint.Y();
|
||||
controlPoints[2][0] = nextPoint.X(); controlPoints[2][1] = nextPoint.Y();
|
||||
|
||||
evaluateQuadraticCurve();
|
||||
++pointIndex;
|
||||
|
||||
previousPoint = nextPoint;
|
||||
controlPoint = FTPoint( contour[pointIndex]);
|
||||
nextPoint = ( pointIndex == numberOfPoints - 1)
|
||||
? pointList[0]
|
||||
: FTPoint( contour[pointIndex + 1]);
|
||||
nextPointTag = ( pointIndex == numberOfPoints - 1)
|
||||
? pointTags[0]
|
||||
: pointTags[pointIndex + 1];
|
||||
}
|
||||
|
||||
controlPoints[0][0] = previousPoint.X(); controlPoints[0][1] = previousPoint.Y();
|
||||
controlPoints[1][0] = controlPoint.X(); controlPoints[1][1] = controlPoint.Y();
|
||||
controlPoints[2][0] = nextPoint.X(); controlPoints[2][1] = nextPoint.Y();
|
||||
|
||||
evaluateQuadraticCurve();
|
||||
continue;
|
||||
}
|
||||
|
||||
if( pointTag == FT_Curve_Tag_Cubic)
|
||||
{
|
||||
FTPoint controlPoint2 = nextPoint;
|
||||
|
||||
FTPoint nextPoint = ( pointIndex == numberOfPoints - 2)
|
||||
? pointList[0]
|
||||
: FTPoint( contour[pointIndex + 2]);
|
||||
|
||||
controlPoints[0][0] = previousPoint.X(); controlPoints[0][1] = previousPoint.Y();
|
||||
controlPoints[1][0] = controlPoint.X(); controlPoints[1][1] = controlPoint.Y();
|
||||
controlPoints[2][0] = controlPoint2.X(); controlPoints[2][1] = controlPoint2.Y();
|
||||
controlPoints[3][0] = nextPoint.X(); controlPoints[3][1] = nextPoint.Y();
|
||||
|
||||
evaluateCubicCurve();
|
||||
++pointIndex;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
174
ExternalLibs/FTGL/src/FTExtrdGlyph.cpp
Normal file
174
ExternalLibs/FTGL/src/FTExtrdGlyph.cpp
Normal file
|
@ -0,0 +1,174 @@
|
|||
#include <iostream>
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "FTExtrdGlyph.h"
|
||||
#include "FTVectoriser.h"
|
||||
|
||||
|
||||
FTExtrdGlyph::FTExtrdGlyph( FT_GlyphSlot glyph, float depth, bool useDisplayList)
|
||||
: FTGlyph( glyph),
|
||||
glList(0)
|
||||
{
|
||||
bBox.SetDepth( -depth);
|
||||
|
||||
if( ft_glyph_format_outline != glyph->format)
|
||||
{
|
||||
err = 0x14; // Invalid_Outline
|
||||
return;
|
||||
}
|
||||
|
||||
FTVectoriser vectoriser( glyph);
|
||||
if( ( vectoriser.ContourCount() < 1) || ( vectoriser.PointCount() < 3))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned int tesselationIndex;
|
||||
|
||||
if(useDisplayList)
|
||||
{
|
||||
glList = glGenLists(1);
|
||||
glNewList( glList, GL_COMPILE);
|
||||
}
|
||||
|
||||
vectoriser.MakeMesh( 1.0);
|
||||
glNormal3d(0.0, 0.0, 1.0);
|
||||
|
||||
unsigned int horizontalTextureScale = glyph->face->size->metrics.x_ppem * 64;
|
||||
unsigned int verticalTextureScale = glyph->face->size->metrics.y_ppem * 64;
|
||||
|
||||
const FTMesh* mesh = vectoriser.GetMesh();
|
||||
for( tesselationIndex = 0; tesselationIndex < mesh->TesselationCount(); ++tesselationIndex)
|
||||
{
|
||||
const FTTesselation* subMesh = mesh->Tesselation( tesselationIndex);
|
||||
unsigned int polyonType = subMesh->PolygonType();
|
||||
|
||||
glBegin( polyonType);
|
||||
for( unsigned int pointIndex = 0; pointIndex < subMesh->PointCount(); ++pointIndex)
|
||||
{
|
||||
FTPoint point = subMesh->Point(pointIndex);
|
||||
|
||||
glTexCoord2f( point.X() / horizontalTextureScale,
|
||||
point.Y() / verticalTextureScale);
|
||||
|
||||
glVertex3f( point.X() / 64.0f,
|
||||
point.Y() / 64.0f,
|
||||
0.0f);
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
|
||||
vectoriser.MakeMesh( -1.0);
|
||||
glNormal3d(0.0, 0.0, -1.0);
|
||||
|
||||
mesh = vectoriser.GetMesh();
|
||||
for( tesselationIndex = 0; tesselationIndex < mesh->TesselationCount(); ++tesselationIndex)
|
||||
{
|
||||
const FTTesselation* subMesh = mesh->Tesselation( tesselationIndex);
|
||||
unsigned int polyonType = subMesh->PolygonType();
|
||||
|
||||
glBegin( polyonType);
|
||||
for( unsigned int pointIndex = 0; pointIndex < subMesh->PointCount(); ++pointIndex)
|
||||
{
|
||||
FTPoint point = subMesh->Point(pointIndex);
|
||||
|
||||
glTexCoord2f( subMesh->Point(pointIndex).X() / horizontalTextureScale,
|
||||
subMesh->Point(pointIndex).Y() / verticalTextureScale);
|
||||
|
||||
glVertex3f( subMesh->Point( pointIndex).X() / 64.0f,
|
||||
subMesh->Point( pointIndex).Y() / 64.0f,
|
||||
-depth);
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
|
||||
int contourFlag = vectoriser.ContourFlag();
|
||||
|
||||
for( size_t c = 0; c < vectoriser.ContourCount(); ++c)
|
||||
{
|
||||
const FTContour* contour = vectoriser.Contour(c);
|
||||
unsigned int numberOfPoints = contour->PointCount();
|
||||
|
||||
glBegin( GL_QUAD_STRIP);
|
||||
for( unsigned int j = 0; j <= numberOfPoints; ++j)
|
||||
{
|
||||
unsigned int pointIndex = ( j == numberOfPoints) ? 0 : j;
|
||||
unsigned int nextPointIndex = ( pointIndex == numberOfPoints - 1) ? 0 : pointIndex + 1;
|
||||
|
||||
FTPoint point = contour->Point(pointIndex);
|
||||
|
||||
FTPoint normal = GetNormal( point, contour->Point(nextPointIndex));
|
||||
if(normal != FTPoint( 0.0f, 0.0f, 0.0f))
|
||||
{
|
||||
glNormal3dv(static_cast<const FTGL_DOUBLE*>(normal));
|
||||
}
|
||||
|
||||
if( contourFlag & ft_outline_reverse_fill)
|
||||
{
|
||||
glTexCoord2f( point.X() / horizontalTextureScale,
|
||||
point.X() / verticalTextureScale);
|
||||
|
||||
glVertex3f( point.X() / 64.0f, point.Y() / 64.0f, 0.0f);
|
||||
glVertex3f( point.X() / 64.0f, point.Y() / 64.0f, -depth);
|
||||
}
|
||||
else
|
||||
{
|
||||
glTexCoord2f( point.X() / horizontalTextureScale,
|
||||
point.Y() / verticalTextureScale);
|
||||
|
||||
glVertex3f( point.X() / 64.0f, point.Y() / 64.0f, -depth);
|
||||
glVertex3f( point.X() / 64.0f, point.Y() / 64.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
|
||||
if(useDisplayList)
|
||||
{
|
||||
glEndList();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FTExtrdGlyph::~FTExtrdGlyph()
|
||||
{
|
||||
glDeleteLists( glList, 1);
|
||||
}
|
||||
|
||||
|
||||
const FTPoint& FTExtrdGlyph::Render( const FTPoint& pen)
|
||||
{
|
||||
glTranslatef( pen.X(), pen.Y(), 0);
|
||||
|
||||
if( glList)
|
||||
{
|
||||
glCallList( glList);
|
||||
}
|
||||
|
||||
return advance;
|
||||
}
|
||||
|
||||
|
||||
FTPoint FTExtrdGlyph::GetNormal( const FTPoint &a, const FTPoint &b)
|
||||
{
|
||||
float vectorX = a.X() - b.X();
|
||||
float vectorY = a.Y() - b.Y();
|
||||
|
||||
float length = sqrt( vectorX * vectorX + vectorY * vectorY );
|
||||
|
||||
if( length > 0.01f)
|
||||
{
|
||||
length = 1 / length;
|
||||
}
|
||||
else
|
||||
{
|
||||
length = 0.0f;
|
||||
}
|
||||
|
||||
return FTPoint( -vectorY * length,
|
||||
vectorX * length,
|
||||
0.0f);
|
||||
}
|
||||
|
||||
|
145
ExternalLibs/FTGL/src/FTFace.cpp
Normal file
145
ExternalLibs/FTGL/src/FTFace.cpp
Normal file
|
@ -0,0 +1,145 @@
|
|||
#include "FTFace.h"
|
||||
#include "FTLibrary.h"
|
||||
|
||||
#include FT_TRUETYPE_TABLES_H
|
||||
|
||||
FTFace::FTFace( const char* fontFilePath)
|
||||
: numGlyphs(0),
|
||||
fontEncodingList(0),
|
||||
err(0)
|
||||
{
|
||||
const FT_Long DEFAULT_FACE_INDEX = 0;
|
||||
ftFace = new FT_Face;
|
||||
|
||||
err = FT_New_Face( *FTLibrary::Instance().GetLibrary(), fontFilePath, DEFAULT_FACE_INDEX, ftFace);
|
||||
|
||||
if( err)
|
||||
{
|
||||
delete ftFace;
|
||||
ftFace = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
numGlyphs = (*ftFace)->num_glyphs;
|
||||
hasKerningTable = FT_HAS_KERNING((*ftFace));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FTFace::FTFace( const unsigned char *pBufferBytes, size_t bufferSizeInBytes)
|
||||
: numGlyphs(0),
|
||||
err(0)
|
||||
{
|
||||
const FT_Long DEFAULT_FACE_INDEX = 0;
|
||||
ftFace = new FT_Face;
|
||||
|
||||
err = FT_New_Memory_Face( *FTLibrary::Instance().GetLibrary(), (FT_Byte *)pBufferBytes, bufferSizeInBytes, DEFAULT_FACE_INDEX, ftFace);
|
||||
|
||||
if( err)
|
||||
{
|
||||
delete ftFace;
|
||||
ftFace = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
numGlyphs = (*ftFace)->num_glyphs;
|
||||
hasKerningTable = FT_HAS_KERNING((*ftFace));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FTFace::~FTFace()
|
||||
{
|
||||
if( ftFace)
|
||||
{
|
||||
FT_Done_Face( *ftFace);
|
||||
delete ftFace;
|
||||
ftFace = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool FTFace::Attach( const char* fontFilePath)
|
||||
{
|
||||
err = FT_Attach_File( *ftFace, fontFilePath);
|
||||
return !err;
|
||||
}
|
||||
|
||||
|
||||
bool FTFace::Attach( const unsigned char *pBufferBytes, size_t bufferSizeInBytes)
|
||||
{
|
||||
FT_Open_Args open;
|
||||
|
||||
open.flags = FT_OPEN_MEMORY;
|
||||
open.memory_base = (FT_Byte *)pBufferBytes;
|
||||
open.memory_size = bufferSizeInBytes;
|
||||
|
||||
err = FT_Attach_Stream( *ftFace, &open);
|
||||
return !err;
|
||||
}
|
||||
|
||||
|
||||
const FTSize& FTFace::Size( const unsigned int size, const unsigned int res)
|
||||
{
|
||||
charSize.CharSize( ftFace, size, res, res);
|
||||
err = charSize.Error();
|
||||
|
||||
return charSize;
|
||||
}
|
||||
|
||||
|
||||
unsigned int FTFace::CharMapCount()
|
||||
{
|
||||
return (*ftFace)->num_charmaps;
|
||||
}
|
||||
|
||||
|
||||
FT_Encoding* FTFace::CharMapList()
|
||||
{
|
||||
if( 0 == fontEncodingList)
|
||||
{
|
||||
fontEncodingList = new FT_Encoding[CharMapCount()];
|
||||
for( size_t encodingIndex = 0; encodingIndex < CharMapCount(); ++encodingIndex)
|
||||
{
|
||||
fontEncodingList[encodingIndex] = (*ftFace)->charmaps[encodingIndex]->encoding;
|
||||
}
|
||||
}
|
||||
|
||||
return fontEncodingList;
|
||||
}
|
||||
|
||||
|
||||
FTPoint FTFace::KernAdvance( unsigned int index1, unsigned int index2)
|
||||
{
|
||||
float x, y;
|
||||
x = y = 0.0f;
|
||||
|
||||
if( hasKerningTable && index1 && index2)
|
||||
{
|
||||
FT_Vector kernAdvance;
|
||||
kernAdvance.x = kernAdvance.y = 0;
|
||||
|
||||
err = FT_Get_Kerning( *ftFace, index1, index2, ft_kerning_unfitted, &kernAdvance);
|
||||
if( !err)
|
||||
{
|
||||
x = static_cast<float>( kernAdvance.x) / 64.0f;
|
||||
y = static_cast<float>( kernAdvance.y) / 64.0f;
|
||||
}
|
||||
}
|
||||
|
||||
return FTPoint( x, y, 0.0);
|
||||
}
|
||||
|
||||
|
||||
FT_GlyphSlot FTFace::Glyph( unsigned int index, FT_Int load_flags)
|
||||
{
|
||||
err = FT_Load_Glyph( *ftFace, index, load_flags);
|
||||
if( err)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (*ftFace)->glyph;
|
||||
}
|
||||
|
||||
|
298
ExternalLibs/FTGL/src/FTFont.cpp
Normal file
298
ExternalLibs/FTGL/src/FTFont.cpp
Normal file
|
@ -0,0 +1,298 @@
|
|||
#include "FTFace.h"
|
||||
#include "FTFont.h"
|
||||
#include "FTGlyphContainer.h"
|
||||
#include "FTBBox.h"
|
||||
|
||||
|
||||
FTFont::FTFont( const char* fontFilePath)
|
||||
: face( fontFilePath),
|
||||
useDisplayLists(true),
|
||||
glyphList(0)
|
||||
{
|
||||
err = face.Error();
|
||||
if( err == 0)
|
||||
{
|
||||
glyphList = new FTGlyphContainer( &face);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FTFont::FTFont( const unsigned char *pBufferBytes, size_t bufferSizeInBytes)
|
||||
: face( pBufferBytes, bufferSizeInBytes),
|
||||
glyphList(0)
|
||||
{
|
||||
err = face.Error();
|
||||
if( err == 0)
|
||||
{
|
||||
glyphList = new FTGlyphContainer( &face);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FTFont::~FTFont()
|
||||
{
|
||||
delete glyphList;
|
||||
}
|
||||
|
||||
|
||||
bool FTFont::Attach( const char* fontFilePath)
|
||||
{
|
||||
if( face.Attach( fontFilePath))
|
||||
{
|
||||
err = 0;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
err = face.Error();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool FTFont::Attach( const unsigned char *pBufferBytes, size_t bufferSizeInBytes)
|
||||
{
|
||||
if( face.Attach( pBufferBytes, bufferSizeInBytes))
|
||||
{
|
||||
err = 0;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
err = face.Error();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool FTFont::FaceSize( const unsigned int size, const unsigned int res )
|
||||
{
|
||||
charSize = face.Size( size, res);
|
||||
err = face.Error();
|
||||
|
||||
if( err != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if( glyphList != NULL)
|
||||
{
|
||||
delete glyphList;
|
||||
}
|
||||
|
||||
glyphList = new FTGlyphContainer( &face);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
unsigned int FTFont::FaceSize() const
|
||||
{
|
||||
return charSize.CharSize();
|
||||
}
|
||||
|
||||
|
||||
bool FTFont::CharMap( FT_Encoding encoding)
|
||||
{
|
||||
bool result = glyphList->CharMap( encoding);
|
||||
err = glyphList->Error();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
unsigned int FTFont::CharMapCount()
|
||||
{
|
||||
return face.CharMapCount();
|
||||
}
|
||||
|
||||
|
||||
FT_Encoding* FTFont::CharMapList()
|
||||
{
|
||||
return face.CharMapList();
|
||||
}
|
||||
|
||||
|
||||
void FTFont::UseDisplayList( bool useList)
|
||||
{
|
||||
useDisplayLists = useList;
|
||||
}
|
||||
|
||||
float FTFont::Ascender() const
|
||||
{
|
||||
return charSize.Ascender();
|
||||
}
|
||||
|
||||
|
||||
float FTFont::Descender() const
|
||||
{
|
||||
return charSize.Descender();
|
||||
}
|
||||
|
||||
float FTFont::LineHeight() const
|
||||
{
|
||||
return charSize.Height();
|
||||
}
|
||||
|
||||
void FTFont::BBox( const char* string,
|
||||
float& llx, float& lly, float& llz, float& urx, float& ury, float& urz)
|
||||
{
|
||||
FTBBox totalBBox;
|
||||
|
||||
if((NULL != string) && ('\0' != *string))
|
||||
{
|
||||
const unsigned char* c = (unsigned char*)string;
|
||||
float advance = 0;
|
||||
|
||||
if(CheckGlyph( *c))
|
||||
{
|
||||
totalBBox = glyphList->BBox( *c);
|
||||
advance = glyphList->Advance( *c, *(c + 1));
|
||||
}
|
||||
|
||||
while( *++c)
|
||||
{
|
||||
if(CheckGlyph( *c))
|
||||
{
|
||||
FTBBox tempBBox = glyphList->BBox( *c);
|
||||
tempBBox.Move( FTPoint( advance, 0.0f, 0.0f));
|
||||
totalBBox += tempBBox;
|
||||
advance += glyphList->Advance( *c, *(c + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
llx = totalBBox.lowerX;
|
||||
lly = totalBBox.lowerY;
|
||||
llz = totalBBox.lowerZ;
|
||||
urx = totalBBox.upperX;
|
||||
ury = totalBBox.upperY;
|
||||
urz = totalBBox.upperZ;
|
||||
}
|
||||
|
||||
|
||||
void FTFont::BBox( const wchar_t* string,
|
||||
float& llx, float& lly, float& llz, float& urx, float& ury, float& urz)
|
||||
{
|
||||
FTBBox totalBBox;
|
||||
|
||||
if((NULL != string) && ('\0' != *string))
|
||||
{
|
||||
const wchar_t* c = string;
|
||||
float advance = 0;
|
||||
|
||||
if(CheckGlyph( *c))
|
||||
{
|
||||
totalBBox = glyphList->BBox( *c);
|
||||
advance = glyphList->Advance( *c, *(c + 1));
|
||||
}
|
||||
|
||||
while( *++c)
|
||||
{
|
||||
if(CheckGlyph( *c))
|
||||
{
|
||||
FTBBox tempBBox = glyphList->BBox( *c);
|
||||
tempBBox.Move( FTPoint( advance, 0.0f, 0.0f));
|
||||
totalBBox += tempBBox;
|
||||
advance += glyphList->Advance( *c, *(c + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
llx = totalBBox.lowerX;
|
||||
lly = totalBBox.lowerY;
|
||||
llz = totalBBox.lowerZ;
|
||||
urx = totalBBox.upperX;
|
||||
ury = totalBBox.upperY;
|
||||
urz = totalBBox.upperZ;
|
||||
}
|
||||
|
||||
|
||||
float FTFont::Advance( const wchar_t* string)
|
||||
{
|
||||
const wchar_t* c = string;
|
||||
float width = 0.0f;
|
||||
|
||||
while( *c)
|
||||
{
|
||||
if(CheckGlyph( *c))
|
||||
{
|
||||
width += glyphList->Advance( *c, *(c + 1));
|
||||
}
|
||||
++c;
|
||||
}
|
||||
|
||||
return width;
|
||||
}
|
||||
|
||||
|
||||
float FTFont::Advance( const char* string)
|
||||
{
|
||||
const unsigned char* c = (unsigned char*)string;
|
||||
float width = 0.0f;
|
||||
|
||||
while( *c)
|
||||
{
|
||||
if(CheckGlyph( *c))
|
||||
{
|
||||
width += glyphList->Advance( *c, *(c + 1));
|
||||
}
|
||||
++c;
|
||||
}
|
||||
|
||||
return width;
|
||||
}
|
||||
|
||||
|
||||
void FTFont::Render( const char* string )
|
||||
{
|
||||
const unsigned char* c = (unsigned char*)string;
|
||||
pen.X(0); pen.Y(0);
|
||||
|
||||
while( *c)
|
||||
{
|
||||
if(CheckGlyph( *c))
|
||||
{
|
||||
pen = glyphList->Render( *c, *(c + 1), pen);
|
||||
}
|
||||
++c;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FTFont::Render( const wchar_t* string )
|
||||
{
|
||||
const wchar_t* c = string;
|
||||
pen.X(0); pen.Y(0);
|
||||
|
||||
while( *c)
|
||||
{
|
||||
if(CheckGlyph( *c))
|
||||
{
|
||||
pen = glyphList->Render( *c, *(c + 1), pen);
|
||||
}
|
||||
++c;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool FTFont::CheckGlyph( const unsigned int characterCode)
|
||||
{
|
||||
if( NULL == glyphList->Glyph( characterCode))
|
||||
{
|
||||
unsigned int glyphIndex = glyphList->FontIndex( characterCode);
|
||||
FTGlyph* tempGlyph = MakeGlyph( glyphIndex);
|
||||
if( NULL == tempGlyph)
|
||||
{
|
||||
if( 0 == err)
|
||||
{
|
||||
err = 0x13;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
glyphList->Add( tempGlyph, characterCode);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
67
ExternalLibs/FTGL/src/FTGLBitmapFont.cpp
Normal file
67
ExternalLibs/FTGL/src/FTGLBitmapFont.cpp
Normal file
|
@ -0,0 +1,67 @@
|
|||
#include "FTGLBitmapFont.h"
|
||||
#include "FTBitmapGlyph.h"
|
||||
|
||||
|
||||
FTGLBitmapFont::FTGLBitmapFont( const char* fontFilePath)
|
||||
: FTFont( fontFilePath)
|
||||
{}
|
||||
|
||||
|
||||
FTGLBitmapFont::FTGLBitmapFont( const unsigned char *pBufferBytes, size_t bufferSizeInBytes)
|
||||
: FTFont( pBufferBytes, bufferSizeInBytes)
|
||||
{}
|
||||
|
||||
|
||||
FTGLBitmapFont::~FTGLBitmapFont()
|
||||
{}
|
||||
|
||||
|
||||
FTGlyph* FTGLBitmapFont::MakeGlyph( unsigned int g)
|
||||
{
|
||||
FT_GlyphSlot ftGlyph = face.Glyph( g, FT_LOAD_DEFAULT);
|
||||
|
||||
if( ftGlyph)
|
||||
{
|
||||
FTBitmapGlyph* tempGlyph = new FTBitmapGlyph( ftGlyph);
|
||||
return tempGlyph;
|
||||
}
|
||||
|
||||
err = face.Error();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void FTGLBitmapFont::Render( const char* string)
|
||||
{
|
||||
glPushClientAttrib( GL_CLIENT_PIXEL_STORE_BIT);
|
||||
glPushAttrib( GL_ENABLE_BIT);
|
||||
|
||||
glPixelStorei( GL_UNPACK_LSB_FIRST, GL_FALSE);
|
||||
glPixelStorei( GL_UNPACK_ALIGNMENT, 1);
|
||||
|
||||
glDisable( GL_BLEND);
|
||||
|
||||
FTFont::Render( string);
|
||||
|
||||
glPopAttrib();
|
||||
glPopClientAttrib();
|
||||
}
|
||||
|
||||
|
||||
void FTGLBitmapFont::Render( const wchar_t* string)
|
||||
{
|
||||
glPushClientAttrib( GL_CLIENT_PIXEL_STORE_BIT);
|
||||
glPushAttrib( GL_ENABLE_BIT);
|
||||
|
||||
glPixelStorei( GL_UNPACK_LSB_FIRST, GL_FALSE);
|
||||
glPixelStorei( GL_UNPACK_ALIGNMENT, 1);
|
||||
|
||||
glDisable( GL_BLEND);
|
||||
|
||||
FTFont::Render( string);
|
||||
|
||||
glPopAttrib();
|
||||
glPopClientAttrib();
|
||||
}
|
||||
|
||||
|
36
ExternalLibs/FTGL/src/FTGLExtrdFont.cpp
Normal file
36
ExternalLibs/FTGL/src/FTGLExtrdFont.cpp
Normal file
|
@ -0,0 +1,36 @@
|
|||
#include "FTGLExtrdFont.h"
|
||||
#include "FTExtrdGlyph.h"
|
||||
|
||||
|
||||
FTGLExtrdFont::FTGLExtrdFont( const char* fontFilePath)
|
||||
: FTFont( fontFilePath),
|
||||
depth( 0.0f)
|
||||
{}
|
||||
|
||||
|
||||
FTGLExtrdFont::FTGLExtrdFont( const unsigned char *pBufferBytes, size_t bufferSizeInBytes)
|
||||
: FTFont( pBufferBytes, bufferSizeInBytes),
|
||||
depth( 0.0f)
|
||||
{}
|
||||
|
||||
|
||||
FTGLExtrdFont::~FTGLExtrdFont()
|
||||
{}
|
||||
|
||||
|
||||
FTGlyph* FTGLExtrdFont::MakeGlyph( unsigned int glyphIndex)
|
||||
{
|
||||
FT_GlyphSlot ftGlyph = face.Glyph( glyphIndex, FT_LOAD_NO_HINTING);
|
||||
|
||||
if( ftGlyph)
|
||||
{
|
||||
FTExtrdGlyph* tempGlyph = new FTExtrdGlyph( ftGlyph, depth, useDisplayLists);
|
||||
return tempGlyph;
|
||||
}
|
||||
|
||||
err = face.Error();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
67
ExternalLibs/FTGL/src/FTGLOutlineFont.cpp
Normal file
67
ExternalLibs/FTGL/src/FTGLOutlineFont.cpp
Normal file
|
@ -0,0 +1,67 @@
|
|||
#include "FTGLOutlineFont.h"
|
||||
#include "FTOutlineGlyph.h"
|
||||
|
||||
|
||||
FTGLOutlineFont::FTGLOutlineFont( const char* fontFilePath)
|
||||
: FTFont( fontFilePath)
|
||||
{}
|
||||
|
||||
|
||||
FTGLOutlineFont::FTGLOutlineFont( const unsigned char *pBufferBytes, size_t bufferSizeInBytes)
|
||||
: FTFont( pBufferBytes, bufferSizeInBytes)
|
||||
{}
|
||||
|
||||
|
||||
FTGLOutlineFont::~FTGLOutlineFont()
|
||||
{}
|
||||
|
||||
|
||||
FTGlyph* FTGLOutlineFont::MakeGlyph( unsigned int g)
|
||||
{
|
||||
FT_GlyphSlot ftGlyph = face.Glyph( g, FT_LOAD_NO_HINTING);
|
||||
|
||||
if( ftGlyph)
|
||||
{
|
||||
FTOutlineGlyph* tempGlyph = new FTOutlineGlyph( ftGlyph, useDisplayLists);
|
||||
return tempGlyph;
|
||||
}
|
||||
|
||||
err = face.Error();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void FTGLOutlineFont::Render( const char* string)
|
||||
{
|
||||
glPushAttrib( GL_ENABLE_BIT | GL_HINT_BIT | GL_LINE_BIT | GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glDisable( GL_TEXTURE_2D);
|
||||
|
||||
glEnable( GL_LINE_SMOOTH);
|
||||
glHint( GL_LINE_SMOOTH_HINT, GL_DONT_CARE);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // GL_ONE
|
||||
|
||||
FTFont::Render( string);
|
||||
|
||||
glPopAttrib();
|
||||
}
|
||||
|
||||
|
||||
void FTGLOutlineFont::Render( const wchar_t* string)
|
||||
{
|
||||
glPushAttrib( GL_ENABLE_BIT | GL_HINT_BIT | GL_LINE_BIT | GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glDisable( GL_TEXTURE_2D);
|
||||
|
||||
glEnable( GL_LINE_SMOOTH);
|
||||
glHint( GL_LINE_SMOOTH_HINT, GL_DONT_CARE);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // GL_ONE
|
||||
|
||||
FTFont::Render( string);
|
||||
|
||||
glPopAttrib();
|
||||
}
|
||||
|
||||
|
84
ExternalLibs/FTGL/src/FTGLPixmapFont.cpp
Normal file
84
ExternalLibs/FTGL/src/FTGLPixmapFont.cpp
Normal file
|
@ -0,0 +1,84 @@
|
|||
#include "FTGLPixmapFont.h"
|
||||
#include "FTPixmapGlyph.h"
|
||||
|
||||
|
||||
FTGLPixmapFont::FTGLPixmapFont( const char* fontFilePath)
|
||||
: FTFont( fontFilePath)
|
||||
{}
|
||||
|
||||
|
||||
FTGLPixmapFont::FTGLPixmapFont( const unsigned char *pBufferBytes, size_t bufferSizeInBytes)
|
||||
: FTFont( pBufferBytes, bufferSizeInBytes)
|
||||
{}
|
||||
|
||||
|
||||
FTGLPixmapFont::~FTGLPixmapFont()
|
||||
{}
|
||||
|
||||
|
||||
FTGlyph* FTGLPixmapFont::MakeGlyph( unsigned int g)
|
||||
{
|
||||
FT_GlyphSlot ftGlyph = face.Glyph( g, FT_LOAD_NO_HINTING);
|
||||
|
||||
if( ftGlyph)
|
||||
{
|
||||
FTPixmapGlyph* tempGlyph = new FTPixmapGlyph( ftGlyph);
|
||||
return tempGlyph;
|
||||
}
|
||||
|
||||
err = face.Error();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void FTGLPixmapFont::Render( const char* string)
|
||||
{
|
||||
glPushAttrib( GL_ENABLE_BIT | GL_PIXEL_MODE_BIT | GL_COLOR_BUFFER_BIT);
|
||||
glPushClientAttrib( GL_CLIENT_PIXEL_STORE_BIT);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
glDisable( GL_TEXTURE_2D);
|
||||
|
||||
GLfloat ftglColour[4];
|
||||
glGetFloatv( GL_CURRENT_RASTER_COLOR, ftglColour);
|
||||
|
||||
glPixelTransferf(GL_RED_SCALE, ftglColour[0]);
|
||||
glPixelTransferf(GL_GREEN_SCALE, ftglColour[1]);
|
||||
glPixelTransferf(GL_BLUE_SCALE, ftglColour[2]);
|
||||
glPixelTransferf(GL_ALPHA_SCALE, ftglColour[3]);
|
||||
|
||||
FTFont::Render( string);
|
||||
|
||||
glPopClientAttrib();
|
||||
glPopAttrib();
|
||||
}
|
||||
|
||||
|
||||
void FTGLPixmapFont::Render( const wchar_t* string)
|
||||
{
|
||||
glPushAttrib( GL_ENABLE_BIT | GL_PIXEL_MODE_BIT | GL_COLOR_BUFFER_BIT);
|
||||
glPushClientAttrib( GL_CLIENT_PIXEL_STORE_BIT);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
glDisable( GL_TEXTURE_2D);
|
||||
|
||||
GLfloat ftglColour[4];
|
||||
glGetFloatv( GL_CURRENT_RASTER_COLOR, ftglColour);
|
||||
|
||||
glPixelTransferf(GL_RED_SCALE, ftglColour[0]);
|
||||
glPixelTransferf(GL_GREEN_SCALE, ftglColour[1]);
|
||||
glPixelTransferf(GL_BLUE_SCALE, ftglColour[2]);
|
||||
glPixelTransferf(GL_ALPHA_SCALE, ftglColour[3]);
|
||||
|
||||
FTFont::Render( string);
|
||||
|
||||
glPopClientAttrib();
|
||||
glPopAttrib();
|
||||
}
|
||||
|
||||
|
||||
|
34
ExternalLibs/FTGL/src/FTGLPolygonFont.cpp
Normal file
34
ExternalLibs/FTGL/src/FTGLPolygonFont.cpp
Normal file
|
@ -0,0 +1,34 @@
|
|||
#include "FTGLPolygonFont.h"
|
||||
#include "FTPolyGlyph.h"
|
||||
|
||||
|
||||
FTGLPolygonFont::FTGLPolygonFont( const char* fontFilePath)
|
||||
: FTFont( fontFilePath)
|
||||
{}
|
||||
|
||||
|
||||
FTGLPolygonFont::FTGLPolygonFont( const unsigned char *pBufferBytes, size_t bufferSizeInBytes)
|
||||
: FTFont( pBufferBytes, bufferSizeInBytes)
|
||||
{}
|
||||
|
||||
|
||||
FTGLPolygonFont::~FTGLPolygonFont()
|
||||
{}
|
||||
|
||||
|
||||
FTGlyph* FTGLPolygonFont::MakeGlyph( unsigned int g)
|
||||
{
|
||||
FT_GlyphSlot ftGlyph = face.Glyph( g, FT_LOAD_NO_HINTING);
|
||||
|
||||
if( ftGlyph)
|
||||
{
|
||||
FTPolyGlyph* tempGlyph = new FTPolyGlyph( ftGlyph, useDisplayLists);
|
||||
return tempGlyph;
|
||||
}
|
||||
|
||||
err = face.Error();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
181
ExternalLibs/FTGL/src/FTGLTextureFont.cpp
Normal file
181
ExternalLibs/FTGL/src/FTGLTextureFont.cpp
Normal file
|
@ -0,0 +1,181 @@
|
|||
#include <cassert>
|
||||
#include <string> // For memset
|
||||
|
||||
#include "FTGLTextureFont.h"
|
||||
#include "FTTextureGlyph.h"
|
||||
|
||||
|
||||
inline GLuint NextPowerOf2( GLuint in)
|
||||
{
|
||||
in -= 1;
|
||||
|
||||
in |= in >> 16;
|
||||
in |= in >> 8;
|
||||
in |= in >> 4;
|
||||
in |= in >> 2;
|
||||
in |= in >> 1;
|
||||
|
||||
return in + 1;
|
||||
}
|
||||
|
||||
|
||||
FTGLTextureFont::FTGLTextureFont( const char* fontFilePath)
|
||||
: FTFont( fontFilePath),
|
||||
maximumGLTextureSize(0),
|
||||
textureWidth(0),
|
||||
textureHeight(0),
|
||||
glyphHeight(0),
|
||||
glyphWidth(0),
|
||||
padding(3),
|
||||
xOffset(0),
|
||||
yOffset(0)
|
||||
{
|
||||
remGlyphs = numGlyphs = face.GlyphCount();
|
||||
}
|
||||
|
||||
|
||||
FTGLTextureFont::FTGLTextureFont( const unsigned char *pBufferBytes, size_t bufferSizeInBytes)
|
||||
: FTFont( pBufferBytes, bufferSizeInBytes),
|
||||
maximumGLTextureSize(0),
|
||||
textureWidth(0),
|
||||
textureHeight(0),
|
||||
glyphHeight(0),
|
||||
glyphWidth(0),
|
||||
padding(3),
|
||||
xOffset(0),
|
||||
yOffset(0)
|
||||
{
|
||||
remGlyphs = numGlyphs = face.GlyphCount();
|
||||
}
|
||||
|
||||
|
||||
FTGLTextureFont::~FTGLTextureFont()
|
||||
{
|
||||
glDeleteTextures( textureIDList.size(), (const GLuint*)&textureIDList[0]);
|
||||
}
|
||||
|
||||
|
||||
FTGlyph* FTGLTextureFont::MakeGlyph( unsigned int glyphIndex)
|
||||
{
|
||||
FT_GlyphSlot ftGlyph = face.Glyph( glyphIndex, FT_LOAD_NO_HINTING);
|
||||
|
||||
if( ftGlyph)
|
||||
{
|
||||
glyphHeight = static_cast<int>( charSize.Height());
|
||||
glyphWidth = static_cast<int>( charSize.Width());
|
||||
|
||||
if( textureIDList.empty())
|
||||
{
|
||||
textureIDList.push_back( CreateTexture());
|
||||
xOffset = yOffset = padding;
|
||||
}
|
||||
|
||||
if( xOffset > ( textureWidth - glyphWidth))
|
||||
{
|
||||
xOffset = padding;
|
||||
yOffset += glyphHeight;
|
||||
|
||||
if( yOffset > ( textureHeight - glyphHeight))
|
||||
{
|
||||
textureIDList.push_back( CreateTexture());
|
||||
yOffset = padding;
|
||||
}
|
||||
}
|
||||
|
||||
FTTextureGlyph* tempGlyph = new FTTextureGlyph( ftGlyph, textureIDList[textureIDList.size() - 1],
|
||||
xOffset, yOffset, textureWidth, textureHeight);
|
||||
xOffset += static_cast<int>( tempGlyph->BBox().upperX - tempGlyph->BBox().lowerX + padding);
|
||||
|
||||
--remGlyphs;
|
||||
return tempGlyph;
|
||||
}
|
||||
|
||||
err = face.Error();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void FTGLTextureFont::CalculateTextureSize()
|
||||
{
|
||||
if( !maximumGLTextureSize)
|
||||
{
|
||||
glGetIntegerv( GL_MAX_TEXTURE_SIZE, (GLint*)&maximumGLTextureSize);
|
||||
assert(maximumGLTextureSize); // If you hit this then you have an invalid OpenGL context.
|
||||
}
|
||||
|
||||
textureWidth = NextPowerOf2( (remGlyphs * glyphWidth) + ( padding * 2));
|
||||
textureWidth = textureWidth > maximumGLTextureSize ? maximumGLTextureSize : textureWidth;
|
||||
|
||||
int h = static_cast<int>( (textureWidth - ( padding * 2)) / glyphWidth);
|
||||
|
||||
textureHeight = NextPowerOf2( (( numGlyphs / h) + 1) * glyphHeight);
|
||||
textureHeight = textureHeight > maximumGLTextureSize ? maximumGLTextureSize : textureHeight;
|
||||
}
|
||||
|
||||
|
||||
GLuint FTGLTextureFont::CreateTexture()
|
||||
{
|
||||
CalculateTextureSize();
|
||||
|
||||
int totalMemory = textureWidth * textureHeight;
|
||||
unsigned char* textureMemory = new unsigned char[totalMemory];
|
||||
memset( textureMemory, 0, totalMemory);
|
||||
|
||||
GLuint textID;
|
||||
glGenTextures( 1, (GLuint*)&textID);
|
||||
|
||||
glBindTexture( GL_TEXTURE_2D, textID);
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_ALPHA, textureWidth, textureHeight, 0, GL_ALPHA, GL_UNSIGNED_BYTE, textureMemory);
|
||||
|
||||
delete [] textureMemory;
|
||||
|
||||
return textID;
|
||||
}
|
||||
|
||||
|
||||
bool FTGLTextureFont::FaceSize( const unsigned int size, const unsigned int res)
|
||||
{
|
||||
if( !textureIDList.empty())
|
||||
{
|
||||
glDeleteTextures( textureIDList.size(), (const GLuint*)&textureIDList[0]);
|
||||
textureIDList.clear();
|
||||
remGlyphs = numGlyphs = face.GlyphCount();
|
||||
}
|
||||
|
||||
return FTFont::FaceSize( size, res);
|
||||
}
|
||||
|
||||
|
||||
void FTGLTextureFont::Render( const char* string)
|
||||
{
|
||||
glPushAttrib( GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // GL_ONE
|
||||
|
||||
FTTextureGlyph::ResetActiveTexture();
|
||||
|
||||
FTFont::Render( string);
|
||||
|
||||
glPopAttrib();
|
||||
}
|
||||
|
||||
|
||||
void FTGLTextureFont::Render( const wchar_t* string)
|
||||
{
|
||||
glPushAttrib( GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // GL_ONE
|
||||
|
||||
FTTextureGlyph::ResetActiveTexture();
|
||||
|
||||
FTFont::Render( string);
|
||||
|
||||
glPopAttrib();
|
||||
}
|
||||
|
||||
|
18
ExternalLibs/FTGL/src/FTGlyph.cpp
Normal file
18
ExternalLibs/FTGL/src/FTGlyph.cpp
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include "FTGlyph.h"
|
||||
|
||||
|
||||
FTGlyph::FTGlyph( FT_GlyphSlot glyph, bool useList)
|
||||
: useDisplayList(useList),
|
||||
err(0)
|
||||
{
|
||||
if( glyph)
|
||||
{
|
||||
bBox = FTBBox( glyph);
|
||||
advance = FTPoint( glyph->advance.x / 64.0f, glyph->advance.y / 64.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FTGlyph::~FTGlyph()
|
||||
{}
|
||||
|
92
ExternalLibs/FTGL/src/FTGlyphContainer.cpp
Normal file
92
ExternalLibs/FTGL/src/FTGlyphContainer.cpp
Normal file
|
@ -0,0 +1,92 @@
|
|||
#include "FTGlyphContainer.h"
|
||||
#include "FTGlyph.h"
|
||||
#include "FTFace.h"
|
||||
#include "FTCharmap.h"
|
||||
|
||||
|
||||
FTGlyphContainer::FTGlyphContainer( FTFace* f)
|
||||
: face(f),
|
||||
err(0)
|
||||
{
|
||||
glyphs.push_back( NULL);
|
||||
charMap = new FTCharmap( face);
|
||||
}
|
||||
|
||||
|
||||
FTGlyphContainer::~FTGlyphContainer()
|
||||
{
|
||||
GlyphVector::iterator glyphIterator;
|
||||
for( glyphIterator = glyphs.begin(); glyphIterator != glyphs.end(); ++glyphIterator)
|
||||
{
|
||||
delete *glyphIterator;
|
||||
}
|
||||
|
||||
glyphs.clear();
|
||||
delete charMap;
|
||||
}
|
||||
|
||||
|
||||
bool FTGlyphContainer::CharMap( FT_Encoding encoding)
|
||||
{
|
||||
bool result = charMap->CharMap( encoding);
|
||||
err = charMap->Error();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
unsigned int FTGlyphContainer::FontIndex( const unsigned int characterCode) const
|
||||
{
|
||||
return charMap->FontIndex( characterCode);
|
||||
}
|
||||
|
||||
|
||||
void FTGlyphContainer::Add( FTGlyph* tempGlyph, const unsigned int characterCode)
|
||||
{
|
||||
charMap->InsertIndex( characterCode, glyphs.size());
|
||||
glyphs.push_back( tempGlyph);
|
||||
}
|
||||
|
||||
|
||||
const FTGlyph* const FTGlyphContainer::Glyph( const unsigned int characterCode) const
|
||||
{
|
||||
signed int index = charMap->GlyphListIndex( characterCode);
|
||||
return glyphs[index];
|
||||
}
|
||||
|
||||
|
||||
FTBBox FTGlyphContainer::BBox( const unsigned int characterCode) const
|
||||
{
|
||||
return glyphs[charMap->GlyphListIndex( characterCode)]->BBox();
|
||||
}
|
||||
|
||||
|
||||
float FTGlyphContainer::Advance( const unsigned int characterCode, const unsigned int nextCharacterCode)
|
||||
{
|
||||
unsigned int left = charMap->FontIndex( characterCode);
|
||||
unsigned int right = charMap->FontIndex( nextCharacterCode);
|
||||
|
||||
float width = face->KernAdvance( left, right).X();
|
||||
width += glyphs[charMap->GlyphListIndex( characterCode)]->Advance().X();
|
||||
|
||||
return width;
|
||||
}
|
||||
|
||||
|
||||
FTPoint FTGlyphContainer::Render( const unsigned int characterCode, const unsigned int nextCharacterCode, FTPoint penPosition)
|
||||
{
|
||||
FTPoint kernAdvance, advance;
|
||||
|
||||
unsigned int left = charMap->FontIndex( characterCode);
|
||||
unsigned int right = charMap->FontIndex( nextCharacterCode);
|
||||
|
||||
kernAdvance = face->KernAdvance( left, right);
|
||||
|
||||
if( !face->Error())
|
||||
{
|
||||
advance = glyphs[charMap->GlyphListIndex( characterCode)]->Render( penPosition);
|
||||
}
|
||||
|
||||
kernAdvance += advance;
|
||||
return kernAdvance;
|
||||
}
|
||||
|
65
ExternalLibs/FTGL/src/FTLibrary.cpp
Normal file
65
ExternalLibs/FTGL/src/FTLibrary.cpp
Normal file
|
@ -0,0 +1,65 @@
|
|||
#include "FTLibrary.h"
|
||||
|
||||
|
||||
const FTLibrary& FTLibrary::Instance()
|
||||
{
|
||||
static FTLibrary ftlib;
|
||||
return ftlib;
|
||||
}
|
||||
|
||||
|
||||
FTLibrary::~FTLibrary()
|
||||
{
|
||||
if( library != 0)
|
||||
{
|
||||
FT_Done_FreeType( *library);
|
||||
|
||||
delete library;
|
||||
library= 0;
|
||||
}
|
||||
|
||||
// if( manager != 0)
|
||||
// {
|
||||
// FTC_Manager_Done( manager );
|
||||
//
|
||||
// delete manager;
|
||||
// manager= 0;
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
FTLibrary::FTLibrary()
|
||||
: library(0),
|
||||
err(0)
|
||||
{
|
||||
Initialise();
|
||||
}
|
||||
|
||||
|
||||
bool FTLibrary::Initialise()
|
||||
{
|
||||
if( library != 0)
|
||||
return true;
|
||||
|
||||
library = new FT_Library;
|
||||
|
||||
err = FT_Init_FreeType( library);
|
||||
if( err)
|
||||
{
|
||||
delete library;
|
||||
library = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
// FTC_Manager* manager;
|
||||
//
|
||||
// if( FTC_Manager_New( lib, 0, 0, 0, my_face_requester, 0, manager )
|
||||
// {
|
||||
// delete manager;
|
||||
// manager= 0;
|
||||
// return false;
|
||||
// }
|
||||
|
||||
return true;
|
||||
}
|
||||
|
67
ExternalLibs/FTGL/src/FTOutlineGlyph.cpp
Normal file
67
ExternalLibs/FTGL/src/FTOutlineGlyph.cpp
Normal file
|
@ -0,0 +1,67 @@
|
|||
#include "FTOutlineGlyph.h"
|
||||
#include "FTVectoriser.h"
|
||||
|
||||
|
||||
FTOutlineGlyph::FTOutlineGlyph( FT_GlyphSlot glyph, bool useDisplayList)
|
||||
: FTGlyph( glyph),
|
||||
glList(0)
|
||||
{
|
||||
if( ft_glyph_format_outline != glyph->format)
|
||||
{
|
||||
err = 0x14; // Invalid_Outline
|
||||
return;
|
||||
}
|
||||
|
||||
FTVectoriser vectoriser( glyph);
|
||||
|
||||
size_t numContours = vectoriser.ContourCount();
|
||||
if ( ( numContours < 1) || ( vectoriser.PointCount() < 3))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(useDisplayList)
|
||||
{
|
||||
glList = glGenLists(1);
|
||||
glNewList( glList, GL_COMPILE);
|
||||
}
|
||||
|
||||
for( unsigned int c = 0; c < numContours; ++c)
|
||||
{
|
||||
const FTContour* contour = vectoriser.Contour(c);
|
||||
|
||||
glBegin( GL_LINE_LOOP);
|
||||
for( unsigned int pointIndex = 0; pointIndex < contour->PointCount(); ++pointIndex)
|
||||
{
|
||||
FTPoint point = contour->Point(pointIndex);
|
||||
glVertex2f( point.X() / 64.0f, point.Y() / 64.0f);
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
|
||||
if(useDisplayList)
|
||||
{
|
||||
glEndList();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FTOutlineGlyph::~FTOutlineGlyph()
|
||||
{
|
||||
glDeleteLists( glList, 1);
|
||||
}
|
||||
|
||||
|
||||
const FTPoint& FTOutlineGlyph::Render( const FTPoint& pen)
|
||||
{
|
||||
glTranslatef( pen.X(), pen.Y(), 0.0f);
|
||||
|
||||
if( glList)
|
||||
{
|
||||
glCallList( glList);
|
||||
}
|
||||
|
||||
return advance;
|
||||
}
|
||||
|
||||
|
74
ExternalLibs/FTGL/src/FTPixmapGlyph.cpp
Normal file
74
ExternalLibs/FTGL/src/FTPixmapGlyph.cpp
Normal file
|
@ -0,0 +1,74 @@
|
|||
#include "FTPixmapGlyph.h"
|
||||
|
||||
FTPixmapGlyph::FTPixmapGlyph( FT_GlyphSlot glyph)
|
||||
: FTGlyph( glyph),
|
||||
destWidth(0),
|
||||
destHeight(0),
|
||||
data(0)
|
||||
{
|
||||
err = FT_Render_Glyph( glyph, FT_RENDER_MODE_NORMAL);
|
||||
if( err || ft_glyph_format_bitmap != glyph->format)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
FT_Bitmap bitmap = glyph->bitmap;
|
||||
|
||||
//check the pixel mode
|
||||
//ft_pixel_mode_grays
|
||||
|
||||
int srcWidth = bitmap.width;
|
||||
int srcHeight = bitmap.rows;
|
||||
|
||||
destWidth = srcWidth;
|
||||
destHeight = srcHeight;
|
||||
|
||||
if( destWidth && destHeight)
|
||||
{
|
||||
data = new unsigned char[destWidth * destHeight * 2];
|
||||
unsigned char* src = bitmap.buffer;
|
||||
|
||||
unsigned char* dest = data + ((destHeight - 1) * destWidth * 2);
|
||||
size_t destStep = destWidth * 2 * 2;
|
||||
|
||||
for( int y = 0; y < srcHeight; ++y)
|
||||
{
|
||||
for( int x = 0; x < srcWidth; ++x)
|
||||
{
|
||||
*dest++ = static_cast<unsigned char>(255);
|
||||
*dest++ = *src++;
|
||||
}
|
||||
dest -= destStep;
|
||||
}
|
||||
|
||||
destHeight = srcHeight;
|
||||
}
|
||||
|
||||
pos.X(glyph->bitmap_left);
|
||||
pos.Y(srcHeight - glyph->bitmap_top);
|
||||
}
|
||||
|
||||
|
||||
FTPixmapGlyph::~FTPixmapGlyph()
|
||||
{
|
||||
delete [] data;
|
||||
}
|
||||
|
||||
|
||||
const FTPoint& FTPixmapGlyph::Render( const FTPoint& pen)
|
||||
{
|
||||
glBitmap( 0, 0, 0.0f, 0.0f, pen.X() + pos.X(), pen.Y() - pos.Y(), (const GLubyte*)0);
|
||||
|
||||
if( data)
|
||||
{
|
||||
glPixelStorei( GL_UNPACK_ROW_LENGTH, 0);
|
||||
glPixelStorei( GL_UNPACK_ALIGNMENT, 2);
|
||||
|
||||
glDrawPixels( destWidth, destHeight, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, (const GLvoid*)data);
|
||||
}
|
||||
|
||||
glBitmap( 0, 0, 0.0f, 0.0f, -pos.X(), pos.Y(), (const GLubyte*)0);
|
||||
|
||||
return advance;
|
||||
}
|
||||
|
20
ExternalLibs/FTGL/src/FTPoint.cpp
Normal file
20
ExternalLibs/FTGL/src/FTPoint.cpp
Normal file
|
@ -0,0 +1,20 @@
|
|||
#include "FTPoint.h"
|
||||
|
||||
|
||||
bool operator == ( const FTPoint &a, const FTPoint &b)
|
||||
{
|
||||
return((a.values[0] == b.values[0]) && (a.values[1] == b.values[1]) && (a.values[2] == b.values[2]));
|
||||
}
|
||||
|
||||
bool operator != ( const FTPoint &a, const FTPoint &b)
|
||||
{
|
||||
return((a.values[0] != b.values[0]) || (a.values[1] != b.values[1]) || (a.values[2] != b.values[2]));
|
||||
}
|
||||
|
||||
|
||||
FTPoint operator*( double multiplier, FTPoint& point)
|
||||
{
|
||||
return point * multiplier;
|
||||
}
|
||||
|
||||
|
78
ExternalLibs/FTGL/src/FTPolyGlyph.cpp
Normal file
78
ExternalLibs/FTGL/src/FTPolyGlyph.cpp
Normal file
|
@ -0,0 +1,78 @@
|
|||
#include "FTPolyGlyph.h"
|
||||
#include "FTVectoriser.h"
|
||||
|
||||
|
||||
FTPolyGlyph::FTPolyGlyph( FT_GlyphSlot glyph, bool useDisplayList)
|
||||
: FTGlyph( glyph),
|
||||
glList(0)
|
||||
{
|
||||
if( ft_glyph_format_outline != glyph->format)
|
||||
{
|
||||
err = 0x14; // Invalid_Outline
|
||||
return;
|
||||
}
|
||||
|
||||
FTVectoriser vectoriser( glyph);
|
||||
|
||||
if(( vectoriser.ContourCount() < 1) || ( vectoriser.PointCount() < 3))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned int horizontalTextureScale = glyph->face->size->metrics.x_ppem * 64;
|
||||
unsigned int verticalTextureScale = glyph->face->size->metrics.y_ppem * 64;
|
||||
|
||||
vectoriser.MakeMesh( 1.0);
|
||||
|
||||
if( useDisplayList)
|
||||
{
|
||||
glList = glGenLists( 1);
|
||||
glNewList( glList, GL_COMPILE);
|
||||
}
|
||||
|
||||
const FTMesh* mesh = vectoriser.GetMesh();
|
||||
for( unsigned int index = 0; index < mesh->TesselationCount(); ++index)
|
||||
{
|
||||
const FTTesselation* subMesh = mesh->Tesselation( index);
|
||||
unsigned int polyonType = subMesh->PolygonType();
|
||||
|
||||
glBegin( polyonType);
|
||||
for( unsigned int pointIndex = 0; pointIndex < subMesh->PointCount(); ++pointIndex)
|
||||
{
|
||||
FTPoint point = subMesh->Point(pointIndex);
|
||||
|
||||
glTexCoord2f( point.X() / horizontalTextureScale,
|
||||
point.Y() / verticalTextureScale);
|
||||
|
||||
glVertex3f( point.X() / 64.0f,
|
||||
point.Y() / 64.0f,
|
||||
0.0f);
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
|
||||
if(useDisplayList)
|
||||
{
|
||||
glEndList();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FTPolyGlyph::~FTPolyGlyph()
|
||||
{
|
||||
glDeleteLists( glList, 1);
|
||||
}
|
||||
|
||||
|
||||
const FTPoint& FTPolyGlyph::Render( const FTPoint& pen)
|
||||
{
|
||||
glTranslatef( pen.X(), pen.Y(), 0.0f);
|
||||
|
||||
if( glList)
|
||||
{
|
||||
glCallList( glList);
|
||||
}
|
||||
|
||||
return advance;
|
||||
}
|
||||
|
105
ExternalLibs/FTGL/src/FTSize.cpp
Normal file
105
ExternalLibs/FTGL/src/FTSize.cpp
Normal file
|
@ -0,0 +1,105 @@
|
|||
#include "FTSize.h"
|
||||
|
||||
|
||||
FTSize::FTSize()
|
||||
: ftFace(0),
|
||||
ftSize(0),
|
||||
size(0),
|
||||
xResolution(0),
|
||||
yResolution(0),
|
||||
err(0)
|
||||
{}
|
||||
|
||||
|
||||
FTSize::~FTSize()
|
||||
{}
|
||||
|
||||
|
||||
bool FTSize::CharSize( FT_Face* face, unsigned int pointSize, unsigned int xRes, unsigned int yRes )
|
||||
{
|
||||
if( size != pointSize || xResolution != xRes || yResolution != yRes)
|
||||
{
|
||||
err = FT_Set_Char_Size( *face, 0L, pointSize * 64, xResolution, yResolution);
|
||||
|
||||
if( !err)
|
||||
{
|
||||
ftFace = face;
|
||||
size = pointSize;
|
||||
xResolution = xRes;
|
||||
yResolution = yRes;
|
||||
ftSize = (*ftFace)->size;
|
||||
}
|
||||
else
|
||||
{
|
||||
ftFace = 0;
|
||||
size = 0;
|
||||
xResolution = 0;
|
||||
yResolution = 0;
|
||||
ftSize = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return !err;
|
||||
}
|
||||
|
||||
|
||||
unsigned int FTSize::CharSize() const
|
||||
{
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
float FTSize::Ascender() const
|
||||
{
|
||||
return ftSize == 0 ? 0.0f : static_cast<float>( ftSize->metrics.ascender) / 64.0f;
|
||||
}
|
||||
|
||||
|
||||
float FTSize::Descender() const
|
||||
{
|
||||
return ftSize == 0 ? 0.0f : static_cast<float>( ftSize->metrics.descender) / 64.0f;
|
||||
}
|
||||
|
||||
|
||||
float FTSize::Height() const
|
||||
{
|
||||
if( 0 == ftSize)
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
if( FT_IS_SCALABLE((*ftFace)))
|
||||
{
|
||||
return ( (*ftFace)->bbox.yMax - (*ftFace)->bbox.yMin) * ( (float)ftSize->metrics.y_ppem / (float)(*ftFace)->units_per_EM);
|
||||
}
|
||||
else
|
||||
{
|
||||
return static_cast<float>( ftSize->metrics.height) / 64.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
float FTSize::Width() const
|
||||
{
|
||||
if( 0 == ftSize)
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
if( FT_IS_SCALABLE((*ftFace)))
|
||||
{
|
||||
return ( (*ftFace)->bbox.xMax - (*ftFace)->bbox.xMin) * ( static_cast<float>(ftSize->metrics.x_ppem) / static_cast<float>((*ftFace)->units_per_EM));
|
||||
}
|
||||
else
|
||||
{
|
||||
return static_cast<float>( ftSize->metrics.max_advance) / 64.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
float FTSize::Underline() const
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
|
83
ExternalLibs/FTGL/src/FTTextureGlyph.cpp
Normal file
83
ExternalLibs/FTGL/src/FTTextureGlyph.cpp
Normal file
|
@ -0,0 +1,83 @@
|
|||
#include "FTTextureGlyph.h"
|
||||
|
||||
GLint FTTextureGlyph::activeTextureID = 0;
|
||||
|
||||
FTTextureGlyph::FTTextureGlyph( FT_GlyphSlot glyph, int id, int xOffset, int yOffset, GLsizei width, GLsizei height)
|
||||
: FTGlyph( glyph),
|
||||
destWidth(0),
|
||||
destHeight(0),
|
||||
glTextureID(id)
|
||||
{
|
||||
err = FT_Render_Glyph( glyph, FT_RENDER_MODE_NORMAL);
|
||||
if( err || glyph->format != ft_glyph_format_bitmap)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
FT_Bitmap bitmap = glyph->bitmap;
|
||||
|
||||
destWidth = bitmap.width;
|
||||
destHeight = bitmap.rows;
|
||||
|
||||
if( destWidth && destHeight)
|
||||
{
|
||||
glPushClientAttrib( GL_CLIENT_PIXEL_STORE_BIT);
|
||||
glPixelStorei( GL_UNPACK_LSB_FIRST, GL_FALSE);
|
||||
glPixelStorei( GL_UNPACK_ROW_LENGTH, 0);
|
||||
glPixelStorei( GL_UNPACK_ALIGNMENT, 1);
|
||||
glBindTexture( GL_TEXTURE_2D, glTextureID);
|
||||
glTexSubImage2D( GL_TEXTURE_2D, 0, xOffset, yOffset, destWidth, destHeight, GL_ALPHA, GL_UNSIGNED_BYTE, bitmap.buffer);
|
||||
glPopClientAttrib();
|
||||
}
|
||||
|
||||
|
||||
// 0
|
||||
// +----+
|
||||
// | |
|
||||
// | |
|
||||
// | |
|
||||
// +----+
|
||||
// 1
|
||||
|
||||
uv[0].X( static_cast<float>(xOffset) / static_cast<float>(width));
|
||||
uv[0].Y( static_cast<float>(yOffset) / static_cast<float>(height));
|
||||
uv[1].X( static_cast<float>( xOffset + destWidth) / static_cast<float>(width));
|
||||
uv[1].Y( static_cast<float>( yOffset + destHeight) / static_cast<float>(height));
|
||||
|
||||
pos.X( glyph->bitmap_left);
|
||||
pos.Y( glyph->bitmap_top);
|
||||
}
|
||||
|
||||
|
||||
FTTextureGlyph::~FTTextureGlyph()
|
||||
{}
|
||||
|
||||
|
||||
const FTPoint& FTTextureGlyph::Render( const FTPoint& pen)
|
||||
{
|
||||
if( activeTextureID != glTextureID)
|
||||
{
|
||||
glBindTexture( GL_TEXTURE_2D, (GLuint)glTextureID);
|
||||
activeTextureID = glTextureID;
|
||||
}
|
||||
|
||||
glTranslatef( pen.X(), pen.Y(), 0.0f);
|
||||
|
||||
glBegin( GL_QUADS);
|
||||
glTexCoord2f( uv[0].X(), uv[0].Y());
|
||||
glVertex2f( pos.X(), pos.Y());
|
||||
|
||||
glTexCoord2f( uv[0].X(), uv[1].Y());
|
||||
glVertex2f( pos.X(), pos.Y() - destHeight);
|
||||
|
||||
glTexCoord2f( uv[1].X(), uv[1].Y());
|
||||
glVertex2f( destWidth + pos.X(), pos.Y() - destHeight);
|
||||
|
||||
glTexCoord2f( uv[1].X(), uv[0].Y());
|
||||
glVertex2f( destWidth + pos.X(), pos.Y());
|
||||
glEnd();
|
||||
|
||||
return advance;
|
||||
}
|
||||
|
||||
|
228
ExternalLibs/FTGL/src/FTVectoriser.cpp
Normal file
228
ExternalLibs/FTGL/src/FTVectoriser.cpp
Normal file
|
@ -0,0 +1,228 @@
|
|||
#include "FTVectoriser.h"
|
||||
#include "FTGL.h"
|
||||
|
||||
#ifndef CALLBACK
|
||||
#define CALLBACK
|
||||
#endif
|
||||
|
||||
#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2))
|
||||
typedef void (*GLUTesselatorFunction)();
|
||||
#elif defined(__APPLE_CC__)
|
||||
typedef void (*GLUTesselatorFunction)();
|
||||
#elif defined( __mips ) || defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __OpenBSD__ ) || defined( __sun ) || defined (__CYGWIN__)
|
||||
typedef GLvoid (*GLUTesselatorFunction)();
|
||||
#elif defined ( WIN32)
|
||||
typedef GLvoid (CALLBACK *GLUTesselatorFunction)( );
|
||||
#else
|
||||
#error "Error - need to define type GLUTesselatorFunction for this platform/compiler"
|
||||
#endif
|
||||
|
||||
|
||||
void CALLBACK ftglError( GLenum errCode, FTMesh* mesh)
|
||||
{
|
||||
mesh->Error( errCode);
|
||||
}
|
||||
|
||||
|
||||
void CALLBACK ftglVertex( void* data, FTMesh* mesh)
|
||||
{
|
||||
FTGL_DOUBLE* vertex = static_cast<FTGL_DOUBLE*>(data);
|
||||
mesh->AddPoint( vertex[0], vertex[1], vertex[2]);
|
||||
}
|
||||
|
||||
|
||||
void CALLBACK ftglCombine( FTGL_DOUBLE coords[3], void* vertex_data[4], GLfloat weight[4], void** outData, FTMesh* mesh)
|
||||
{
|
||||
const FTGL_DOUBLE* vertex = static_cast<const FTGL_DOUBLE*>(coords);
|
||||
*outData = const_cast<FTGL_DOUBLE*>(mesh->Combine( vertex[0], vertex[1], vertex[2]));
|
||||
}
|
||||
|
||||
|
||||
void CALLBACK ftglBegin( GLenum type, FTMesh* mesh)
|
||||
{
|
||||
mesh->Begin( type);
|
||||
}
|
||||
|
||||
|
||||
void CALLBACK ftglEnd( FTMesh* mesh)
|
||||
{
|
||||
mesh->End();
|
||||
}
|
||||
|
||||
|
||||
FTMesh::FTMesh()
|
||||
: currentTesselation(0),
|
||||
err(0)
|
||||
{
|
||||
tesselationList.reserve( 16);
|
||||
}
|
||||
|
||||
|
||||
FTMesh::~FTMesh()
|
||||
{
|
||||
for( size_t t = 0; t < tesselationList.size(); ++t)
|
||||
{
|
||||
delete tesselationList[t];
|
||||
}
|
||||
|
||||
tesselationList.clear();
|
||||
}
|
||||
|
||||
|
||||
void FTMesh::AddPoint( const FTGL_DOUBLE x, const FTGL_DOUBLE y, const FTGL_DOUBLE z)
|
||||
{
|
||||
currentTesselation->AddPoint( x, y, z);
|
||||
}
|
||||
|
||||
|
||||
const FTGL_DOUBLE* FTMesh::Combine( const FTGL_DOUBLE x, const FTGL_DOUBLE y, const FTGL_DOUBLE z)
|
||||
{
|
||||
tempPointList.push_back( FTPoint( x, y,z));
|
||||
return static_cast<const FTGL_DOUBLE*>(tempPointList.back());
|
||||
}
|
||||
|
||||
|
||||
void FTMesh::Begin( GLenum meshType)
|
||||
{
|
||||
currentTesselation = new FTTesselation( meshType);
|
||||
}
|
||||
|
||||
|
||||
void FTMesh::End()
|
||||
{
|
||||
tesselationList.push_back( currentTesselation);
|
||||
}
|
||||
|
||||
|
||||
const FTTesselation* const FTMesh::Tesselation( unsigned int index) const
|
||||
{
|
||||
return ( index < tesselationList.size()) ? tesselationList[index] : NULL;
|
||||
}
|
||||
|
||||
|
||||
FTVectoriser::FTVectoriser( const FT_GlyphSlot glyph)
|
||||
: contourList(0),
|
||||
mesh(0),
|
||||
ftContourCount(0),
|
||||
contourFlag(0)
|
||||
{
|
||||
if( glyph)
|
||||
{
|
||||
outline = glyph->outline;
|
||||
|
||||
ftContourCount = outline.n_contours;
|
||||
contourList = 0;
|
||||
contourFlag = outline.flags;
|
||||
|
||||
ProcessContours();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FTVectoriser::~FTVectoriser()
|
||||
{
|
||||
for( size_t c = 0; c < ContourCount(); ++c)
|
||||
{
|
||||
delete contourList[c];
|
||||
}
|
||||
|
||||
delete [] contourList;
|
||||
delete mesh;
|
||||
}
|
||||
|
||||
|
||||
void FTVectoriser::ProcessContours()
|
||||
{
|
||||
short contourLength = 0;
|
||||
short startIndex = 0;
|
||||
short endIndex = 0;
|
||||
|
||||
contourList = new FTContour*[ftContourCount];
|
||||
|
||||
for( short contourIndex = 0; contourIndex < ftContourCount; ++contourIndex)
|
||||
{
|
||||
FT_Vector* pointList = &outline.points[startIndex];
|
||||
char* tagList = &outline.tags[startIndex];
|
||||
|
||||
endIndex = outline.contours[contourIndex];
|
||||
contourLength = ( endIndex - startIndex) + 1;
|
||||
|
||||
FTContour* contour = new FTContour( pointList, tagList, contourLength);
|
||||
|
||||
contourList[contourIndex] = contour;
|
||||
|
||||
startIndex = endIndex + 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
size_t FTVectoriser::PointCount()
|
||||
{
|
||||
size_t s = 0;
|
||||
for( size_t c = 0; c < ContourCount(); ++c)
|
||||
{
|
||||
s += contourList[c]->PointCount();
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
const FTContour* const FTVectoriser::Contour( unsigned int index) const
|
||||
{
|
||||
return ( index < ContourCount()) ? contourList[index] : NULL;
|
||||
}
|
||||
|
||||
|
||||
void FTVectoriser::MakeMesh( FTGL_DOUBLE zNormal)
|
||||
{
|
||||
if( mesh)
|
||||
{
|
||||
delete mesh;
|
||||
}
|
||||
|
||||
mesh = new FTMesh;
|
||||
|
||||
GLUtesselator* tobj = gluNewTess();
|
||||
|
||||
gluTessCallback( tobj, GLU_TESS_BEGIN_DATA, (GLUTesselatorFunction)ftglBegin);
|
||||
gluTessCallback( tobj, GLU_TESS_VERTEX_DATA, (GLUTesselatorFunction)ftglVertex);
|
||||
gluTessCallback( tobj, GLU_TESS_COMBINE_DATA, (GLUTesselatorFunction)ftglCombine);
|
||||
gluTessCallback( tobj, GLU_TESS_END_DATA, (GLUTesselatorFunction)ftglEnd);
|
||||
gluTessCallback( tobj, GLU_TESS_ERROR_DATA, (GLUTesselatorFunction)ftglError);
|
||||
|
||||
if( contourFlag & ft_outline_even_odd_fill) // ft_outline_reverse_fill
|
||||
{
|
||||
gluTessProperty( tobj, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_ODD);
|
||||
}
|
||||
else
|
||||
{
|
||||
gluTessProperty( tobj, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_NONZERO);
|
||||
}
|
||||
|
||||
|
||||
gluTessProperty( tobj, GLU_TESS_TOLERANCE, 0);
|
||||
gluTessNormal( tobj, 0.0f, 0.0f, zNormal);
|
||||
gluTessBeginPolygon( tobj, mesh);
|
||||
|
||||
for( size_t c = 0; c < ContourCount(); ++c)
|
||||
{
|
||||
const FTContour* contour = contourList[c];
|
||||
|
||||
gluTessBeginContour( tobj);
|
||||
|
||||
for( size_t p = 0; p < contour->PointCount(); ++p)
|
||||
{
|
||||
const FTGL_DOUBLE* d = contour->Point(p);
|
||||
gluTessVertex( tobj, (GLdouble*)d, (GLdouble*)d);
|
||||
}
|
||||
|
||||
gluTessEndContour( tobj);
|
||||
}
|
||||
|
||||
gluTessEndPolygon( tobj);
|
||||
|
||||
gluDeleteTess( tobj);
|
||||
}
|
||||
|
||||
|
95
ExternalLibs/SDL12/include/SDL.h
Normal file
95
ExternalLibs/SDL12/include/SDL.h
Normal file
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* Main include header for the SDL library */
|
||||
|
||||
#ifndef _SDL_H
|
||||
#define _SDL_H
|
||||
|
||||
#include "SDL_main.h"
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_audio.h"
|
||||
#include "SDL_cdrom.h"
|
||||
#include "SDL_cpuinfo.h"
|
||||
#include "SDL_endian.h"
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_events.h"
|
||||
#include "SDL_loadso.h"
|
||||
#include "SDL_mutex.h"
|
||||
#include "SDL_rwops.h"
|
||||
#include "SDL_thread.h"
|
||||
#include "SDL_timer.h"
|
||||
#include "SDL_video.h"
|
||||
#include "SDL_version.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* As of version 0.5, SDL is loaded dynamically into the application */
|
||||
|
||||
/* These are the flags which may be passed to SDL_Init() -- you should
|
||||
specify the subsystems which you will be using in your application.
|
||||
*/
|
||||
#define SDL_INIT_TIMER 0x00000001
|
||||
#define SDL_INIT_AUDIO 0x00000010
|
||||
#define SDL_INIT_VIDEO 0x00000020
|
||||
#define SDL_INIT_CDROM 0x00000100
|
||||
#define SDL_INIT_JOYSTICK 0x00000200
|
||||
#define SDL_INIT_NOPARACHUTE 0x00100000 /* Don't catch fatal signals */
|
||||
#define SDL_INIT_EVENTTHREAD 0x01000000 /* Not supported on all OS's */
|
||||
#define SDL_INIT_EVERYTHING 0x0000FFFF
|
||||
|
||||
/* This function loads the SDL dynamically linked library and initializes
|
||||
* the subsystems specified by 'flags' (and those satisfying dependencies)
|
||||
* Unless the SDL_INIT_NOPARACHUTE flag is set, it will install cleanup
|
||||
* signal handlers for some commonly ignored fatal signals (like SIGSEGV)
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags);
|
||||
|
||||
/* This function initializes specific SDL subsystems */
|
||||
extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags);
|
||||
|
||||
/* This function cleans up specific SDL subsystems */
|
||||
extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags);
|
||||
|
||||
/* This function returns mask of the specified subsystems which have
|
||||
been initialized.
|
||||
If 'flags' is 0, it returns a mask of all initialized subsystems.
|
||||
*/
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags);
|
||||
|
||||
/* This function cleans up all initialized subsystems and unloads the
|
||||
* dynamically linked library. You should call it upon all exit conditions.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_Quit(void);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_H */
|
||||
|
59
ExternalLibs/SDL12/include/SDL_active.h
Normal file
59
ExternalLibs/SDL12/include/SDL_active.h
Normal file
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* Include file for SDL application focus event handling */
|
||||
|
||||
#ifndef _SDL_active_h
|
||||
#define _SDL_active_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_error.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* The available application states */
|
||||
#define SDL_APPMOUSEFOCUS 0x01 /* The app has mouse coverage */
|
||||
#define SDL_APPINPUTFOCUS 0x02 /* The app has input focus */
|
||||
#define SDL_APPACTIVE 0x04 /* The application is active */
|
||||
|
||||
/* Function prototypes */
|
||||
/*
|
||||
* This function returns the current state of the application, which is a
|
||||
* bitwise combination of SDL_APPMOUSEFOCUS, SDL_APPINPUTFOCUS, and
|
||||
* SDL_APPACTIVE. If SDL_APPACTIVE is set, then the user is able to
|
||||
* see your application, otherwise it has been iconified or disabled.
|
||||
*/
|
||||
extern DECLSPEC Uint8 SDLCALL SDL_GetAppState(void);
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_active_h */
|
||||
|
254
ExternalLibs/SDL12/include/SDL_audio.h
Normal file
254
ExternalLibs/SDL12/include/SDL_audio.h
Normal file
|
@ -0,0 +1,254 @@
|
|||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* Access to the raw audio mixing buffer for the SDL library */
|
||||
|
||||
#ifndef _SDL_audio_h
|
||||
#define _SDL_audio_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_endian.h"
|
||||
#include "SDL_mutex.h"
|
||||
#include "SDL_thread.h"
|
||||
#include "SDL_rwops.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* The calculated values in this structure are calculated by SDL_OpenAudio() */
|
||||
typedef struct SDL_AudioSpec {
|
||||
int freq; /* DSP frequency -- samples per second */
|
||||
Uint16 format; /* Audio data format */
|
||||
Uint8 channels; /* Number of channels: 1 mono, 2 stereo */
|
||||
Uint8 silence; /* Audio buffer silence value (calculated) */
|
||||
Uint16 samples; /* Audio buffer size in samples (power of 2) */
|
||||
Uint16 padding; /* Necessary for some compile environments */
|
||||
Uint32 size; /* Audio buffer size in bytes (calculated) */
|
||||
/* This function is called when the audio device needs more data.
|
||||
'stream' is a pointer to the audio data buffer
|
||||
'len' is the length of that buffer in bytes.
|
||||
Once the callback returns, the buffer will no longer be valid.
|
||||
Stereo samples are stored in a LRLRLR ordering.
|
||||
*/
|
||||
void (SDLCALL *callback)(void *userdata, Uint8 *stream, int len);
|
||||
void *userdata;
|
||||
} SDL_AudioSpec;
|
||||
|
||||
/* Audio format flags (defaults to LSB byte order) */
|
||||
#define AUDIO_U8 0x0008 /* Unsigned 8-bit samples */
|
||||
#define AUDIO_S8 0x8008 /* Signed 8-bit samples */
|
||||
#define AUDIO_U16LSB 0x0010 /* Unsigned 16-bit samples */
|
||||
#define AUDIO_S16LSB 0x8010 /* Signed 16-bit samples */
|
||||
#define AUDIO_U16MSB 0x1010 /* As above, but big-endian byte order */
|
||||
#define AUDIO_S16MSB 0x9010 /* As above, but big-endian byte order */
|
||||
#define AUDIO_U16 AUDIO_U16LSB
|
||||
#define AUDIO_S16 AUDIO_S16LSB
|
||||
|
||||
/* Native audio byte ordering */
|
||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||
#define AUDIO_U16SYS AUDIO_U16LSB
|
||||
#define AUDIO_S16SYS AUDIO_S16LSB
|
||||
#else
|
||||
#define AUDIO_U16SYS AUDIO_U16MSB
|
||||
#define AUDIO_S16SYS AUDIO_S16MSB
|
||||
#endif
|
||||
|
||||
|
||||
/* A structure to hold a set of audio conversion filters and buffers */
|
||||
typedef struct SDL_AudioCVT {
|
||||
int needed; /* Set to 1 if conversion possible */
|
||||
Uint16 src_format; /* Source audio format */
|
||||
Uint16 dst_format; /* Target audio format */
|
||||
double rate_incr; /* Rate conversion increment */
|
||||
Uint8 *buf; /* Buffer to hold entire audio data */
|
||||
int len; /* Length of original audio buffer */
|
||||
int len_cvt; /* Length of converted audio buffer */
|
||||
int len_mult; /* buffer must be len*len_mult big */
|
||||
double len_ratio; /* Given len, final size is len*len_ratio */
|
||||
void (SDLCALL *filters[10])(struct SDL_AudioCVT *cvt, Uint16 format);
|
||||
int filter_index; /* Current audio conversion function */
|
||||
} SDL_AudioCVT;
|
||||
|
||||
|
||||
/* Function prototypes */
|
||||
|
||||
/* These functions are used internally, and should not be used unless you
|
||||
* have a specific need to specify the audio driver you want to use.
|
||||
* You should normally use SDL_Init() or SDL_InitSubSystem().
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name);
|
||||
extern DECLSPEC void SDLCALL SDL_AudioQuit(void);
|
||||
|
||||
/* This function fills the given character buffer with the name of the
|
||||
* current audio driver, and returns a pointer to it if the audio driver has
|
||||
* been initialized. It returns NULL if no driver has been initialized.
|
||||
*/
|
||||
extern DECLSPEC char * SDLCALL SDL_AudioDriverName(char *namebuf, int maxlen);
|
||||
|
||||
/*
|
||||
* This function opens the audio device with the desired parameters, and
|
||||
* returns 0 if successful, placing the actual hardware parameters in the
|
||||
* structure pointed to by 'obtained'. If 'obtained' is NULL, the audio
|
||||
* data passed to the callback function will be guaranteed to be in the
|
||||
* requested format, and will be automatically converted to the hardware
|
||||
* audio format if necessary. This function returns -1 if it failed
|
||||
* to open the audio device, or couldn't set up the audio thread.
|
||||
*
|
||||
* When filling in the desired audio spec structure,
|
||||
* 'desired->freq' should be the desired audio frequency in samples-per-second.
|
||||
* 'desired->format' should be the desired audio format.
|
||||
* 'desired->samples' is the desired size of the audio buffer, in samples.
|
||||
* This number should be a power of two, and may be adjusted by the audio
|
||||
* driver to a value more suitable for the hardware. Good values seem to
|
||||
* range between 512 and 8096 inclusive, depending on the application and
|
||||
* CPU speed. Smaller values yield faster response time, but can lead
|
||||
* to underflow if the application is doing heavy processing and cannot
|
||||
* fill the audio buffer in time. A stereo sample consists of both right
|
||||
* and left channels in LR ordering.
|
||||
* Note that the number of samples is directly related to time by the
|
||||
* following formula: ms = (samples*1000)/freq
|
||||
* 'desired->size' is the size in bytes of the audio buffer, and is
|
||||
* calculated by SDL_OpenAudio().
|
||||
* 'desired->silence' is the value used to set the buffer to silence,
|
||||
* and is calculated by SDL_OpenAudio().
|
||||
* 'desired->callback' should be set to a function that will be called
|
||||
* when the audio device is ready for more data. It is passed a pointer
|
||||
* to the audio buffer, and the length in bytes of the audio buffer.
|
||||
* This function usually runs in a separate thread, and so you should
|
||||
* protect data structures that it accesses by calling SDL_LockAudio()
|
||||
* and SDL_UnlockAudio() in your code.
|
||||
* 'desired->userdata' is passed as the first parameter to your callback
|
||||
* function.
|
||||
*
|
||||
* The audio device starts out playing silence when it's opened, and should
|
||||
* be enabled for playing by calling SDL_PauseAudio(0) when you are ready
|
||||
* for your audio callback function to be called. Since the audio driver
|
||||
* may modify the requested size of the audio buffer, you should allocate
|
||||
* any local mixing buffers after you open the audio device.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained);
|
||||
|
||||
/*
|
||||
* Get the current audio state:
|
||||
*/
|
||||
typedef enum {
|
||||
SDL_AUDIO_STOPPED = 0,
|
||||
SDL_AUDIO_PLAYING,
|
||||
SDL_AUDIO_PAUSED
|
||||
} SDL_audiostatus;
|
||||
extern DECLSPEC SDL_audiostatus SDLCALL SDL_GetAudioStatus(void);
|
||||
|
||||
/*
|
||||
* This function pauses and unpauses the audio callback processing.
|
||||
* It should be called with a parameter of 0 after opening the audio
|
||||
* device to start playing sound. This is so you can safely initialize
|
||||
* data for your callback function after opening the audio device.
|
||||
* Silence will be written to the audio device during the pause.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on);
|
||||
|
||||
/*
|
||||
* This function loads a WAVE from the data source, automatically freeing
|
||||
* that source if 'freesrc' is non-zero. For example, to load a WAVE file,
|
||||
* you could do:
|
||||
* SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...);
|
||||
*
|
||||
* If this function succeeds, it returns the given SDL_AudioSpec,
|
||||
* filled with the audio data format of the wave data, and sets
|
||||
* 'audio_buf' to a malloc()'d buffer containing the audio data,
|
||||
* and sets 'audio_len' to the length of that audio buffer, in bytes.
|
||||
* You need to free the audio buffer with SDL_FreeWAV() when you are
|
||||
* done with it.
|
||||
*
|
||||
* This function returns NULL and sets the SDL error message if the
|
||||
* wave file cannot be opened, uses an unknown data format, or is
|
||||
* corrupt. Currently raw and MS-ADPCM WAVE files are supported.
|
||||
*/
|
||||
extern DECLSPEC SDL_AudioSpec * SDLCALL SDL_LoadWAV_RW(SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len);
|
||||
|
||||
/* Compatibility convenience function -- loads a WAV from a file */
|
||||
#define SDL_LoadWAV(file, spec, audio_buf, audio_len) \
|
||||
SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len)
|
||||
|
||||
/*
|
||||
* This function frees data previously allocated with SDL_LoadWAV_RW()
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 *audio_buf);
|
||||
|
||||
/*
|
||||
* This function takes a source format and rate and a destination format
|
||||
* and rate, and initializes the 'cvt' structure with information needed
|
||||
* by SDL_ConvertAudio() to convert a buffer of audio data from one format
|
||||
* to the other.
|
||||
* This function returns 0, or -1 if there was an error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT *cvt,
|
||||
Uint16 src_format, Uint8 src_channels, int src_rate,
|
||||
Uint16 dst_format, Uint8 dst_channels, int dst_rate);
|
||||
|
||||
/* Once you have initialized the 'cvt' structure using SDL_BuildAudioCVT(),
|
||||
* created an audio buffer cvt->buf, and filled it with cvt->len bytes of
|
||||
* audio data in the source format, this function will convert it in-place
|
||||
* to the desired format.
|
||||
* The data conversion may expand the size of the audio data, so the buffer
|
||||
* cvt->buf should be allocated after the cvt structure is initialized by
|
||||
* SDL_BuildAudioCVT(), and should be cvt->len*cvt->len_mult bytes long.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT *cvt);
|
||||
|
||||
/*
|
||||
* This takes two audio buffers of the playing audio format and mixes
|
||||
* them, performing addition, volume adjustment, and overflow clipping.
|
||||
* The volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME
|
||||
* for full audio volume. Note this does not change hardware volume.
|
||||
* This is provided for convenience -- you can mix your own audio data.
|
||||
*/
|
||||
#define SDL_MIX_MAXVOLUME 128
|
||||
extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 *dst, const Uint8 *src, Uint32 len, int volume);
|
||||
|
||||
/*
|
||||
* The lock manipulated by these functions protects the callback function.
|
||||
* During a LockAudio/UnlockAudio pair, you can be guaranteed that the
|
||||
* callback function is not running. Do not call these from the callback
|
||||
* function or you will cause deadlock.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_LockAudio(void);
|
||||
extern DECLSPEC void SDLCALL SDL_UnlockAudio(void);
|
||||
|
||||
/*
|
||||
* This function shuts down audio processing and closes the audio device.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_CloseAudio(void);
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_audio_h */
|
||||
|
25
ExternalLibs/SDL12/include/SDL_byteorder.h
Normal file
25
ExternalLibs/SDL12/include/SDL_byteorder.h
Normal file
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* DEPRECATED */
|
||||
#include "SDL_endian.h"
|
||||
|
172
ExternalLibs/SDL12/include/SDL_cdrom.h
Normal file
172
ExternalLibs/SDL12/include/SDL_cdrom.h
Normal file
|
@ -0,0 +1,172 @@
|
|||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* This is the CD-audio control API for Simple DirectMedia Layer */
|
||||
|
||||
#ifndef _SDL_cdrom_h
|
||||
#define _SDL_cdrom_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_error.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* In order to use these functions, SDL_Init() must have been called
|
||||
with the SDL_INIT_CDROM flag. This causes SDL to scan the system
|
||||
for CD-ROM drives, and load appropriate drivers.
|
||||
*/
|
||||
|
||||
/* The maximum number of CD-ROM tracks on a disk */
|
||||
#define SDL_MAX_TRACKS 99
|
||||
|
||||
/* The types of CD-ROM track possible */
|
||||
#define SDL_AUDIO_TRACK 0x00
|
||||
#define SDL_DATA_TRACK 0x04
|
||||
|
||||
/* The possible states which a CD-ROM drive can be in. */
|
||||
typedef enum {
|
||||
CD_TRAYEMPTY,
|
||||
CD_STOPPED,
|
||||
CD_PLAYING,
|
||||
CD_PAUSED,
|
||||
CD_ERROR = -1
|
||||
} CDstatus;
|
||||
|
||||
/* Given a status, returns true if there's a disk in the drive */
|
||||
#define CD_INDRIVE(status) ((int)(status) > 0)
|
||||
|
||||
typedef struct SDL_CDtrack {
|
||||
Uint8 id; /* Track number */
|
||||
Uint8 type; /* Data or audio track */
|
||||
Uint16 unused;
|
||||
Uint32 length; /* Length, in frames, of this track */
|
||||
Uint32 offset; /* Offset, in frames, from start of disk */
|
||||
} SDL_CDtrack;
|
||||
|
||||
/* This structure is only current as of the last call to SDL_CDStatus() */
|
||||
typedef struct SDL_CD {
|
||||
int id; /* Private drive identifier */
|
||||
CDstatus status; /* Current drive status */
|
||||
|
||||
/* The rest of this structure is only valid if there's a CD in drive */
|
||||
int numtracks; /* Number of tracks on disk */
|
||||
int cur_track; /* Current track position */
|
||||
int cur_frame; /* Current frame offset within current track */
|
||||
SDL_CDtrack track[SDL_MAX_TRACKS+1];
|
||||
} SDL_CD;
|
||||
|
||||
/* Conversion functions from frames to Minute/Second/Frames and vice versa */
|
||||
#define CD_FPS 75
|
||||
#define FRAMES_TO_MSF(f, M,S,F) { \
|
||||
int value = f; \
|
||||
*(F) = value%CD_FPS; \
|
||||
value /= CD_FPS; \
|
||||
*(S) = value%60; \
|
||||
value /= 60; \
|
||||
*(M) = value; \
|
||||
}
|
||||
#define MSF_TO_FRAMES(M, S, F) ((M)*60*CD_FPS+(S)*CD_FPS+(F))
|
||||
|
||||
/* CD-audio API functions: */
|
||||
|
||||
/* 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 SDLCALL SDL_CDNumDrives(void);
|
||||
|
||||
/* Returns a human-readable, system-dependent identifier for the CD-ROM.
|
||||
Example:
|
||||
"/dev/cdrom"
|
||||
"E:"
|
||||
"/dev/disk/ide/1/master"
|
||||
*/
|
||||
extern DECLSPEC const char * SDLCALL SDL_CDName(int drive);
|
||||
|
||||
/* 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
|
||||
becomes the default CD used when other CD functions are passed a NULL
|
||||
CD-ROM handle.
|
||||
Drives are numbered starting with 0. Drive 0 is the system default CD-ROM.
|
||||
*/
|
||||
extern DECLSPEC SDL_CD * SDLCALL SDL_CDOpen(int drive);
|
||||
|
||||
/* 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 SDLCALL SDL_CDStatus(SDL_CD *cdrom);
|
||||
|
||||
/* 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
|
||||
until the end of the CD. This function will skip data tracks.
|
||||
This function should only be called after calling SDL_CDStatus() to
|
||||
get track information about the CD.
|
||||
For example:
|
||||
// Play entire CD:
|
||||
if ( CD_INDRIVE(SDL_CDStatus(cdrom)) )
|
||||
SDL_CDPlayTracks(cdrom, 0, 0, 0, 0);
|
||||
// Play last track:
|
||||
if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) {
|
||||
SDL_CDPlayTracks(cdrom, cdrom->numtracks-1, 0, 0, 0);
|
||||
}
|
||||
// Play first and second track and 10 seconds of third track:
|
||||
if ( CD_INDRIVE(SDL_CDStatus(cdrom)) )
|
||||
SDL_CDPlayTracks(cdrom, 0, 0, 2, 10);
|
||||
|
||||
This function returns 0, or -1 if there was an error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_CDPlayTracks(SDL_CD *cdrom,
|
||||
int start_track, int start_frame, int ntracks, int nframes);
|
||||
|
||||
/* Play the given CD starting at 'start' frame for 'length' frames.
|
||||
It returns 0, or -1 if there was an error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_CDPlay(SDL_CD *cdrom, int start, int length);
|
||||
|
||||
/* Pause play -- returns 0, or -1 on error */
|
||||
extern DECLSPEC int SDLCALL SDL_CDPause(SDL_CD *cdrom);
|
||||
|
||||
/* Resume play -- returns 0, or -1 on error */
|
||||
extern DECLSPEC int SDLCALL SDL_CDResume(SDL_CD *cdrom);
|
||||
|
||||
/* Stop play -- returns 0, or -1 on error */
|
||||
extern DECLSPEC int SDLCALL SDL_CDStop(SDL_CD *cdrom);
|
||||
|
||||
/* Eject CD-ROM -- returns 0, or -1 on error */
|
||||
extern DECLSPEC int SDLCALL SDL_CDEject(SDL_CD *cdrom);
|
||||
|
||||
/* Closes the handle for the CD-ROM drive */
|
||||
extern DECLSPEC void SDLCALL SDL_CDClose(SDL_CD *cdrom);
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_video_h */
|
||||
|
70
ExternalLibs/SDL12/include/SDL_config.h
Normal file
70
ExternalLibs/SDL12/include/SDL_config.h
Normal file
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
#ifndef _SDL_config_minimal_h
|
||||
#define _SDL_config_minimal_h
|
||||
|
||||
#include "SDL_platform.h"
|
||||
|
||||
/* This is the minimal configuration that can be used to build SDL */
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
typedef __int8 int8_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef __int16 int16_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef __int32 int32_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef size_t uintptr_t;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
/* Enable the dummy audio driver (src/audio/dummy/\*.c) */
|
||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||
|
||||
/* Enable the stub cdrom driver (src/cdrom/dummy/\*.c) */
|
||||
#define SDL_CDROM_DISABLED 1
|
||||
|
||||
/* Enable the stub joystick driver (src/joystick/dummy/\*.c) */
|
||||
#define SDL_JOYSTICK_DISABLED 1
|
||||
|
||||
/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
|
||||
#define SDL_LOADSO_DISABLED 1
|
||||
|
||||
/* Enable the stub thread support (src/thread/generic/\*.c) */
|
||||
#define SDL_THREADS_DISABLED 1
|
||||
|
||||
/* Enable the stub timer support (src/timer/dummy/\*.c) */
|
||||
#define SDL_TIMERS_DISABLED 1
|
||||
|
||||
/* Enable the dummy video driver (src/video/dummy/\*.c) */
|
||||
#define SDL_VIDEO_DRIVER_DUMMY 1
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#define SDL_VIDEO_DRIVER_WINDIB 1
|
||||
#endif
|
||||
|
||||
#endif /* _SDL_config_minimal_h */
|
70
ExternalLibs/SDL12/include/SDL_config.h.orig
Normal file
70
ExternalLibs/SDL12/include/SDL_config.h.orig
Normal file
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
#ifndef _SDL_config_minimal_h
|
||||
#define _SDL_config_minimal_h
|
||||
|
||||
#include "SDL_platform.h"
|
||||
|
||||
/* This is the minimal configuration that can be used to build SDL */
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
typedef __int8 int8_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef __int16 int16_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef __int32 int32_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef size_t uintptr_t;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
/* Enable the dummy audio driver (src/audio/dummy/\*.c) */
|
||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||
|
||||
/* Enable the stub cdrom driver (src/cdrom/dummy/\*.c) */
|
||||
#define SDL_CDROM_DISABLED 1
|
||||
|
||||
/* Enable the stub joystick driver (src/joystick/dummy/\*.c) */
|
||||
#define SDL_JOYSTICK_DISABLED 1
|
||||
|
||||
/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
|
||||
#define SDL_LOADSO_DISABLED 1
|
||||
|
||||
/* Enable the stub thread support (src/thread/generic/\*.c) */
|
||||
#define SDL_THREADS_DISABLED 1
|
||||
|
||||
/* Enable the stub timer support (src/timer/dummy/\*.c) */
|
||||
#define SDL_TIMERS_DISABLED 1
|
||||
|
||||
/* Enable the dummy video driver (src/video/dummy/\*.c) */
|
||||
#define SDL_VIDEO_DRIVER_DUMMY 1
|
||||
|
||||
#ifdef _WIN32
|
||||
#define SDL_VIDEO_DRIVER_WINDIB 1
|
||||
#endif
|
||||
|
||||
#endif /* _SDL_config_minimal_h */
|
76
ExternalLibs/SDL12/include/SDL_cpuinfo.h
Normal file
76
ExternalLibs/SDL12/include/SDL_cpuinfo.h
Normal file
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/* CPU feature detection for SDL */
|
||||
|
||||
#ifndef _SDL_cpuinfo_h
|
||||
#define _SDL_cpuinfo_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* This function returns true if the CPU has the RDTSC instruction
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void);
|
||||
|
||||
/* This function returns true if the CPU has MMX features
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void);
|
||||
|
||||
/* This function returns true if the CPU has MMX Ext. features
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasMMXExt(void);
|
||||
|
||||
/* This function returns true if the CPU has 3DNow features
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void);
|
||||
|
||||
/* This function returns true if the CPU has 3DNow! Ext. features
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNowExt(void);
|
||||
|
||||
/* This function returns true if the CPU has SSE features
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void);
|
||||
|
||||
/* This function returns true if the CPU has SSE2 features
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void);
|
||||
|
||||
/* This function returns true if the CPU has AltiVec features
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_cpuinfo_h */
|
||||
|
195
ExternalLibs/SDL12/include/SDL_endian.h
Normal file
195
ExternalLibs/SDL12/include/SDL_endian.h
Normal file
|
@ -0,0 +1,195 @@
|
|||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* Functions for reading and writing endian-specific values */
|
||||
|
||||
#ifndef _SDL_endian_h
|
||||
#define _SDL_endian_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
|
||||
/* The two types of endianness */
|
||||
#define SDL_LIL_ENDIAN 1234
|
||||
#define SDL_BIG_ENDIAN 4321
|
||||
|
||||
#ifndef SDL_BYTEORDER /* Not defined in SDL_config.h? */
|
||||
#if defined(__hppa__) || \
|
||||
defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
|
||||
(defined(__MIPS__) && defined(__MISPEB__)) || \
|
||||
defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \
|
||||
defined(__sparc__)
|
||||
#define SDL_BYTEORDER SDL_BIG_ENDIAN
|
||||
#else
|
||||
#define SDL_BYTEORDER SDL_LIL_ENDIAN
|
||||
#endif
|
||||
#endif /* !SDL_BYTEORDER */
|
||||
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Use inline functions for compilers that support them, and static
|
||||
functions for those that do not. Because these functions become
|
||||
static for compilers that do not support inline functions, this
|
||||
header should only be included in files that actually use them.
|
||||
*/
|
||||
#if defined(__GNUC__) && defined(__i386__) && \
|
||||
!(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */)
|
||||
static __inline__ Uint16 SDL_Swap16(Uint16 x)
|
||||
{
|
||||
__asm__("xchgb %b0,%h0" : "=q" (x) : "0" (x));
|
||||
return x;
|
||||
}
|
||||
#elif defined(__GNUC__) && defined(__x86_64__)
|
||||
static __inline__ Uint16 SDL_Swap16(Uint16 x)
|
||||
{
|
||||
__asm__("xchgb %b0,%h0" : "=Q" (x) : "0" (x));
|
||||
return x;
|
||||
}
|
||||
#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
|
||||
static __inline__ Uint16 SDL_Swap16(Uint16 x)
|
||||
{
|
||||
Uint16 result;
|
||||
|
||||
__asm__("rlwimi %0,%2,8,16,23" : "=&r" (result) : "0" (x >> 8), "r" (x));
|
||||
return result;
|
||||
}
|
||||
#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__))
|
||||
static __inline__ Uint16 SDL_Swap16(Uint16 x)
|
||||
{
|
||||
__asm__("rorw #8,%0" : "=d" (x) : "0" (x) : "cc");
|
||||
return x;
|
||||
}
|
||||
#else
|
||||
static __inline__ Uint16 SDL_Swap16(Uint16 x) {
|
||||
return((x<<8)|(x>>8));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && defined(__i386__) && \
|
||||
!(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */)
|
||||
static __inline__ Uint32 SDL_Swap32(Uint32 x)
|
||||
{
|
||||
__asm__("bswap %0" : "=r" (x) : "0" (x));
|
||||
return x;
|
||||
}
|
||||
#elif defined(__GNUC__) && defined(__x86_64__)
|
||||
static __inline__ Uint32 SDL_Swap32(Uint32 x)
|
||||
{
|
||||
__asm__("bswapl %0" : "=r" (x) : "0" (x));
|
||||
return x;
|
||||
}
|
||||
#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
|
||||
static __inline__ Uint32 SDL_Swap32(Uint32 x)
|
||||
{
|
||||
Uint32 result;
|
||||
|
||||
__asm__("rlwimi %0,%2,24,16,23" : "=&r" (result) : "0" (x>>24), "r" (x));
|
||||
__asm__("rlwimi %0,%2,8,8,15" : "=&r" (result) : "0" (result), "r" (x));
|
||||
__asm__("rlwimi %0,%2,24,0,7" : "=&r" (result) : "0" (result), "r" (x));
|
||||
return result;
|
||||
}
|
||||
#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__))
|
||||
static __inline__ Uint32 SDL_Swap32(Uint32 x)
|
||||
{
|
||||
__asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0" : "=d" (x) : "0" (x) : "cc");
|
||||
return x;
|
||||
}
|
||||
#else
|
||||
static __inline__ Uint32 SDL_Swap32(Uint32 x) {
|
||||
return((x<<24)|((x<<8)&0x00FF0000)|((x>>8)&0x0000FF00)|(x>>24));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SDL_HAS_64BIT_TYPE
|
||||
#if defined(__GNUC__) && defined(__i386__) && \
|
||||
!(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */)
|
||||
static __inline__ Uint64 SDL_Swap64(Uint64 x)
|
||||
{
|
||||
union {
|
||||
struct { Uint32 a,b; } s;
|
||||
Uint64 u;
|
||||
} v;
|
||||
v.u = x;
|
||||
__asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1"
|
||||
: "=r" (v.s.a), "=r" (v.s.b)
|
||||
: "0" (v.s.a), "1" (v.s.b));
|
||||
return v.u;
|
||||
}
|
||||
#elif defined(__GNUC__) && defined(__x86_64__)
|
||||
static __inline__ Uint64 SDL_Swap64(Uint64 x)
|
||||
{
|
||||
__asm__("bswapq %0" : "=r" (x) : "0" (x));
|
||||
return x;
|
||||
}
|
||||
#else
|
||||
static __inline__ Uint64 SDL_Swap64(Uint64 x)
|
||||
{
|
||||
Uint32 hi, lo;
|
||||
|
||||
/* Separate into high and low 32-bit values and swap them */
|
||||
lo = (Uint32)(x&0xFFFFFFFF);
|
||||
x >>= 32;
|
||||
hi = (Uint32)(x&0xFFFFFFFF);
|
||||
x = SDL_Swap32(lo);
|
||||
x <<= 32;
|
||||
x |= SDL_Swap32(hi);
|
||||
return(x);
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
/* This is mainly to keep compilers from complaining in SDL code.
|
||||
If there is no real 64-bit datatype, then compilers will complain about
|
||||
the fake 64-bit datatype that SDL provides when it compiles user code.
|
||||
*/
|
||||
#define SDL_Swap64(X) (X)
|
||||
#endif /* SDL_HAS_64BIT_TYPE */
|
||||
|
||||
|
||||
/* Byteswap item from the specified endianness to the native endianness */
|
||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||
#define SDL_SwapLE16(X) (X)
|
||||
#define SDL_SwapLE32(X) (X)
|
||||
#define SDL_SwapLE64(X) (X)
|
||||
#define SDL_SwapBE16(X) SDL_Swap16(X)
|
||||
#define SDL_SwapBE32(X) SDL_Swap32(X)
|
||||
#define SDL_SwapBE64(X) SDL_Swap64(X)
|
||||
#else
|
||||
#define SDL_SwapLE16(X) SDL_Swap16(X)
|
||||
#define SDL_SwapLE32(X) SDL_Swap32(X)
|
||||
#define SDL_SwapLE64(X) SDL_Swap64(X)
|
||||
#define SDL_SwapBE16(X) (X)
|
||||
#define SDL_SwapBE32(X) (X)
|
||||
#define SDL_SwapBE64(X) (X)
|
||||
#endif
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_endian_h */
|
||||
|
62
ExternalLibs/SDL12/include/SDL_error.h
Normal file
62
ExternalLibs/SDL12/include/SDL_error.h
Normal file
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* Simple error message routines for SDL */
|
||||
|
||||
#ifndef _SDL_error_h
|
||||
#define _SDL_error_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Public functions */
|
||||
extern DECLSPEC void SDLCALL SDL_SetError(const char *fmt, ...);
|
||||
extern DECLSPEC char * SDLCALL SDL_GetError(void);
|
||||
extern DECLSPEC void SDLCALL 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 DECLSPEC void SDLCALL SDL_Error(SDL_errorcode code);
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_error_h */
|
||||
|
338
ExternalLibs/SDL12/include/SDL_events.h
Normal file
338
ExternalLibs/SDL12/include/SDL_events.h
Normal file
|
@ -0,0 +1,338 @@
|
|||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* Include file for SDL event handling */
|
||||
|
||||
#ifndef _SDL_events_h
|
||||
#define _SDL_events_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_active.h"
|
||||
#include "SDL_keyboard.h"
|
||||
#include "SDL_mouse.h"
|
||||
#include "SDL_joystick.h"
|
||||
#include "SDL_quit.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* General keyboard/mouse state definitions */
|
||||
#define SDL_RELEASED 0
|
||||
#define SDL_PRESSED 1
|
||||
|
||||
/* Event enumerations */
|
||||
typedef enum {
|
||||
SDL_NOEVENT = 0, /* Unused (do not remove) */
|
||||
SDL_ACTIVEEVENT, /* Application loses/gains visibility */
|
||||
SDL_KEYDOWN, /* Keys pressed */
|
||||
SDL_KEYUP, /* Keys released */
|
||||
SDL_MOUSEMOTION, /* Mouse moved */
|
||||
SDL_MOUSEBUTTONDOWN, /* Mouse button pressed */
|
||||
SDL_MOUSEBUTTONUP, /* Mouse button released */
|
||||
SDL_JOYAXISMOTION, /* Joystick axis motion */
|
||||
SDL_JOYBALLMOTION, /* Joystick trackball motion */
|
||||
SDL_JOYHATMOTION, /* Joystick hat position change */
|
||||
SDL_JOYBUTTONDOWN, /* Joystick button pressed */
|
||||
SDL_JOYBUTTONUP, /* Joystick button released */
|
||||
SDL_QUIT, /* User-requested quit */
|
||||
SDL_SYSWMEVENT, /* System specific event */
|
||||
SDL_EVENT_RESERVEDA, /* Reserved for future use.. */
|
||||
SDL_EVENT_RESERVEDB, /* Reserved for future use.. */
|
||||
SDL_VIDEORESIZE, /* User resized video mode */
|
||||
SDL_VIDEOEXPOSE, /* Screen needs to be redrawn */
|
||||
SDL_EVENT_RESERVED2, /* Reserved for future use.. */
|
||||
SDL_EVENT_RESERVED3, /* Reserved for future use.. */
|
||||
SDL_EVENT_RESERVED4, /* Reserved for future use.. */
|
||||
SDL_EVENT_RESERVED5, /* Reserved for future use.. */
|
||||
SDL_EVENT_RESERVED6, /* Reserved for future use.. */
|
||||
SDL_EVENT_RESERVED7, /* Reserved for future use.. */
|
||||
/* Events SDL_USEREVENT through SDL_MAXEVENTS-1 are for your use */
|
||||
SDL_USEREVENT = 24,
|
||||
/* This last event is only for bounding internal arrays
|
||||
It is the number of bits in the event mask datatype -- Uint32
|
||||
*/
|
||||
SDL_NUMEVENTS = 32
|
||||
} SDL_EventType;
|
||||
|
||||
/* Predefined event masks */
|
||||
#define SDL_EVENTMASK(X) (1<<(X))
|
||||
typedef enum {
|
||||
SDL_ACTIVEEVENTMASK = SDL_EVENTMASK(SDL_ACTIVEEVENT),
|
||||
SDL_KEYDOWNMASK = SDL_EVENTMASK(SDL_KEYDOWN),
|
||||
SDL_KEYUPMASK = SDL_EVENTMASK(SDL_KEYUP),
|
||||
SDL_KEYEVENTMASK = SDL_EVENTMASK(SDL_KEYDOWN)|
|
||||
SDL_EVENTMASK(SDL_KEYUP),
|
||||
SDL_MOUSEMOTIONMASK = SDL_EVENTMASK(SDL_MOUSEMOTION),
|
||||
SDL_MOUSEBUTTONDOWNMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN),
|
||||
SDL_MOUSEBUTTONUPMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONUP),
|
||||
SDL_MOUSEEVENTMASK = SDL_EVENTMASK(SDL_MOUSEMOTION)|
|
||||
SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN)|
|
||||
SDL_EVENTMASK(SDL_MOUSEBUTTONUP),
|
||||
SDL_JOYAXISMOTIONMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION),
|
||||
SDL_JOYBALLMOTIONMASK = SDL_EVENTMASK(SDL_JOYBALLMOTION),
|
||||
SDL_JOYHATMOTIONMASK = SDL_EVENTMASK(SDL_JOYHATMOTION),
|
||||
SDL_JOYBUTTONDOWNMASK = SDL_EVENTMASK(SDL_JOYBUTTONDOWN),
|
||||
SDL_JOYBUTTONUPMASK = SDL_EVENTMASK(SDL_JOYBUTTONUP),
|
||||
SDL_JOYEVENTMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION)|
|
||||
SDL_EVENTMASK(SDL_JOYBALLMOTION)|
|
||||
SDL_EVENTMASK(SDL_JOYHATMOTION)|
|
||||
SDL_EVENTMASK(SDL_JOYBUTTONDOWN)|
|
||||
SDL_EVENTMASK(SDL_JOYBUTTONUP),
|
||||
SDL_VIDEORESIZEMASK = SDL_EVENTMASK(SDL_VIDEORESIZE),
|
||||
SDL_VIDEOEXPOSEMASK = SDL_EVENTMASK(SDL_VIDEOEXPOSE),
|
||||
SDL_QUITMASK = SDL_EVENTMASK(SDL_QUIT),
|
||||
SDL_SYSWMEVENTMASK = SDL_EVENTMASK(SDL_SYSWMEVENT)
|
||||
} SDL_EventMask ;
|
||||
#define SDL_ALLEVENTS 0xFFFFFFFF
|
||||
|
||||
/* Application visibility event structure */
|
||||
typedef struct SDL_ActiveEvent {
|
||||
Uint8 type; /* SDL_ACTIVEEVENT */
|
||||
Uint8 gain; /* Whether given states were gained or lost (1/0) */
|
||||
Uint8 state; /* A mask of the focus states */
|
||||
} SDL_ActiveEvent;
|
||||
|
||||
/* Keyboard event structure */
|
||||
typedef struct SDL_KeyboardEvent {
|
||||
Uint8 type; /* SDL_KEYDOWN or SDL_KEYUP */
|
||||
Uint8 which; /* The keyboard device index */
|
||||
Uint8 state; /* SDL_PRESSED or SDL_RELEASED */
|
||||
SDL_keysym keysym;
|
||||
} SDL_KeyboardEvent;
|
||||
|
||||
/* Mouse motion event structure */
|
||||
typedef struct SDL_MouseMotionEvent {
|
||||
Uint8 type; /* SDL_MOUSEMOTION */
|
||||
Uint8 which; /* The mouse device index */
|
||||
Uint8 state; /* The current button state */
|
||||
Uint16 x, y; /* The X/Y coordinates of the mouse */
|
||||
Sint16 xrel; /* The relative motion in the X direction */
|
||||
Sint16 yrel; /* The relative motion in the Y direction */
|
||||
} SDL_MouseMotionEvent;
|
||||
|
||||
/* Mouse button event structure */
|
||||
typedef struct SDL_MouseButtonEvent {
|
||||
Uint8 type; /* SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP */
|
||||
Uint8 which; /* The mouse device index */
|
||||
Uint8 button; /* The mouse button index */
|
||||
Uint8 state; /* SDL_PRESSED or SDL_RELEASED */
|
||||
Uint16 x, y; /* The X/Y coordinates of the mouse at press time */
|
||||
} SDL_MouseButtonEvent;
|
||||
|
||||
/* Joystick axis motion event structure */
|
||||
typedef struct SDL_JoyAxisEvent {
|
||||
Uint8 type; /* SDL_JOYAXISMOTION */
|
||||
Uint8 which; /* The joystick device index */
|
||||
Uint8 axis; /* The joystick axis index */
|
||||
Sint16 value; /* The axis value (range: -32768 to 32767) */
|
||||
} SDL_JoyAxisEvent;
|
||||
|
||||
/* Joystick trackball motion event structure */
|
||||
typedef struct SDL_JoyBallEvent {
|
||||
Uint8 type; /* SDL_JOYBALLMOTION */
|
||||
Uint8 which; /* The joystick device index */
|
||||
Uint8 ball; /* The joystick trackball index */
|
||||
Sint16 xrel; /* The relative motion in the X direction */
|
||||
Sint16 yrel; /* The relative motion in the Y direction */
|
||||
} SDL_JoyBallEvent;
|
||||
|
||||
/* Joystick hat position change event structure */
|
||||
typedef struct SDL_JoyHatEvent {
|
||||
Uint8 type; /* SDL_JOYHATMOTION */
|
||||
Uint8 which; /* The joystick device index */
|
||||
Uint8 hat; /* The joystick hat index */
|
||||
Uint8 value; /* The hat position value:
|
||||
SDL_HAT_LEFTUP SDL_HAT_UP SDL_HAT_RIGHTUP
|
||||
SDL_HAT_LEFT SDL_HAT_CENTERED SDL_HAT_RIGHT
|
||||
SDL_HAT_LEFTDOWN SDL_HAT_DOWN SDL_HAT_RIGHTDOWN
|
||||
Note that zero means the POV is centered.
|
||||
*/
|
||||
} SDL_JoyHatEvent;
|
||||
|
||||
/* Joystick button event structure */
|
||||
typedef struct SDL_JoyButtonEvent {
|
||||
Uint8 type; /* SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP */
|
||||
Uint8 which; /* The joystick device index */
|
||||
Uint8 button; /* The joystick button index */
|
||||
Uint8 state; /* SDL_PRESSED or SDL_RELEASED */
|
||||
} SDL_JoyButtonEvent;
|
||||
|
||||
/* The "window resized" event
|
||||
When you get this event, you are responsible for setting a new video
|
||||
mode with the new width and height.
|
||||
*/
|
||||
typedef struct SDL_ResizeEvent {
|
||||
Uint8 type; /* SDL_VIDEORESIZE */
|
||||
int w; /* New width */
|
||||
int h; /* New height */
|
||||
} SDL_ResizeEvent;
|
||||
|
||||
/* The "screen redraw" event */
|
||||
typedef struct SDL_ExposeEvent {
|
||||
Uint8 type; /* SDL_VIDEOEXPOSE */
|
||||
} SDL_ExposeEvent;
|
||||
|
||||
/* The "quit requested" event */
|
||||
typedef struct SDL_QuitEvent {
|
||||
Uint8 type; /* SDL_QUIT */
|
||||
} SDL_QuitEvent;
|
||||
|
||||
/* A user-defined event type */
|
||||
typedef struct SDL_UserEvent {
|
||||
Uint8 type; /* SDL_USEREVENT through SDL_NUMEVENTS-1 */
|
||||
int code; /* User defined event code */
|
||||
void *data1; /* User defined data pointer */
|
||||
void *data2; /* User defined data pointer */
|
||||
} SDL_UserEvent;
|
||||
|
||||
/* If you want to use this event, you should include SDL_syswm.h */
|
||||
struct SDL_SysWMmsg;
|
||||
typedef struct SDL_SysWMmsg SDL_SysWMmsg;
|
||||
typedef struct SDL_SysWMEvent {
|
||||
Uint8 type;
|
||||
SDL_SysWMmsg *msg;
|
||||
} SDL_SysWMEvent;
|
||||
|
||||
/* General event structure */
|
||||
typedef union SDL_Event {
|
||||
Uint8 type;
|
||||
SDL_ActiveEvent active;
|
||||
SDL_KeyboardEvent key;
|
||||
SDL_MouseMotionEvent motion;
|
||||
SDL_MouseButtonEvent button;
|
||||
SDL_JoyAxisEvent jaxis;
|
||||
SDL_JoyBallEvent jball;
|
||||
SDL_JoyHatEvent jhat;
|
||||
SDL_JoyButtonEvent jbutton;
|
||||
SDL_ResizeEvent resize;
|
||||
SDL_ExposeEvent expose;
|
||||
SDL_QuitEvent quit;
|
||||
SDL_UserEvent user;
|
||||
SDL_SysWMEvent syswm;
|
||||
} SDL_Event;
|
||||
|
||||
|
||||
/* Function prototypes */
|
||||
|
||||
/* Pumps the event loop, gathering events from the input devices.
|
||||
This function updates the event queue and internal input device state.
|
||||
This should only be run in the thread that sets the video mode.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_PumpEvents(void);
|
||||
|
||||
/* Checks the event queue for messages and optionally returns them.
|
||||
If 'action' is SDL_ADDEVENT, up to 'numevents' events will be added to
|
||||
the back of the event queue.
|
||||
If 'action' is SDL_PEEKEVENT, up to 'numevents' events at the front
|
||||
of the event queue, matching 'mask', will be returned and will not
|
||||
be removed from the queue.
|
||||
If 'action' is SDL_GETEVENT, up to 'numevents' events at the front
|
||||
of the event queue, matching 'mask', will be returned and will be
|
||||
removed from the queue.
|
||||
This function returns the number of events actually stored, or -1
|
||||
if there was an error. This function is thread-safe.
|
||||
*/
|
||||
typedef enum {
|
||||
SDL_ADDEVENT,
|
||||
SDL_PEEKEVENT,
|
||||
SDL_GETEVENT
|
||||
} SDL_eventaction;
|
||||
/* */
|
||||
extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents,
|
||||
SDL_eventaction action, Uint32 mask);
|
||||
|
||||
/* Polls for currently pending events, and returns 1 if there are any pending
|
||||
events, or 0 if there are none available. If 'event' is not NULL, the next
|
||||
event is removed from the queue and stored in that area.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event *event);
|
||||
|
||||
/* Waits indefinitely for the next available event, returning 1, or 0 if there
|
||||
was an error while waiting for events. If 'event' is not NULL, the next
|
||||
event is removed from the queue and stored in that area.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event *event);
|
||||
|
||||
/* Add an event to the event queue.
|
||||
This function returns 0 on success, or -1 if the event queue was full
|
||||
or there was some other error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event);
|
||||
|
||||
/*
|
||||
This function sets up a filter to process all events before they
|
||||
change internal state and are posted to the internal event queue.
|
||||
|
||||
The filter is protypted as:
|
||||
*/
|
||||
typedef int (SDLCALL *SDL_EventFilter)(const SDL_Event *event);
|
||||
/*
|
||||
If the filter returns 1, then the event will be added to the internal queue.
|
||||
If it returns 0, then the event will be dropped from the queue, but the
|
||||
internal state will still be updated. This allows selective filtering of
|
||||
dynamically arriving events.
|
||||
|
||||
WARNING: Be very careful of what you do in the event filter function, as
|
||||
it may run in a different thread!
|
||||
|
||||
There is one caveat when dealing with the SDL_QUITEVENT event type. The
|
||||
event filter is only called when the window manager desires to close the
|
||||
application window. If the event filter returns 1, then the window will
|
||||
be closed, otherwise the window will remain open if possible.
|
||||
If the quit event is generated by an interrupt signal, it will bypass the
|
||||
internal queue and be delivered to the application at the next event poll.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter);
|
||||
|
||||
/*
|
||||
Return the current event filter - can be used to "chain" filters.
|
||||
If there is no event filter set, this function returns NULL.
|
||||
*/
|
||||
extern DECLSPEC SDL_EventFilter SDLCALL SDL_GetEventFilter(void);
|
||||
|
||||
/*
|
||||
This function allows you to set the state of processing certain events.
|
||||
If 'state' is set to SDL_IGNORE, that event will be automatically dropped
|
||||
from the event queue and will not event be filtered.
|
||||
If 'state' is set to SDL_ENABLE, that event will be processed normally.
|
||||
If 'state' is set to SDL_QUERY, SDL_EventState() will return the
|
||||
current processing state of the specified event.
|
||||
*/
|
||||
#define SDL_QUERY -1
|
||||
#define SDL_IGNORE 0
|
||||
#define SDL_DISABLE 0
|
||||
#define SDL_ENABLE 1
|
||||
extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint8 type, int state);
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_events_h */
|
||||
|
25
ExternalLibs/SDL12/include/SDL_getenv.h
Normal file
25
ExternalLibs/SDL12/include/SDL_getenv.h
Normal file
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* DEPRECATED */
|
||||
#include "SDL_stdinc.h"
|
||||
|
168
ExternalLibs/SDL12/include/SDL_joystick.h
Normal file
168
ExternalLibs/SDL12/include/SDL_joystick.h
Normal file
|
@ -0,0 +1,168 @@
|
|||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* Include file for SDL joystick event handling */
|
||||
|
||||
#ifndef _SDL_joystick_h
|
||||
#define _SDL_joystick_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_error.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* In order to use these functions, SDL_Init() must have been called
|
||||
with the SDL_INIT_JOYSTICK flag. This causes SDL to scan the system
|
||||
for joysticks, and load appropriate drivers.
|
||||
*/
|
||||
|
||||
/* The joystick structure used to identify an SDL joystick */
|
||||
struct _SDL_Joystick;
|
||||
typedef struct _SDL_Joystick SDL_Joystick;
|
||||
|
||||
|
||||
/* Function prototypes */
|
||||
/*
|
||||
* Count the number of joysticks attached to the system
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_NumJoysticks(void);
|
||||
|
||||
/*
|
||||
* 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 * SDLCALL SDL_JoystickName(int device_index);
|
||||
|
||||
/*
|
||||
* Open a joystick for use - the index passed as an argument refers to
|
||||
* the N'th joystick on the system. This index is the value which will
|
||||
* identify this joystick in future joystick events.
|
||||
*
|
||||
* This function returns a joystick identifier, or NULL if an error occurred.
|
||||
*/
|
||||
extern DECLSPEC SDL_Joystick * SDLCALL SDL_JoystickOpen(int device_index);
|
||||
|
||||
/*
|
||||
* Returns 1 if the joystick has been opened, or 0 if it has not.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickOpened(int device_index);
|
||||
|
||||
/*
|
||||
* Get the device index of an opened joystick.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickIndex(SDL_Joystick *joystick);
|
||||
|
||||
/*
|
||||
* Get the number of general axis controls on a joystick
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick *joystick);
|
||||
|
||||
/*
|
||||
* 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 SDLCALL SDL_JoystickNumBalls(SDL_Joystick *joystick);
|
||||
|
||||
/*
|
||||
* Get the number of POV hats on a joystick
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickNumHats(SDL_Joystick *joystick);
|
||||
|
||||
/*
|
||||
* Get the number of buttons on a joystick
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickNumButtons(SDL_Joystick *joystick);
|
||||
|
||||
/*
|
||||
* 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 SDLCALL SDL_JoystickUpdate(void);
|
||||
|
||||
/*
|
||||
* Enable/disable joystick event polling.
|
||||
* If joystick events are disabled, you must call SDL_JoystickUpdate()
|
||||
* yourself and check the state of the joystick when you want joystick
|
||||
* information.
|
||||
* The state can be one of SDL_QUERY, SDL_ENABLE or SDL_IGNORE.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state);
|
||||
|
||||
/*
|
||||
* 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 SDLCALL SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis);
|
||||
|
||||
/*
|
||||
* Get the current state of a POV hat on a joystick
|
||||
* The return value is one of the following positions:
|
||||
*/
|
||||
#define SDL_HAT_CENTERED 0x00
|
||||
#define SDL_HAT_UP 0x01
|
||||
#define SDL_HAT_RIGHT 0x02
|
||||
#define SDL_HAT_DOWN 0x04
|
||||
#define SDL_HAT_LEFT 0x08
|
||||
#define SDL_HAT_RIGHTUP (SDL_HAT_RIGHT|SDL_HAT_UP)
|
||||
#define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT|SDL_HAT_DOWN)
|
||||
#define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP)
|
||||
#define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN)
|
||||
/*
|
||||
* The hat indices start at index 0.
|
||||
*/
|
||||
extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick *joystick, int hat);
|
||||
|
||||
/*
|
||||
* 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 SDLCALL SDL_JoystickGetBall(SDL_Joystick *joystick, int ball, int *dx, int *dy);
|
||||
|
||||
/*
|
||||
* Get the current state of a button on a joystick
|
||||
* The button indices start at index 0.
|
||||
*/
|
||||
extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick *joystick, int button);
|
||||
|
||||
/*
|
||||
* Close a joystick previously opened with SDL_JoystickOpen()
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick *joystick);
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_joystick_h */
|
||||
|
122
ExternalLibs/SDL12/include/SDL_keyboard.h
Normal file
122
ExternalLibs/SDL12/include/SDL_keyboard.h
Normal file
|
@ -0,0 +1,122 @@
|
|||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* Include file for SDL keyboard event handling */
|
||||
|
||||
#ifndef _SDL_keyboard_h
|
||||
#define _SDL_keyboard_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_keysym.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Keysym structure
|
||||
- The scancode is hardware dependent, and should not be used by general
|
||||
applications. If no hardware scancode is available, it will be 0.
|
||||
|
||||
- The 'unicode' translated character is only available when character
|
||||
translation is enabled by the SDL_EnableUNICODE() API. If non-zero,
|
||||
this is a UNICODE character corresponding to the keypress. If the
|
||||
high 9 bits of the character are 0, then this maps to the equivalent
|
||||
ASCII character:
|
||||
char ch;
|
||||
if ( (keysym.unicode & 0xFF80) == 0 ) {
|
||||
ch = keysym.unicode & 0x7F;
|
||||
} else {
|
||||
An international character..
|
||||
}
|
||||
*/
|
||||
typedef struct SDL_keysym {
|
||||
Uint8 scancode; /* hardware specific scancode */
|
||||
SDLKey sym; /* SDL virtual keysym */
|
||||
SDLMod mod; /* current key modifiers */
|
||||
Uint16 unicode; /* translated character */
|
||||
} SDL_keysym;
|
||||
|
||||
/* This is the mask which refers to all hotkey bindings */
|
||||
#define SDL_ALL_HOTKEYS 0xFFFFFFFF
|
||||
|
||||
/* Function prototypes */
|
||||
/*
|
||||
* Enable/Disable UNICODE translation of keyboard input.
|
||||
* This translation has some overhead, so translation defaults off.
|
||||
* If 'enable' is 1, translation is enabled.
|
||||
* If 'enable' is 0, translation is disabled.
|
||||
* If 'enable' is -1, the translation state is not changed.
|
||||
* It returns the previous state of keyboard translation.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_EnableUNICODE(int enable);
|
||||
|
||||
/*
|
||||
* Enable/Disable keyboard repeat. Keyboard repeat defaults to off.
|
||||
* 'delay' is the initial delay in ms between the time when a key is
|
||||
* pressed, and keyboard repeat begins.
|
||||
* 'interval' is the time in ms between keyboard repeat events.
|
||||
*/
|
||||
#define SDL_DEFAULT_REPEAT_DELAY 500
|
||||
#define SDL_DEFAULT_REPEAT_INTERVAL 30
|
||||
/*
|
||||
* If 'delay' is set to 0, keyboard repeat is disabled.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_EnableKeyRepeat(int delay, int interval);
|
||||
extern DECLSPEC void SDLCALL SDL_GetKeyRepeat(int *delay, int *interval);
|
||||
|
||||
/*
|
||||
* Get a snapshot of the current state of the keyboard.
|
||||
* Returns an array of keystates, indexed by the SDLK_* syms.
|
||||
* Used:
|
||||
* Uint8 *keystate = SDL_GetKeyState(NULL);
|
||||
* if ( keystate[SDLK_RETURN] ) ... <RETURN> is pressed.
|
||||
*/
|
||||
extern DECLSPEC Uint8 * SDLCALL SDL_GetKeyState(int *numkeys);
|
||||
|
||||
/*
|
||||
* Get the current key modifier state
|
||||
*/
|
||||
extern DECLSPEC SDLMod SDLCALL SDL_GetModState(void);
|
||||
|
||||
/*
|
||||
* Set the current key modifier state
|
||||
* This does not change the keyboard state, only the key modifier flags.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_SetModState(SDLMod modstate);
|
||||
|
||||
/*
|
||||
* Get the name of an SDL virtual keysym
|
||||
*/
|
||||
extern DECLSPEC char * SDLCALL SDL_GetKeyName(SDLKey key);
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_keyboard_h */
|
||||
|
312
ExternalLibs/SDL12/include/SDL_keysym.h
Normal file
312
ExternalLibs/SDL12/include/SDL_keysym.h
Normal file
|
@ -0,0 +1,312 @@
|
|||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
#ifndef _SDL_keysym_h
|
||||
#define _SDL_keysym_h
|
||||
|
||||
/* What we really want is a mapping of every raw key on the keyboard.
|
||||
To support international keyboards, we use the range 0xA1 - 0xFF
|
||||
as international virtual keycodes. We'll follow in the footsteps of X11...
|
||||
The names of the keys
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
/* The keyboard syms have been cleverly chosen to map to ASCII */
|
||||
SDLK_UNKNOWN = 0,
|
||||
SDLK_FIRST = 0,
|
||||
SDLK_BACKSPACE = 8,
|
||||
SDLK_TAB = 9,
|
||||
SDLK_CLEAR = 12,
|
||||
SDLK_RETURN = 13,
|
||||
SDLK_PAUSE = 19,
|
||||
SDLK_ESCAPE = 27,
|
||||
SDLK_SPACE = 32,
|
||||
SDLK_EXCLAIM = 33,
|
||||
SDLK_QUOTEDBL = 34,
|
||||
SDLK_HASH = 35,
|
||||
SDLK_DOLLAR = 36,
|
||||
SDLK_AMPERSAND = 38,
|
||||
SDLK_QUOTE = 39,
|
||||
SDLK_LEFTPAREN = 40,
|
||||
SDLK_RIGHTPAREN = 41,
|
||||
SDLK_ASTERISK = 42,
|
||||
SDLK_PLUS = 43,
|
||||
SDLK_COMMA = 44,
|
||||
SDLK_MINUS = 45,
|
||||
SDLK_PERIOD = 46,
|
||||
SDLK_SLASH = 47,
|
||||
SDLK_0 = 48,
|
||||
SDLK_1 = 49,
|
||||
SDLK_2 = 50,
|
||||
SDLK_3 = 51,
|
||||
SDLK_4 = 52,
|
||||
SDLK_5 = 53,
|
||||
SDLK_6 = 54,
|
||||
SDLK_7 = 55,
|
||||
SDLK_8 = 56,
|
||||
SDLK_9 = 57,
|
||||
SDLK_COLON = 58,
|
||||
SDLK_SEMICOLON = 59,
|
||||
SDLK_LESS = 60,
|
||||
SDLK_EQUALS = 61,
|
||||
SDLK_GREATER = 62,
|
||||
SDLK_QUESTION = 63,
|
||||
SDLK_AT = 64,
|
||||
/*
|
||||
Skip uppercase letters
|
||||
*/
|
||||
SDLK_LEFTBRACKET = 91,
|
||||
SDLK_BACKSLASH = 92,
|
||||
SDLK_RIGHTBRACKET = 93,
|
||||
SDLK_CARET = 94,
|
||||
SDLK_UNDERSCORE = 95,
|
||||
SDLK_BACKQUOTE = 96,
|
||||
SDLK_a = 97,
|
||||
SDLK_b = 98,
|
||||
SDLK_c = 99,
|
||||
SDLK_d = 100,
|
||||
SDLK_e = 101,
|
||||
SDLK_f = 102,
|
||||
SDLK_g = 103,
|
||||
SDLK_h = 104,
|
||||
SDLK_i = 105,
|
||||
SDLK_j = 106,
|
||||
SDLK_k = 107,
|
||||
SDLK_l = 108,
|
||||
SDLK_m = 109,
|
||||
SDLK_n = 110,
|
||||
SDLK_o = 111,
|
||||
SDLK_p = 112,
|
||||
SDLK_q = 113,
|
||||
SDLK_r = 114,
|
||||
SDLK_s = 115,
|
||||
SDLK_t = 116,
|
||||
SDLK_u = 117,
|
||||
SDLK_v = 118,
|
||||
SDLK_w = 119,
|
||||
SDLK_x = 120,
|
||||
SDLK_y = 121,
|
||||
SDLK_z = 122,
|
||||
SDLK_DELETE = 127,
|
||||
/* End of ASCII mapped keysyms */
|
||||
|
||||
/* International keyboard syms */
|
||||
SDLK_WORLD_0 = 160, /* 0xA0 */
|
||||
SDLK_WORLD_1 = 161,
|
||||
SDLK_WORLD_2 = 162,
|
||||
SDLK_WORLD_3 = 163,
|
||||
SDLK_WORLD_4 = 164,
|
||||
SDLK_WORLD_5 = 165,
|
||||
SDLK_WORLD_6 = 166,
|
||||
SDLK_WORLD_7 = 167,
|
||||
SDLK_WORLD_8 = 168,
|
||||
SDLK_WORLD_9 = 169,
|
||||
SDLK_WORLD_10 = 170,
|
||||
SDLK_WORLD_11 = 171,
|
||||
SDLK_WORLD_12 = 172,
|
||||
SDLK_WORLD_13 = 173,
|
||||
SDLK_WORLD_14 = 174,
|
||||
SDLK_WORLD_15 = 175,
|
||||
SDLK_WORLD_16 = 176,
|
||||
SDLK_WORLD_17 = 177,
|
||||
SDLK_WORLD_18 = 178,
|
||||
SDLK_WORLD_19 = 179,
|
||||
SDLK_WORLD_20 = 180,
|
||||
SDLK_WORLD_21 = 181,
|
||||
SDLK_WORLD_22 = 182,
|
||||
SDLK_WORLD_23 = 183,
|
||||
SDLK_WORLD_24 = 184,
|
||||
SDLK_WORLD_25 = 185,
|
||||
SDLK_WORLD_26 = 186,
|
||||
SDLK_WORLD_27 = 187,
|
||||
SDLK_WORLD_28 = 188,
|
||||
SDLK_WORLD_29 = 189,
|
||||
SDLK_WORLD_30 = 190,
|
||||
SDLK_WORLD_31 = 191,
|
||||
SDLK_WORLD_32 = 192,
|
||||
SDLK_WORLD_33 = 193,
|
||||
SDLK_WORLD_34 = 194,
|
||||
SDLK_WORLD_35 = 195,
|
||||
SDLK_WORLD_36 = 196,
|
||||
SDLK_WORLD_37 = 197,
|
||||
SDLK_WORLD_38 = 198,
|
||||
SDLK_WORLD_39 = 199,
|
||||
SDLK_WORLD_40 = 200,
|
||||
SDLK_WORLD_41 = 201,
|
||||
SDLK_WORLD_42 = 202,
|
||||
SDLK_WORLD_43 = 203,
|
||||
SDLK_WORLD_44 = 204,
|
||||
SDLK_WORLD_45 = 205,
|
||||
SDLK_WORLD_46 = 206,
|
||||
SDLK_WORLD_47 = 207,
|
||||
SDLK_WORLD_48 = 208,
|
||||
SDLK_WORLD_49 = 209,
|
||||
SDLK_WORLD_50 = 210,
|
||||
SDLK_WORLD_51 = 211,
|
||||
SDLK_WORLD_52 = 212,
|
||||
SDLK_WORLD_53 = 213,
|
||||
SDLK_WORLD_54 = 214,
|
||||
SDLK_WORLD_55 = 215,
|
||||
SDLK_WORLD_56 = 216,
|
||||
SDLK_WORLD_57 = 217,
|
||||
SDLK_WORLD_58 = 218,
|
||||
SDLK_WORLD_59 = 219,
|
||||
SDLK_WORLD_60 = 220,
|
||||
SDLK_WORLD_61 = 221,
|
||||
SDLK_WORLD_62 = 222,
|
||||
SDLK_WORLD_63 = 223,
|
||||
SDLK_WORLD_64 = 224,
|
||||
SDLK_WORLD_65 = 225,
|
||||
SDLK_WORLD_66 = 226,
|
||||
SDLK_WORLD_67 = 227,
|
||||
SDLK_WORLD_68 = 228,
|
||||
SDLK_WORLD_69 = 229,
|
||||
SDLK_WORLD_70 = 230,
|
||||
SDLK_WORLD_71 = 231,
|
||||
SDLK_WORLD_72 = 232,
|
||||
SDLK_WORLD_73 = 233,
|
||||
SDLK_WORLD_74 = 234,
|
||||
SDLK_WORLD_75 = 235,
|
||||
SDLK_WORLD_76 = 236,
|
||||
SDLK_WORLD_77 = 237,
|
||||
SDLK_WORLD_78 = 238,
|
||||
SDLK_WORLD_79 = 239,
|
||||
SDLK_WORLD_80 = 240,
|
||||
SDLK_WORLD_81 = 241,
|
||||
SDLK_WORLD_82 = 242,
|
||||
SDLK_WORLD_83 = 243,
|
||||
SDLK_WORLD_84 = 244,
|
||||
SDLK_WORLD_85 = 245,
|
||||
SDLK_WORLD_86 = 246,
|
||||
SDLK_WORLD_87 = 247,
|
||||
SDLK_WORLD_88 = 248,
|
||||
SDLK_WORLD_89 = 249,
|
||||
SDLK_WORLD_90 = 250,
|
||||
SDLK_WORLD_91 = 251,
|
||||
SDLK_WORLD_92 = 252,
|
||||
SDLK_WORLD_93 = 253,
|
||||
SDLK_WORLD_94 = 254,
|
||||
SDLK_WORLD_95 = 255, /* 0xFF */
|
||||
|
||||
/* Numeric keypad */
|
||||
SDLK_KP0 = 256,
|
||||
SDLK_KP1 = 257,
|
||||
SDLK_KP2 = 258,
|
||||
SDLK_KP3 = 259,
|
||||
SDLK_KP4 = 260,
|
||||
SDLK_KP5 = 261,
|
||||
SDLK_KP6 = 262,
|
||||
SDLK_KP7 = 263,
|
||||
SDLK_KP8 = 264,
|
||||
SDLK_KP9 = 265,
|
||||
SDLK_KP_PERIOD = 266,
|
||||
SDLK_KP_DIVIDE = 267,
|
||||
SDLK_KP_MULTIPLY = 268,
|
||||
SDLK_KP_MINUS = 269,
|
||||
SDLK_KP_PLUS = 270,
|
||||
SDLK_KP_ENTER = 271,
|
||||
SDLK_KP_EQUALS = 272,
|
||||
|
||||
/* Arrows + Home/End pad */
|
||||
SDLK_UP = 273,
|
||||
SDLK_DOWN = 274,
|
||||
SDLK_RIGHT = 275,
|
||||
SDLK_LEFT = 276,
|
||||
SDLK_INSERT = 277,
|
||||
SDLK_HOME = 278,
|
||||
SDLK_END = 279,
|
||||
SDLK_PAGEUP = 280,
|
||||
SDLK_PAGEDOWN = 281,
|
||||
|
||||
/* Function keys */
|
||||
SDLK_F1 = 282,
|
||||
SDLK_F2 = 283,
|
||||
SDLK_F3 = 284,
|
||||
SDLK_F4 = 285,
|
||||
SDLK_F5 = 286,
|
||||
SDLK_F6 = 287,
|
||||
SDLK_F7 = 288,
|
||||
SDLK_F8 = 289,
|
||||
SDLK_F9 = 290,
|
||||
SDLK_F10 = 291,
|
||||
SDLK_F11 = 292,
|
||||
SDLK_F12 = 293,
|
||||
SDLK_F13 = 294,
|
||||
SDLK_F14 = 295,
|
||||
SDLK_F15 = 296,
|
||||
|
||||
/* Key state modifier keys */
|
||||
SDLK_NUMLOCK = 300,
|
||||
SDLK_CAPSLOCK = 301,
|
||||
SDLK_SCROLLOCK = 302,
|
||||
SDLK_RSHIFT = 303,
|
||||
SDLK_LSHIFT = 304,
|
||||
SDLK_RCTRL = 305,
|
||||
SDLK_LCTRL = 306,
|
||||
SDLK_RALT = 307,
|
||||
SDLK_LALT = 308,
|
||||
SDLK_RMETA = 309,
|
||||
SDLK_LMETA = 310,
|
||||
SDLK_LSUPER = 311, /* Left "Windows" key */
|
||||
SDLK_RSUPER = 312, /* Right "Windows" key */
|
||||
SDLK_MODE = 313, /* "Alt Gr" key */
|
||||
SDLK_COMPOSE = 314, /* Multi-key compose key */
|
||||
|
||||
/* Miscellaneous function keys */
|
||||
SDLK_HELP = 315,
|
||||
SDLK_PRINT = 316,
|
||||
SDLK_SYSREQ = 317,
|
||||
SDLK_BREAK = 318,
|
||||
SDLK_MENU = 319,
|
||||
SDLK_POWER = 320, /* Power Macintosh power key */
|
||||
SDLK_EURO = 321, /* Some european keyboards */
|
||||
SDLK_UNDO = 322, /* Atari keyboard has Undo */
|
||||
|
||||
/* Add any other keys here */
|
||||
|
||||
SDLK_LAST
|
||||
} SDLKey;
|
||||
|
||||
/* Enumeration of valid key mods (possibly OR'd together) */
|
||||
typedef enum {
|
||||
KMOD_NONE = 0x0000,
|
||||
KMOD_LSHIFT= 0x0001,
|
||||
KMOD_RSHIFT= 0x0002,
|
||||
KMOD_LCTRL = 0x0040,
|
||||
KMOD_RCTRL = 0x0080,
|
||||
KMOD_LALT = 0x0100,
|
||||
KMOD_RALT = 0x0200,
|
||||
KMOD_LMETA = 0x0400,
|
||||
KMOD_RMETA = 0x0800,
|
||||
KMOD_NUM = 0x1000,
|
||||
KMOD_CAPS = 0x2000,
|
||||
KMOD_MODE = 0x4000,
|
||||
KMOD_RESERVED = 0x8000
|
||||
} SDLMod;
|
||||
|
||||
#define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL)
|
||||
#define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT)
|
||||
#define KMOD_ALT (KMOD_LALT|KMOD_RALT)
|
||||
#define KMOD_META (KMOD_LMETA|KMOD_RMETA)
|
||||
|
||||
#endif /* _SDL_keysym_h */
|
||||
|
75
ExternalLibs/SDL12/include/SDL_loadso.h
Normal file
75
ExternalLibs/SDL12/include/SDL_loadso.h
Normal file
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/* System dependent library loading routines */
|
||||
|
||||
/* Some things to keep in mind:
|
||||
- These functions only work on C function names. Other languages may
|
||||
have name mangling and intrinsic language support that varies from
|
||||
compiler to compiler.
|
||||
- Make sure you declare your function pointers with the same calling
|
||||
convention as the actual library function. Your code will crash
|
||||
mysteriously if you do not do this.
|
||||
- Avoid namespace collisions. If you load a symbol from the library,
|
||||
it is not defined whether or not it goes into the global symbol
|
||||
namespace for the application. If it does and it conflicts with
|
||||
symbols in your code or other shared libraries, you will not get
|
||||
the results you expect. :)
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _SDL_loadso_h
|
||||
#define _SDL_loadso_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_error.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* This function dynamically loads a shared object and returns a pointer
|
||||
* to the object handle (or NULL if there was an error).
|
||||
* The 'sofile' parameter is a system dependent name of the object file.
|
||||
*/
|
||||
extern DECLSPEC void * SDLCALL SDL_LoadObject(const char *sofile);
|
||||
|
||||
/* Given an object handle, this function looks up the address of the
|
||||
* named function in the shared object and returns it. This address
|
||||
* is no longer valid after calling SDL_UnloadObject().
|
||||
*/
|
||||
extern DECLSPEC void * SDLCALL SDL_LoadFunction(void *handle, const char *name);
|
||||
|
||||
/* Unload a shared object from memory */
|
||||
extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_loadso_h */
|
||||
|
99
ExternalLibs/SDL12/include/SDL_main.h
Normal file
99
ExternalLibs/SDL12/include/SDL_main.h
Normal file
|
@ -0,0 +1,99 @@
|
|||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
#ifndef _SDL_main_h
|
||||
#define _SDL_main_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
|
||||
/* Redefine main() on Win32 and MacOS so that it is called by winmain.c */
|
||||
|
||||
#if defined(__WIN32__) || \
|
||||
(defined(__MWERKS__) && !defined(__BEOS__)) || \
|
||||
defined(__MACOS__) || defined(__MACOSX__) || \
|
||||
defined(__SYMBIAN32__) || defined(QWS)
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define C_LINKAGE "C"
|
||||
#else
|
||||
#define C_LINKAGE
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* The application's main() function must be called with C linkage,
|
||||
and should be declared like this:
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
}
|
||||
*/
|
||||
#define main SDL_main
|
||||
|
||||
/* The prototype for the application's main() function */
|
||||
extern C_LINKAGE int SDL_main(int argc, char *argv[]);
|
||||
|
||||
|
||||
/* From the SDL library code -- needed for registering the app on Win32 */
|
||||
#ifdef __WIN32__
|
||||
|
||||
#include "begin_code.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* This should be called from your WinMain() function, if any */
|
||||
extern DECLSPEC void SDLCALL SDL_SetModuleHandle(void *hInst);
|
||||
/* This can also be called, but is no longer necessary */
|
||||
extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style, void *hInst);
|
||||
/* This can also be called, but is no longer necessary (SDL_Quit calls it) */
|
||||
extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
#endif
|
||||
|
||||
/* From the SDL library code -- needed for registering QuickDraw on MacOS */
|
||||
#if defined(__MACOS__)
|
||||
|
||||
#include "begin_code.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Forward declaration so we don't need to include QuickDraw.h */
|
||||
struct QDGlobals;
|
||||
|
||||
/* This should be called from your main() function, if any */
|
||||
extern DECLSPEC void SDLCALL SDL_InitQuickDraw(struct QDGlobals *the_qd);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
#endif
|
||||
|
||||
#endif /* Need to redefine main()? */
|
||||
|
||||
#endif /* _SDL_main_h */
|
||||
|
141
ExternalLibs/SDL12/include/SDL_mouse.h
Normal file
141
ExternalLibs/SDL12/include/SDL_mouse.h
Normal file
|
@ -0,0 +1,141 @@
|
|||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* Include file for SDL mouse event handling */
|
||||
|
||||
#ifndef _SDL_mouse_h
|
||||
#define _SDL_mouse_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_video.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct WMcursor WMcursor; /* Implementation dependent */
|
||||
typedef struct SDL_Cursor {
|
||||
SDL_Rect area; /* The area of the mouse cursor */
|
||||
Sint16 hot_x, hot_y; /* The "tip" of the cursor */
|
||||
Uint8 *data; /* B/W cursor data */
|
||||
Uint8 *mask; /* B/W cursor mask */
|
||||
Uint8 *save[2]; /* Place to save cursor area */
|
||||
WMcursor *wm_cursor; /* Window-manager cursor */
|
||||
} SDL_Cursor;
|
||||
|
||||
/* Function prototypes */
|
||||
/*
|
||||
* Retrieve the current state of the mouse.
|
||||
* The current button state is returned as a button bitmask, which can
|
||||
* be tested using the SDL_BUTTON(X) macros, and x and y are set to the
|
||||
* current mouse cursor position. You can pass NULL for either x or y.
|
||||
*/
|
||||
extern DECLSPEC Uint8 SDLCALL SDL_GetMouseState(int *x, int *y);
|
||||
|
||||
/*
|
||||
* Retrieve the current state of the mouse.
|
||||
* The current button state is returned as a button bitmask, which can
|
||||
* be tested using the SDL_BUTTON(X) macros, and x and y are set to the
|
||||
* mouse deltas since the last call to SDL_GetRelativeMouseState().
|
||||
*/
|
||||
extern DECLSPEC Uint8 SDLCALL SDL_GetRelativeMouseState(int *x, int *y);
|
||||
|
||||
/*
|
||||
* Set the position of the mouse cursor (generates a mouse motion event)
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_WarpMouse(Uint16 x, Uint16 y);
|
||||
|
||||
/*
|
||||
* Create a cursor using the specified data and mask (in MSB format).
|
||||
* The cursor width must be a multiple of 8 bits.
|
||||
*
|
||||
* The cursor is created in black and white according to the following:
|
||||
* data mask resulting pixel on screen
|
||||
* 0 1 White
|
||||
* 1 1 Black
|
||||
* 0 0 Transparent
|
||||
* 1 0 Inverted color if possible, black if not.
|
||||
*
|
||||
* Cursors created with this function must be freed with SDL_FreeCursor().
|
||||
*/
|
||||
extern DECLSPEC SDL_Cursor * SDLCALL SDL_CreateCursor
|
||||
(Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y);
|
||||
|
||||
/*
|
||||
* Set the currently active cursor to the specified one.
|
||||
* If the cursor is currently visible, the change will be immediately
|
||||
* represented on the display.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor *cursor);
|
||||
|
||||
/*
|
||||
* Returns the currently active cursor.
|
||||
*/
|
||||
extern DECLSPEC SDL_Cursor * SDLCALL SDL_GetCursor(void);
|
||||
|
||||
/*
|
||||
* Deallocates a cursor created with SDL_CreateCursor().
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor *cursor);
|
||||
|
||||
/*
|
||||
* Toggle whether or not the cursor is shown on the screen.
|
||||
* The cursor start off displayed, but can be turned off.
|
||||
* SDL_ShowCursor() returns 1 if the cursor was being displayed
|
||||
* before the call, or 0 if it was not. You can query the current
|
||||
* state by passing a 'toggle' value of -1.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
|
||||
|
||||
/* Used as a mask when testing buttons in buttonstate
|
||||
Button 1: Left mouse button
|
||||
Button 2: Middle mouse button
|
||||
Button 3: Right mouse button
|
||||
Button 4: Mouse wheel up (may also be a real button)
|
||||
Button 5: Mouse wheel down (may also be a real button)
|
||||
*/
|
||||
#define SDL_BUTTON(X) (1 << ((X)-1))
|
||||
#define SDL_BUTTON_LEFT 1
|
||||
#define SDL_BUTTON_MIDDLE 2
|
||||
#define SDL_BUTTON_RIGHT 3
|
||||
#define SDL_BUTTON_WHEELUP 4
|
||||
#define SDL_BUTTON_WHEELDOWN 5
|
||||
#define SDL_BUTTON_X1 6
|
||||
#define SDL_BUTTON_X2 7
|
||||
#define SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT)
|
||||
#define SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE)
|
||||
#define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT)
|
||||
#define SDL_BUTTON_X1MASK SDL_BUTTON(SDL_BUTTON_X1)
|
||||
#define SDL_BUTTON_X2MASK SDL_BUTTON(SDL_BUTTON_X2)
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_mouse_h */
|
||||
|
163
ExternalLibs/SDL12/include/SDL_mutex.h
Normal file
163
ExternalLibs/SDL12/include/SDL_mutex.h
Normal file
|
@ -0,0 +1,163 @@
|
|||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
#ifndef _SDL_mutex_h
|
||||
#define _SDL_mutex_h
|
||||
|
||||
/* Functions to provide thread synchronization primitives
|
||||
|
||||
These are independent of the other SDL routines.
|
||||
*/
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_error.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Synchronization functions which can time out return this value
|
||||
if they time out.
|
||||
*/
|
||||
#define SDL_MUTEX_TIMEDOUT 1
|
||||
|
||||
/* This is the timeout value which corresponds to never time out */
|
||||
#define SDL_MUTEX_MAXWAIT (~(Uint32)0)
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/* Mutex functions */
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/* The SDL mutex structure, defined in SDL_mutex.c */
|
||||
struct SDL_mutex;
|
||||
typedef struct SDL_mutex SDL_mutex;
|
||||
|
||||
/* Create a mutex, initialized unlocked */
|
||||
extern DECLSPEC SDL_mutex * SDLCALL SDL_CreateMutex(void);
|
||||
|
||||
/* Lock the mutex (Returns 0, or -1 on error) */
|
||||
#define SDL_LockMutex(m) SDL_mutexP(m)
|
||||
extern DECLSPEC int SDLCALL SDL_mutexP(SDL_mutex *mutex);
|
||||
|
||||
/* Unlock the mutex (Returns 0, or -1 on error)
|
||||
It is an error to unlock a mutex that has not been locked by
|
||||
the current thread, and doing so results in undefined behavior.
|
||||
*/
|
||||
#define SDL_UnlockMutex(m) SDL_mutexV(m)
|
||||
extern DECLSPEC int SDLCALL SDL_mutexV(SDL_mutex *mutex);
|
||||
|
||||
/* Destroy a mutex */
|
||||
extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex *mutex);
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/* Semaphore functions */
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/* The SDL semaphore structure, defined in SDL_sem.c */
|
||||
struct SDL_semaphore;
|
||||
typedef struct SDL_semaphore SDL_sem;
|
||||
|
||||
/* Create a semaphore, initialized with value, returns NULL on failure. */
|
||||
extern DECLSPEC SDL_sem * SDLCALL SDL_CreateSemaphore(Uint32 initial_value);
|
||||
|
||||
/* Destroy a semaphore */
|
||||
extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem *sem);
|
||||
|
||||
/* This function suspends the calling thread until the semaphore pointed
|
||||
* to by sem has a positive count. It then atomically decreases the semaphore
|
||||
* count.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem *sem);
|
||||
|
||||
/* Non-blocking variant of SDL_SemWait(), returns 0 if the wait succeeds,
|
||||
SDL_MUTEX_TIMEDOUT if the wait would block, and -1 on error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem *sem);
|
||||
|
||||
/* Variant of SDL_SemWait() with a timeout in milliseconds, returns 0 if
|
||||
the wait succeeds, SDL_MUTEX_TIMEDOUT if the wait does not succeed in
|
||||
the allotted time, and -1 on error.
|
||||
On some platforms this function is implemented by looping with a delay
|
||||
of 1 ms, and so should be avoided if possible.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem *sem, Uint32 ms);
|
||||
|
||||
/* Atomically increases the semaphore's count (not blocking), returns 0,
|
||||
or -1 on error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem *sem);
|
||||
|
||||
/* Returns the current count of the semaphore */
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_SemValue(SDL_sem *sem);
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/* Condition variable functions */
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/* The SDL condition variable structure, defined in SDL_cond.c */
|
||||
struct SDL_cond;
|
||||
typedef struct SDL_cond SDL_cond;
|
||||
|
||||
/* Create a condition variable */
|
||||
extern DECLSPEC SDL_cond * SDLCALL SDL_CreateCond(void);
|
||||
|
||||
/* Destroy a condition variable */
|
||||
extern DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond *cond);
|
||||
|
||||
/* Restart one of the threads that are waiting on the condition variable,
|
||||
returns 0 or -1 on error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond *cond);
|
||||
|
||||
/* Restart all threads that are waiting on the condition variable,
|
||||
returns 0 or -1 on error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond *cond);
|
||||
|
||||
/* Wait on the condition variable, unlocking the provided mutex.
|
||||
The mutex must be locked before entering this function!
|
||||
The mutex is re-locked once the condition variable is signaled.
|
||||
Returns 0 when it is signaled, or -1 on error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond *cond, SDL_mutex *mut);
|
||||
|
||||
/* Waits for at most 'ms' milliseconds, and returns 0 if the condition
|
||||
variable is signaled, SDL_MUTEX_TIMEDOUT if the condition is not
|
||||
signaled in the allotted time, and -1 on error.
|
||||
On some platforms this function is implemented by looping with a delay
|
||||
of 1 ms, and so should be avoided if possible.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_mutex_h */
|
||||
|
12
ExternalLibs/SDL12/include/SDL_name.h
Normal file
12
ExternalLibs/SDL12/include/SDL_name.h
Normal file
|
@ -0,0 +1,12 @@
|
|||
|
||||
#ifndef _SDLname_h_
|
||||
#define _SDLname_h_
|
||||
|
||||
#if defined(__STDC__) || defined(__cplusplus)
|
||||
#define NeedFunctionPrototypes 1
|
||||
#endif
|
||||
|
||||
#define SDL_NAME(X) SDL_##X
|
||||
|
||||
#endif /* _SDLname_h_ */
|
||||
|
445
ExternalLibs/SDL12/include/SDL_net.h
Normal file
445
ExternalLibs/SDL12/include/SDL_net.h
Normal file
|
@ -0,0 +1,445 @@
|
|||
/*
|
||||
SDL_net: An example cross-platform network library for use with SDL
|
||||
Copyright (C) 1997-2004 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* $Id: SDL_net.h 3281 2007-07-15 05:58:56Z slouken $ */
|
||||
|
||||
#ifndef _SDL_NET_H
|
||||
#define _SDL_NET_H
|
||||
|
||||
#include "SDL.h"
|
||||
#include "SDL_endian.h"
|
||||
#include "SDL_version.h"
|
||||
#include "begin_code.h"
|
||||
|
||||
|
||||
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
|
||||
*/
|
||||
#define SDL_NET_MAJOR_VERSION 1
|
||||
#define SDL_NET_MINOR_VERSION 2
|
||||
#define SDL_NET_PATCHLEVEL 7
|
||||
|
||||
/* This macro can be used to fill a version structure with the compile-time
|
||||
* version of the SDL_net library.
|
||||
*/
|
||||
#define SDL_NET_VERSION(X) \
|
||||
{ \
|
||||
(X)->major = SDL_NET_MAJOR_VERSION; \
|
||||
(X)->minor = SDL_NET_MINOR_VERSION; \
|
||||
(X)->patch = SDL_NET_PATCHLEVEL; \
|
||||
}
|
||||
|
||||
/* This function gets the version of the dynamically linked SDL_net library.
|
||||
it should NOT be used to fill a version structure, instead you should
|
||||
use the SDL_NET_VERSION() macro.
|
||||
*/
|
||||
extern DECLSPEC const SDL_version * SDLCALL SDLNet_Linked_Version(void);
|
||||
|
||||
/* Initialize/Cleanup the network API
|
||||
SDL must be initialized before calls to functions in this library,
|
||||
because this library uses utility functions from the SDL library.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDLNet_Init(void);
|
||||
extern DECLSPEC void SDLCALL SDLNet_Quit(void);
|
||||
|
||||
/***********************************************************************/
|
||||
/* IPv4 hostname resolution API */
|
||||
/***********************************************************************/
|
||||
|
||||
typedef struct {
|
||||
Uint32 host; /* 32-bit IPv4 host address */
|
||||
Uint16 port; /* 16-bit protocol port */
|
||||
} IPaddress;
|
||||
|
||||
/* Resolve a host name and port to an IP address in network form.
|
||||
If the function succeeds, it will return 0.
|
||||
If the host couldn't be resolved, the host portion of the returned
|
||||
address will be INADDR_NONE, and the function will return -1.
|
||||
If 'host' is NULL, the resolved host will be set to INADDR_ANY.
|
||||
*/
|
||||
#ifndef INADDR_ANY
|
||||
#define INADDR_ANY 0x00000000
|
||||
#endif
|
||||
#ifndef INADDR_NONE
|
||||
#define INADDR_NONE 0xFFFFFFFF
|
||||
#endif
|
||||
#ifndef INADDR_BROADCAST
|
||||
#define INADDR_BROADCAST 0xFFFFFFFF
|
||||
#endif
|
||||
extern DECLSPEC int SDLCALL SDLNet_ResolveHost(IPaddress *address, const char *host, Uint16 port);
|
||||
|
||||
/* Resolve an ip address to a host name in canonical form.
|
||||
If the ip couldn't be resolved, this function returns NULL,
|
||||
otherwise a pointer to a static buffer containing the hostname
|
||||
is returned. Note that this function is not thread-safe.
|
||||
*/
|
||||
extern DECLSPEC const char * SDLCALL SDLNet_ResolveIP(IPaddress *ip);
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
/* TCP network API */
|
||||
/***********************************************************************/
|
||||
|
||||
typedef struct _TCPsocket *TCPsocket;
|
||||
|
||||
/* Open a TCP network socket
|
||||
If ip.host is INADDR_NONE or INADDR_ANY, this creates a local server
|
||||
socket on the given port, otherwise a TCP connection to the remote
|
||||
host and port is attempted. The address passed in should already be
|
||||
swapped to network byte order (addresses returned from
|
||||
SDLNet_ResolveHost() are already in the correct form).
|
||||
The newly created socket is returned, or NULL if there was an error.
|
||||
*/
|
||||
extern DECLSPEC TCPsocket SDLCALL SDLNet_TCP_Open(IPaddress *ip);
|
||||
|
||||
/* Accept an incoming connection on the given server socket.
|
||||
The newly created socket is returned, or NULL if there was an error.
|
||||
*/
|
||||
extern DECLSPEC TCPsocket SDLCALL SDLNet_TCP_Accept(TCPsocket server);
|
||||
|
||||
/* Get the IP address of the remote system associated with the socket.
|
||||
If the socket is a server socket, this function returns NULL.
|
||||
*/
|
||||
extern DECLSPEC IPaddress * SDLCALL SDLNet_TCP_GetPeerAddress(TCPsocket sock);
|
||||
|
||||
/* Send 'len' bytes of 'data' over the non-server socket 'sock'
|
||||
This function returns the actual amount of data sent. If the return value
|
||||
is less than the amount of data sent, then either the remote connection was
|
||||
closed, or an unknown socket error occurred.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDLNet_TCP_Send(TCPsocket sock, const void *data,
|
||||
int len);
|
||||
|
||||
/* Receive up to 'maxlen' bytes of data over the non-server socket 'sock',
|
||||
and store them in the buffer pointed to by 'data'.
|
||||
This function returns the actual amount of data received. If the return
|
||||
value is less than or equal to zero, then either the remote connection was
|
||||
closed, or an unknown socket error occurred.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDLNet_TCP_Recv(TCPsocket sock, void *data, int maxlen);
|
||||
|
||||
/* Close a TCP network socket */
|
||||
extern DECLSPEC void SDLCALL SDLNet_TCP_Close(TCPsocket sock);
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
/* UDP network API */
|
||||
/***********************************************************************/
|
||||
|
||||
/* The maximum channels on a a UDP socket */
|
||||
#define SDLNET_MAX_UDPCHANNELS 32
|
||||
/* The maximum addresses bound to a single UDP socket channel */
|
||||
#define SDLNET_MAX_UDPADDRESSES 4
|
||||
|
||||
typedef struct _UDPsocket *UDPsocket;
|
||||
typedef struct {
|
||||
int channel; /* The src/dst channel of the packet */
|
||||
Uint8 *data; /* The packet data */
|
||||
int len; /* The length of the packet data */
|
||||
int maxlen; /* The size of the data buffer */
|
||||
int status; /* packet status after sending */
|
||||
IPaddress address; /* The source/dest address of an incoming/outgoing packet */
|
||||
} UDPpacket;
|
||||
|
||||
/* Allocate/resize/free a single UDP packet 'size' bytes long.
|
||||
The new packet is returned, or NULL if the function ran out of memory.
|
||||
*/
|
||||
extern DECLSPEC UDPpacket * SDLCALL SDLNet_AllocPacket(int size);
|
||||
extern DECLSPEC int SDLCALL SDLNet_ResizePacket(UDPpacket *packet, int newsize);
|
||||
extern DECLSPEC void SDLCALL SDLNet_FreePacket(UDPpacket *packet);
|
||||
|
||||
/* Allocate/Free a UDP packet vector (array of packets) of 'howmany' packets,
|
||||
each 'size' bytes long.
|
||||
A pointer to the first packet in the array is returned, or NULL if the
|
||||
function ran out of memory.
|
||||
*/
|
||||
extern DECLSPEC UDPpacket ** SDLCALL SDLNet_AllocPacketV(int howmany, int size);
|
||||
extern DECLSPEC void SDLCALL SDLNet_FreePacketV(UDPpacket **packetV);
|
||||
|
||||
|
||||
/* Open a UDP network socket
|
||||
If 'port' is non-zero, the UDP socket is bound to a local port.
|
||||
The 'port' should be given in native byte order, but is used
|
||||
internally in network (big endian) byte order, in addresses, etc.
|
||||
This allows other systems to send to this socket via a known port.
|
||||
*/
|
||||
extern DECLSPEC UDPsocket SDLCALL SDLNet_UDP_Open(Uint16 port);
|
||||
|
||||
/* Bind the address 'address' to the requested channel on the UDP socket.
|
||||
If the channel is -1, then the first unbound channel will be bound with
|
||||
the given address as it's primary address.
|
||||
If the channel is already bound, this new address will be added to the
|
||||
list of valid source addresses for packets arriving on the channel.
|
||||
If the channel is not already bound, then the address becomes the primary
|
||||
address, to which all outbound packets on the channel are sent.
|
||||
This function returns the channel which was bound, or -1 on error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDLNet_UDP_Bind(UDPsocket sock, int channel, IPaddress *address);
|
||||
|
||||
/* Unbind all addresses from the given channel */
|
||||
extern DECLSPEC void SDLCALL SDLNet_UDP_Unbind(UDPsocket sock, int channel);
|
||||
|
||||
/* Get the primary IP address of the remote system associated with the
|
||||
socket and channel. If the channel is -1, then the primary IP port
|
||||
of the UDP socket is returned -- this is only meaningful for sockets
|
||||
opened with a specific port.
|
||||
If the channel is not bound and not -1, this function returns NULL.
|
||||
*/
|
||||
extern DECLSPEC IPaddress * SDLCALL SDLNet_UDP_GetPeerAddress(UDPsocket sock, int channel);
|
||||
|
||||
/* Send a vector of packets to the the channels specified within the packet.
|
||||
If the channel specified in the packet is -1, the packet will be sent to
|
||||
the address in the 'src' member of the packet.
|
||||
Each packet will be updated with the status of the packet after it has
|
||||
been sent, -1 if the packet send failed.
|
||||
This function returns the number of packets sent.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDLNet_UDP_SendV(UDPsocket sock, UDPpacket **packets, int npackets);
|
||||
|
||||
/* Send a single packet to the specified channel.
|
||||
If the channel specified in the packet is -1, the packet will be sent to
|
||||
the address in the 'src' member of the packet.
|
||||
The packet will be updated with the status of the packet after it has
|
||||
been sent.
|
||||
This function returns 1 if the packet was sent, or 0 on error.
|
||||
|
||||
NOTE:
|
||||
The maximum size of the packet is limited by the MTU (Maximum Transfer Unit)
|
||||
of the transport medium. It can be as low as 250 bytes for some PPP links,
|
||||
and as high as 1500 bytes for ethernet.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDLNet_UDP_Send(UDPsocket sock, int channel, UDPpacket *packet);
|
||||
|
||||
/* Receive a vector of pending packets from the UDP socket.
|
||||
The returned packets contain the source address and the channel they arrived
|
||||
on. If they did not arrive on a bound channel, the the channel will be set
|
||||
to -1.
|
||||
The channels are checked in highest to lowest order, so if an address is
|
||||
bound to multiple channels, the highest channel with the source address
|
||||
bound will be returned.
|
||||
This function returns the number of packets read from the network, or -1
|
||||
on error. This function does not block, so can return 0 packets pending.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDLNet_UDP_RecvV(UDPsocket sock, UDPpacket **packets);
|
||||
|
||||
/* Receive a single packet from the UDP socket.
|
||||
The returned packet contains the source address and the channel it arrived
|
||||
on. If it did not arrive on a bound channel, the the channel will be set
|
||||
to -1.
|
||||
The channels are checked in highest to lowest order, so if an address is
|
||||
bound to multiple channels, the highest channel with the source address
|
||||
bound will be returned.
|
||||
This function returns the number of packets read from the network, or -1
|
||||
on error. This function does not block, so can return 0 packets pending.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDLNet_UDP_Recv(UDPsocket sock, UDPpacket *packet);
|
||||
|
||||
/* Close a UDP network socket */
|
||||
extern DECLSPEC void SDLCALL SDLNet_UDP_Close(UDPsocket sock);
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
/* Hooks for checking sockets for available data */
|
||||
/***********************************************************************/
|
||||
|
||||
typedef struct _SDLNet_SocketSet *SDLNet_SocketSet;
|
||||
|
||||
/* Any network socket can be safely cast to this socket type */
|
||||
typedef struct {
|
||||
int ready;
|
||||
} *SDLNet_GenericSocket;
|
||||
|
||||
/* Allocate a socket set for use with SDLNet_CheckSockets()
|
||||
This returns a socket set for up to 'maxsockets' sockets, or NULL if
|
||||
the function ran out of memory.
|
||||
*/
|
||||
extern DECLSPEC SDLNet_SocketSet SDLCALL SDLNet_AllocSocketSet(int maxsockets);
|
||||
|
||||
/* Add a socket to a set of sockets to be checked for available data */
|
||||
#define SDLNet_TCP_AddSocket(set, sock) \
|
||||
SDLNet_AddSocket(set, (SDLNet_GenericSocket)sock)
|
||||
#define SDLNet_UDP_AddSocket(set, sock) \
|
||||
SDLNet_AddSocket(set, (SDLNet_GenericSocket)sock)
|
||||
extern DECLSPEC int SDLCALL SDLNet_AddSocket(SDLNet_SocketSet set, SDLNet_GenericSocket sock);
|
||||
|
||||
/* Remove a socket from a set of sockets to be checked for available data */
|
||||
#define SDLNet_TCP_DelSocket(set, sock) \
|
||||
SDLNet_DelSocket(set, (SDLNet_GenericSocket)sock)
|
||||
#define SDLNet_UDP_DelSocket(set, sock) \
|
||||
SDLNet_DelSocket(set, (SDLNet_GenericSocket)sock)
|
||||
extern DECLSPEC int SDLCALL SDLNet_DelSocket(SDLNet_SocketSet set, SDLNet_GenericSocket sock);
|
||||
|
||||
/* This function checks to see if data is available for reading on the
|
||||
given set of sockets. If 'timeout' is 0, it performs a quick poll,
|
||||
otherwise the function returns when either data is available for
|
||||
reading, or the timeout in milliseconds has elapsed, which ever occurs
|
||||
first. This function returns the number of sockets ready for reading,
|
||||
or -1 if there was an error with the select() system call.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDLNet_CheckSockets(SDLNet_SocketSet set, Uint32 timeout);
|
||||
|
||||
/* After calling SDLNet_CheckSockets(), you can use this function on a
|
||||
socket that was in the socket set, to find out if data is available
|
||||
for reading.
|
||||
*/
|
||||
#define SDLNet_SocketReady(sock) \
|
||||
((sock != NULL) && ((SDLNet_GenericSocket)sock)->ready)
|
||||
|
||||
/* Free a set of sockets allocated by SDL_NetAllocSocketSet() */
|
||||
extern DECLSPEC void SDLCALL SDLNet_FreeSocketSet(SDLNet_SocketSet set);
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
/* Platform-independent data conversion functions */
|
||||
/***********************************************************************/
|
||||
|
||||
/* Write a 16/32 bit value to network packet buffer */
|
||||
extern DECLSPEC void SDLCALL SDLNet_Write16(Uint16 value, void *area);
|
||||
extern DECLSPEC void SDLCALL SDLNet_Write32(Uint32 value, void *area);
|
||||
|
||||
/* Read a 16/32 bit value from network packet buffer */
|
||||
extern DECLSPEC Uint16 SDLCALL SDLNet_Read16(void *area);
|
||||
extern DECLSPEC Uint32 SDLCALL SDLNet_Read32(void *area);
|
||||
|
||||
/***********************************************************************/
|
||||
/* Error reporting functions */
|
||||
/***********************************************************************/
|
||||
|
||||
/* We'll use SDL's functions for error reporting */
|
||||
#define SDLNet_SetError SDL_SetError
|
||||
#define SDLNet_GetError SDL_GetError
|
||||
|
||||
/* I'm eventually going to try to disentangle SDL_net from SDL, thus making
|
||||
SDL_net an independent X-platform networking toolkit. Not today though....
|
||||
|
||||
extern no_parse_DECLSPEC void SDLCALL SDLNet_SetError(const char *fmt, ...);
|
||||
extern no_parse_DECLSPEC char * SDLCALL SDLNet_GetError(void);
|
||||
*/
|
||||
|
||||
|
||||
/* Inline macro functions to read/write network data */
|
||||
|
||||
/* Warning, some systems have data access alignment restrictions */
|
||||
#if defined(sparc) || defined(mips)
|
||||
#define SDL_DATA_ALIGNED 1
|
||||
#endif
|
||||
#ifndef SDL_DATA_ALIGNED
|
||||
#define SDL_DATA_ALIGNED 0
|
||||
#endif
|
||||
|
||||
/* Write a 16 bit value to network packet buffer */
|
||||
#if !SDL_DATA_ALIGNED
|
||||
#define SDLNet_Write16(value, areap) \
|
||||
(*(Uint16 *)(areap) = SDL_SwapBE16(value))
|
||||
#else
|
||||
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
|
||||
#define SDLNet_Write16(value, areap) \
|
||||
do \
|
||||
{ \
|
||||
Uint8 *area = (Uint8 *)(areap); \
|
||||
area[0] = (value >> 8) & 0xFF; \
|
||||
area[1] = value & 0xFF; \
|
||||
} while ( 0 )
|
||||
#else
|
||||
#define SDLNet_Write16(value, areap) \
|
||||
do \
|
||||
{ \
|
||||
Uint8 *area = (Uint8 *)(areap); \
|
||||
area[1] = (value >> 8) & 0xFF; \
|
||||
area[0] = value & 0xFF; \
|
||||
} while ( 0 )
|
||||
#endif
|
||||
#endif /* !SDL_DATA_ALIGNED */
|
||||
|
||||
/* Write a 32 bit value to network packet buffer */
|
||||
#if !SDL_DATA_ALIGNED
|
||||
#define SDLNet_Write32(value, areap) \
|
||||
*(Uint32 *)(areap) = SDL_SwapBE32(value);
|
||||
#else
|
||||
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
|
||||
#define SDLNet_Write32(value, areap) \
|
||||
do \
|
||||
{ \
|
||||
Uint8 *area = (Uint8 *)(areap); \
|
||||
area[0] = (value >> 24) & 0xFF; \
|
||||
area[1] = (value >> 16) & 0xFF; \
|
||||
area[2] = (value >> 8) & 0xFF; \
|
||||
area[3] = value & 0xFF; \
|
||||
} while ( 0 )
|
||||
#else
|
||||
#define SDLNet_Write32(value, areap) \
|
||||
do \
|
||||
{ \
|
||||
Uint8 *area = (Uint8 *)(areap); \
|
||||
area[3] = (value >> 24) & 0xFF; \
|
||||
area[2] = (value >> 16) & 0xFF; \
|
||||
area[1] = (value >> 8) & 0xFF; \
|
||||
area[0] = value & 0xFF; \
|
||||
} while ( 0 )
|
||||
#endif
|
||||
#endif /* !SDL_DATA_ALIGNED */
|
||||
|
||||
/* Read a 16 bit value from network packet buffer */
|
||||
#if !SDL_DATA_ALIGNED
|
||||
#define SDLNet_Read16(areap) \
|
||||
(SDL_SwapBE16(*(Uint16 *)(areap)))
|
||||
#else
|
||||
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
|
||||
#define SDLNet_Read16(areap) \
|
||||
((((Uint8 *)areap)[0] << 8) | ((Uint8 *)areap)[1] << 0)
|
||||
#else
|
||||
#define SDLNet_Read16(areap) \
|
||||
((((Uint8 *)areap)[1] << 8) | ((Uint8 *)areap)[0] << 0)
|
||||
#endif
|
||||
#endif /* !SDL_DATA_ALIGNED */
|
||||
|
||||
/* Read a 32 bit value from network packet buffer */
|
||||
#if !SDL_DATA_ALIGNED
|
||||
#define SDLNet_Read32(areap) \
|
||||
(SDL_SwapBE32(*(Uint32 *)(areap)))
|
||||
#else
|
||||
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
|
||||
#define SDLNet_Read32(areap) \
|
||||
((((Uint8 *)areap)[0] << 24) | (((Uint8 *)areap)[1] << 16) | \
|
||||
(((Uint8 *)areap)[2] << 8) | ((Uint8 *)areap)[3] << 0)
|
||||
#else
|
||||
#define SDLNet_Read32(areap) \
|
||||
((((Uint8 *)areap)[3] << 24) | (((Uint8 *)areap)[2] << 16) | \
|
||||
(((Uint8 *)areap)[1] << 8) | ((Uint8 *)areap)[0] << 0)
|
||||
#endif
|
||||
#endif /* !SDL_DATA_ALIGNED */
|
||||
|
||||
#ifdef MACOS_OPENTRANSPORT
|
||||
#endif
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_NET_H */
|
||||
|
6552
ExternalLibs/SDL12/include/SDL_opengl.h
Normal file
6552
ExternalLibs/SDL12/include/SDL_opengl.h
Normal file
File diff suppressed because it is too large
Load diff
109
ExternalLibs/SDL12/include/SDL_platform.h
Normal file
109
ExternalLibs/SDL12/include/SDL_platform.h
Normal file
|
@ -0,0 +1,109 @@
|
|||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* Try to get a standard set of platform defines */
|
||||
|
||||
#ifndef _SDL_platform_h
|
||||
#define _SDL_platform_h
|
||||
|
||||
#if defined(_AIX)
|
||||
#undef __AIX__
|
||||
#define __AIX__ 1
|
||||
#endif
|
||||
#if defined(__BEOS__)
|
||||
#undef __BEOS__
|
||||
#define __BEOS__ 1
|
||||
#endif
|
||||
#if defined(__HAIKU__)
|
||||
#undef __HAIKU__
|
||||
#define __HAIKU__ 1
|
||||
#endif
|
||||
#if defined(bsdi) || defined(__bsdi) || defined(__bsdi__)
|
||||
#undef __BSDI__
|
||||
#define __BSDI__ 1
|
||||
#endif
|
||||
#if defined(_arch_dreamcast)
|
||||
#undef __DREAMCAST__
|
||||
#define __DREAMCAST__ 1
|
||||
#endif
|
||||
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
#undef __FREEBSD__
|
||||
#define __FREEBSD__ 1
|
||||
#endif
|
||||
#if defined(__HAIKU__)
|
||||
#undef __HAIKU__
|
||||
#define __HAIKU__ 1
|
||||
#endif
|
||||
#if defined(hpux) || defined(__hpux) || defined(__hpux__)
|
||||
#undef __HPUX__
|
||||
#define __HPUX__ 1
|
||||
#endif
|
||||
#if defined(sgi) || defined(__sgi) || defined(__sgi__) || defined(_SGI_SOURCE)
|
||||
#undef __IRIX__
|
||||
#define __IRIX__ 1
|
||||
#endif
|
||||
#if defined(linux) || defined(__linux) || defined(__linux__)
|
||||
#undef __LINUX__
|
||||
#define __LINUX__ 1
|
||||
#endif
|
||||
#if defined(__APPLE__)
|
||||
#undef __MACOSX__
|
||||
#define __MACOSX__ 1
|
||||
#elif defined(macintosh)
|
||||
#undef __MACOS__
|
||||
#define __MACOS__ 1
|
||||
#endif
|
||||
#if defined(__NetBSD__)
|
||||
#undef __NETBSD__
|
||||
#define __NETBSD__ 1
|
||||
#endif
|
||||
#if defined(__OpenBSD__)
|
||||
#undef __OPENBSD__
|
||||
#define __OPENBSD__ 1
|
||||
#endif
|
||||
#if defined(__OS2__)
|
||||
#undef __OS2__
|
||||
#define __OS2__ 1
|
||||
#endif
|
||||
#if defined(osf) || defined(__osf) || defined(__osf__) || defined(_OSF_SOURCE)
|
||||
#undef __OSF__
|
||||
#define __OSF__ 1
|
||||
#endif
|
||||
#if defined(__QNXNTO__)
|
||||
#undef __QNXNTO__
|
||||
#define __QNXNTO__ 1
|
||||
#endif
|
||||
#if defined(riscos) || defined(__riscos) || defined(__riscos__)
|
||||
#undef __RISCOS__
|
||||
#define __RISCOS__ 1
|
||||
#endif
|
||||
#if defined(__SVR4)
|
||||
#undef __SOLARIS__
|
||||
#define __SOLARIS__ 1
|
||||
#endif
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
#undef __WIN32__
|
||||
#define __WIN32__ 1
|
||||
#endif
|
||||
|
||||
#endif /* _SDL_platform_h */
|
||||
|
51
ExternalLibs/SDL12/include/SDL_quit.h
Normal file
51
ExternalLibs/SDL12/include/SDL_quit.h
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* Include file for SDL quit event handling */
|
||||
|
||||
#ifndef _SDL_quit_h
|
||||
#define _SDL_quit_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_error.h"
|
||||
|
||||
/*
|
||||
An SDL_QUITEVENT is generated when the user tries to close the application
|
||||
window. If it is ignored or filtered out, the window will remain open.
|
||||
If it is not ignored or filtered, it is queued normally and the window
|
||||
is allowed to close. When the window is closed, screen updates will
|
||||
complete, but have no effect.
|
||||
|
||||
SDL_Init() installs signal handlers for SIGINT (keyboard interrupt)
|
||||
and SIGTERM (system termination request), if handlers do not already
|
||||
exist, that generate SDL_QUITEVENT events as well. There is no way
|
||||
to determine the cause of an SDL_QUITEVENT, but setting a signal
|
||||
handler in your application will override the default generation of
|
||||
quit events for that signal.
|
||||
*/
|
||||
|
||||
/* There are no functions directly affecting the quit event */
|
||||
#define SDL_QuitRequested() \
|
||||
(SDL_PumpEvents(), SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUITMASK))
|
||||
|
||||
#endif /* _SDL_quit_h */
|
||||
|
145
ExternalLibs/SDL12/include/SDL_rwops.h
Normal file
145
ExternalLibs/SDL12/include/SDL_rwops.h
Normal file
|
@ -0,0 +1,145 @@
|
|||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* This file provides a general interface for SDL to read and write
|
||||
data sources. It can easily be extended to files, memory, etc.
|
||||
*/
|
||||
|
||||
#ifndef _SDL_rwops_h
|
||||
#define _SDL_rwops_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_error.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* This is the read/write operation structure -- very basic */
|
||||
|
||||
typedef struct SDL_RWops {
|
||||
/* Seek to 'offset' relative to whence, one of stdio's whence values:
|
||||
SEEK_SET, SEEK_CUR, SEEK_END
|
||||
Returns the final offset in the data source.
|
||||
*/
|
||||
int (SDLCALL *seek)(struct SDL_RWops *context, int offset, int whence);
|
||||
|
||||
/* Read up to 'maxnum' objects each of size 'size' from the data
|
||||
source to the area pointed at by 'ptr'.
|
||||
Returns the number of objects read, or -1 if the read failed.
|
||||
*/
|
||||
int (SDLCALL *read)(struct SDL_RWops *context, void *ptr, int size, int maxnum);
|
||||
|
||||
/* Write exactly 'num' objects each of size 'objsize' from the area
|
||||
pointed at by 'ptr' to data source.
|
||||
Returns 'num', or -1 if the write failed.
|
||||
*/
|
||||
int (SDLCALL *write)(struct SDL_RWops *context, const void *ptr, int size, int num);
|
||||
|
||||
/* Close and free an allocated SDL_FSops structure */
|
||||
int (SDLCALL *close)(struct SDL_RWops *context);
|
||||
|
||||
Uint32 type;
|
||||
union {
|
||||
#if defined(__WIN32__) && !defined(__SYMBIAN32__)
|
||||
struct {
|
||||
int append;
|
||||
void *h;
|
||||
struct {
|
||||
void *data;
|
||||
int size;
|
||||
int left;
|
||||
} buffer;
|
||||
} win32io;
|
||||
#endif
|
||||
#ifdef HAVE_STDIO_H
|
||||
struct {
|
||||
int autoclose;
|
||||
FILE *fp;
|
||||
} stdio;
|
||||
#endif
|
||||
struct {
|
||||
Uint8 *base;
|
||||
Uint8 *here;
|
||||
Uint8 *stop;
|
||||
} mem;
|
||||
struct {
|
||||
void *data1;
|
||||
} unknown;
|
||||
} hidden;
|
||||
|
||||
} SDL_RWops;
|
||||
|
||||
|
||||
/* Functions to create SDL_RWops structures from various data sources */
|
||||
|
||||
extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromFile(const char *file, const char *mode);
|
||||
|
||||
#ifdef HAVE_STDIO_H
|
||||
extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromFP(FILE *fp, int autoclose);
|
||||
#endif
|
||||
|
||||
extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromMem(void *mem, int size);
|
||||
extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromConstMem(const void *mem, int size);
|
||||
|
||||
extern DECLSPEC SDL_RWops * SDLCALL SDL_AllocRW(void);
|
||||
extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops *area);
|
||||
|
||||
#define RW_SEEK_SET 0 /* Seek from the beginning of data */
|
||||
#define RW_SEEK_CUR 1 /* Seek relative to current read point */
|
||||
#define RW_SEEK_END 2 /* Seek relative to the end of data */
|
||||
|
||||
/* Macros to easily read and write from an SDL_RWops structure */
|
||||
#define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence)
|
||||
#define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, RW_SEEK_CUR)
|
||||
#define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n)
|
||||
#define SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n)
|
||||
#define SDL_RWclose(ctx) (ctx)->close(ctx)
|
||||
|
||||
|
||||
/* Read an item of the specified endianness and return in native format */
|
||||
extern DECLSPEC Uint16 SDLCALL SDL_ReadLE16(SDL_RWops *src);
|
||||
extern DECLSPEC Uint16 SDLCALL SDL_ReadBE16(SDL_RWops *src);
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_ReadLE32(SDL_RWops *src);
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_ReadBE32(SDL_RWops *src);
|
||||
extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops *src);
|
||||
extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops *src);
|
||||
|
||||
/* Write an item of native format to the specified endianness */
|
||||
extern DECLSPEC int SDLCALL SDL_WriteLE16(SDL_RWops *dst, Uint16 value);
|
||||
extern DECLSPEC int SDLCALL SDL_WriteBE16(SDL_RWops *dst, Uint16 value);
|
||||
extern DECLSPEC int SDLCALL SDL_WriteLE32(SDL_RWops *dst, Uint32 value);
|
||||
extern DECLSPEC int SDLCALL SDL_WriteBE32(SDL_RWops *dst, Uint32 value);
|
||||
extern DECLSPEC int SDLCALL SDL_WriteLE64(SDL_RWops *dst, Uint64 value);
|
||||
extern DECLSPEC int SDLCALL SDL_WriteBE64(SDL_RWops *dst, Uint64 value);
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_rwops_h */
|
||||
|
598
ExternalLibs/SDL12/include/SDL_stdinc.h
Normal file
598
ExternalLibs/SDL12/include/SDL_stdinc.h
Normal file
|
@ -0,0 +1,598 @@
|
|||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* This is a general header that includes C language support */
|
||||
|
||||
#ifndef _SDL_stdinc_h
|
||||
#define _SDL_stdinc_h
|
||||
|
||||
#include "SDL_config.h"
|
||||
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#if defined(STDC_HEADERS)
|
||||
# include <stdlib.h>
|
||||
# include <stddef.h>
|
||||
# include <stdarg.h>
|
||||
#else
|
||||
# if defined(HAVE_STDLIB_H)
|
||||
# include <stdlib.h>
|
||||
# elif defined(HAVE_MALLOC_H)
|
||||
# include <malloc.h>
|
||||
# endif
|
||||
# if defined(HAVE_STDDEF_H)
|
||||
# include <stddef.h>
|
||||
# endif
|
||||
# if defined(HAVE_STDARG_H)
|
||||
# include <stdarg.h>
|
||||
# endif
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
|
||||
# include <memory.h>
|
||||
# endif
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#if defined(HAVE_INTTYPES_H)
|
||||
# include <inttypes.h>
|
||||
#elif defined(HAVE_STDINT_H)
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
#ifdef HAVE_CTYPE_H
|
||||
# include <ctype.h>
|
||||
#endif
|
||||
#ifdef HAVE_ICONV_H
|
||||
# include <iconv.h>
|
||||
#endif
|
||||
|
||||
/* The number of elements in an array */
|
||||
#define SDL_arraysize(array) (sizeof(array)/sizeof(array[0]))
|
||||
#define SDL_TABLESIZE(table) SDL_arraysize(table)
|
||||
|
||||
/* Basic data types */
|
||||
typedef enum SDL_bool {
|
||||
SDL_FALSE = 0,
|
||||
SDL_TRUE = 1
|
||||
} SDL_bool;
|
||||
|
||||
typedef int8_t Sint8;
|
||||
typedef uint8_t Uint8;
|
||||
typedef int16_t Sint16;
|
||||
typedef uint16_t Uint16;
|
||||
typedef int32_t Sint32;
|
||||
typedef uint32_t Uint32;
|
||||
|
||||
#ifdef SDL_HAS_64BIT_TYPE
|
||||
typedef int64_t Sint64;
|
||||
#ifndef SYMBIAN32_GCCE
|
||||
typedef uint64_t Uint64;
|
||||
#endif
|
||||
#else
|
||||
/* This is really just a hack to prevent the compiler from complaining */
|
||||
typedef struct {
|
||||
Uint32 hi;
|
||||
Uint32 lo;
|
||||
} Uint64, Sint64;
|
||||
#endif
|
||||
|
||||
/* Make sure the types really have the right sizes */
|
||||
#define SDL_COMPILE_TIME_ASSERT(name, x) \
|
||||
typedef int SDL_dummy_ ## name[(x) * 2 - 1]
|
||||
|
||||
SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1);
|
||||
SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1);
|
||||
SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2);
|
||||
SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2);
|
||||
SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4);
|
||||
SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4);
|
||||
SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8);
|
||||
SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
|
||||
|
||||
/* Check to make sure enums are the size of ints, for structure packing.
|
||||
For both Watcom C/C++ and Borland C/C++ the compiler option that makes
|
||||
enums having the size of an int must be enabled.
|
||||
This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11).
|
||||
*/
|
||||
/* Enable enums always int in CodeWarrior (for MPW use "-enum int") */
|
||||
#ifdef __MWERKS__
|
||||
#pragma enumsalwaysint on
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
DUMMY_ENUM_VALUE
|
||||
} SDL_DUMMY_ENUM;
|
||||
|
||||
#ifndef __NDS__
|
||||
SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int));
|
||||
#endif
|
||||
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MALLOC
|
||||
#define SDL_malloc malloc
|
||||
#else
|
||||
extern DECLSPEC void * SDLCALL SDL_malloc(size_t size);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CALLOC
|
||||
#define SDL_calloc calloc
|
||||
#else
|
||||
extern DECLSPEC void * SDLCALL SDL_calloc(size_t nmemb, size_t size);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_REALLOC
|
||||
#define SDL_realloc realloc
|
||||
#else
|
||||
extern DECLSPEC void * SDLCALL SDL_realloc(void *mem, size_t size);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FREE
|
||||
#define SDL_free free
|
||||
#else
|
||||
extern DECLSPEC void SDLCALL SDL_free(void *mem);
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_ALLOCA) && !defined(alloca)
|
||||
# if defined(HAVE_ALLOCA_H)
|
||||
# include <alloca.h>
|
||||
# elif defined(__GNUC__)
|
||||
# define alloca __builtin_alloca
|
||||
# elif defined(_MSC_VER)
|
||||
# include <malloc.h>
|
||||
# define alloca _alloca
|
||||
# elif defined(__WATCOMC__)
|
||||
# include <malloc.h>
|
||||
# elif defined(__BORLANDC__)
|
||||
# include <malloc.h>
|
||||
# elif defined(__DMC__)
|
||||
# include <stdlib.h>
|
||||
# elif defined(__AIX__)
|
||||
#pragma alloca
|
||||
# elif defined(__MRC__)
|
||||
void *alloca (unsigned);
|
||||
# else
|
||||
char *alloca ();
|
||||
# endif
|
||||
#endif
|
||||
#ifdef HAVE_ALLOCA
|
||||
#define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*(count))
|
||||
#define SDL_stack_free(data)
|
||||
#else
|
||||
#define SDL_stack_alloc(type, count) (type*)SDL_malloc(sizeof(type)*(count))
|
||||
#define SDL_stack_free(data) SDL_free(data)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GETENV
|
||||
#define SDL_getenv getenv
|
||||
#else
|
||||
extern DECLSPEC char * SDLCALL SDL_getenv(const char *name);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PUTENV
|
||||
#define SDL_putenv putenv
|
||||
#else
|
||||
extern DECLSPEC int SDLCALL SDL_putenv(const char *variable);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_QSORT
|
||||
#define SDL_qsort qsort
|
||||
#else
|
||||
extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size,
|
||||
int (*compare)(const void *, const void *));
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ABS
|
||||
#define SDL_abs abs
|
||||
#else
|
||||
#define SDL_abs(X) ((X) < 0 ? -(X) : (X))
|
||||
#endif
|
||||
|
||||
#define SDL_min(x, y) (((x) < (y)) ? (x) : (y))
|
||||
#define SDL_max(x, y) (((x) > (y)) ? (x) : (y))
|
||||
|
||||
#ifdef HAVE_CTYPE_H
|
||||
#define SDL_isdigit(X) isdigit(X)
|
||||
#define SDL_isspace(X) isspace(X)
|
||||
#define SDL_toupper(X) toupper(X)
|
||||
#define SDL_tolower(X) tolower(X)
|
||||
#else
|
||||
#define SDL_isdigit(X) (((X) >= '0') && ((X) <= '9'))
|
||||
#define SDL_isspace(X) (((X) == ' ') || ((X) == '\t') || ((X) == '\r') || ((X) == '\n'))
|
||||
#define SDL_toupper(X) (((X) >= 'a') && ((X) <= 'z') ? ('A'+((X)-'a')) : (X))
|
||||
#define SDL_tolower(X) (((X) >= 'A') && ((X) <= 'Z') ? ('a'+((X)-'A')) : (X))
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MEMSET
|
||||
#define SDL_memset memset
|
||||
#else
|
||||
extern DECLSPEC void * SDLCALL SDL_memset(void *dst, int c, size_t len);
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && defined(i386)
|
||||
#define SDL_memset4(dst, val, len) \
|
||||
do { \
|
||||
int u0, u1, u2; \
|
||||
__asm__ __volatile__ ( \
|
||||
"cld\n\t" \
|
||||
"rep ; stosl\n\t" \
|
||||
: "=&D" (u0), "=&a" (u1), "=&c" (u2) \
|
||||
: "0" (dst), "1" (val), "2" ((Uint32)(len)) \
|
||||
: "memory" ); \
|
||||
} while(0)
|
||||
#endif
|
||||
#ifndef SDL_memset4
|
||||
#define SDL_memset4(dst, val, len) \
|
||||
do { \
|
||||
unsigned _count = (len); \
|
||||
unsigned _n = (_count + 3) / 4; \
|
||||
Uint32 *_p = (Uint32 *)(dst); \
|
||||
Uint32 _val = (val); \
|
||||
switch (_count % 4) { \
|
||||
case 0: do { *_p++ = _val; \
|
||||
case 3: *_p++ = _val; \
|
||||
case 2: *_p++ = _val; \
|
||||
case 1: *_p++ = _val; \
|
||||
} while ( --_n ); \
|
||||
} \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
/* We can count on memcpy existing on Mac OS X and being well-tuned. */
|
||||
#if defined(__MACH__) && defined(__APPLE__)
|
||||
#define SDL_memcpy(dst, src, len) memcpy(dst, src, len)
|
||||
#elif defined(__GNUC__) && defined(i386)
|
||||
#define SDL_memcpy(dst, src, len) \
|
||||
do { \
|
||||
int u0, u1, u2; \
|
||||
__asm__ __volatile__ ( \
|
||||
"cld\n\t" \
|
||||
"rep ; movsl\n\t" \
|
||||
"testb $2,%b4\n\t" \
|
||||
"je 1f\n\t" \
|
||||
"movsw\n" \
|
||||
"1:\ttestb $1,%b4\n\t" \
|
||||
"je 2f\n\t" \
|
||||
"movsb\n" \
|
||||
"2:" \
|
||||
: "=&c" (u0), "=&D" (u1), "=&S" (u2) \
|
||||
: "0" ((unsigned)(len)/4), "q" (len), "1" (dst),"2" (src) \
|
||||
: "memory" ); \
|
||||
} while(0)
|
||||
#endif
|
||||
#ifndef SDL_memcpy
|
||||
#ifdef HAVE_MEMCPY
|
||||
#define SDL_memcpy memcpy
|
||||
#elif defined(HAVE_BCOPY)
|
||||
#define SDL_memcpy(d, s, n) bcopy((s), (d), (n))
|
||||
#else
|
||||
extern DECLSPEC void * SDLCALL SDL_memcpy(void *dst, const void *src, size_t len);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* We can count on memcpy existing on Mac OS X and being well-tuned. */
|
||||
#if defined(__MACH__) && defined(__APPLE__)
|
||||
#define SDL_memcpy4(dst, src, len) memcpy(dst, src, (len)*4)
|
||||
#elif defined(__GNUC__) && defined(i386)
|
||||
#define SDL_memcpy4(dst, src, len) \
|
||||
do { \
|
||||
int ecx, edi, esi; \
|
||||
__asm__ __volatile__ ( \
|
||||
"cld\n\t" \
|
||||
"rep ; movsl" \
|
||||
: "=&c" (ecx), "=&D" (edi), "=&S" (esi) \
|
||||
: "0" ((unsigned)(len)), "1" (dst), "2" (src) \
|
||||
: "memory" ); \
|
||||
} while(0)
|
||||
#endif
|
||||
#ifndef SDL_memcpy4
|
||||
#define SDL_memcpy4(dst, src, len) SDL_memcpy(dst, src, (len) << 2)
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && defined(i386)
|
||||
#define SDL_revcpy(dst, src, len) \
|
||||
do { \
|
||||
int u0, u1, u2; \
|
||||
char *dstp = (char *)(dst); \
|
||||
char *srcp = (char *)(src); \
|
||||
int n = (len); \
|
||||
if ( n >= 4 ) { \
|
||||
__asm__ __volatile__ ( \
|
||||
"std\n\t" \
|
||||
"rep ; movsl\n\t" \
|
||||
"cld\n\t" \
|
||||
: "=&c" (u0), "=&D" (u1), "=&S" (u2) \
|
||||
: "0" (n >> 2), \
|
||||
"1" (dstp+(n-4)), "2" (srcp+(n-4)) \
|
||||
: "memory" ); \
|
||||
} \
|
||||
switch (n & 3) { \
|
||||
case 3: dstp[2] = srcp[2]; \
|
||||
case 2: dstp[1] = srcp[1]; \
|
||||
case 1: dstp[0] = srcp[0]; \
|
||||
break; \
|
||||
default: \
|
||||
break; \
|
||||
} \
|
||||
} while(0)
|
||||
#endif
|
||||
#ifndef SDL_revcpy
|
||||
extern DECLSPEC void * SDLCALL SDL_revcpy(void *dst, const void *src, size_t len);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MEMMOVE
|
||||
#define SDL_memmove memmove
|
||||
#elif defined(HAVE_BCOPY)
|
||||
#define SDL_memmove(d, s, n) bcopy((s), (d), (n))
|
||||
#else
|
||||
#define SDL_memmove(dst, src, len) \
|
||||
do { \
|
||||
if ( dst < src ) { \
|
||||
SDL_memcpy(dst, src, len); \
|
||||
} else { \
|
||||
SDL_revcpy(dst, src, len); \
|
||||
} \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MEMCMP
|
||||
#define SDL_memcmp memcmp
|
||||
#else
|
||||
extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRLEN
|
||||
#define SDL_strlen strlen
|
||||
#else
|
||||
extern DECLSPEC size_t SDLCALL SDL_strlen(const char *string);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRLCPY
|
||||
#define SDL_strlcpy strlcpy
|
||||
#else
|
||||
extern DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src, size_t maxlen);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRLCAT
|
||||
#define SDL_strlcat strlcat
|
||||
#else
|
||||
extern DECLSPEC size_t SDLCALL SDL_strlcat(char *dst, const char *src, size_t maxlen);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRDUP
|
||||
#define SDL_strdup strdup
|
||||
#else
|
||||
extern DECLSPEC char * SDLCALL SDL_strdup(const char *string);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE__STRREV
|
||||
#define SDL_strrev _strrev
|
||||
#else
|
||||
extern DECLSPEC char * SDLCALL SDL_strrev(char *string);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE__STRUPR
|
||||
#define SDL_strupr _strupr
|
||||
#else
|
||||
extern DECLSPEC char * SDLCALL SDL_strupr(char *string);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE__STRLWR
|
||||
#define SDL_strlwr _strlwr
|
||||
#else
|
||||
extern DECLSPEC char * SDLCALL SDL_strlwr(char *string);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRCHR
|
||||
#define SDL_strchr strchr
|
||||
#elif defined(HAVE_INDEX)
|
||||
#define SDL_strchr index
|
||||
#else
|
||||
extern DECLSPEC char * SDLCALL SDL_strchr(const char *string, int c);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRRCHR
|
||||
#define SDL_strrchr strrchr
|
||||
#elif defined(HAVE_RINDEX)
|
||||
#define SDL_strrchr rindex
|
||||
#else
|
||||
extern DECLSPEC char * SDLCALL SDL_strrchr(const char *string, int c);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRSTR
|
||||
#define SDL_strstr strstr
|
||||
#else
|
||||
extern DECLSPEC char * SDLCALL SDL_strstr(const char *haystack, const char *needle);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ITOA
|
||||
#define SDL_itoa itoa
|
||||
#else
|
||||
#define SDL_itoa(value, string, radix) SDL_ltoa((long)value, string, radix)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE__LTOA
|
||||
#define SDL_ltoa _ltoa
|
||||
#else
|
||||
extern DECLSPEC char * SDLCALL SDL_ltoa(long value, char *string, int radix);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE__UITOA
|
||||
#define SDL_uitoa _uitoa
|
||||
#else
|
||||
#define SDL_uitoa(value, string, radix) SDL_ultoa((long)value, string, radix)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE__ULTOA
|
||||
#define SDL_ultoa _ultoa
|
||||
#else
|
||||
extern DECLSPEC char * SDLCALL SDL_ultoa(unsigned long value, char *string, int radix);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRTOL
|
||||
#define SDL_strtol strtol
|
||||
#else
|
||||
extern DECLSPEC long SDLCALL SDL_strtol(const char *string, char **endp, int base);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRTOUL
|
||||
#define SDL_strtoul strtoul
|
||||
#else
|
||||
extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *string, char **endp, int base);
|
||||
#endif
|
||||
|
||||
#ifdef SDL_HAS_64BIT_TYPE
|
||||
|
||||
#ifdef HAVE__I64TOA
|
||||
#define SDL_lltoa _i64toa
|
||||
#else
|
||||
extern DECLSPEC char* SDLCALL SDL_lltoa(Sint64 value, char *string, int radix);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE__UI64TOA
|
||||
#define SDL_ulltoa _ui64toa
|
||||
#else
|
||||
extern DECLSPEC char* SDLCALL SDL_ulltoa(Uint64 value, char *string, int radix);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRTOLL
|
||||
#define SDL_strtoll strtoll
|
||||
#else
|
||||
extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *string, char **endp, int base);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRTOULL
|
||||
#define SDL_strtoull strtoull
|
||||
#else
|
||||
extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *string, char **endp, int base);
|
||||
#endif
|
||||
|
||||
#endif /* SDL_HAS_64BIT_TYPE */
|
||||
|
||||
#ifdef HAVE_STRTOD
|
||||
#define SDL_strtod strtod
|
||||
#else
|
||||
extern DECLSPEC double SDLCALL SDL_strtod(const char *string, char **endp);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ATOI
|
||||
#define SDL_atoi atoi
|
||||
#else
|
||||
#define SDL_atoi(X) SDL_strtol(X, NULL, 0)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ATOF
|
||||
#define SDL_atof atof
|
||||
#else
|
||||
#define SDL_atof(X) SDL_strtod(X, NULL)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRCMP
|
||||
#define SDL_strcmp strcmp
|
||||
#else
|
||||
extern DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRNCMP
|
||||
#define SDL_strncmp strncmp
|
||||
#else
|
||||
extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size_t maxlen);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRCASECMP
|
||||
#define SDL_strcasecmp strcasecmp
|
||||
#elif defined(HAVE__STRICMP)
|
||||
#define SDL_strcasecmp _stricmp
|
||||
#else
|
||||
extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRNCASECMP
|
||||
#define SDL_strncasecmp strncasecmp
|
||||
#elif defined(HAVE__STRNICMP)
|
||||
#define SDL_strncasecmp _strnicmp
|
||||
#else
|
||||
extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t maxlen);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SSCANF
|
||||
#define SDL_sscanf sscanf
|
||||
#else
|
||||
extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, const char *fmt, ...);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SNPRINTF
|
||||
#define SDL_snprintf snprintf
|
||||
#else
|
||||
extern DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen, const char *fmt, ...);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_VSNPRINTF
|
||||
#define SDL_vsnprintf vsnprintf
|
||||
#else
|
||||
extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap);
|
||||
#endif
|
||||
|
||||
/* The SDL implementation of iconv() returns these error codes */
|
||||
#define SDL_ICONV_ERROR (size_t)-1
|
||||
#define SDL_ICONV_E2BIG (size_t)-2
|
||||
#define SDL_ICONV_EILSEQ (size_t)-3
|
||||
#define SDL_ICONV_EINVAL (size_t)-4
|
||||
|
||||
#ifdef HAVE_ICONV
|
||||
#define SDL_iconv_t iconv_t
|
||||
#define SDL_iconv_open iconv_open
|
||||
#define SDL_iconv_close iconv_close
|
||||
#else
|
||||
typedef struct _SDL_iconv_t *SDL_iconv_t;
|
||||
extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode, const char *fromcode);
|
||||
extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd);
|
||||
#endif
|
||||
extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft);
|
||||
/* This function converts a string between encodings in one pass, returning a
|
||||
string that must be freed with SDL_free() or NULL on error.
|
||||
*/
|
||||
extern DECLSPEC char * SDLCALL SDL_iconv_string(const char *tocode, const char *fromcode, const char *inbuf, size_t inbytesleft);
|
||||
#define SDL_iconv_utf8_locale(S) SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1)
|
||||
#define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2", "UTF-8", S, SDL_strlen(S)+1)
|
||||
#define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4", "UTF-8", S, SDL_strlen(S)+1)
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_stdinc_h */
|
||||
|
215
ExternalLibs/SDL12/include/SDL_syswm.h
Normal file
215
ExternalLibs/SDL12/include/SDL_syswm.h
Normal file
|
@ -0,0 +1,215 @@
|
|||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* Include file for SDL custom system window manager hooks */
|
||||
|
||||
#ifndef _SDL_syswm_h
|
||||
#define _SDL_syswm_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_version.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Your application has access to a special type of event 'SDL_SYSWMEVENT',
|
||||
which contains window-manager specific information and arrives whenever
|
||||
an unhandled window event occurs. This event is ignored by default, but
|
||||
you can enable it with SDL_EventState()
|
||||
*/
|
||||
#ifdef SDL_PROTOTYPES_ONLY
|
||||
struct SDL_SysWMinfo;
|
||||
typedef struct SDL_SysWMinfo SDL_SysWMinfo;
|
||||
#else
|
||||
|
||||
/* This is the structure for custom window manager events */
|
||||
#if defined(SDL_VIDEO_DRIVER_X11)
|
||||
#if defined(__APPLE__) && defined(__MACH__)
|
||||
/* conflicts with Quickdraw.h */
|
||||
#define Cursor X11Cursor
|
||||
#endif
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
|
||||
#if defined(__APPLE__) && defined(__MACH__)
|
||||
/* matches the re-define above */
|
||||
#undef Cursor
|
||||
#endif
|
||||
|
||||
/* These are the various supported subsystems under UNIX */
|
||||
typedef enum {
|
||||
SDL_SYSWM_X11
|
||||
} SDL_SYSWM_TYPE;
|
||||
|
||||
/* The UNIX custom event structure */
|
||||
struct SDL_SysWMmsg {
|
||||
SDL_version version;
|
||||
SDL_SYSWM_TYPE subsystem;
|
||||
union {
|
||||
XEvent xevent;
|
||||
} event;
|
||||
};
|
||||
|
||||
/* The UNIX custom window manager information structure.
|
||||
When this structure is returned, it holds information about which
|
||||
low level system it is using, and will be one of SDL_SYSWM_TYPE.
|
||||
*/
|
||||
typedef struct SDL_SysWMinfo {
|
||||
SDL_version version;
|
||||
SDL_SYSWM_TYPE subsystem;
|
||||
union {
|
||||
struct {
|
||||
Display *display; /* The X11 display */
|
||||
Window window; /* The X11 display window */
|
||||
/* These locking functions should be called around
|
||||
any X11 functions using the display variable,
|
||||
but not the gfxdisplay variable.
|
||||
They lock the event thread, so should not be
|
||||
called around event functions or from event filters.
|
||||
*/
|
||||
void (*lock_func)(void);
|
||||
void (*unlock_func)(void);
|
||||
|
||||
/* Introduced in SDL 1.0.2 */
|
||||
Window fswindow; /* The X11 fullscreen window */
|
||||
Window wmwindow; /* The X11 managed input window */
|
||||
|
||||
/* Introduced in SDL 1.2.12 */
|
||||
Display *gfxdisplay; /* The X11 display to which rendering is done */
|
||||
} x11;
|
||||
} info;
|
||||
} SDL_SysWMinfo;
|
||||
|
||||
#elif defined(SDL_VIDEO_DRIVER_NANOX)
|
||||
#include <microwin/nano-X.h>
|
||||
|
||||
/* The generic custom event structure */
|
||||
struct SDL_SysWMmsg {
|
||||
SDL_version version;
|
||||
int data;
|
||||
};
|
||||
|
||||
/* The windows custom window manager information structure */
|
||||
typedef struct SDL_SysWMinfo {
|
||||
SDL_version version ;
|
||||
GR_WINDOW_ID window ; /* The display window */
|
||||
} SDL_SysWMinfo;
|
||||
|
||||
#elif defined(SDL_VIDEO_DRIVER_WINDIB) || defined(SDL_VIDEO_DRIVER_DDRAW) || defined(SDL_VIDEO_DRIVER_GAPI)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
/* The windows custom event structure */
|
||||
struct SDL_SysWMmsg {
|
||||
SDL_version version;
|
||||
HWND hwnd; /* The window for the message */
|
||||
UINT msg; /* The type of message */
|
||||
WPARAM wParam; /* WORD message parameter */
|
||||
LPARAM lParam; /* LONG message parameter */
|
||||
};
|
||||
|
||||
/* The windows custom window manager information structure */
|
||||
typedef struct SDL_SysWMinfo {
|
||||
SDL_version version;
|
||||
HWND window; /* The Win32 display window */
|
||||
HGLRC hglrc; /* The OpenGL context, if any */
|
||||
} SDL_SysWMinfo;
|
||||
|
||||
#elif defined(SDL_VIDEO_DRIVER_RISCOS)
|
||||
|
||||
/* RISC OS custom event structure */
|
||||
struct SDL_SysWMmsg {
|
||||
SDL_version version;
|
||||
int eventCode; /* The window for the message */
|
||||
int pollBlock[64];
|
||||
};
|
||||
|
||||
/* The RISC OS custom window manager information structure */
|
||||
typedef struct SDL_SysWMinfo {
|
||||
SDL_version version;
|
||||
int wimpVersion; /* Wimp version running under */
|
||||
int taskHandle; /* The RISC OS task handle */
|
||||
int window; /* The RISC OS display window */
|
||||
} SDL_SysWMinfo;
|
||||
|
||||
#elif defined(SDL_VIDEO_DRIVER_PHOTON)
|
||||
#include <sys/neutrino.h>
|
||||
#include <Ph.h>
|
||||
|
||||
/* The QNX custom event structure */
|
||||
struct SDL_SysWMmsg {
|
||||
SDL_version version;
|
||||
int data;
|
||||
};
|
||||
|
||||
/* The QNX custom window manager information structure */
|
||||
typedef struct SDL_SysWMinfo {
|
||||
SDL_version version;
|
||||
int data;
|
||||
} SDL_SysWMinfo;
|
||||
|
||||
#else
|
||||
|
||||
/* The generic custom event structure */
|
||||
struct SDL_SysWMmsg {
|
||||
SDL_version version;
|
||||
int data;
|
||||
};
|
||||
|
||||
/* The generic custom window manager information structure */
|
||||
typedef struct SDL_SysWMinfo {
|
||||
SDL_version version;
|
||||
int data;
|
||||
} SDL_SysWMinfo;
|
||||
|
||||
#endif /* video driver type */
|
||||
|
||||
#endif /* SDL_PROTOTYPES_ONLY */
|
||||
|
||||
/* Function prototypes */
|
||||
/*
|
||||
* This function gives you custom hooks into the window manager information.
|
||||
* It fills the structure pointed to by 'info' with custom information and
|
||||
* returns 1 if the function is implemented. If it's not implemented, or
|
||||
* the version member of the 'info' structure is invalid, it returns 0.
|
||||
*
|
||||
* You typically use this function like this:
|
||||
* SDL_SysWMInfo info;
|
||||
* SDL_VERSION(&info.version);
|
||||
* if ( SDL_GetWMInfo(&info) ) { ... }
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetWMInfo(SDL_SysWMinfo *info);
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_syswm_h */
|
||||
|
120
ExternalLibs/SDL12/include/SDL_thread.h
Normal file
120
ExternalLibs/SDL12/include/SDL_thread.h
Normal file
|
@ -0,0 +1,120 @@
|
|||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
#ifndef _SDL_thread_h
|
||||
#define _SDL_thread_h
|
||||
|
||||
/* Header for the SDL thread management routines
|
||||
|
||||
These are independent of the other SDL routines.
|
||||
*/
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_error.h"
|
||||
|
||||
/* Thread synchronization primitives */
|
||||
#include "SDL_mutex.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* The SDL thread structure, defined in SDL_thread.c */
|
||||
struct SDL_Thread;
|
||||
typedef struct SDL_Thread SDL_Thread;
|
||||
|
||||
/* Create a thread */
|
||||
#if ((defined(__WIN32__) && !defined(HAVE_LIBC)) || defined(__OS2__)) && !defined(__SYMBIAN32__)
|
||||
/*
|
||||
We compile SDL into a DLL on OS/2. This means, that it's the DLL which
|
||||
creates a new thread for the calling process with the SDL_CreateThread()
|
||||
API. There is a problem with this, that only the RTL of the SDL.DLL will
|
||||
be initialized for those threads, and not the RTL of the calling application!
|
||||
To solve this, we make a little hack here.
|
||||
We'll always use the caller's _beginthread() and _endthread() APIs to
|
||||
start a new thread. This way, if it's the SDL.DLL which uses this API,
|
||||
then the RTL of SDL.DLL will be used to create the new thread, and if it's
|
||||
the application, then the RTL of the application will be used.
|
||||
So, in short:
|
||||
Always use the _beginthread() and _endthread() of the calling runtime library!
|
||||
*/
|
||||
#define SDL_PASSED_BEGINTHREAD_ENDTHREAD
|
||||
#ifndef _WIN32_WCE
|
||||
#include <process.h> /* This has _beginthread() and _endthread() defined! */
|
||||
#endif
|
||||
|
||||
#ifdef __OS2__
|
||||
typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void *arg);
|
||||
typedef void (*pfnSDL_CurrentEndThread)(void);
|
||||
#elif __GNUC__
|
||||
typedef unsigned long (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned,
|
||||
unsigned (__stdcall *func)(void *), void *arg,
|
||||
unsigned, unsigned *threadID);
|
||||
typedef void (__cdecl *pfnSDL_CurrentEndThread)(unsigned code);
|
||||
#else
|
||||
typedef uintptr_t (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned,
|
||||
unsigned (__stdcall *func)(void *), void *arg,
|
||||
unsigned, unsigned *threadID);
|
||||
typedef void (__cdecl *pfnSDL_CurrentEndThread)(unsigned code);
|
||||
#endif
|
||||
|
||||
extern DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (SDLCALL *fn)(void *), void *data, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread);
|
||||
|
||||
#ifdef __OS2__
|
||||
#define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, _beginthread, _endthread)
|
||||
#elif defined(_WIN32_WCE)
|
||||
#define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, NULL, NULL)
|
||||
#else
|
||||
#define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, _beginthreadex, _endthreadex)
|
||||
#endif
|
||||
#else
|
||||
extern DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (SDLCALL *fn)(void *), void *data);
|
||||
#endif
|
||||
|
||||
/* Get the 32-bit thread identifier for the current thread */
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_ThreadID(void);
|
||||
|
||||
/* Get the 32-bit thread identifier for the specified thread,
|
||||
equivalent to SDL_ThreadID() if the specified thread is NULL.
|
||||
*/
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_GetThreadID(SDL_Thread *thread);
|
||||
|
||||
/* Wait for a thread to finish.
|
||||
The return code for the thread function is placed in the area
|
||||
pointed to by 'status', if 'status' is not NULL.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread *thread, int *status);
|
||||
|
||||
/* Forcefully kill a thread without worrying about its state */
|
||||
extern DECLSPEC void SDLCALL SDL_KillThread(SDL_Thread *thread);
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_thread_h */
|
||||
|
116
ExternalLibs/SDL12/include/SDL_timer.h
Normal file
116
ExternalLibs/SDL12/include/SDL_timer.h
Normal file
|
@ -0,0 +1,116 @@
|
|||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
#ifndef _SDL_timer_h
|
||||
#define _SDL_timer_h
|
||||
|
||||
/* Header for the SDL time management routines */
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_error.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* This is the OS scheduler timeslice, in milliseconds */
|
||||
#define SDL_TIMESLICE 10
|
||||
|
||||
/* This is the maximum resolution of the SDL timer on all platforms */
|
||||
#define TIMER_RESOLUTION 10 /* Experimentally determined */
|
||||
|
||||
/* Get the number of milliseconds since the SDL library initialization.
|
||||
* Note that this value wraps if the program runs for more than ~49 days.
|
||||
*/
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void);
|
||||
|
||||
/* Wait a specified number of milliseconds before returning */
|
||||
extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms);
|
||||
|
||||
/* Function prototype for the timer callback function */
|
||||
typedef Uint32 (SDLCALL *SDL_TimerCallback)(Uint32 interval);
|
||||
|
||||
/* Set a callback to run after the specified number of milliseconds has
|
||||
* elapsed. The callback function is passed the current timer interval
|
||||
* and returns the next timer interval. If the returned value is the
|
||||
* same as the one passed in, the periodic alarm continues, otherwise a
|
||||
* new alarm is scheduled. If the callback returns 0, the periodic alarm
|
||||
* is cancelled.
|
||||
*
|
||||
* To cancel a currently running timer, call SDL_SetTimer(0, NULL);
|
||||
*
|
||||
* The timer callback function may run in a different thread than your
|
||||
* main code, and so shouldn't call any functions from within itself.
|
||||
*
|
||||
* The maximum resolution of this timer is 10 ms, which means that if
|
||||
* you request a 16 ms timer, your callback will run approximately 20 ms
|
||||
* later on an unloaded system. If you wanted to set a flag signaling
|
||||
* a frame update at 30 frames per second (every 33 ms), you might set a
|
||||
* timer for 30 ms:
|
||||
* SDL_SetTimer((33/10)*10, flag_update);
|
||||
*
|
||||
* If you use this function, you need to pass SDL_INIT_TIMER to SDL_Init().
|
||||
*
|
||||
* Under UNIX, you should not use raise or use SIGALRM and this function
|
||||
* in the same program, as it is implemented using setitimer(). You also
|
||||
* should not use this function in multi-threaded applications as signals
|
||||
* to multi-threaded apps have undefined behavior in some implementations.
|
||||
*
|
||||
* This function returns 0 if successful, or -1 if there was an error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetTimer(Uint32 interval, SDL_TimerCallback callback);
|
||||
|
||||
/* New timer API, supports multiple timers
|
||||
* Written by Stephane Peter <megastep@lokigames.com>
|
||||
*/
|
||||
|
||||
/* Function prototype for the new timer callback function.
|
||||
* The callback function is passed the current timer interval and returns
|
||||
* the next timer interval. If the returned value is the same as the one
|
||||
* passed in, the periodic alarm continues, otherwise a new alarm is
|
||||
* scheduled. If the callback returns 0, the periodic alarm is cancelled.
|
||||
*/
|
||||
typedef Uint32 (SDLCALL *SDL_NewTimerCallback)(Uint32 interval, void *param);
|
||||
|
||||
/* Definition of the timer ID type */
|
||||
typedef struct _SDL_TimerID *SDL_TimerID;
|
||||
|
||||
/* Add a new timer to the pool of timers already running.
|
||||
Returns a timer ID, or NULL when an error occurs.
|
||||
*/
|
||||
extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval, SDL_NewTimerCallback callback, void *param);
|
||||
|
||||
/* Remove one of the multiple timers knowing its ID.
|
||||
* Returns a boolean value indicating success.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID t);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_timer_h */
|
||||
|
25
ExternalLibs/SDL12/include/SDL_types.h
Normal file
25
ExternalLibs/SDL12/include/SDL_types.h
Normal file
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* DEPRECATED */
|
||||
#include "SDL_stdinc.h"
|
||||
|
86
ExternalLibs/SDL12/include/SDL_version.h
Normal file
86
ExternalLibs/SDL12/include/SDL_version.h
Normal file
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* This header defines the current SDL version */
|
||||
|
||||
#ifndef _SDL_version_h
|
||||
#define _SDL_version_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
|
||||
*/
|
||||
#define SDL_MAJOR_VERSION 1
|
||||
#define SDL_MINOR_VERSION 2
|
||||
#define SDL_PATCHLEVEL 13
|
||||
|
||||
typedef struct SDL_version {
|
||||
Uint8 major;
|
||||
Uint8 minor;
|
||||
Uint8 patch;
|
||||
} SDL_version;
|
||||
|
||||
/* This macro can be used to fill a version structure with the compile-time
|
||||
* version of the SDL library.
|
||||
*/
|
||||
#define SDL_VERSION(X) \
|
||||
{ \
|
||||
(X)->major = SDL_MAJOR_VERSION; \
|
||||
(X)->minor = SDL_MINOR_VERSION; \
|
||||
(X)->patch = SDL_PATCHLEVEL; \
|
||||
}
|
||||
|
||||
/* This macro turns the version numbers into a numeric value:
|
||||
(1,2,3) -> (1203)
|
||||
This assumes that there will never be more than 100 patchlevels
|
||||
*/
|
||||
#define SDL_VERSIONNUM(X, Y, Z) \
|
||||
((X)*1000 + (Y)*100 + (Z))
|
||||
|
||||
/* This is the version number macro for the current SDL version */
|
||||
#define SDL_COMPILEDVERSION \
|
||||
SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL)
|
||||
|
||||
/* This macro will evaluate to true if compiled with SDL at least X.Y.Z */
|
||||
#define SDL_VERSION_ATLEAST(X, Y, Z) \
|
||||
(SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))
|
||||
|
||||
/* This function gets the version of the dynamically linked SDL library.
|
||||
it should NOT be used to fill a version structure, instead you should
|
||||
use the SDL_Version() macro.
|
||||
*/
|
||||
extern DECLSPEC const SDL_version * SDLCALL SDL_Linked_Version(void);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_version_h */
|
||||
|
894
ExternalLibs/SDL12/include/SDL_video.h
Normal file
894
ExternalLibs/SDL12/include/SDL_video.h
Normal file
|
@ -0,0 +1,894 @@
|
|||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* Header file for access to the SDL raw framebuffer window */
|
||||
|
||||
#ifndef _SDL_video_h
|
||||
#define _SDL_video_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_rwops.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Transparency definitions: These define alpha as the opacity of a surface */
|
||||
#define SDL_ALPHA_OPAQUE 255
|
||||
#define SDL_ALPHA_TRANSPARENT 0
|
||||
|
||||
/* Useful data types */
|
||||
typedef struct SDL_Rect {
|
||||
Sint16 x, y;
|
||||
Uint16 w, h;
|
||||
} SDL_Rect;
|
||||
|
||||
typedef struct SDL_Color {
|
||||
Uint8 r;
|
||||
Uint8 g;
|
||||
Uint8 b;
|
||||
Uint8 unused;
|
||||
} SDL_Color;
|
||||
#define SDL_Colour SDL_Color
|
||||
|
||||
typedef struct SDL_Palette {
|
||||
int ncolors;
|
||||
SDL_Color *colors;
|
||||
} SDL_Palette;
|
||||
|
||||
/* Everything in the pixel format structure is read-only */
|
||||
typedef struct SDL_PixelFormat {
|
||||
SDL_Palette *palette;
|
||||
Uint8 BitsPerPixel;
|
||||
Uint8 BytesPerPixel;
|
||||
Uint8 Rloss;
|
||||
Uint8 Gloss;
|
||||
Uint8 Bloss;
|
||||
Uint8 Aloss;
|
||||
Uint8 Rshift;
|
||||
Uint8 Gshift;
|
||||
Uint8 Bshift;
|
||||
Uint8 Ashift;
|
||||
Uint32 Rmask;
|
||||
Uint32 Gmask;
|
||||
Uint32 Bmask;
|
||||
Uint32 Amask;
|
||||
|
||||
/* RGB color key information */
|
||||
Uint32 colorkey;
|
||||
/* Alpha value information (per-surface alpha) */
|
||||
Uint8 alpha;
|
||||
} SDL_PixelFormat;
|
||||
|
||||
/* This structure should be treated as read-only, except for 'pixels',
|
||||
which, if not NULL, contains the raw pixel data for the surface.
|
||||
*/
|
||||
typedef struct SDL_Surface {
|
||||
Uint32 flags; /* Read-only */
|
||||
SDL_PixelFormat *format; /* Read-only */
|
||||
int w, h; /* Read-only */
|
||||
Uint16 pitch; /* Read-only */
|
||||
void *pixels; /* Read-write */
|
||||
int offset; /* Private */
|
||||
|
||||
/* Hardware-specific surface info */
|
||||
struct private_hwdata *hwdata;
|
||||
|
||||
/* clipping information */
|
||||
SDL_Rect clip_rect; /* Read-only */
|
||||
Uint32 unused1; /* for binary compatibility */
|
||||
|
||||
/* Allow recursive locks */
|
||||
Uint32 locked; /* Private */
|
||||
|
||||
/* info for fast blit mapping to other surfaces */
|
||||
struct SDL_BlitMap *map; /* Private */
|
||||
|
||||
/* format version, bumped at every change to invalidate blit maps */
|
||||
unsigned int format_version; /* Private */
|
||||
|
||||
/* Reference count -- used when freeing surface */
|
||||
int refcount; /* Read-mostly */
|
||||
} SDL_Surface;
|
||||
|
||||
/* These are the currently supported flags for the SDL_surface */
|
||||
/* Available for SDL_CreateRGBSurface() or SDL_SetVideoMode() */
|
||||
#define SDL_SWSURFACE 0x00000000 /* Surface is in system memory */
|
||||
#define SDL_HWSURFACE 0x00000001 /* Surface is in video memory */
|
||||
#define SDL_ASYNCBLIT 0x00000004 /* Use asynchronous blits if possible */
|
||||
/* Available for SDL_SetVideoMode() */
|
||||
#define SDL_ANYFORMAT 0x10000000 /* Allow any video depth/pixel-format */
|
||||
#define SDL_HWPALETTE 0x20000000 /* Surface has exclusive palette */
|
||||
#define SDL_DOUBLEBUF 0x40000000 /* Set up double-buffered video mode */
|
||||
#define SDL_FULLSCREEN 0x80000000 /* Surface is a full screen display */
|
||||
#define SDL_OPENGL 0x00000002 /* Create an OpenGL rendering context */
|
||||
#define SDL_OPENGLBLIT 0x0000000A /* Create an OpenGL rendering context and use it for blitting */
|
||||
#define SDL_RESIZABLE 0x00000010 /* This video mode may be resized */
|
||||
#define SDL_NOFRAME 0x00000020 /* No window caption or edge frame */
|
||||
/* Used internally (read-only) */
|
||||
#define SDL_HWACCEL 0x00000100 /* Blit uses hardware acceleration */
|
||||
#define SDL_SRCCOLORKEY 0x00001000 /* Blit uses a source color key */
|
||||
#define SDL_RLEACCELOK 0x00002000 /* Private flag */
|
||||
#define SDL_RLEACCEL 0x00004000 /* Surface is RLE encoded */
|
||||
#define SDL_SRCALPHA 0x00010000 /* Blit uses source alpha blending */
|
||||
#define SDL_PREALLOC 0x01000000 /* Surface uses preallocated memory */
|
||||
|
||||
/* Evaluates to true if the surface needs to be locked before access */
|
||||
#define SDL_MUSTLOCK(surface) \
|
||||
(surface->offset || \
|
||||
((surface->flags & (SDL_HWSURFACE|SDL_ASYNCBLIT|SDL_RLEACCEL)) != 0))
|
||||
|
||||
/* typedef for private surface blitting functions */
|
||||
typedef int (*SDL_blit)(struct SDL_Surface *src, SDL_Rect *srcrect,
|
||||
struct SDL_Surface *dst, SDL_Rect *dstrect);
|
||||
|
||||
|
||||
/* Useful for determining the video hardware capabilities */
|
||||
typedef struct SDL_VideoInfo {
|
||||
Uint32 hw_available :1; /* Flag: Can you create hardware surfaces? */
|
||||
Uint32 wm_available :1; /* Flag: Can you talk to a window manager? */
|
||||
Uint32 UnusedBits1 :6;
|
||||
Uint32 UnusedBits2 :1;
|
||||
Uint32 blit_hw :1; /* Flag: Accelerated blits HW --> HW */
|
||||
Uint32 blit_hw_CC :1; /* Flag: Accelerated blits with Colorkey */
|
||||
Uint32 blit_hw_A :1; /* Flag: Accelerated blits with Alpha */
|
||||
Uint32 blit_sw :1; /* Flag: Accelerated blits SW --> HW */
|
||||
Uint32 blit_sw_CC :1; /* Flag: Accelerated blits with Colorkey */
|
||||
Uint32 blit_sw_A :1; /* Flag: Accelerated blits with Alpha */
|
||||
Uint32 blit_fill :1; /* Flag: Accelerated color fill */
|
||||
Uint32 UnusedBits3 :16;
|
||||
Uint32 video_mem; /* The total amount of video memory (in K) */
|
||||
SDL_PixelFormat *vfmt; /* Value: The format of the video surface */
|
||||
int current_w; /* Value: The current video mode width */
|
||||
int current_h; /* Value: The current video mode height */
|
||||
} SDL_VideoInfo;
|
||||
|
||||
|
||||
/* The most common video overlay formats.
|
||||
For an explanation of these pixel formats, see:
|
||||
http://www.webartz.com/fourcc/indexyuv.htm
|
||||
|
||||
For information on the relationship between color spaces, see:
|
||||
http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html
|
||||
*/
|
||||
#define SDL_YV12_OVERLAY 0x32315659 /* Planar mode: Y + V + U (3 planes) */
|
||||
#define SDL_IYUV_OVERLAY 0x56555949 /* Planar mode: Y + U + V (3 planes) */
|
||||
#define SDL_YUY2_OVERLAY 0x32595559 /* Packed mode: Y0+U0+Y1+V0 (1 plane) */
|
||||
#define SDL_UYVY_OVERLAY 0x59565955 /* Packed mode: U0+Y0+V0+Y1 (1 plane) */
|
||||
#define SDL_YVYU_OVERLAY 0x55595659 /* Packed mode: Y0+V0+Y1+U0 (1 plane) */
|
||||
|
||||
/* The YUV hardware video overlay */
|
||||
typedef struct SDL_Overlay {
|
||||
Uint32 format; /* Read-only */
|
||||
int w, h; /* Read-only */
|
||||
int planes; /* Read-only */
|
||||
Uint16 *pitches; /* Read-only */
|
||||
Uint8 **pixels; /* Read-write */
|
||||
|
||||
/* Hardware-specific surface info */
|
||||
struct private_yuvhwfuncs *hwfuncs;
|
||||
struct private_yuvhwdata *hwdata;
|
||||
|
||||
/* Special flags */
|
||||
Uint32 hw_overlay :1; /* Flag: This overlay hardware accelerated? */
|
||||
Uint32 UnusedBits :31;
|
||||
} SDL_Overlay;
|
||||
|
||||
|
||||
/* Public enumeration for setting the OpenGL window attributes. */
|
||||
typedef enum {
|
||||
SDL_GL_RED_SIZE,
|
||||
SDL_GL_GREEN_SIZE,
|
||||
SDL_GL_BLUE_SIZE,
|
||||
SDL_GL_ALPHA_SIZE,
|
||||
SDL_GL_BUFFER_SIZE,
|
||||
SDL_GL_DOUBLEBUFFER,
|
||||
SDL_GL_DEPTH_SIZE,
|
||||
SDL_GL_STENCIL_SIZE,
|
||||
SDL_GL_ACCUM_RED_SIZE,
|
||||
SDL_GL_ACCUM_GREEN_SIZE,
|
||||
SDL_GL_ACCUM_BLUE_SIZE,
|
||||
SDL_GL_ACCUM_ALPHA_SIZE,
|
||||
SDL_GL_STEREO,
|
||||
SDL_GL_MULTISAMPLEBUFFERS,
|
||||
SDL_GL_MULTISAMPLESAMPLES,
|
||||
SDL_GL_ACCELERATED_VISUAL,
|
||||
SDL_GL_SWAP_CONTROL
|
||||
} SDL_GLattr;
|
||||
|
||||
/* flags for SDL_SetPalette() */
|
||||
#define SDL_LOGPAL 0x01
|
||||
#define SDL_PHYSPAL 0x02
|
||||
|
||||
/* Function prototypes */
|
||||
|
||||
/* These functions are used internally, and should not be used unless you
|
||||
* have a specific need to specify the video driver you want to use.
|
||||
* You should normally use SDL_Init() or SDL_InitSubSystem().
|
||||
*
|
||||
* SDL_VideoInit() initializes the video subsystem -- sets up a connection
|
||||
* to the window manager, etc, and determines the current video mode and
|
||||
* pixel format, but does not initialize a window or graphics mode.
|
||||
* Note that event handling is activated by this routine.
|
||||
*
|
||||
* If you use both sound and video in your application, you need to call
|
||||
* SDL_Init() before opening the sound device, otherwise under Win32 DirectX,
|
||||
* you won't be able to set full-screen display modes.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name, Uint32 flags);
|
||||
extern DECLSPEC void SDLCALL SDL_VideoQuit(void);
|
||||
|
||||
/* This function fills the given character buffer with the name of the
|
||||
* video driver, and returns a pointer to it if the video driver has
|
||||
* been initialized. It returns NULL if no driver has been initialized.
|
||||
*/
|
||||
extern DECLSPEC char * SDLCALL SDL_VideoDriverName(char *namebuf, int maxlen);
|
||||
|
||||
/*
|
||||
* This function returns a pointer to the current display surface.
|
||||
* If SDL is doing format conversion on the display surface, this
|
||||
* function returns the publicly visible surface, not the real video
|
||||
* surface.
|
||||
*/
|
||||
extern DECLSPEC SDL_Surface * SDLCALL SDL_GetVideoSurface(void);
|
||||
|
||||
/*
|
||||
* This function returns a read-only pointer to information about the
|
||||
* video hardware. If this is called before SDL_SetVideoMode(), the 'vfmt'
|
||||
* member of the returned structure will contain the pixel format of the
|
||||
* "best" video mode.
|
||||
*/
|
||||
extern DECLSPEC const SDL_VideoInfo * SDLCALL SDL_GetVideoInfo(void);
|
||||
|
||||
/*
|
||||
* Check to see if a particular video mode is supported.
|
||||
* It returns 0 if the requested mode is not supported under any bit depth,
|
||||
* or returns the bits-per-pixel of the closest available mode with the
|
||||
* given width and height. If this bits-per-pixel is different from the
|
||||
* one used when setting the video mode, SDL_SetVideoMode() will succeed,
|
||||
* but will emulate the requested bits-per-pixel with a shadow surface.
|
||||
*
|
||||
* The arguments to SDL_VideoModeOK() are the same ones you would pass to
|
||||
* SDL_SetVideoMode()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_VideoModeOK(int width, int height, int bpp, Uint32 flags);
|
||||
|
||||
/*
|
||||
* Return a pointer to an array of available screen dimensions for the
|
||||
* given format and video flags, sorted largest to smallest. Returns
|
||||
* NULL if there are no dimensions available for a particular format,
|
||||
* or (SDL_Rect **)-1 if any dimension is okay for the given format.
|
||||
*
|
||||
* If 'format' is NULL, the mode list will be for the format given
|
||||
* by SDL_GetVideoInfo()->vfmt
|
||||
*/
|
||||
extern DECLSPEC SDL_Rect ** SDLCALL SDL_ListModes(SDL_PixelFormat *format, Uint32 flags);
|
||||
|
||||
/*
|
||||
* Set up a video mode with the specified width, height and bits-per-pixel.
|
||||
*
|
||||
* If 'bpp' is 0, it is treated as the current display bits per pixel.
|
||||
*
|
||||
* If SDL_ANYFORMAT is set in 'flags', the SDL library will try to set the
|
||||
* requested bits-per-pixel, but will return whatever video pixel format is
|
||||
* available. The default is to emulate the requested pixel format if it
|
||||
* is not natively available.
|
||||
*
|
||||
* If SDL_HWSURFACE is set in 'flags', the video surface will be placed in
|
||||
* video memory, if possible, and you may have to call SDL_LockSurface()
|
||||
* in order to access the raw framebuffer. Otherwise, the video surface
|
||||
* will be created in system memory.
|
||||
*
|
||||
* If SDL_ASYNCBLIT is set in 'flags', SDL will try to perform rectangle
|
||||
* updates asynchronously, but you must always lock before accessing pixels.
|
||||
* SDL will wait for updates to complete before returning from the lock.
|
||||
*
|
||||
* If SDL_HWPALETTE is set in 'flags', the SDL library will guarantee
|
||||
* that the colors set by SDL_SetColors() will be the colors you get.
|
||||
* Otherwise, in 8-bit mode, SDL_SetColors() may not be able to set all
|
||||
* of the colors exactly the way they are requested, and you should look
|
||||
* at the video surface structure to determine the actual palette.
|
||||
* If SDL cannot guarantee that the colors you request can be set,
|
||||
* i.e. if the colormap is shared, then the video surface may be created
|
||||
* under emulation in system memory, overriding the SDL_HWSURFACE flag.
|
||||
*
|
||||
* If SDL_FULLSCREEN is set in 'flags', the SDL library will try to set
|
||||
* a fullscreen video mode. The default is to create a windowed mode
|
||||
* if the current graphics system has a window manager.
|
||||
* If the SDL library is able to set a fullscreen video mode, this flag
|
||||
* will be set in the surface that is returned.
|
||||
*
|
||||
* If SDL_DOUBLEBUF is set in 'flags', the SDL library will try to set up
|
||||
* two surfaces in video memory and swap between them when you call
|
||||
* SDL_Flip(). This is usually slower than the normal single-buffering
|
||||
* scheme, but prevents "tearing" artifacts caused by modifying video
|
||||
* memory while the monitor is refreshing. It should only be used by
|
||||
* applications that redraw the entire screen on every update.
|
||||
*
|
||||
* If SDL_RESIZABLE is set in 'flags', the SDL library will allow the
|
||||
* window manager, if any, to resize the window at runtime. When this
|
||||
* occurs, SDL will send a SDL_VIDEORESIZE event to you application,
|
||||
* and you must respond to the event by re-calling SDL_SetVideoMode()
|
||||
* with the requested size (or another size that suits the application).
|
||||
*
|
||||
* If SDL_NOFRAME is set in 'flags', the SDL library will create a window
|
||||
* without any title bar or frame decoration. Fullscreen video modes have
|
||||
* this flag set automatically.
|
||||
*
|
||||
* This function returns the video framebuffer surface, or NULL if it fails.
|
||||
*
|
||||
* If you rely on functionality provided by certain video flags, check the
|
||||
* flags of the returned surface to make sure that functionality is available.
|
||||
* SDL will fall back to reduced functionality if the exact flags you wanted
|
||||
* are not available.
|
||||
*/
|
||||
extern DECLSPEC SDL_Surface * SDLCALL SDL_SetVideoMode
|
||||
(int width, int height, int bpp, Uint32 flags);
|
||||
|
||||
/*
|
||||
* Makes sure the given list of rectangles is updated on the given screen.
|
||||
* If 'x', 'y', 'w' and 'h' are all 0, SDL_UpdateRect will update the entire
|
||||
* screen.
|
||||
* These functions should not be called while 'screen' is locked.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_UpdateRects
|
||||
(SDL_Surface *screen, int numrects, SDL_Rect *rects);
|
||||
extern DECLSPEC void SDLCALL SDL_UpdateRect
|
||||
(SDL_Surface *screen, Sint32 x, Sint32 y, Uint32 w, Uint32 h);
|
||||
|
||||
/*
|
||||
* On hardware that supports double-buffering, this function sets up a flip
|
||||
* and returns. The hardware will wait for vertical retrace, and then swap
|
||||
* video buffers before the next video surface blit or lock will return.
|
||||
* On hardware that doesn not support double-buffering, this is equivalent
|
||||
* to calling SDL_UpdateRect(screen, 0, 0, 0, 0);
|
||||
* The SDL_DOUBLEBUF flag must have been passed to SDL_SetVideoMode() when
|
||||
* setting the video mode for this function to perform hardware flipping.
|
||||
* This function returns 0 if successful, or -1 if there was an error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_Flip(SDL_Surface *screen);
|
||||
|
||||
/*
|
||||
* Set the gamma correction for each of the color channels.
|
||||
* The gamma values range (approximately) between 0.1 and 10.0
|
||||
*
|
||||
* If this function isn't supported directly by the hardware, it will
|
||||
* be emulated using gamma ramps, if available. If successful, this
|
||||
* function returns 0, otherwise it returns -1.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetGamma(float red, float green, float blue);
|
||||
|
||||
/*
|
||||
* Set the gamma translation table for the red, green, and blue channels
|
||||
* of the video hardware. Each table is an array of 256 16-bit quantities,
|
||||
* representing a mapping between the input and output for that channel.
|
||||
* The input is the index into the array, and the output is the 16-bit
|
||||
* gamma value at that index, scaled to the output color precision.
|
||||
*
|
||||
* You may pass NULL for any of the channels to leave it unchanged.
|
||||
* If the call succeeds, it will return 0. If the display driver or
|
||||
* hardware does not support gamma translation, or otherwise fails,
|
||||
* this function will return -1.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetGammaRamp(const Uint16 *red, const Uint16 *green, const Uint16 *blue);
|
||||
|
||||
/*
|
||||
* Retrieve the current values of the gamma translation tables.
|
||||
*
|
||||
* You must pass in valid pointers to arrays of 256 16-bit quantities.
|
||||
* Any of the pointers may be NULL to ignore that channel.
|
||||
* If the call succeeds, it will return 0. If the display driver or
|
||||
* hardware does not support gamma translation, or otherwise fails,
|
||||
* this function will return -1.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetGammaRamp(Uint16 *red, Uint16 *green, Uint16 *blue);
|
||||
|
||||
/*
|
||||
* Sets a portion of the colormap for the given 8-bit surface. If 'surface'
|
||||
* is not a palettized surface, this function does nothing, returning 0.
|
||||
* If all of the colors were set as passed to SDL_SetColors(), it will
|
||||
* return 1. If not all the color entries were set exactly as given,
|
||||
* it will return 0, and you should look at the surface palette to
|
||||
* determine the actual color palette.
|
||||
*
|
||||
* When 'surface' is the surface associated with the current display, the
|
||||
* display colormap will be updated with the requested colors. If
|
||||
* SDL_HWPALETTE was set in SDL_SetVideoMode() flags, SDL_SetColors()
|
||||
* will always return 1, and the palette is guaranteed to be set the way
|
||||
* you desire, even if the window colormap has to be warped or run under
|
||||
* emulation.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetColors(SDL_Surface *surface,
|
||||
SDL_Color *colors, int firstcolor, int ncolors);
|
||||
|
||||
/*
|
||||
* Sets a portion of the colormap for a given 8-bit surface.
|
||||
* 'flags' is one or both of:
|
||||
* SDL_LOGPAL -- set logical palette, which controls how blits are mapped
|
||||
* to/from the surface,
|
||||
* SDL_PHYSPAL -- set physical palette, which controls how pixels look on
|
||||
* the screen
|
||||
* Only screens have physical palettes. Separate change of physical/logical
|
||||
* palettes is only possible if the screen has SDL_HWPALETTE set.
|
||||
*
|
||||
* The return value is 1 if all colours could be set as requested, and 0
|
||||
* otherwise.
|
||||
*
|
||||
* SDL_SetColors() is equivalent to calling this function with
|
||||
* flags = (SDL_LOGPAL|SDL_PHYSPAL).
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetPalette(SDL_Surface *surface, int flags,
|
||||
SDL_Color *colors, int firstcolor,
|
||||
int ncolors);
|
||||
|
||||
/*
|
||||
* Maps an RGB triple to an opaque pixel value for a given pixel format
|
||||
*/
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_MapRGB
|
||||
(const SDL_PixelFormat * const format,
|
||||
const Uint8 r, const Uint8 g, const Uint8 b);
|
||||
|
||||
/*
|
||||
* Maps an RGBA quadruple to a pixel value for a given pixel format
|
||||
*/
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA
|
||||
(const SDL_PixelFormat * const format,
|
||||
const Uint8 r, const Uint8 g, const Uint8 b, const Uint8 a);
|
||||
|
||||
/*
|
||||
* Maps a pixel value into the RGB components for a given pixel format
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel,
|
||||
const SDL_PixelFormat * const fmt,
|
||||
Uint8 *r, Uint8 *g, Uint8 *b);
|
||||
|
||||
/*
|
||||
* Maps a pixel value into the RGBA components for a given pixel format
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel,
|
||||
const SDL_PixelFormat * const fmt,
|
||||
Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a);
|
||||
|
||||
/*
|
||||
* Allocate and free an RGB surface (must be called after SDL_SetVideoMode)
|
||||
* If the depth is 4 or 8 bits, an empty palette is allocated for the surface.
|
||||
* If the depth is greater than 8 bits, the pixel format is set using the
|
||||
* flags '[RGB]mask'.
|
||||
* If the function runs out of memory, it will return NULL.
|
||||
*
|
||||
* The 'flags' tell what kind of surface to create.
|
||||
* SDL_SWSURFACE means that the surface should be created in system memory.
|
||||
* SDL_HWSURFACE means that the surface should be created in video memory,
|
||||
* with the same format as the display surface. This is useful for surfaces
|
||||
* that will not change much, to take advantage of hardware acceleration
|
||||
* when being blitted to the display surface.
|
||||
* SDL_ASYNCBLIT means that SDL will try to perform asynchronous blits with
|
||||
* this surface, but you must always lock it before accessing the pixels.
|
||||
* SDL will wait for current blits to finish before returning from the lock.
|
||||
* SDL_SRCCOLORKEY indicates that the surface will be used for colorkey blits.
|
||||
* If the hardware supports acceleration of colorkey blits between
|
||||
* two surfaces in video memory, SDL will try to place the surface in
|
||||
* video memory. If this isn't possible or if there is no hardware
|
||||
* acceleration available, the surface will be placed in system memory.
|
||||
* SDL_SRCALPHA means that the surface will be used for alpha blits and
|
||||
* if the hardware supports hardware acceleration of alpha blits between
|
||||
* two surfaces in video memory, to place the surface in video memory
|
||||
* if possible, otherwise it will be placed in system memory.
|
||||
* If the surface is created in video memory, blits will be _much_ faster,
|
||||
* but the surface format must be identical to the video surface format,
|
||||
* and the only way to access the pixels member of the surface is to use
|
||||
* the SDL_LockSurface() and SDL_UnlockSurface() calls.
|
||||
* If the requested surface actually resides in video memory, SDL_HWSURFACE
|
||||
* will be set in the flags member of the returned surface. If for some
|
||||
* reason the surface could not be placed in video memory, it will not have
|
||||
* the SDL_HWSURFACE flag set, and will be created in system memory instead.
|
||||
*/
|
||||
#define SDL_AllocSurface SDL_CreateRGBSurface
|
||||
extern DECLSPEC SDL_Surface * SDLCALL SDL_CreateRGBSurface
|
||||
(Uint32 flags, int width, int height, int depth,
|
||||
Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
|
||||
extern DECLSPEC SDL_Surface * SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
|
||||
int width, int height, int depth, int pitch,
|
||||
Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
|
||||
extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface *surface);
|
||||
|
||||
/*
|
||||
* SDL_LockSurface() sets up a surface for directly accessing the pixels.
|
||||
* Between calls to SDL_LockSurface()/SDL_UnlockSurface(), you can write
|
||||
* to and read from 'surface->pixels', using the pixel format stored in
|
||||
* 'surface->format'. Once you are done accessing the surface, you should
|
||||
* use SDL_UnlockSurface() to release it.
|
||||
*
|
||||
* Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates
|
||||
* to 0, then you can read and write to the surface at any time, and the
|
||||
* pixel format of the surface will not change. In particular, if the
|
||||
* SDL_HWSURFACE flag is not given when calling SDL_SetVideoMode(), you
|
||||
* will not need to lock the display surface before accessing it.
|
||||
*
|
||||
* No operating system or library calls should be made between lock/unlock
|
||||
* pairs, as critical system locks may be held during this time.
|
||||
*
|
||||
* SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface *surface);
|
||||
extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface *surface);
|
||||
|
||||
/*
|
||||
* Load a surface from a seekable SDL data source (memory or file.)
|
||||
* If 'freesrc' is non-zero, the source will be closed after being read.
|
||||
* Returns the new surface, or NULL if there was an error.
|
||||
* The new surface should be freed with SDL_FreeSurface().
|
||||
*/
|
||||
extern DECLSPEC SDL_Surface * SDLCALL SDL_LoadBMP_RW(SDL_RWops *src, int freesrc);
|
||||
|
||||
/* Convenience macro -- load a surface from a file */
|
||||
#define SDL_LoadBMP(file) SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1)
|
||||
|
||||
/*
|
||||
* Save a surface to a seekable SDL data source (memory or file.)
|
||||
* If 'freedst' is non-zero, the source will be closed after being written.
|
||||
* Returns 0 if successful or -1 if there was an error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SaveBMP_RW
|
||||
(SDL_Surface *surface, SDL_RWops *dst, int freedst);
|
||||
|
||||
/* Convenience macro -- save a surface to a file */
|
||||
#define SDL_SaveBMP(surface, file) \
|
||||
SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1)
|
||||
|
||||
/*
|
||||
* Sets the color key (transparent pixel) in a blittable surface.
|
||||
* If 'flag' is SDL_SRCCOLORKEY (optionally OR'd with SDL_RLEACCEL),
|
||||
* 'key' will be the transparent pixel in the source image of a blit.
|
||||
* SDL_RLEACCEL requests RLE acceleration for the surface if present,
|
||||
* and removes RLE acceleration if absent.
|
||||
* If 'flag' is 0, this function clears any current color key.
|
||||
* This function returns 0, or -1 if there was an error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetColorKey
|
||||
(SDL_Surface *surface, Uint32 flag, Uint32 key);
|
||||
|
||||
/*
|
||||
* This function sets the alpha value for the entire surface, as opposed to
|
||||
* using the alpha component of each pixel. This value measures the range
|
||||
* of transparency of the surface, 0 being completely transparent to 255
|
||||
* being completely opaque. An 'alpha' value of 255 causes blits to be
|
||||
* opaque, the source pixels copied to the destination (the default). Note
|
||||
* that per-surface alpha can be combined with colorkey transparency.
|
||||
*
|
||||
* If 'flag' is 0, alpha blending is disabled for the surface.
|
||||
* If 'flag' is SDL_SRCALPHA, alpha blending is enabled for the surface.
|
||||
* OR:ing the flag with SDL_RLEACCEL requests RLE acceleration for the
|
||||
* surface; if SDL_RLEACCEL is not specified, the RLE accel will be removed.
|
||||
*
|
||||
* The 'alpha' parameter is ignored for surfaces that have an alpha channel.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetAlpha(SDL_Surface *surface, Uint32 flag, Uint8 alpha);
|
||||
|
||||
/*
|
||||
* Sets the clipping rectangle for the destination surface in a blit.
|
||||
*
|
||||
* If the clip rectangle is NULL, clipping will be disabled.
|
||||
* If the clip rectangle doesn't intersect the surface, the function will
|
||||
* return SDL_FALSE and blits will be completely clipped. Otherwise the
|
||||
* function returns SDL_TRUE and blits to the surface will be clipped to
|
||||
* the intersection of the surface area and the clipping rectangle.
|
||||
*
|
||||
* Note that blits are automatically clipped to the edges of the source
|
||||
* and destination surfaces.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface *surface, const SDL_Rect *rect);
|
||||
|
||||
/*
|
||||
* Gets the clipping rectangle for the destination surface in a blit.
|
||||
* 'rect' must be a pointer to a valid rectangle which will be filled
|
||||
* with the correct values.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface *surface, SDL_Rect *rect);
|
||||
|
||||
/*
|
||||
* Creates a new surface of the specified format, and then copies and maps
|
||||
* the given surface to it so the blit of the converted surface will be as
|
||||
* fast as possible. If this function fails, it returns NULL.
|
||||
*
|
||||
* The 'flags' parameter is passed to SDL_CreateRGBSurface() and has those
|
||||
* semantics. You can also pass SDL_RLEACCEL in the flags parameter and
|
||||
* SDL will try to RLE accelerate colorkey and alpha blits in the resulting
|
||||
* surface.
|
||||
*
|
||||
* This function is used internally by SDL_DisplayFormat().
|
||||
*/
|
||||
extern DECLSPEC SDL_Surface * SDLCALL SDL_ConvertSurface
|
||||
(SDL_Surface *src, SDL_PixelFormat *fmt, Uint32 flags);
|
||||
|
||||
/*
|
||||
* This performs a fast blit from the source surface to the destination
|
||||
* surface. It assumes that the source and destination rectangles are
|
||||
* the same size. If either 'srcrect' or 'dstrect' are NULL, the entire
|
||||
* surface (src or dst) is copied. The final blit rectangles are saved
|
||||
* in 'srcrect' and 'dstrect' after all clipping is performed.
|
||||
* If the blit is successful, it returns 0, otherwise it returns -1.
|
||||
*
|
||||
* The blit function should not be called on a locked surface.
|
||||
*
|
||||
* The blit semantics for surfaces with and without alpha and colorkey
|
||||
* are defined as follows:
|
||||
*
|
||||
* RGBA->RGB:
|
||||
* SDL_SRCALPHA set:
|
||||
* alpha-blend (using alpha-channel).
|
||||
* SDL_SRCCOLORKEY ignored.
|
||||
* SDL_SRCALPHA not set:
|
||||
* copy RGB.
|
||||
* if SDL_SRCCOLORKEY set, only copy the pixels matching the
|
||||
* RGB values of the source colour key, ignoring alpha in the
|
||||
* comparison.
|
||||
*
|
||||
* RGB->RGBA:
|
||||
* SDL_SRCALPHA set:
|
||||
* alpha-blend (using the source per-surface alpha value);
|
||||
* set destination alpha to opaque.
|
||||
* SDL_SRCALPHA not set:
|
||||
* copy RGB, set destination alpha to source per-surface alpha value.
|
||||
* both:
|
||||
* if SDL_SRCCOLORKEY set, only copy the pixels matching the
|
||||
* source colour key.
|
||||
*
|
||||
* RGBA->RGBA:
|
||||
* SDL_SRCALPHA set:
|
||||
* alpha-blend (using the source alpha channel) the RGB values;
|
||||
* leave destination alpha untouched. [Note: is this correct?]
|
||||
* SDL_SRCCOLORKEY ignored.
|
||||
* SDL_SRCALPHA not set:
|
||||
* copy all of RGBA to the destination.
|
||||
* if SDL_SRCCOLORKEY set, only copy the pixels matching the
|
||||
* RGB values of the source colour key, ignoring alpha in the
|
||||
* comparison.
|
||||
*
|
||||
* RGB->RGB:
|
||||
* SDL_SRCALPHA set:
|
||||
* alpha-blend (using the source per-surface alpha value).
|
||||
* SDL_SRCALPHA not set:
|
||||
* copy RGB.
|
||||
* both:
|
||||
* if SDL_SRCCOLORKEY set, only copy the pixels matching the
|
||||
* source colour key.
|
||||
*
|
||||
* If either of the surfaces were in video memory, and the blit returns -2,
|
||||
* the video memory was lost, so it should be reloaded with artwork and
|
||||
* re-blitted:
|
||||
while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2 ) {
|
||||
while ( SDL_LockSurface(image) < 0 )
|
||||
Sleep(10);
|
||||
-- Write image pixels to image->pixels --
|
||||
SDL_UnlockSurface(image);
|
||||
}
|
||||
* This happens under DirectX 5.0 when the system switches away from your
|
||||
* fullscreen application. The lock will also fail until you have access
|
||||
* to the video memory again.
|
||||
*/
|
||||
/* You should call SDL_BlitSurface() unless you know exactly how SDL
|
||||
blitting works internally and how to use the other blit functions.
|
||||
*/
|
||||
#define SDL_BlitSurface SDL_UpperBlit
|
||||
|
||||
/* This is the public blit function, SDL_BlitSurface(), and it performs
|
||||
rectangle validation and clipping before passing it to SDL_LowerBlit()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_UpperBlit
|
||||
(SDL_Surface *src, SDL_Rect *srcrect,
|
||||
SDL_Surface *dst, SDL_Rect *dstrect);
|
||||
/* This is a semi-private blit function and it performs low-level surface
|
||||
blitting only.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_LowerBlit
|
||||
(SDL_Surface *src, SDL_Rect *srcrect,
|
||||
SDL_Surface *dst, SDL_Rect *dstrect);
|
||||
|
||||
/*
|
||||
* This function performs a fast fill of the given rectangle with 'color'
|
||||
* The given rectangle is clipped to the destination surface clip area
|
||||
* and the final fill rectangle is saved in the passed in pointer.
|
||||
* If 'dstrect' is NULL, the whole surface will be filled with 'color'
|
||||
* The color should be a pixel of the format used by the surface, and
|
||||
* can be generated by the SDL_MapRGB() function.
|
||||
* This function returns 0 on success, or -1 on error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_FillRect
|
||||
(SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color);
|
||||
|
||||
/*
|
||||
* This function takes a surface and copies it to a new surface of the
|
||||
* pixel format and colors of the video framebuffer, suitable for fast
|
||||
* blitting onto the display surface. It calls SDL_ConvertSurface()
|
||||
*
|
||||
* If you want to take advantage of hardware colorkey or alpha blit
|
||||
* acceleration, you should set the colorkey and alpha value before
|
||||
* calling this function.
|
||||
*
|
||||
* If the conversion fails or runs out of memory, it returns NULL
|
||||
*/
|
||||
extern DECLSPEC SDL_Surface * SDLCALL SDL_DisplayFormat(SDL_Surface *surface);
|
||||
|
||||
/*
|
||||
* This function takes a surface and copies it to a new surface of the
|
||||
* pixel format and colors of the video framebuffer (if possible),
|
||||
* suitable for fast alpha blitting onto the display surface.
|
||||
* The new surface will always have an alpha channel.
|
||||
*
|
||||
* If you want to take advantage of hardware colorkey or alpha blit
|
||||
* acceleration, you should set the colorkey and alpha value before
|
||||
* calling this function.
|
||||
*
|
||||
* If the conversion fails or runs out of memory, it returns NULL
|
||||
*/
|
||||
extern DECLSPEC SDL_Surface * SDLCALL SDL_DisplayFormatAlpha(SDL_Surface *surface);
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/* YUV video surface overlay functions */
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/* This function creates a video output overlay
|
||||
Calling the returned surface an overlay is something of a misnomer because
|
||||
the contents of the display surface underneath the area where the overlay
|
||||
is shown is undefined - it may be overwritten with the converted YUV data.
|
||||
*/
|
||||
extern DECLSPEC SDL_Overlay * SDLCALL SDL_CreateYUVOverlay(int width, int height,
|
||||
Uint32 format, SDL_Surface *display);
|
||||
|
||||
/* Lock an overlay for direct access, and unlock it when you are done */
|
||||
extern DECLSPEC int SDLCALL SDL_LockYUVOverlay(SDL_Overlay *overlay);
|
||||
extern DECLSPEC void SDLCALL SDL_UnlockYUVOverlay(SDL_Overlay *overlay);
|
||||
|
||||
/* Blit a video overlay to the display surface.
|
||||
The contents of the video surface underneath the blit destination are
|
||||
not defined.
|
||||
The width and height of the destination rectangle may be different from
|
||||
that of the overlay, but currently only 2x scaling is supported.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_DisplayYUVOverlay(SDL_Overlay *overlay, SDL_Rect *dstrect);
|
||||
|
||||
/* Free a video overlay */
|
||||
extern DECLSPEC void SDLCALL SDL_FreeYUVOverlay(SDL_Overlay *overlay);
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/* OpenGL support functions. */
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/*
|
||||
* Dynamically load an OpenGL library, or the default one if path is NULL
|
||||
*
|
||||
* If you do this, you need to retrieve all of the GL functions used in
|
||||
* your program from the dynamic library using SDL_GL_GetProcAddress().
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path);
|
||||
|
||||
/*
|
||||
* Get the address of a GL function
|
||||
*/
|
||||
extern DECLSPEC void * SDLCALL SDL_GL_GetProcAddress(const char* proc);
|
||||
|
||||
/*
|
||||
* Set an attribute of the OpenGL subsystem before intialization.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
|
||||
|
||||
/*
|
||||
* Get an attribute of the OpenGL subsystem from the windowing
|
||||
* interface, such as glX. This is of course different from getting
|
||||
* the values from SDL's internal OpenGL subsystem, which only
|
||||
* stores the values you request before initialization.
|
||||
*
|
||||
* Developers should track the values they pass into SDL_GL_SetAttribute
|
||||
* themselves if they want to retrieve these values.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int* value);
|
||||
|
||||
/*
|
||||
* Swap the OpenGL buffers, if double-buffering is supported.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_GL_SwapBuffers(void);
|
||||
|
||||
/*
|
||||
* Internal functions that should not be called unless you have read
|
||||
* and understood the source code for these functions.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_GL_UpdateRects(int numrects, SDL_Rect* rects);
|
||||
extern DECLSPEC void SDLCALL SDL_GL_Lock(void);
|
||||
extern DECLSPEC void SDLCALL SDL_GL_Unlock(void);
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/* These functions allow interaction with the window manager, if any. */
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/*
|
||||
* Sets/Gets the title and icon text of the display window (UTF-8 encoded)
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title, const char *icon);
|
||||
extern DECLSPEC void SDLCALL SDL_WM_GetCaption(char **title, char **icon);
|
||||
|
||||
/*
|
||||
* Sets the icon for the display window.
|
||||
* This function must be called before the first call to SDL_SetVideoMode().
|
||||
* It takes an icon surface, and a mask in MSB format.
|
||||
* If 'mask' is NULL, the entire icon surface will be used as the icon.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask);
|
||||
|
||||
/*
|
||||
* This function iconifies the window, and returns 1 if it succeeded.
|
||||
* If the function succeeds, it generates an SDL_APPACTIVE loss event.
|
||||
* This function is a noop and returns 0 in non-windowed environments.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_WM_IconifyWindow(void);
|
||||
|
||||
/*
|
||||
* Toggle fullscreen mode without changing the contents of the screen.
|
||||
* If the display surface does not require locking before accessing
|
||||
* the pixel information, then the memory pointers will not change.
|
||||
*
|
||||
* If this function was able to toggle fullscreen mode (change from
|
||||
* running in a window to fullscreen, or vice-versa), it will return 1.
|
||||
* If it is not implemented, or fails, it returns 0.
|
||||
*
|
||||
* The next call to SDL_SetVideoMode() will set the mode fullscreen
|
||||
* attribute based on the flags parameter - if SDL_FULLSCREEN is not
|
||||
* set, then the display will be windowed by default where supported.
|
||||
*
|
||||
* This is currently only implemented in the X11 video driver.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_WM_ToggleFullScreen(SDL_Surface *surface);
|
||||
|
||||
/*
|
||||
* This function allows you to set and query the input grab state of
|
||||
* the application. It returns the new input grab state.
|
||||
*/
|
||||
typedef enum {
|
||||
SDL_GRAB_QUERY = -1,
|
||||
SDL_GRAB_OFF = 0,
|
||||
SDL_GRAB_ON = 1,
|
||||
SDL_GRAB_FULLSCREEN /* Used internally */
|
||||
} SDL_GrabMode;
|
||||
/*
|
||||
* Grabbing means that the mouse is confined to the application window,
|
||||
* and nearly all keyboard input is passed directly to the application,
|
||||
* and not interpreted by a window manager, if any.
|
||||
*/
|
||||
extern DECLSPEC SDL_GrabMode SDLCALL SDL_WM_GrabInput(SDL_GrabMode mode);
|
||||
|
||||
/* Not in public API at the moment - do not use! */
|
||||
extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface *src, SDL_Rect *srcrect,
|
||||
SDL_Surface *dst, SDL_Rect *dstrect);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_video_h */
|
||||
|
157
ExternalLibs/SDL12/include/begin_code.h
Normal file
157
ExternalLibs/SDL12/include/begin_code.h
Normal file
|
@ -0,0 +1,157 @@
|
|||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* This file sets things up for C dynamic library function definitions,
|
||||
static inlined functions, and structures aligned at 4-byte alignment.
|
||||
If you don't like ugly C preprocessor code, don't look at this file. :)
|
||||
*/
|
||||
|
||||
/* This shouldn't be nested -- included it around code only. */
|
||||
#ifdef _begin_code_h
|
||||
#error Nested inclusion of begin_code.h
|
||||
#endif
|
||||
#define _begin_code_h
|
||||
|
||||
/* Some compilers use a special export keyword */
|
||||
#ifndef DECLSPEC
|
||||
# if defined(__BEOS__) || defined(__HAIKU__)
|
||||
# if defined(__GNUC__)
|
||||
# define DECLSPEC __declspec(dllexport)
|
||||
# else
|
||||
# define DECLSPEC __declspec(export)
|
||||
# endif
|
||||
# elif defined(__WIN32__)
|
||||
# ifdef __BORLANDC__
|
||||
# ifdef BUILD_SDL
|
||||
# define DECLSPEC
|
||||
# else
|
||||
# define DECLSPEC __declspec(dllimport)
|
||||
# endif
|
||||
# else
|
||||
# define DECLSPEC __declspec(dllexport)
|
||||
# endif
|
||||
# elif defined(__OS2__)
|
||||
# ifdef __WATCOMC__
|
||||
# ifdef BUILD_SDL
|
||||
# define DECLSPEC __declspec(dllexport)
|
||||
# else
|
||||
# define DECLSPEC
|
||||
# endif
|
||||
# else
|
||||
# define DECLSPEC
|
||||
# endif
|
||||
# else
|
||||
# if defined(__GNUC__) && __GNUC__ >= 4
|
||||
# define DECLSPEC __attribute__ ((visibility("default")))
|
||||
# else
|
||||
# define DECLSPEC
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* By default SDL uses the C calling convention */
|
||||
#ifndef SDLCALL
|
||||
#if defined(__WIN32__) && !defined(__GNUC__)
|
||||
#define SDLCALL __cdecl
|
||||
#else
|
||||
#ifdef __OS2__
|
||||
/* But on OS/2, we use the _System calling convention */
|
||||
/* to be compatible with every compiler */
|
||||
#define SDLCALL _System
|
||||
#else
|
||||
#define SDLCALL
|
||||
#endif
|
||||
#endif
|
||||
#endif /* SDLCALL */
|
||||
|
||||
#ifdef __SYMBIAN32__
|
||||
#ifndef EKA2
|
||||
#undef DECLSPEC
|
||||
#define DECLSPEC
|
||||
#elif !defined(__WINS__)
|
||||
#undef DECLSPEC
|
||||
#define DECLSPEC __declspec(dllexport)
|
||||
#endif /* !EKA2 */
|
||||
#endif /* __SYMBIAN32__ */
|
||||
|
||||
/* Force structure packing at 4 byte alignment.
|
||||
This is necessary if the header is included in code which has structure
|
||||
packing set to an alternate value, say for loading structures from disk.
|
||||
The packing is reset to the previous value in close_code.h
|
||||
*/
|
||||
#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable: 4103)
|
||||
#endif
|
||||
#ifdef __BORLANDC__
|
||||
#pragma nopackwarning
|
||||
#endif
|
||||
#pragma pack(push,4)
|
||||
#elif (defined(__MWERKS__) && defined(__MACOS__))
|
||||
#pragma options align=mac68k4byte
|
||||
#pragma enumsalwaysint on
|
||||
#endif /* Compiler needs structure packing set */
|
||||
|
||||
/* Set up compiler-specific options for inlining functions */
|
||||
#ifndef SDL_INLINE_OKAY
|
||||
#ifdef __GNUC__
|
||||
#define SDL_INLINE_OKAY
|
||||
#else
|
||||
/* Add any special compiler-specific cases here */
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__) || \
|
||||
defined(__DMC__) || defined(__SC__) || \
|
||||
defined(__WATCOMC__) || defined(__LCC__) || \
|
||||
defined(__DECC) || defined(__EABI__)
|
||||
#ifndef __inline__
|
||||
#define __inline__ __inline
|
||||
#endif
|
||||
#define SDL_INLINE_OKAY
|
||||
#else
|
||||
#if !defined(__MRC__) && !defined(_SGI_SOURCE)
|
||||
#ifndef __inline__
|
||||
#define __inline__ inline
|
||||
#endif
|
||||
#define SDL_INLINE_OKAY
|
||||
#endif /* Not a funky compiler */
|
||||
#endif /* Visual C++ */
|
||||
#endif /* GNU C */
|
||||
#endif /* SDL_INLINE_OKAY */
|
||||
|
||||
/* If inlining isn't supported, remove "__inline__", turning static
|
||||
inlined functions into static functions (resulting in code bloat
|
||||
in all files which include the offending header files)
|
||||
*/
|
||||
#ifndef SDL_INLINE_OKAY
|
||||
#define __inline__
|
||||
#endif
|
||||
|
||||
/* Apparently this is needed by several Windows compilers */
|
||||
#if !defined(__MACH__)
|
||||
#ifndef NULL
|
||||
#ifdef __cplusplus
|
||||
#define NULL 0
|
||||
#else
|
||||
#define NULL ((void *)0)
|
||||
#endif
|
||||
#endif /* NULL */
|
||||
#endif /* ! Mac OS X - breaks precompiled headers */
|
||||
|
42
ExternalLibs/SDL12/include/close_code.h
Normal file
42
ExternalLibs/SDL12/include/close_code.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
/* This file reverses the effects of begin_code.h and should be included
|
||||
after you finish any function and structure declarations in your headers
|
||||
*/
|
||||
|
||||
#undef _begin_code_h
|
||||
|
||||
/* Reset structure packing at previous byte alignment */
|
||||
#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__)
|
||||
#ifdef __BORLANDC__
|
||||
#pragma nopackwarning
|
||||
#endif
|
||||
#if (defined(__MWERKS__) && defined(__MACOS__))
|
||||
#pragma options align=reset
|
||||
#pragma enumsalwaysint reset
|
||||
#else
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
#endif /* Compiler needs structure packing set */
|
||||
|
||||
|
BIN
ExternalLibs/SDL12/lib/macosx/libSDL-1.2.0.dylib
Normal file
BIN
ExternalLibs/SDL12/lib/macosx/libSDL-1.2.0.dylib
Normal file
Binary file not shown.
BIN
ExternalLibs/SDL12/lib/macosx/libSDLmain.a
Normal file
BIN
ExternalLibs/SDL12/lib/macosx/libSDLmain.a
Normal file
Binary file not shown.
BIN
ExternalLibs/SDL12/lib/win32/SDL.lib
Normal file
BIN
ExternalLibs/SDL12/lib/win32/SDL.lib
Normal file
Binary file not shown.
BIN
ExternalLibs/SDL12/lib/win32/SDLmain.lib
Normal file
BIN
ExternalLibs/SDL12/lib/win32/SDLmain.lib
Normal file
Binary file not shown.
4956
ExternalLibs/freetype2/ChangeLog
Normal file
4956
ExternalLibs/freetype2/ChangeLog
Normal file
File diff suppressed because it is too large
Load diff
2613
ExternalLibs/freetype2/ChangeLog.20
Normal file
2613
ExternalLibs/freetype2/ChangeLog.20
Normal file
File diff suppressed because it is too large
Load diff
9439
ExternalLibs/freetype2/ChangeLog.21
Normal file
9439
ExternalLibs/freetype2/ChangeLog.21
Normal file
File diff suppressed because it is too large
Load diff
2837
ExternalLibs/freetype2/ChangeLog.22
Normal file
2837
ExternalLibs/freetype2/ChangeLog.22
Normal file
File diff suppressed because it is too large
Load diff
203
ExternalLibs/freetype2/Jamfile
Normal file
203
ExternalLibs/freetype2/Jamfile
Normal file
|
@ -0,0 +1,203 @@
|
|||
# FreeType 2 top Jamfile.
|
||||
#
|
||||
# Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
# The HDRMACRO is already defined in FTJam and is used to add
|
||||
# the content of certain macros to the list of included header
|
||||
# files.
|
||||
#
|
||||
# We can compile FreeType 2 with classic Jam however thanks to
|
||||
# the following code
|
||||
#
|
||||
if ! $(JAM_TOOLSET)
|
||||
{
|
||||
rule HDRMACRO
|
||||
{
|
||||
# nothing
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# We need to invoke a SubDir rule if the FT2 source directory top is not the
|
||||
# current directory. This allows us to build FreeType 2 as part of a larger
|
||||
# project easily.
|
||||
#
|
||||
if $(FT2_TOP) != $(DOT)
|
||||
{
|
||||
SubDir FT2_TOP ;
|
||||
}
|
||||
|
||||
|
||||
# The following macros define the include directory, the source directory,
|
||||
# and the final library name (without library extensions). They can be
|
||||
# replaced by other definitions when the library is compiled as part of
|
||||
# a larger project.
|
||||
#
|
||||
|
||||
# Name of FreeType include directory during compilation.
|
||||
# This is relative to FT2_TOP.
|
||||
#
|
||||
FT2_INCLUDE_DIR ?= include ;
|
||||
|
||||
# Name of FreeType source directory during compilation.
|
||||
# This is relative to FT2_TOP.
|
||||
#
|
||||
FT2_SRC_DIR ?= src ;
|
||||
|
||||
# Name of final library, without extension.
|
||||
#
|
||||
FT2_LIB ?= $(LIBPREFIX)freetype ;
|
||||
|
||||
|
||||
# Define FT2_BUILD_INCLUDE to point to your build-specific directory.
|
||||
# This is prepended to FT2_INCLUDE_DIR. It can be used to specify
|
||||
# the location of a custom <ft2build.h> which will point to custom
|
||||
# versions of `ftmodule.h' and `ftoption.h', for example.
|
||||
#
|
||||
FT2_BUILD_INCLUDE ?= ;
|
||||
|
||||
# The list of modules to compile on any given build of the library.
|
||||
# By default, this will contain _all_ modules defined in FT2_SRC_DIR.
|
||||
#
|
||||
# IMPORTANT: You'll need to change the content of `ftmodule.h' as well
|
||||
# if you modify this list or provide your own.
|
||||
#
|
||||
FT2_COMPONENTS ?= autofit # auto-fitter
|
||||
base # base component (public APIs)
|
||||
bdf # BDF font driver
|
||||
cache # cache sub-system
|
||||
cff # CFF/CEF font driver
|
||||
cid # PostScript CID-keyed font driver
|
||||
gzip # support for gzip-compressed files
|
||||
lzw # support for LZW-compressed files
|
||||
pcf # PCF font driver
|
||||
pfr # PFR/TrueDoc font driver
|
||||
psaux # common PostScript routines module
|
||||
pshinter # PostScript hinter module
|
||||
psnames # PostScript names handling
|
||||
raster # monochrome rasterizer
|
||||
smooth # anti-aliased rasterizer
|
||||
sfnt # SFNT-based format support routines
|
||||
truetype # TrueType font driver
|
||||
type1 # PostScript Type 1 font driver
|
||||
type42 # PostScript Type 42 (embedded TrueType) driver
|
||||
winfonts # Windows FON/FNT font driver
|
||||
;
|
||||
|
||||
|
||||
# Don't touch.
|
||||
#
|
||||
FT2_INCLUDE = $(FT2_BUILD_INCLUDE)
|
||||
[ FT2_SubDir $(FT2_INCLUDE_DIR) ] ;
|
||||
|
||||
FT2_SRC = [ FT2_SubDir $(FT2_SRC_DIR) ] ;
|
||||
|
||||
# Location of API Reference Documentation
|
||||
#
|
||||
if $(DOC_DIR)
|
||||
{
|
||||
DOC_DIR = $(DOCDIR:T) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
DOC_DIR = docs/reference ;
|
||||
}
|
||||
|
||||
|
||||
# Only used by FreeType developers.
|
||||
#
|
||||
if $(DEBUG_HINTER)
|
||||
{
|
||||
CCFLAGS += -DDEBUG_HINTER ;
|
||||
}
|
||||
|
||||
|
||||
# We need `freetype2/include' in the current include path in order to
|
||||
# compile any part of FreeType 2.
|
||||
#: updating documentation for upcoming release
|
||||
|
||||
HDRS += $(FT2_INCLUDE) ;
|
||||
|
||||
|
||||
# We need to #define FT2_BUILD_LIBRARY so that our sources find the
|
||||
# internal headers
|
||||
#
|
||||
DEFINES += FT2_BUILD_LIBRARY ;
|
||||
|
||||
# Uncomment the following line if you want to build individual source files
|
||||
# for each FreeType 2 module. This is only useful during development, and
|
||||
# is better defined as an environment variable anyway!
|
||||
#
|
||||
# FT2_MULTI = true ;
|
||||
|
||||
|
||||
# The file <freetype/config/ftheader.h> is used to define macros that are
|
||||
# later used in #include statements. It needs to be parsed in order to
|
||||
# record these definitions.
|
||||
#
|
||||
HDRMACRO [ FT2_SubDir include freetype config ftheader.h ] ;
|
||||
HDRMACRO [ FT2_SubDir include freetype internal internal.h ] ;
|
||||
|
||||
|
||||
# Now include the Jamfile in `freetype2/src', used to drive the compilation
|
||||
# of each FreeType 2 component and/or module.
|
||||
#
|
||||
SubInclude FT2_TOP $(FT2_SRC_DIR) ;
|
||||
|
||||
# Handle the generation of the `ftexport.sym' file which contain the list
|
||||
# of exported symbols. This can be used on Unix by libtool.
|
||||
#
|
||||
SubInclude FT2_TOP $(FT2_SRC_DIR) tools ;
|
||||
|
||||
rule GenExportSymbols
|
||||
{
|
||||
local apinames = apinames$(SUFEXE) ;
|
||||
local headers = [ Glob $(2) : *.h ] ;
|
||||
|
||||
LOCATE on $(1) = $(ALL_LOCATE_TARGET) ;
|
||||
|
||||
APINAMES on $(1) = apinames$(SUFEXE) ;
|
||||
|
||||
Depends $(1) : $(apinames) $(headers) ;
|
||||
GenExportSymbols1 $(1) : $(headers) ;
|
||||
Clean clean : $(1) ;
|
||||
}
|
||||
|
||||
actions GenExportSymbols1 bind APINAMES
|
||||
{
|
||||
$(APINAMES) $(2) > $(1)
|
||||
}
|
||||
|
||||
GenExportSymbols ftexport.sym : include/freetype include/freetype/cache ;
|
||||
|
||||
# Test files (hinter debugging). Only used by FreeType developers.
|
||||
#
|
||||
if $(DEBUG_HINTER)
|
||||
{
|
||||
SubInclude FT2_TOP tests ;
|
||||
}
|
||||
|
||||
rule RefDoc
|
||||
{
|
||||
Depends $1 : all ;
|
||||
NotFile $1 ;
|
||||
Always $1 ;
|
||||
}
|
||||
|
||||
actions RefDoc
|
||||
{
|
||||
python $(FT2_SRC)/tools/docmaker/docmaker.py --prefix=ft2 --title=FreeType-2.3.9 --output=$(DOC_DIR) $(FT2_INCLUDE)/freetype/*.h $(FT2_INCLUDE)/freetype/config/*.h
|
||||
}
|
||||
|
||||
RefDoc refdoc ;
|
||||
|
||||
|
||||
# end of top Jamfile
|
71
ExternalLibs/freetype2/Jamrules
Normal file
71
ExternalLibs/freetype2/Jamrules
Normal file
|
@ -0,0 +1,71 @@
|
|||
# FreeType 2 JamRules.
|
||||
#
|
||||
# Copyright 2001, 2002, 2003 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
# This file contains the Jam rules needed to build the FreeType 2 library.
|
||||
# It is shared by all Jamfiles and is included only once in the build
|
||||
# process.
|
||||
#
|
||||
|
||||
|
||||
# Call SubDirHdrs on a list of directories.
|
||||
#
|
||||
rule AddSubDirHdrs
|
||||
{
|
||||
local x ;
|
||||
|
||||
for x in $(<)
|
||||
{
|
||||
SubDirHdrs $(x) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Determine prefix of library file. We must use "libxxxxx" on Unix systems,
|
||||
# while all other simply use the real name.
|
||||
#
|
||||
if $(UNIX)
|
||||
{
|
||||
LIBPREFIX ?= lib ;
|
||||
}
|
||||
else
|
||||
{
|
||||
LIBPREFIX ?= "" ;
|
||||
}
|
||||
|
||||
# FT2_TOP contains the location of the FreeType source directory. You can
|
||||
# set it to a specific value if you want to compile the library as part of a
|
||||
# larger project.
|
||||
#
|
||||
FT2_TOP ?= $(DOT) ;
|
||||
|
||||
# Define a new rule used to declare a sub directory of the Nirvana source
|
||||
# tree.
|
||||
#
|
||||
rule FT2_SubDir
|
||||
{
|
||||
if $(FT2_TOP) = $(DOT)
|
||||
{
|
||||
return [ FDirName $(<) ] ;
|
||||
}
|
||||
else
|
||||
{
|
||||
return [ FDirName $(FT2_TOP) $(<) ] ;
|
||||
}
|
||||
}
|
||||
|
||||
# We also set ALL_LOCATE_TARGET in order to place all object and library
|
||||
# files in "objs".
|
||||
#
|
||||
ALL_LOCATE_TARGET ?= [ FT2_SubDir objs ] ;
|
||||
|
||||
|
||||
# end of Jamrules
|
34
ExternalLibs/freetype2/Makefile
Normal file
34
ExternalLibs/freetype2/Makefile
Normal file
|
@ -0,0 +1,34 @@
|
|||
#
|
||||
# FreeType 2 build system -- top-level Makefile
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2000, 2002, 2006 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# and distributed under the terms of the FreeType project license,
|
||||
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||
# indicate that you have read the license and understand and accept it
|
||||
# fully.
|
||||
|
||||
|
||||
# Project names
|
||||
#
|
||||
PROJECT := freetype
|
||||
PROJECT_TITLE := FreeType
|
||||
|
||||
# The variable TOP_DIR holds the path to the topmost directory in the project
|
||||
# engine source hierarchy. If it is not defined, default it to `.'.
|
||||
#
|
||||
TOP_DIR ?= .
|
||||
|
||||
# The variable OBJ_DIR gives the location where object files and the
|
||||
# FreeType library are built.
|
||||
#
|
||||
OBJ_DIR ?= $(TOP_DIR)/objs
|
||||
|
||||
|
||||
include $(TOP_DIR)/builds/toplevel.mk
|
||||
|
||||
# EOF
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue