include/SDL_types.h
changeset 0 74212992fb08
child 166 39877400bd1e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/include/SDL_types.h	Thu Apr 26 16:45:43 2001 +0000
     1.3 @@ -0,0 +1,87 @@
     1.4 +/*
     1.5 +    SDL - Simple DirectMedia Layer
     1.6 +    Copyright (C) 1997, 1998, 1999, 2000, 2001  Sam Lantinga
     1.7 +
     1.8 +    This library is free software; you can redistribute it and/or
     1.9 +    modify it under the terms of the GNU Library General Public
    1.10 +    License as published by the Free Software Foundation; either
    1.11 +    version 2 of the License, or (at your option) any later version.
    1.12 +
    1.13 +    This library is distributed in the hope that it will be useful,
    1.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1.16 +    Library General Public License for more details.
    1.17 +
    1.18 +    You should have received a copy of the GNU Library General Public
    1.19 +    License along with this library; if not, write to the Free
    1.20 +    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1.21 +
    1.22 +    Sam Lantinga
    1.23 +    slouken@devolution.com
    1.24 +*/
    1.25 +
    1.26 +#ifdef SAVE_RCSID
    1.27 +static char rcsid =
    1.28 + "@(#) $Id$";
    1.29 +#endif
    1.30 +
    1.31 +/* General data types used by the SDL library */
    1.32 +
    1.33 +#ifndef _SDL_types_h
    1.34 +#define _SDL_types_h
    1.35 +
    1.36 +/* The number of elements in a table */
    1.37 +#define SDL_TABLESIZE(table)	(sizeof(table)/sizeof(table[0]))
    1.38 +
    1.39 +/* Basic data types */
    1.40 +typedef enum {
    1.41 +	SDL_FALSE = 0,
    1.42 +	SDL_TRUE  = 1
    1.43 +} SDL_bool;
    1.44 +typedef unsigned char	Uint8;
    1.45 +typedef signed char	Sint8;
    1.46 +typedef unsigned short	Uint16;
    1.47 +typedef signed short	Sint16;
    1.48 +typedef unsigned int	Uint32;
    1.49 +typedef signed int	Sint32;
    1.50 +
    1.51 +/* Figure out how to support 64-bit datatypes */
    1.52 +#if !defined(__STRICT_ANSI__)
    1.53 +#if defined(__GNUC__) || defined(__MWERKS__) /* MJS */
    1.54 +#define SDL_HAS_64BIT_TYPE	long long
    1.55 +#elif defined(_MSC_VER) /* VC++ */
    1.56 +#define SDL_HAS_64BIT_TYPE	__int64
    1.57 +#endif
    1.58 +#endif /* !__STRICT_ANSI__ */
    1.59 +
    1.60 +/* The 64-bit datatype isn't supported on all platforms */
    1.61 +#ifdef SDL_HAS_64BIT_TYPE
    1.62 +typedef unsigned SDL_HAS_64BIT_TYPE Uint64;
    1.63 +typedef SDL_HAS_64BIT_TYPE Sint64;
    1.64 +#else
    1.65 +/* This is really just a hack to prevent the compiler from complaining */
    1.66 +typedef struct {
    1.67 +	Uint32 hi;
    1.68 +	Uint32 lo;
    1.69 +} Uint64, Sint64;
    1.70 +#endif
    1.71 +
    1.72 +/* Make sure the types really have the right sizes */
    1.73 +#define SDL_COMPILE_TIME_ASSERT(name, x)               \
    1.74 +       typedef int SDL_dummy_ ## name[(x) * 2 - 1]
    1.75 +
    1.76 +SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1);
    1.77 +SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1);
    1.78 +SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2);
    1.79 +SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2);
    1.80 +SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4);
    1.81 +SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4);
    1.82 +SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8);
    1.83 +SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
    1.84 +
    1.85 +#undef SDL_COMPILE_TIME_ASSERT
    1.86 +
    1.87 +/* General keyboard/mouse state definitions */
    1.88 +enum { SDL_PRESSED = 0x01, SDL_RELEASED = 0x00 };
    1.89 +
    1.90 +#endif