#
# SDL.jako
#
# A Jako module for interfacing with the SDL library.
#
# Copyright (C) 2004-2007, The Perl Foundation.
# This program is free software. Its use is subject to the same
# license as Parrot.
#
# $Id: /mirror/trunk/languages/jako/SDL.jako 18563 2007-05-16T00:53:55.855429Z chromatic  $
#

module SDL
  :fnlib = "libSDL"
{


  #
  # Basic Functions:
  #
  #   SDL_Surface * SDL_DisplayFormat(SDL_Surface * surface)
  #   int SDL_FillRect(SDL_Surface * dst, SDL_Rect * dstrect, Uint32 color)
  #   int SDL_Flip(SDL_Surface * screen)
  #   void SDL_FreeSurface(SDL_Surface * surface)
  #   char * SDL_GetKeyName(SDLKey key)
  #   int SDL_Init(Uint32 flags)
  #   SDL_Surface * SDL_LoadBMP(const char * file)
  #   int SDL_PollEvent(SDL_Event * event)
  #   void SDL_Quit(void)
  #   SDL_Surface * SDL_SetVideoMode(int width, int height, int bpp,
  #     Uint32 flags)
  #   void SDL_UpdateRect(SDL_Surface * screen, Sint32 x, Sint32 y,
  #     Sint32 w, Sint32 h)
  #   int SDL_WaitEvent(SDL_Event * event)
  #
  # TODO: What about SDL_LoadBMP_RW?
  #
  # From /usr/include/SDL/SDL_video.h:
  #
  #   int SDL_UpperBlit(SDL_Surface * src, SDL_Rect * srcrect,
  #     SDL_Surface * dst, SDL_Rect * dstrect)
  #

  sub int DisplayFormat :fn = "SDL_DisplayFormat" (int surface);
  sub int FillRect      :fn = "SDL_FillRect"      (int dst, int dstrect, int color);
  sub int Flip          :fn = "SDL_Flip"          (int screen);
  sub     FreeSurface   :fn = "SDL_FreeSurface"   (int surface);
  sub str GetKeyName    :fn = "SDL_GetKeyName"    (int key);
  sub int Init          :fn = "SDL_Init"          (int flags);
  sub int LoadBMP       :fn = "SDL_LoadBMP"       (str file);
  sub int PollEvent     :fn = "SDL_PollEvent"     (int event);
  sub     Quit          :fn = "SDL_Quit"          ();
  sub int SetVideoMode  :fn = "SDL_SetVideoMode"  (int width, int height, int bpp, int flags);
  sub int WaitEvent     :fn = "SDL_WaitEvent"     (int event);
  sub     UpdateRect    :fn = "SDL_UpdateRect"    (int screen, int x, int y, int w, int h);
  sub int UpperBlit     :fn = "SDL_UpperBlit"     (int src, int srcrect, int dst, int dstrect);


  #
  # Image functions:
  #
  #   SDL_Surface * IMG_Load(const char * file)
  #

  sub int IMG_Load :fn = "IMG_Load" :fnlib = "libSDL_image" (str file);


  #
  # SDL Init Flags:


  const int SDL_INIT_TIMER       = 0x00000001;
  const int SDL_INIT_AUDIO       = 0x00000010;
  const int SDL_INIT_VIDEO       = 0x00000020;
  const int SDL_INIT_CDROM       = 0x00000100;
  const int SDL_INIT_JOYSTICK    = 0x00000200;
  const int SDL_INIT_NOPARACHUTE = 0x00100000;
  const int SDL_INIT_EVENTTHREAD = 0x01000000;
  const int SDL_INIT_EVERYTHING  = 0x0000ffff;

  #
  # Event type constants:
  #

  const int SDL_KEYDOWN       =   2;
  const int SDL_KEYUP         =   3;
  const int SDL_QUIT          =  12;
  
  #
  # Key symbol constants:
  #

  const int SDLK_UNKNOWN      =   0;

  const int SDLK_FIRST        =   0;
  # 1 - 7?
  const int SDLK_BACKSPACE    =   8;
  const int SDLK_TAB          =   9;
  # 10 - 11?
  const int SDLK_CLEAR        =  12;
  const int SDLK_RETURN       =  13;
  # 14 - 18?
  const int SDLK_PAUSE        =  19;
  # 20 - 26?
  const int SDLK_ESCAPE       =  27;
  # 28 - 31?
  const int SDLK_SPACE        =  32;
  const int SDLK_EXCLAIM      =  33;
  const int SDLK_QUOTEDBL     =  34;
  const int SDLK_HASH         =  35;
  const int SDLK_DOLLAR       =  36;
  # 37?
  const int SDLK_AMPERSAND    =  38;
  const int SDLK_QUOTE        =  39;
  const int SDLK_LEFTPAREN    =  40;
  const int SDLK_RIGHTPAREN   =  41;
  const int SDLK_ASTERISK     =  42;
  const int SDLK_PLUS         =  43;
  const int SDLK_COMMA        =  44;
  const int SDLK_MINUS        =  45;
  const int SDLK_PERIOD       =  46;
  const int SDLK_SLASH        =  47;
  const int SDLK_0            =  48;
  const int SDLK_1            =  49;
  const int SDLK_2            =  50;
  const int SDLK_3            =  51;
  const int SDLK_4            =  52;
  const int SDLK_5            =  53;
  const int SDLK_6            =  54;
  const int SDLK_7            =  55;
  const int SDLK_8            =  56;
  const int SDLK_9            =  57;
  const int SDLK_COLON        =  58;
  const int SDLK_SEMICOLON    =  59;
  const int SDLK_LESS         =  60;
  const int SDLK_EQUALS       =  61;
  const int SDLK_GREATER      =  62;
  const int SDLK_QUESTION     =  63;
  const int SDLK_AT           =  64;
  # 65 - 90?
  const int SDLK_LEFTBRACKET  =  91;
  const int SDLK_BACKSLASH    =  92;
  const int SDLK_RIGHTBRACKET =  93;
  const int SDLK_CARET        =  94;
  const int SDLK_UNDERSCORE   =  95;
  const int SDLK_BACKQUOTE    =  96;
  const int SDLK_a            =  97;
  const int SDLK_b            =  98;
  const int SDLK_c            =  99;
  const int SDLK_d            = 100;
  const int SDLK_e            = 101;
  const int SDLK_f            = 102;
  const int SDLK_g            = 103;
  const int SDLK_h            = 104;
  const int SDLK_i            = 105;
  const int SDLK_j            = 106;
  const int SDLK_k            = 107;
  const int SDLK_l            = 108;
  const int SDLK_m            = 109;
  const int SDLK_n            = 110;
  const int SDLK_o            = 111;
  const int SDLK_p            = 112;
  const int SDLK_q            = 113;
  const int SDLK_r            = 114;
  const int SDLK_s            = 115;
  const int SDLK_t            = 116;
  const int SDLK_u            = 117;
  const int SDLK_v            = 118;
  const int SDLK_w            = 119;
  const int SDLK_x            = 120;
  const int SDLK_y            = 121;
  const int SDLK_z            = 122;
  # 123 - 126?
  const int SDLK_DELETE       = 127;
  # 128 - 159?
  const int SDLK_WORLD_0      = 160;
  const int SDLK_WORLD_1      = 161;
  const int SDLK_WORLD_2      = 162;
  const int SDLK_WORLD_3      = 163;
  const int SDLK_WORLD_4      = 164;
  const int SDLK_WORLD_5      = 165;
  const int SDLK_WORLD_6      = 166;
  const int SDLK_WORLD_7      = 167;
  const int SDLK_WORLD_8      = 168;
  const int SDLK_WORLD_9      = 169;
  const int SDLK_WORLD_10     = 170;
  const int SDLK_WORLD_11     = 171;
  const int SDLK_WORLD_12     = 172;
  const int SDLK_WORLD_13     = 173;
  const int SDLK_WORLD_14     = 174;
  const int SDLK_WORLD_15     = 175;
  const int SDLK_WORLD_16     = 176;
  const int SDLK_WORLD_17     = 177;
  const int SDLK_WORLD_18     = 178;
  const int SDLK_WORLD_19     = 179;
  const int SDLK_WORLD_20     = 180;
  const int SDLK_WORLD_21     = 181;
  const int SDLK_WORLD_22     = 182;
  const int SDLK_WORLD_23     = 183;
  const int SDLK_WORLD_24     = 184;
  const int SDLK_WORLD_25     = 185;
  const int SDLK_WORLD_26     = 186;
  const int SDLK_WORLD_27     = 187;
  const int SDLK_WORLD_28     = 188;
  const int SDLK_WORLD_29     = 189;
  const int SDLK_WORLD_30     = 190;
  const int SDLK_WORLD_31     = 191;
  const int SDLK_WORLD_32     = 192;
  const int SDLK_WORLD_33     = 193;
  const int SDLK_WORLD_34     = 194;
  const int SDLK_WORLD_35     = 195;
  const int SDLK_WORLD_36     = 196;
  const int SDLK_WORLD_37     = 197;
  const int SDLK_WORLD_38     = 198;
  const int SDLK_WORLD_39     = 199;
  const int SDLK_WORLD_40     = 200;
  const int SDLK_WORLD_41     = 201;
  const int SDLK_WORLD_42     = 202;
  const int SDLK_WORLD_43     = 203;
  const int SDLK_WORLD_44     = 204;
  const int SDLK_WORLD_45     = 205;
  const int SDLK_WORLD_46     = 206;
  const int SDLK_WORLD_47     = 207;
  const int SDLK_WORLD_48     = 208;
  const int SDLK_WORLD_49     = 209;
  const int SDLK_WORLD_50     = 210;
  const int SDLK_WORLD_51     = 211;
  const int SDLK_WORLD_52     = 212;
  const int SDLK_WORLD_53     = 213;
  const int SDLK_WORLD_54     = 214;
  const int SDLK_WORLD_55     = 215;
  const int SDLK_WORLD_56     = 216;
  const int SDLK_WORLD_57     = 217;
  const int SDLK_WORLD_58     = 218;
  const int SDLK_WORLD_59     = 219;
  const int SDLK_WORLD_60     = 220;
  const int SDLK_WORLD_61     = 221;
  const int SDLK_WORLD_62     = 222;
  const int SDLK_WORLD_63     = 223;
  const int SDLK_WORLD_64     = 224;
  const int SDLK_WORLD_65     = 225;
  const int SDLK_WORLD_66     = 226;
  const int SDLK_WORLD_67     = 227;
  const int SDLK_WORLD_68     = 228;
  const int SDLK_WORLD_69     = 229;
  const int SDLK_WORLD_70     = 230;
  const int SDLK_WORLD_71     = 231;
  const int SDLK_WORLD_72     = 232;
  const int SDLK_WORLD_73     = 233;
  const int SDLK_WORLD_74     = 234;
  const int SDLK_WORLD_75     = 235;
  const int SDLK_WORLD_76     = 236;
  const int SDLK_WORLD_77     = 237;
  const int SDLK_WORLD_78     = 238;
  const int SDLK_WORLD_79     = 239;
  const int SDLK_WORLD_80     = 240;
  const int SDLK_WORLD_81     = 241;
  const int SDLK_WORLD_82     = 242;
  const int SDLK_WORLD_83     = 243;
  const int SDLK_WORLD_84     = 244;
  const int SDLK_WORLD_85     = 245;
  const int SDLK_WORLD_86     = 246;
  const int SDLK_WORLD_87     = 247;
  const int SDLK_WORLD_88     = 248;
  const int SDLK_WORLD_89     = 249;
  const int SDLK_WORLD_90     = 250;
  const int SDLK_WORLD_91     = 251;
  const int SDLK_WORLD_92     = 252;
  const int SDLK_WORLD_93     = 253;
  const int SDLK_WORLD_94     = 254;
  const int SDLK_WORLD_95     = 255;
  const int SDLK_KP0          = 256;
  const int SDLK_KP1          = 257;
  const int SDLK_KP2          = 258;
  const int SDLK_KP3          = 259;
  const int SDLK_KP4          = 260;
  const int SDLK_KP5          = 261;
  const int SDLK_KP6          = 262;
  const int SDLK_KP7          = 263;
  const int SDLK_KP8          = 264;
  const int SDLK_KP9          = 265;
  const int SDLK_KP_PERIOD    = 266;
  const int SDLK_KP_DIVIDE    = 267;
  const int SDLK_KP_MULTIPLY  = 268;
  const int SDLK_KP_MINUS     = 269;
  const int SDLK_KP_PLUS      = 270;
  const int SDLK_KP_ENTER     = 271;
  const int SDLK_KP_EQUALS    = 272;
  const int SDLK_UP           = 273;
  const int SDLK_DOWN         = 274;
  const int SDLK_RIGHT        = 275;
  const int SDLK_LEFT         = 276;
  const int SDLK_INSERT       = 277;
  const int SDLK_HOME         = 278;
  const int SDLK_END          = 279;
  const int SDLK_PAGEUP       = 280;
  const int SDLK_PAGEDOWN     = 281;
  const int SDLK_F1           = 282;
  const int SDLK_F2           = 283;
  const int SDLK_F3           = 284;
  const int SDLK_F4           = 285;
  const int SDLK_F5           = 286;
  const int SDLK_F6           = 287;
  const int SDLK_F7           = 288;
  const int SDLK_F8           = 289;
  const int SDLK_F9           = 290;
  const int SDLK_F10          = 291;
  const int SDLK_F11          = 292;
  const int SDLK_F12          = 293;
  const int SDLK_F13          = 294;
  const int SDLK_F14          = 295;
  const int SDLK_F15          = 296;
  # 297 - 299?
  const int SDLK_NUMLOCK      = 300;
  const int SDLK_CAPSLOCK     = 301;
  const int SDLK_SCROLLOCK    = 302;
  const int SDLK_RSHIFT       = 303;
  const int SDLK_LSHIFT       = 304;
  const int SDLK_RCTRL        = 305;
  const int SDLK_LCTRL        = 306;
  const int SDLK_RALT         = 307;
  const int SDLK_LALT         = 308;
  const int SDLK_RMETA        = 309;
  const int SDLK_LMETA        = 310;
  const int SDLK_LSUPER       = 311;
  const int SDLK_RSUPER       = 312;
  const int SDLK_MODE         = 313;
  const int SDLK_COMPOSE      = 314;
  const int SDLK_HELP         = 315;
  const int SDLK_PRINT        = 316;
  const int SDLK_SYSREQ       = 317;
  const int SDLK_BREAK        = 318;
  const int SDLK_MENU         = 319;
  const int SDLK_POWER        = 320;
  const int SDLK_EURO         = 321;
  const int SDLK_UNDO         = 322;
  const int SDLK_LAST         = 323;

}

