[MLton-commit] r6224
Vesa Karvonen
vesak at mlton.org
Thu Nov 29 02:33:24 PST 2007
A bunch of additions and signature tweaks. (Mostly untested at the moment.)
----------------------------------------------------------------------
U mltonlib/trunk/org/mlton/vesak/sdl/unstable/detail/lib/util.c
U mltonlib/trunk/org/mlton/vesak/sdl/unstable/detail/lib/util.h
A mltonlib/trunk/org/mlton/vesak/sdl/unstable/detail/sdl-key-sym.sml
D mltonlib/trunk/org/mlton/vesak/sdl/unstable/detail/sdl-key.sml
U mltonlib/trunk/org/mlton/vesak/sdl/unstable/detail/sdl.sml
U mltonlib/trunk/org/mlton/vesak/sdl/unstable/example/bounce/bounce.sml
U mltonlib/trunk/org/mlton/vesak/sdl/unstable/lib.mlb
U mltonlib/trunk/org/mlton/vesak/sdl/unstable/public/export.sml
A mltonlib/trunk/org/mlton/vesak/sdl/unstable/public/sdl-key-sym.sig
D mltonlib/trunk/org/mlton/vesak/sdl/unstable/public/sdl-key.sig
U mltonlib/trunk/org/mlton/vesak/sdl/unstable/public/sdl.sig
----------------------------------------------------------------------
Modified: mltonlib/trunk/org/mlton/vesak/sdl/unstable/detail/lib/util.c
===================================================================
--- mltonlib/trunk/org/mlton/vesak/sdl/unstable/detail/lib/util.c 2007-11-29 10:19:29 UTC (rev 6223)
+++ mltonlib/trunk/org/mlton/vesak/sdl/unstable/detail/lib/util.c 2007-11-29 10:33:23 UTC (rev 6224)
@@ -6,16 +6,16 @@
#include "util.h"
-int SML_SDL_FillRect(SDL_Surface *dst,
- int x,
- int y,
- unsigned w,
- unsigned h,
- Uint32 color) {
- SDL_Rect rect;
- rect.x = x;
- rect.y = y;
- rect.w = w;
- rect.h = h;
- return SDL_FillRect(dst, &rect, color);
+int
+SML_SDL_FillRect(SDL_Surface *d, int x, int y, unsigned w, unsigned h,
+ Uint32 c) {
+ SDL_Rect dr = {x, y, w, h};
+ return SDL_FillRect(d, &dr, c);
}
+
+int
+SML_SDL_BlitRect(SDL_Surface *s, int sx, int sy, unsigned sw, unsigned sh,
+ SDL_Surface *d, int dx, int dy, unsigned dw, unsigned dh) {
+ SDL_Rect sr = {sx, sy, sw, sh}, dr = {dx, dy, dw, dh};
+ return SDL_BlitSurface(s, &sr, d, &dr);
+}
Modified: mltonlib/trunk/org/mlton/vesak/sdl/unstable/detail/lib/util.h
===================================================================
--- mltonlib/trunk/org/mlton/vesak/sdl/unstable/detail/lib/util.h 2007-11-29 10:19:29 UTC (rev 6223)
+++ mltonlib/trunk/org/mlton/vesak/sdl/unstable/detail/lib/util.h 2007-11-29 10:33:23 UTC (rev 6224)
@@ -9,7 +9,12 @@
#include <SDL/SDL_video.h>
-int SML_SDL_FillRect(SDL_Surface *dst, int x, int y, unsigned w, unsigned h,
- Uint32 color);
+int
+SML_SDL_FillRect(SDL_Surface *d, int x, int y, unsigned w, unsigned h,
+ Uint32 c);
+int
+SML_SDL_BlitRect(SDL_Surface *s, int sx, int sy, unsigned sw, unsigned sh,
+ SDL_Surface *d, int dx, int dy, unsigned dw, unsigned dh);
+
#endif
Copied: mltonlib/trunk/org/mlton/vesak/sdl/unstable/detail/sdl-key-sym.sml (from rev 6221, mltonlib/trunk/org/mlton/vesak/sdl/unstable/detail/sdl-key.sml)
===================================================================
--- mltonlib/trunk/org/mlton/vesak/sdl/unstable/detail/sdl-key.sml 2007-11-29 06:20:02 UTC (rev 6221)
+++ mltonlib/trunk/org/mlton/vesak/sdl/unstable/detail/sdl-key-sym.sml 2007-11-29 10:33:23 UTC (rev 6224)
@@ -0,0 +1,244 @@
+(* Copyright (C) 2007 Vesa Karvonen
+ *
+ * This code is released under the MLton license, a BSD-style license.
+ * See the LICENSE file or http://mlton.org/License for details.
+ *)
+
+structure SDLKeySym = struct
+ type t = E_'SDLKey.mlrep
+ local
+ open E_'SDLKey
+ in
+ val BACKSPACE = e_SDLK_BACKSPACE
+ val TAB = e_SDLK_TAB
+ val CLEAR = e_SDLK_CLEAR
+ val RETURN = e_SDLK_RETURN
+ val PAUSE = e_SDLK_PAUSE
+ val ESCAPE = e_SDLK_ESCAPE
+ val SPACE = e_SDLK_SPACE
+ val EXCLAIM = e_SDLK_EXCLAIM
+ val QUOTEDBL = e_SDLK_QUOTEDBL
+ val HASH = e_SDLK_HASH
+ val DOLLAR = e_SDLK_DOLLAR
+ val AMPERSAND = e_SDLK_AMPERSAND
+ val QUOTE = e_SDLK_QUOTE
+ val LEFTPAREN = e_SDLK_LEFTPAREN
+ val RIGHTPAREN = e_SDLK_RIGHTPAREN
+ val ASTERISK = e_SDLK_ASTERISK
+ val PLUS = e_SDLK_PLUS
+ val COMMA = e_SDLK_COMMA
+ val MINUS = e_SDLK_MINUS
+ val PERIOD = e_SDLK_PERIOD
+ val SLASH = e_SDLK_SLASH
+ val NUM0 = e_SDLK_0
+ val NUM1 = e_SDLK_1
+ val NUM2 = e_SDLK_2
+ val NUM3 = e_SDLK_3
+ val NUM4 = e_SDLK_4
+ val NUM5 = e_SDLK_5
+ val NUM6 = e_SDLK_6
+ val NUM7 = e_SDLK_7
+ val NUM8 = e_SDLK_8
+ val NUM9 = e_SDLK_9
+ val COLON = e_SDLK_COLON
+ val SEMICOLON = e_SDLK_SEMICOLON
+ val LESSKEY = e_SDLK_LESS
+ val EQUALS = e_SDLK_EQUALS
+ val GREATERKEY = e_SDLK_GREATER
+ val QUESTION = e_SDLK_QUESTION
+ val AT = e_SDLK_AT
+ val LEFTBRACKET = e_SDLK_LEFTBRACKET
+ val BACKSLASH = e_SDLK_BACKSLASH
+ val RIGHTBRACKET = e_SDLK_RIGHTBRACKET
+ val CARET = e_SDLK_CARET
+ val UNDERSCORE = e_SDLK_UNDERSCORE
+ val BACKQUOTE = e_SDLK_BACKQUOTE
+ val A = e_SDLK_a
+ val B = e_SDLK_b
+ val C = e_SDLK_c
+ val D = e_SDLK_d
+ val E = e_SDLK_e
+ val F = e_SDLK_f
+ val G = e_SDLK_g
+ val H = e_SDLK_h
+ val I = e_SDLK_i
+ val J = e_SDLK_j
+ val K = e_SDLK_k
+ val L = e_SDLK_l
+ val M = e_SDLK_m
+ val N = e_SDLK_n
+ val O = e_SDLK_o
+ val P = e_SDLK_p
+ val Q = e_SDLK_q
+ val R = e_SDLK_r
+ val S = e_SDLK_s
+ val T = e_SDLK_t
+ val U = e_SDLK_u
+ val V = e_SDLK_v
+ val W = e_SDLK_w
+ val X = e_SDLK_x
+ val Y = e_SDLK_y
+ val Z = e_SDLK_z
+ val DELETE = e_SDLK_DELETE
+ val WORLD_0 = e_SDLK_WORLD_0
+ val WORLD_1 = e_SDLK_WORLD_1
+ val WORLD_2 = e_SDLK_WORLD_2
+ val WORLD_3 = e_SDLK_WORLD_3
+ val WORLD_4 = e_SDLK_WORLD_4
+ val WORLD_5 = e_SDLK_WORLD_5
+ val WORLD_6 = e_SDLK_WORLD_6
+ val WORLD_7 = e_SDLK_WORLD_7
+ val WORLD_8 = e_SDLK_WORLD_8
+ val WORLD_9 = e_SDLK_WORLD_9
+ val WORLD_10 = e_SDLK_WORLD_10
+ val WORLD_11 = e_SDLK_WORLD_11
+ val WORLD_12 = e_SDLK_WORLD_12
+ val WORLD_13 = e_SDLK_WORLD_13
+ val WORLD_14 = e_SDLK_WORLD_14
+ val WORLD_15 = e_SDLK_WORLD_15
+ val WORLD_16 = e_SDLK_WORLD_16
+ val WORLD_17 = e_SDLK_WORLD_17
+ val WORLD_18 = e_SDLK_WORLD_18
+ val WORLD_19 = e_SDLK_WORLD_19
+ val WORLD_20 = e_SDLK_WORLD_20
+ val WORLD_21 = e_SDLK_WORLD_21
+ val WORLD_22 = e_SDLK_WORLD_22
+ val WORLD_23 = e_SDLK_WORLD_23
+ val WORLD_24 = e_SDLK_WORLD_24
+ val WORLD_25 = e_SDLK_WORLD_25
+ val WORLD_26 = e_SDLK_WORLD_26
+ val WORLD_27 = e_SDLK_WORLD_27
+ val WORLD_28 = e_SDLK_WORLD_28
+ val WORLD_29 = e_SDLK_WORLD_29
+ val WORLD_30 = e_SDLK_WORLD_30
+ val WORLD_31 = e_SDLK_WORLD_31
+ val WORLD_32 = e_SDLK_WORLD_32
+ val WORLD_33 = e_SDLK_WORLD_33
+ val WORLD_34 = e_SDLK_WORLD_34
+ val WORLD_35 = e_SDLK_WORLD_35
+ val WORLD_36 = e_SDLK_WORLD_36
+ val WORLD_37 = e_SDLK_WORLD_37
+ val WORLD_38 = e_SDLK_WORLD_38
+ val WORLD_39 = e_SDLK_WORLD_39
+ val WORLD_40 = e_SDLK_WORLD_40
+ val WORLD_41 = e_SDLK_WORLD_41
+ val WORLD_42 = e_SDLK_WORLD_42
+ val WORLD_43 = e_SDLK_WORLD_43
+ val WORLD_44 = e_SDLK_WORLD_44
+ val WORLD_45 = e_SDLK_WORLD_45
+ val WORLD_46 = e_SDLK_WORLD_46
+ val WORLD_47 = e_SDLK_WORLD_47
+ val WORLD_48 = e_SDLK_WORLD_48
+ val WORLD_49 = e_SDLK_WORLD_49
+ val WORLD_50 = e_SDLK_WORLD_50
+ val WORLD_51 = e_SDLK_WORLD_51
+ val WORLD_52 = e_SDLK_WORLD_52
+ val WORLD_53 = e_SDLK_WORLD_53
+ val WORLD_54 = e_SDLK_WORLD_54
+ val WORLD_55 = e_SDLK_WORLD_55
+ val WORLD_56 = e_SDLK_WORLD_56
+ val WORLD_57 = e_SDLK_WORLD_57
+ val WORLD_58 = e_SDLK_WORLD_58
+ val WORLD_59 = e_SDLK_WORLD_59
+ val WORLD_60 = e_SDLK_WORLD_60
+ val WORLD_61 = e_SDLK_WORLD_61
+ val WORLD_62 = e_SDLK_WORLD_62
+ val WORLD_63 = e_SDLK_WORLD_63
+ val WORLD_64 = e_SDLK_WORLD_64
+ val WORLD_65 = e_SDLK_WORLD_65
+ val WORLD_66 = e_SDLK_WORLD_66
+ val WORLD_67 = e_SDLK_WORLD_67
+ val WORLD_68 = e_SDLK_WORLD_68
+ val WORLD_69 = e_SDLK_WORLD_69
+ val WORLD_70 = e_SDLK_WORLD_70
+ val WORLD_71 = e_SDLK_WORLD_71
+ val WORLD_72 = e_SDLK_WORLD_72
+ val WORLD_73 = e_SDLK_WORLD_73
+ val WORLD_74 = e_SDLK_WORLD_74
+ val WORLD_75 = e_SDLK_WORLD_75
+ val WORLD_76 = e_SDLK_WORLD_76
+ val WORLD_77 = e_SDLK_WORLD_77
+ val WORLD_78 = e_SDLK_WORLD_78
+ val WORLD_79 = e_SDLK_WORLD_79
+ val WORLD_80 = e_SDLK_WORLD_80
+ val WORLD_81 = e_SDLK_WORLD_81
+ val WORLD_82 = e_SDLK_WORLD_82
+ val WORLD_83 = e_SDLK_WORLD_83
+ val WORLD_84 = e_SDLK_WORLD_84
+ val WORLD_85 = e_SDLK_WORLD_85
+ val WORLD_86 = e_SDLK_WORLD_86
+ val WORLD_87 = e_SDLK_WORLD_87
+ val WORLD_88 = e_SDLK_WORLD_88
+ val WORLD_89 = e_SDLK_WORLD_89
+ val WORLD_90 = e_SDLK_WORLD_90
+ val WORLD_91 = e_SDLK_WORLD_91
+ val WORLD_92 = e_SDLK_WORLD_92
+ val WORLD_93 = e_SDLK_WORLD_93
+ val WORLD_94 = e_SDLK_WORLD_94
+ val WORLD_95 = e_SDLK_WORLD_95
+ val KP0 = e_SDLK_KP0
+ val KP1 = e_SDLK_KP1
+ val KP2 = e_SDLK_KP2
+ val KP3 = e_SDLK_KP3
+ val KP4 = e_SDLK_KP4
+ val KP5 = e_SDLK_KP5
+ val KP6 = e_SDLK_KP6
+ val KP7 = e_SDLK_KP7
+ val KP8 = e_SDLK_KP8
+ val KP9 = e_SDLK_KP9
+ val KP_PERIOD = e_SDLK_KP_PERIOD
+ val KP_DIVIDE = e_SDLK_KP_DIVIDE
+ val KP_MULTIPLY = e_SDLK_KP_MULTIPLY
+ val KP_MINUS = e_SDLK_KP_MINUS
+ val KP_PLUS = e_SDLK_KP_PLUS
+ val KP_ENTER = e_SDLK_KP_ENTER
+ val KP_EQUALS = e_SDLK_KP_EQUALS
+ val UP = e_SDLK_UP
+ val DOWN = e_SDLK_DOWN
+ val RIGHT = e_SDLK_RIGHT
+ val LEFT = e_SDLK_LEFT
+ val INSERT = e_SDLK_INSERT
+ val HOME = e_SDLK_HOME
+ val END = e_SDLK_END
+ val PAGEUP = e_SDLK_PAGEUP
+ val PAGEDOWN = e_SDLK_PAGEDOWN
+ val F1 = e_SDLK_F1
+ val F2 = e_SDLK_F2
+ val F3 = e_SDLK_F3
+ val F4 = e_SDLK_F4
+ val F5 = e_SDLK_F5
+ val F6 = e_SDLK_F6
+ val F7 = e_SDLK_F7
+ val F8 = e_SDLK_F8
+ val F9 = e_SDLK_F9
+ val F10 = e_SDLK_F10
+ val F11 = e_SDLK_F11
+ val F12 = e_SDLK_F12
+ val F13 = e_SDLK_F13
+ val F14 = e_SDLK_F14
+ val F15 = e_SDLK_F15
+ val NUMLOCK = e_SDLK_NUMLOCK
+ val CAPSLOCK = e_SDLK_CAPSLOCK
+ val SCROLLOCK = e_SDLK_SCROLLOCK
+ val RSHIFT = e_SDLK_RSHIFT
+ val LSHIFT = e_SDLK_LSHIFT
+ val RCTRL = e_SDLK_RCTRL
+ val LCTRL = e_SDLK_LCTRL
+ val RALT = e_SDLK_RALT
+ val LALT = e_SDLK_LALT
+ val RMETA = e_SDLK_RMETA
+ val LMETA = e_SDLK_LMETA
+ val LSUPER = e_SDLK_LSUPER
+ val RSUPER = e_SDLK_RSUPER
+ val MODE = e_SDLK_MODE
+ val COMPOSE = e_SDLK_COMPOSE
+ val HELP = e_SDLK_HELP
+ val PRINT = e_SDLK_PRINT
+ val SYSREQ = e_SDLK_SYSREQ
+ val BREAK = e_SDLK_BREAK
+ val MENU = e_SDLK_MENU
+ val POWER = e_SDLK_POWER
+ val EURO = e_SDLK_EURO
+ val UNDO = e_SDLK_UNDO
+ end
+end
Deleted: mltonlib/trunk/org/mlton/vesak/sdl/unstable/detail/sdl-key.sml
===================================================================
--- mltonlib/trunk/org/mlton/vesak/sdl/unstable/detail/sdl-key.sml 2007-11-29 10:19:29 UTC (rev 6223)
+++ mltonlib/trunk/org/mlton/vesak/sdl/unstable/detail/sdl-key.sml 2007-11-29 10:33:23 UTC (rev 6224)
@@ -1,244 +0,0 @@
-(* Copyright (C) 2007 Vesa Karvonen
- *
- * This code is released under the MLton license, a BSD-style license.
- * See the LICENSE file or http://mlton.org/License for details.
- *)
-
-structure SDLKey = struct
- type t = E_'SDLKey.mlrep
- local
- open E_'SDLKey
- in
- val BACKSPACE = e_SDLK_BACKSPACE
- val TAB = e_SDLK_TAB
- val CLEAR = e_SDLK_CLEAR
- val RETURN = e_SDLK_RETURN
- val PAUSE = e_SDLK_PAUSE
- val ESCAPE = e_SDLK_ESCAPE
- val SPACE = e_SDLK_SPACE
- val EXCLAIM = e_SDLK_EXCLAIM
- val QUOTEDBL = e_SDLK_QUOTEDBL
- val HASH = e_SDLK_HASH
- val DOLLAR = e_SDLK_DOLLAR
- val AMPERSAND = e_SDLK_AMPERSAND
- val QUOTE = e_SDLK_QUOTE
- val LEFTPAREN = e_SDLK_LEFTPAREN
- val RIGHTPAREN = e_SDLK_RIGHTPAREN
- val ASTERISK = e_SDLK_ASTERISK
- val PLUS = e_SDLK_PLUS
- val COMMA = e_SDLK_COMMA
- val MINUS = e_SDLK_MINUS
- val PERIOD = e_SDLK_PERIOD
- val SLASH = e_SDLK_SLASH
- val NUM0 = e_SDLK_0
- val NUM1 = e_SDLK_1
- val NUM2 = e_SDLK_2
- val NUM3 = e_SDLK_3
- val NUM4 = e_SDLK_4
- val NUM5 = e_SDLK_5
- val NUM6 = e_SDLK_6
- val NUM7 = e_SDLK_7
- val NUM8 = e_SDLK_8
- val NUM9 = e_SDLK_9
- val COLON = e_SDLK_COLON
- val SEMICOLON = e_SDLK_SEMICOLON
- val LESSKEY = e_SDLK_LESS
- val EQUALS = e_SDLK_EQUALS
- val GREATERKEY = e_SDLK_GREATER
- val QUESTION = e_SDLK_QUESTION
- val AT = e_SDLK_AT
- val LEFTBRACKET = e_SDLK_LEFTBRACKET
- val BACKSLASH = e_SDLK_BACKSLASH
- val RIGHTBRACKET = e_SDLK_RIGHTBRACKET
- val CARET = e_SDLK_CARET
- val UNDERSCORE = e_SDLK_UNDERSCORE
- val BACKQUOTE = e_SDLK_BACKQUOTE
- val A = e_SDLK_a
- val B = e_SDLK_b
- val C = e_SDLK_c
- val D = e_SDLK_d
- val E = e_SDLK_e
- val F = e_SDLK_f
- val G = e_SDLK_g
- val H = e_SDLK_h
- val I = e_SDLK_i
- val J = e_SDLK_j
- val K = e_SDLK_k
- val L = e_SDLK_l
- val M = e_SDLK_m
- val N = e_SDLK_n
- val O = e_SDLK_o
- val P = e_SDLK_p
- val Q = e_SDLK_q
- val R = e_SDLK_r
- val S = e_SDLK_s
- val T = e_SDLK_t
- val U = e_SDLK_u
- val V = e_SDLK_v
- val W = e_SDLK_w
- val X = e_SDLK_x
- val Y = e_SDLK_y
- val Z = e_SDLK_z
- val DELETE = e_SDLK_DELETE
- val WORLD_0 = e_SDLK_WORLD_0
- val WORLD_1 = e_SDLK_WORLD_1
- val WORLD_2 = e_SDLK_WORLD_2
- val WORLD_3 = e_SDLK_WORLD_3
- val WORLD_4 = e_SDLK_WORLD_4
- val WORLD_5 = e_SDLK_WORLD_5
- val WORLD_6 = e_SDLK_WORLD_6
- val WORLD_7 = e_SDLK_WORLD_7
- val WORLD_8 = e_SDLK_WORLD_8
- val WORLD_9 = e_SDLK_WORLD_9
- val WORLD_10 = e_SDLK_WORLD_10
- val WORLD_11 = e_SDLK_WORLD_11
- val WORLD_12 = e_SDLK_WORLD_12
- val WORLD_13 = e_SDLK_WORLD_13
- val WORLD_14 = e_SDLK_WORLD_14
- val WORLD_15 = e_SDLK_WORLD_15
- val WORLD_16 = e_SDLK_WORLD_16
- val WORLD_17 = e_SDLK_WORLD_17
- val WORLD_18 = e_SDLK_WORLD_18
- val WORLD_19 = e_SDLK_WORLD_19
- val WORLD_20 = e_SDLK_WORLD_20
- val WORLD_21 = e_SDLK_WORLD_21
- val WORLD_22 = e_SDLK_WORLD_22
- val WORLD_23 = e_SDLK_WORLD_23
- val WORLD_24 = e_SDLK_WORLD_24
- val WORLD_25 = e_SDLK_WORLD_25
- val WORLD_26 = e_SDLK_WORLD_26
- val WORLD_27 = e_SDLK_WORLD_27
- val WORLD_28 = e_SDLK_WORLD_28
- val WORLD_29 = e_SDLK_WORLD_29
- val WORLD_30 = e_SDLK_WORLD_30
- val WORLD_31 = e_SDLK_WORLD_31
- val WORLD_32 = e_SDLK_WORLD_32
- val WORLD_33 = e_SDLK_WORLD_33
- val WORLD_34 = e_SDLK_WORLD_34
- val WORLD_35 = e_SDLK_WORLD_35
- val WORLD_36 = e_SDLK_WORLD_36
- val WORLD_37 = e_SDLK_WORLD_37
- val WORLD_38 = e_SDLK_WORLD_38
- val WORLD_39 = e_SDLK_WORLD_39
- val WORLD_40 = e_SDLK_WORLD_40
- val WORLD_41 = e_SDLK_WORLD_41
- val WORLD_42 = e_SDLK_WORLD_42
- val WORLD_43 = e_SDLK_WORLD_43
- val WORLD_44 = e_SDLK_WORLD_44
- val WORLD_45 = e_SDLK_WORLD_45
- val WORLD_46 = e_SDLK_WORLD_46
- val WORLD_47 = e_SDLK_WORLD_47
- val WORLD_48 = e_SDLK_WORLD_48
- val WORLD_49 = e_SDLK_WORLD_49
- val WORLD_50 = e_SDLK_WORLD_50
- val WORLD_51 = e_SDLK_WORLD_51
- val WORLD_52 = e_SDLK_WORLD_52
- val WORLD_53 = e_SDLK_WORLD_53
- val WORLD_54 = e_SDLK_WORLD_54
- val WORLD_55 = e_SDLK_WORLD_55
- val WORLD_56 = e_SDLK_WORLD_56
- val WORLD_57 = e_SDLK_WORLD_57
- val WORLD_58 = e_SDLK_WORLD_58
- val WORLD_59 = e_SDLK_WORLD_59
- val WORLD_60 = e_SDLK_WORLD_60
- val WORLD_61 = e_SDLK_WORLD_61
- val WORLD_62 = e_SDLK_WORLD_62
- val WORLD_63 = e_SDLK_WORLD_63
- val WORLD_64 = e_SDLK_WORLD_64
- val WORLD_65 = e_SDLK_WORLD_65
- val WORLD_66 = e_SDLK_WORLD_66
- val WORLD_67 = e_SDLK_WORLD_67
- val WORLD_68 = e_SDLK_WORLD_68
- val WORLD_69 = e_SDLK_WORLD_69
- val WORLD_70 = e_SDLK_WORLD_70
- val WORLD_71 = e_SDLK_WORLD_71
- val WORLD_72 = e_SDLK_WORLD_72
- val WORLD_73 = e_SDLK_WORLD_73
- val WORLD_74 = e_SDLK_WORLD_74
- val WORLD_75 = e_SDLK_WORLD_75
- val WORLD_76 = e_SDLK_WORLD_76
- val WORLD_77 = e_SDLK_WORLD_77
- val WORLD_78 = e_SDLK_WORLD_78
- val WORLD_79 = e_SDLK_WORLD_79
- val WORLD_80 = e_SDLK_WORLD_80
- val WORLD_81 = e_SDLK_WORLD_81
- val WORLD_82 = e_SDLK_WORLD_82
- val WORLD_83 = e_SDLK_WORLD_83
- val WORLD_84 = e_SDLK_WORLD_84
- val WORLD_85 = e_SDLK_WORLD_85
- val WORLD_86 = e_SDLK_WORLD_86
- val WORLD_87 = e_SDLK_WORLD_87
- val WORLD_88 = e_SDLK_WORLD_88
- val WORLD_89 = e_SDLK_WORLD_89
- val WORLD_90 = e_SDLK_WORLD_90
- val WORLD_91 = e_SDLK_WORLD_91
- val WORLD_92 = e_SDLK_WORLD_92
- val WORLD_93 = e_SDLK_WORLD_93
- val WORLD_94 = e_SDLK_WORLD_94
- val WORLD_95 = e_SDLK_WORLD_95
- val KP0 = e_SDLK_KP0
- val KP1 = e_SDLK_KP1
- val KP2 = e_SDLK_KP2
- val KP3 = e_SDLK_KP3
- val KP4 = e_SDLK_KP4
- val KP5 = e_SDLK_KP5
- val KP6 = e_SDLK_KP6
- val KP7 = e_SDLK_KP7
- val KP8 = e_SDLK_KP8
- val KP9 = e_SDLK_KP9
- val KP_PERIOD = e_SDLK_KP_PERIOD
- val KP_DIVIDE = e_SDLK_KP_DIVIDE
- val KP_MULTIPLY = e_SDLK_KP_MULTIPLY
- val KP_MINUS = e_SDLK_KP_MINUS
- val KP_PLUS = e_SDLK_KP_PLUS
- val KP_ENTER = e_SDLK_KP_ENTER
- val KP_EQUALS = e_SDLK_KP_EQUALS
- val UP = e_SDLK_UP
- val DOWN = e_SDLK_DOWN
- val RIGHT = e_SDLK_RIGHT
- val LEFT = e_SDLK_LEFT
- val INSERT = e_SDLK_INSERT
- val HOME = e_SDLK_HOME
- val END = e_SDLK_END
- val PAGEUP = e_SDLK_PAGEUP
- val PAGEDOWN = e_SDLK_PAGEDOWN
- val F1 = e_SDLK_F1
- val F2 = e_SDLK_F2
- val F3 = e_SDLK_F3
- val F4 = e_SDLK_F4
- val F5 = e_SDLK_F5
- val F6 = e_SDLK_F6
- val F7 = e_SDLK_F7
- val F8 = e_SDLK_F8
- val F9 = e_SDLK_F9
- val F10 = e_SDLK_F10
- val F11 = e_SDLK_F11
- val F12 = e_SDLK_F12
- val F13 = e_SDLK_F13
- val F14 = e_SDLK_F14
- val F15 = e_SDLK_F15
- val NUMLOCK = e_SDLK_NUMLOCK
- val CAPSLOCK = e_SDLK_CAPSLOCK
- val SCROLLOCK = e_SDLK_SCROLLOCK
- val RSHIFT = e_SDLK_RSHIFT
- val LSHIFT = e_SDLK_LSHIFT
- val RCTRL = e_SDLK_RCTRL
- val LCTRL = e_SDLK_LCTRL
- val RALT = e_SDLK_RALT
- val LALT = e_SDLK_LALT
- val RMETA = e_SDLK_RMETA
- val LMETA = e_SDLK_LMETA
- val LSUPER = e_SDLK_LSUPER
- val RSUPER = e_SDLK_RSUPER
- val MODE = e_SDLK_MODE
- val COMPOSE = e_SDLK_COMPOSE
- val HELP = e_SDLK_HELP
- val PRINT = e_SDLK_PRINT
- val SYSREQ = e_SDLK_SYSREQ
- val BREAK = e_SDLK_BREAK
- val MENU = e_SDLK_MENU
- val POWER = e_SDLK_POWER
- val EURO = e_SDLK_EURO
- val UNDO = e_SDLK_UNDO
- end
-end
Modified: mltonlib/trunk/org/mlton/vesak/sdl/unstable/detail/sdl.sml
===================================================================
--- mltonlib/trunk/org/mlton/vesak/sdl/unstable/detail/sdl.sml 2007-11-29 10:19:29 UTC (rev 6223)
+++ mltonlib/trunk/org/mlton/vesak/sdl/unstable/detail/sdl.sml 2007-11-29 10:33:23 UTC (rev 6224)
@@ -7,8 +7,10 @@
structure SDL :> SDL = struct
structure Word32Flags = MkWordFlags (Word32)
+ val op >>& = With.Monad.>>&
fun withNew size = With.around (fn () => C.new' size) C.discard'
fun withAlloc alloc = With.around alloc C.free'
+ fun withZs mlStr = withAlloc (fn () => ZString.dupML' mlStr)
fun withBuf length = withAlloc (fn () => C.alloc' C.S.uchar length)
val one = With.one
@@ -52,32 +54,67 @@
val NOFRAME = `SDL_NOFRAME
end
- type xy = {x : Int.t, y : Int.t}
- type wh = {w : Int.t, h : Int.t}
- type xywh = {x : Int.t, y : Int.t, w : Int.t, h : Int.t}
- type 'a rgb = {r : 'a, g : 'a, b : 'a}
- type 'a rgba = {r : 'a, g : 'a, b : 'a, a : 'a}
+ structure Pos = struct type 'a t = {x : 'a, y : 'a} end
+ structure Dim = struct type 'a t = {w : 'a, h : 'a} end
+ structure Rect = struct type 'a t = {pos : 'a Pos.t, dim : 'a Dim.t} end
+ structure RGB = struct type 'a t = {r : 'a, g : 'a, b : 'a} end
+ structure RGBA = struct type 'a t = {r : 'a, g : 'a, b : 'a, a : 'a} end
+ structure Pixel = struct
+ type t = Word32.t
+
+ structure Format = struct
+ type t = {mask : t RGBA.t,
+ shift : Word8.t RGBA.t,
+ loss : Word8.t RGBA.t}
+ end
+
+ fun fromRGBA ({shift, loss, ...} : Format.t) {r, g, b, a} = let
+ open Word32
+ fun pack (v, s, l) =
+ (Word32.fromWord8 v >> Word.fromWord8 l) << Word.fromWord8 s
+ in
+ pack (r, #r shift, #r loss) orb
+ pack (g, #g shift, #g loss) orb
+ pack (b, #b shift, #b loss) orb
+ pack (a, #a shift, #a loss)
+ end
+ fun fromRGB format {r, g, b} =
+ fromRGBA format {r=r, g=g, b=b, a=0w255}
+ end
+
structure Surface = struct
type 'a t = (T_SDL_Surface.t, C.rw) C.obj C.ptr'
+ fun pixelFormat surface = let
+ val pf = C.Ptr.|*! (C.Get.ptr' (S_SDL_Surface.f_format' (C.Ptr.|*! surface)))
+ fun m f = C.Get.uint' (f pf)
+ fun s f = C.Get.uchar' (f pf)
+ val l = s
+ open S_SDL_PixelFormat
+ in
+ {mask = {r = m f_Rmask', g = m f_Gmask', b = m f_Bmask', a = m f_Amask'},
+ shift = {r = s f_Rshift', g = s f_Gshift', b = s f_Bshift', a = s f_Ashift'},
+ loss = {r = l f_Rloss', g = l f_Gloss', b = l f_Bloss', a = l f_Aloss'}}
+ end
val free = F_SDL_FreeSurface.f'
- fun updateRect surface =
- F_SDL_UpdateRect.f' o
- (fn NONE => (surface, 0, 0, 0w0, 0w0)
- | SOME {x, y, w, h} => (surface, x, y, Word.fromInt w, Word.fromInt h))
val flip = checkInt o F_SDL_Flip.f'
- fun getPixelFormat surface =
- C.Get.ptr' (S_SDL_Surface.f_format' (C.Ptr.|*! surface))
+ fun update surface = F_SDL_UpdateRect.f' (surface, 0, 0, 0w0, 0w0)
+ fun updateRect surface {pos = {x, y}, dim = {w, h}} =
+ F_SDL_UpdateRect.f' (surface, x, y, Word.fromInt w, Word.fromInt h)
+ fun fill surface pixel =
+ checkInt (F_SDL_FillRect.f' (surface, C.Ptr.null', pixel))
+ fun fillRect surface pixel {pos = {x, y}, dim = {w, h}} =
+ checkInt (F_SML_SDL_FillRect.f'
+ (surface, x, y, Word.fromInt w, Word.fromInt h, pixel))
+ fun blit src dst =
+ checkInt (F_SDL_UpperBlit.f' (src, C.Ptr.null', dst, C.Ptr.null'))
+ fun blitRect src {pos = {x = sx, y = sy}, dim = {w = sw, h = sh}}
+ dst {pos = {x = dx, y = dy}, dim = {w = dw, h = dh}} =
+ checkInt (F_SML_SDL_BlitRect.f'
+ (src, sx, sy, Word.fromInt sw, Word.fromInt sh,
+ dst, dx, dy, Word.fromInt dw, Word.fromInt dh))
end
- structure Color = struct
- type t = Word32.t
- fun fromRGB surface {r, g, b} =
- F_SDL_MapRGB.f' (Surface.getPixelFormat surface, r, g, b)
- fun fromRGBA surface {r, g, b, a} =
- F_SDL_MapRGBA.f' (Surface.getPixelFormat surface, r, g, b, a)
- end
-
structure Video = struct
fun setMode props {bpp} {w, h} =
checkPtr (F_SDL_SetVideoMode.f' (w, h, bpp, props))
@@ -112,16 +149,18 @@
checkInt (F_SDL_SetGamma.f' (toFloat r, toFloat g, toFloat b))
end
- fun fillRect surface color =
- fn NONE => checkInt (F_SDL_FillRect.f' (surface, C.Ptr.null', color))
- | SOME {x, y, w, h} =>
- checkInt (F_SML_SDL_FillRect.f'
- (surface, x, y, Word.fromInt w, Word.fromInt h, color))
- structure ScanCode = Word8
+ structure Key = struct
+ structure Code = Word8
+ structure Sym = SDLKeySym
+ val setRepeat =
+ fn NONE => checkInt (F_SDL_EnableKeyRepeat.f' (0, 0))
+ | SOME {delay, interval} =>
+ checkInt (F_SDL_EnableKeyRepeat.f'
+ (Int.fromLarge (Time.toMilliseconds delay),
+ Int.fromLarge (Time.toMilliseconds interval)))
+ end
- structure Key = SDLKey
-
structure Alt = struct
open Word32Flags
local
@@ -147,8 +186,8 @@
datatype t =
KEY of {down : Bool.t,
pressed : Bool.t,
- code : ScanCode.t,
- key : Key.t,
+ code : Key.Code.t,
+ sym : Key.Sym.t,
alt : Alt.flags}
fun toML event = let
@@ -165,7 +204,7 @@
pressed = Word8.fromLargeInt SDL_PRESSED =
C.Get.uchar' (S_SDL_KeyboardEvent.f_state' ke),
code = C.Get.uchar' (S_SDL_keysym.f_scancode' ks),
- key = C.Get.enum' (S_SDL_keysym.f_sym' ks),
+ sym = C.Get.enum' (S_SDL_keysym.f_sym' ks),
alt = Alt.toML (C.Get.enum' (S_SDL_keysym.f_mod' ks))})
end
else NONE (* We just ignore other events for now *)
@@ -188,4 +227,17 @@
| SOME e => e)
| _ => raiseError ())
end
+
+ structure Image = struct
+ fun loadBMP path =
+ one (withZs path >>& withZs "rb")
+ (fn path & rb =>
+ checkPtr (F_SDL_LoadBMP_RW.f'
+ (F_SDL_RWFromFile.f' (path, rb), 1)))
+ fun saveBMP surface path =
+ one (withZs path >>& withZs "wb")
+ (fn path & wb =>
+ (checkInt (F_SDL_SaveBMP_RW.f'
+ (surface, F_SDL_RWFromFile.f' (path, wb), 1))))
+ end
end
Modified: mltonlib/trunk/org/mlton/vesak/sdl/unstable/example/bounce/bounce.sml
===================================================================
--- mltonlib/trunk/org/mlton/vesak/sdl/unstable/example/bounce/bounce.sml 2007-11-29 10:19:29 UTC (rev 6223)
+++ mltonlib/trunk/org/mlton/vesak/sdl/unstable/example/bounce/bounce.sml 2007-11-29 10:33:23 UTC (rev 6224)
@@ -31,13 +31,16 @@
val surface =
Video.setMode
let open Prop in
- flags ([HWSURFACE] @ (if !Opt.fs then [FULLSCREEN] else [])) end
+ flags ([DOUBLEBUF] @
+ (if !Opt.fs then [HWSURFACE, FULLSCREEN] else [])) end
{bpp = !Opt.bpp}
{w = !Opt.w, h = !Opt.h}
- val black = Color.fromRGB surface {r=0w0, g=0w0, b=0w0}
- val white = Color.fromRGB surface {r=0w255, g=0w255, b=0w255}
+ val format = Surface.pixelFormat surface
+ val black = Pixel.fromRGB format {r=0w0, g=0w0, b=0w0}
+ val white = Pixel.fromRGB format {r=0w255, g=0w255, b=0w255}
+
val xMax = real (!Opt.w - !Opt.size)
val yMax = real (!Opt.h - !Opt.size)
@@ -49,15 +52,18 @@
dx = ref (G.gen (G.realInRange (~5.0, 5.0))),
dy = ref (G.gen (G.realInRange (~5.0, 5.0)))})
+ val obDim = {w = !Opt.size, h = !Opt.size}
+
fun render () =
- (fillRect surface black NONE
+ (Surface.fill surface black
; Vector.app (fn {x, y, ...} =>
- fillRect surface white (SOME {x = trunc (!x),
- y = trunc (!y),
- w = !Opt.size,
- h = !Opt.size}))
+ Surface.fillRect
+ surface
+ white
+ {dim = obDim,
+ pos = {x = trunc (!x), y = trunc (!y)}})
obs
- ; Surface.updateRect surface NONE)
+ ; Surface.flip surface)
fun animate () =
Vector.app (fn {x, y, dx, dy} => let
@@ -86,8 +92,8 @@
fun lp () =
case Event.poll ()
- of SOME (Event.KEY {key, pressed = true, down = true, ...}) =>
- if key = Key.Q orelse key = Key.ESCAPE then () else lp ()
+ of SOME (Event.KEY {sym, pressed = true, down = true, ...}) =>
+ if sym = Key.Sym.Q orelse sym = Key.Sym.ESCAPE then () else lp ()
| _ => (render () ; animate () ; sleep () ; lp ())
in
lp ()
@@ -96,7 +102,8 @@
fun main () =
(printlns ["Driver name: ", Video.getDriverName ()]
; print "Available full screen modes: "
- ; case Video.listModes let open Prop in flags [HWSURFACE, FULLSCREEN] end
+ ; case Video.listModes
+ let open Prop in flags [DOUBLEBUF, HWSURFACE, FULLSCREEN] end
of NONE => println "Any resolution is OK?"
| SOME [] => println "None"
| SOME rs =>
Modified: mltonlib/trunk/org/mlton/vesak/sdl/unstable/lib.mlb
===================================================================
--- mltonlib/trunk/org/mlton/vesak/sdl/unstable/lib.mlb 2007-11-29 10:19:29 UTC (rev 6223)
+++ mltonlib/trunk/org/mlton/vesak/sdl/unstable/lib.mlb 2007-11-29 10:33:23 UTC (rev 6224)
@@ -16,10 +16,10 @@
"warnUnused true"
in
local
- public/sdl-key.sig
+ public/sdl-key-sym.sig
public/sdl.sig
- detail/sdl-key.sml
+ detail/sdl-key-sym.sml
detail/sdl.sml
in
public/export.sml
Modified: mltonlib/trunk/org/mlton/vesak/sdl/unstable/public/export.sml
===================================================================
--- mltonlib/trunk/org/mlton/vesak/sdl/unstable/public/export.sml 2007-11-29 10:19:29 UTC (rev 6223)
+++ mltonlib/trunk/org/mlton/vesak/sdl/unstable/public/export.sml 2007-11-29 10:33:23 UTC (rev 6224)
@@ -7,7 +7,7 @@
(** == Exported Signatures == *)
signature SDL = SDL
-signature SDL_KEY = SDL_KEY
+signature SDL_KEY_SYM = SDL_KEY_SYM
(** == Exported Structures == *)
Copied: mltonlib/trunk/org/mlton/vesak/sdl/unstable/public/sdl-key-sym.sig (from rev 6221, mltonlib/trunk/org/mlton/vesak/sdl/unstable/public/sdl-key.sig)
===================================================================
--- mltonlib/trunk/org/mlton/vesak/sdl/unstable/public/sdl-key.sig 2007-11-29 06:20:02 UTC (rev 6221)
+++ mltonlib/trunk/org/mlton/vesak/sdl/unstable/public/sdl-key-sym.sig 2007-11-29 10:33:23 UTC (rev 6224)
@@ -0,0 +1,240 @@
+(* Copyright (C) 2007 Vesa Karvonen
+ *
+ * This code is released under the MLton license, a BSD-style license.
+ * See the LICENSE file or http://mlton.org/License for details.
+ *)
+
+signature SDL_KEY_SYM = sig
+ eqtype t
+ val BACKSPACE : t
+ val TAB : t
+ val CLEAR : t
+ val RETURN : t
+ val PAUSE : t
+ val ESCAPE : t
+ val SPACE : t
+ val EXCLAIM : t
+ val QUOTEDBL : t
+ val HASH : t
+ val DOLLAR : t
+ val AMPERSAND : t
+ val QUOTE : t
+ val LEFTPAREN : t
+ val RIGHTPAREN : t
+ val ASTERISK : t
+ val PLUS : t
+ val COMMA : t
+ val MINUS : t
+ val PERIOD : t
+ val SLASH : t
+ val NUM0 : t
+ val NUM1 : t
+ val NUM2 : t
+ val NUM3 : t
+ val NUM4 : t
+ val NUM5 : t
+ val NUM6 : t
+ val NUM7 : t
+ val NUM8 : t
+ val NUM9 : t
+ val COLON : t
+ val SEMICOLON : t
+ val LESSKEY : t
+ val EQUALS : t
+ val GREATERKEY : t
+ val QUESTION : t
+ val AT : t
+ val LEFTBRACKET : t
+ val BACKSLASH : t
+ val RIGHTBRACKET : t
+ val CARET : t
+ val UNDERSCORE : t
+ val BACKQUOTE : t
+ val A : t
+ val B : t
+ val C : t
+ val D : t
+ val E : t
+ val F : t
+ val G : t
+ val H : t
+ val I : t
+ val J : t
+ val K : t
+ val L : t
+ val M : t
+ val N : t
+ val O : t
+ val P : t
+ val Q : t
+ val R : t
+ val S : t
+ val T : t
+ val U : t
+ val V : t
+ val W : t
+ val X : t
+ val Y : t
+ val Z : t
+ val DELETE : t
+ val WORLD_0 : t
+ val WORLD_1 : t
+ val WORLD_2 : t
+ val WORLD_3 : t
+ val WORLD_4 : t
+ val WORLD_5 : t
+ val WORLD_6 : t
+ val WORLD_7 : t
+ val WORLD_8 : t
+ val WORLD_9 : t
+ val WORLD_10 : t
+ val WORLD_11 : t
+ val WORLD_12 : t
+ val WORLD_13 : t
+ val WORLD_14 : t
+ val WORLD_15 : t
+ val WORLD_16 : t
+ val WORLD_17 : t
+ val WORLD_18 : t
+ val WORLD_19 : t
+ val WORLD_20 : t
+ val WORLD_21 : t
+ val WORLD_22 : t
+ val WORLD_23 : t
+ val WORLD_24 : t
+ val WORLD_25 : t
+ val WORLD_26 : t
+ val WORLD_27 : t
+ val WORLD_28 : t
+ val WORLD_29 : t
+ val WORLD_30 : t
+ val WORLD_31 : t
+ val WORLD_32 : t
+ val WORLD_33 : t
+ val WORLD_34 : t
+ val WORLD_35 : t
+ val WORLD_36 : t
+ val WORLD_37 : t
+ val WORLD_38 : t
+ val WORLD_39 : t
+ val WORLD_40 : t
+ val WORLD_41 : t
+ val WORLD_42 : t
+ val WORLD_43 : t
+ val WORLD_44 : t
+ val WORLD_45 : t
+ val WORLD_46 : t
+ val WORLD_47 : t
+ val WORLD_48 : t
+ val WORLD_49 : t
+ val WORLD_50 : t
+ val WORLD_51 : t
+ val WORLD_52 : t
+ val WORLD_53 : t
+ val WORLD_54 : t
+ val WORLD_55 : t
+ val WORLD_56 : t
+ val WORLD_57 : t
+ val WORLD_58 : t
+ val WORLD_59 : t
+ val WORLD_60 : t
+ val WORLD_61 : t
+ val WORLD_62 : t
+ val WORLD_63 : t
+ val WORLD_64 : t
+ val WORLD_65 : t
+ val WORLD_66 : t
+ val WORLD_67 : t
+ val WORLD_68 : t
+ val WORLD_69 : t
+ val WORLD_70 : t
+ val WORLD_71 : t
+ val WORLD_72 : t
+ val WORLD_73 : t
+ val WORLD_74 : t
+ val WORLD_75 : t
+ val WORLD_76 : t
+ val WORLD_77 : t
+ val WORLD_78 : t
+ val WORLD_79 : t
+ val WORLD_80 : t
+ val WORLD_81 : t
+ val WORLD_82 : t
+ val WORLD_83 : t
+ val WORLD_84 : t
+ val WORLD_85 : t
+ val WORLD_86 : t
+ val WORLD_87 : t
+ val WORLD_88 : t
+ val WORLD_89 : t
+ val WORLD_90 : t
+ val WORLD_91 : t
+ val WORLD_92 : t
+ val WORLD_93 : t
+ val WORLD_94 : t
+ val WORLD_95 : t
+ val KP0 : t
+ val KP1 : t
+ val KP2 : t
+ val KP3 : t
+ val KP4 : t
+ val KP5 : t
+ val KP6 : t
+ val KP7 : t
+ val KP8 : t
+ val KP9 : t
+ val KP_PERIOD : t
+ val KP_DIVIDE : t
+ val KP_MULTIPLY : t
+ val KP_MINUS : t
+ val KP_PLUS : t
+ val KP_ENTER : t
+ val KP_EQUALS : t
+ val UP : t
+ val DOWN : t
+ val RIGHT : t
+ val LEFT : t
+ val INSERT : t
+ val HOME : t
+ val END : t
+ val PAGEUP : t
+ val PAGEDOWN : t
+ val F1 : t
+ val F2 : t
+ val F3 : t
+ val F4 : t
+ val F5 : t
+ val F6 : t
+ val F7 : t
+ val F8 : t
+ val F9 : t
+ val F10 : t
+ val F11 : t
+ val F12 : t
+ val F13 : t
+ val F14 : t
+ val F15 : t
+ val NUMLOCK : t
+ val CAPSLOCK : t
+ val SCROLLOCK : t
+ val RSHIFT : t
+ val LSHIFT : t
+ val RCTRL : t
+ val LCTRL : t
+ val RALT : t
+ val LALT : t
+ val RMETA : t
+ val LMETA : t
+ val LSUPER : t
+ val RSUPER : t
+ val MODE : t
+ val COMPOSE : t
+ val HELP : t
+ val PRINT : t
+ val SYSREQ : t
+ val BREAK : t
+ val MENU : t
+ val POWER : t
+ val EURO : t
+ val UNDO : t
+end
Deleted: mltonlib/trunk/org/mlton/vesak/sdl/unstable/public/sdl-key.sig
===================================================================
--- mltonlib/trunk/org/mlton/vesak/sdl/unstable/public/sdl-key.sig 2007-11-29 10:19:29 UTC (rev 6223)
+++ mltonlib/trunk/org/mlton/vesak/sdl/unstable/public/sdl-key.sig 2007-11-29 10:33:23 UTC (rev 6224)
@@ -1,240 +0,0 @@
-(* Copyright (C) 2007 Vesa Karvonen
- *
- * This code is released under the MLton license, a BSD-style license.
- * See the LICENSE file or http://mlton.org/License for details.
- *)
-
-signature SDL_KEY = sig
- eqtype t
- val BACKSPACE : t
- val TAB : t
- val CLEAR : t
- val RETURN : t
- val PAUSE : t
- val ESCAPE : t
- val SPACE : t
- val EXCLAIM : t
- val QUOTEDBL : t
- val HASH : t
- val DOLLAR : t
- val AMPERSAND : t
- val QUOTE : t
- val LEFTPAREN : t
- val RIGHTPAREN : t
- val ASTERISK : t
- val PLUS : t
- val COMMA : t
- val MINUS : t
- val PERIOD : t
- val SLASH : t
- val NUM0 : t
- val NUM1 : t
- val NUM2 : t
- val NUM3 : t
- val NUM4 : t
- val NUM5 : t
- val NUM6 : t
- val NUM7 : t
- val NUM8 : t
- val NUM9 : t
- val COLON : t
- val SEMICOLON : t
- val LESSKEY : t
- val EQUALS : t
- val GREATERKEY : t
- val QUESTION : t
- val AT : t
- val LEFTBRACKET : t
- val BACKSLASH : t
- val RIGHTBRACKET : t
- val CARET : t
- val UNDERSCORE : t
- val BACKQUOTE : t
- val A : t
- val B : t
- val C : t
- val D : t
- val E : t
- val F : t
- val G : t
- val H : t
- val I : t
- val J : t
- val K : t
- val L : t
- val M : t
- val N : t
- val O : t
- val P : t
- val Q : t
- val R : t
- val S : t
- val T : t
- val U : t
- val V : t
- val W : t
- val X : t
- val Y : t
- val Z : t
- val DELETE : t
- val WORLD_0 : t
- val WORLD_1 : t
- val WORLD_2 : t
- val WORLD_3 : t
- val WORLD_4 : t
- val WORLD_5 : t
- val WORLD_6 : t
- val WORLD_7 : t
- val WORLD_8 : t
- val WORLD_9 : t
- val WORLD_10 : t
- val WORLD_11 : t
- val WORLD_12 : t
- val WORLD_13 : t
- val WORLD_14 : t
- val WORLD_15 : t
- val WORLD_16 : t
- val WORLD_17 : t
- val WORLD_18 : t
- val WORLD_19 : t
- val WORLD_20 : t
- val WORLD_21 : t
- val WORLD_22 : t
- val WORLD_23 : t
- val WORLD_24 : t
- val WORLD_25 : t
- val WORLD_26 : t
- val WORLD_27 : t
- val WORLD_28 : t
- val WORLD_29 : t
- val WORLD_30 : t
- val WORLD_31 : t
- val WORLD_32 : t
- val WORLD_33 : t
- val WORLD_34 : t
- val WORLD_35 : t
- val WORLD_36 : t
- val WORLD_37 : t
- val WORLD_38 : t
- val WORLD_39 : t
- val WORLD_40 : t
- val WORLD_41 : t
- val WORLD_42 : t
- val WORLD_43 : t
- val WORLD_44 : t
- val WORLD_45 : t
- val WORLD_46 : t
- val WORLD_47 : t
- val WORLD_48 : t
- val WORLD_49 : t
- val WORLD_50 : t
- val WORLD_51 : t
- val WORLD_52 : t
- val WORLD_53 : t
- val WORLD_54 : t
- val WORLD_55 : t
- val WORLD_56 : t
- val WORLD_57 : t
- val WORLD_58 : t
- val WORLD_59 : t
- val WORLD_60 : t
- val WORLD_61 : t
- val WORLD_62 : t
- val WORLD_63 : t
- val WORLD_64 : t
- val WORLD_65 : t
- val WORLD_66 : t
- val WORLD_67 : t
- val WORLD_68 : t
- val WORLD_69 : t
- val WORLD_70 : t
- val WORLD_71 : t
- val WORLD_72 : t
- val WORLD_73 : t
- val WORLD_74 : t
- val WORLD_75 : t
- val WORLD_76 : t
- val WORLD_77 : t
- val WORLD_78 : t
- val WORLD_79 : t
- val WORLD_80 : t
- val WORLD_81 : t
- val WORLD_82 : t
- val WORLD_83 : t
- val WORLD_84 : t
- val WORLD_85 : t
- val WORLD_86 : t
- val WORLD_87 : t
- val WORLD_88 : t
- val WORLD_89 : t
- val WORLD_90 : t
- val WORLD_91 : t
- val WORLD_92 : t
- val WORLD_93 : t
- val WORLD_94 : t
- val WORLD_95 : t
- val KP0 : t
- val KP1 : t
- val KP2 : t
- val KP3 : t
- val KP4 : t
- val KP5 : t
- val KP6 : t
- val KP7 : t
- val KP8 : t
- val KP9 : t
- val KP_PERIOD : t
- val KP_DIVIDE : t
- val KP_MULTIPLY : t
- val KP_MINUS : t
- val KP_PLUS : t
- val KP_ENTER : t
- val KP_EQUALS : t
- val UP : t
- val DOWN : t
- val RIGHT : t
- val LEFT : t
- val INSERT : t
- val HOME : t
- val END : t
- val PAGEUP : t
- val PAGEDOWN : t
- val F1 : t
- val F2 : t
- val F3 : t
- val F4 : t
- val F5 : t
- val F6 : t
- val F7 : t
- val F8 : t
- val F9 : t
- val F10 : t
- val F11 : t
- val F12 : t
- val F13 : t
- val F14 : t
- val F15 : t
- val NUMLOCK : t
- val CAPSLOCK : t
- val SCROLLOCK : t
- val RSHIFT : t
- val LSHIFT : t
- val RCTRL : t
- val LCTRL : t
- val RALT : t
- val LALT : t
- val RMETA : t
- val LMETA : t
- val LSUPER : t
- val RSUPER : t
- val MODE : t
- val COMPOSE : t
- val HELP : t
- val PRINT : t
- val SYSREQ : t
- val BREAK : t
- val MENU : t
- val POWER : t
- val EURO : t
- val UNDO : t
-end
Modified: mltonlib/trunk/org/mlton/vesak/sdl/unstable/public/sdl.sig
===================================================================
--- mltonlib/trunk/org/mlton/vesak/sdl/unstable/public/sdl.sig 2007-11-29 10:19:29 UTC (rev 6223)
+++ mltonlib/trunk/org/mlton/vesak/sdl/unstable/public/sdl.sig 2007-11-29 10:33:23 UTC (rev 6224)
@@ -45,41 +45,50 @@
val NOFRAME : flags
end
- type xy = {x : Int.t, y : Int.t}
- type wh = {w : Int.t, h : Int.t}
- type xywh = {x : Int.t, y : Int.t, w : Int.t, h : Int.t}
- type 'a rgb = {r : 'a, g : 'a, b : 'a}
- type 'a rgba = {r : 'a, g : 'a, b : 'a, a : 'a}
+ structure Pos : sig type 'e t = {x : 'e, y : 'e} end
+ structure Dim : sig type 'e t = {w : 'e, h : 'e} end
+ structure Rect : sig type 'e t = {pos : 'e Pos.t, dim : 'e Dim.t} end
+ structure RGB : sig type 'e t = {r : 'e, g : 'e, b : 'e} end
+ structure RGBA : sig type 'e t = {r : 'e, g : 'e, b : 'e, a : 'e} end
+ structure Pixel : sig
+ eqtype t
+
+ structure Format : sig eqtype t end
+
+ val fromRGB : Format.t -> Word8.t RGB.t -> t
+ val fromRGBA : Format.t -> Word8.t RGBA.t -> t
+ end
+
structure Surface : sig
type 'a t
+ val pixelFormat : 'any t -> Pixel.Format.t
val free : {video : no} t Effect.t
- val updateRect : 'any t -> xywh Option.t Effect.t
- val flip : 'any t Effect.t
+ val flip : 'dst t Effect.t
+ val update : 'dst t Effect.t
+ val updateRect : 'dst t -> Int.t Rect.t Effect.t
+ val fill : 'dst t -> Pixel.t Effect.t
+ val fillRect : 'dst t -> Pixel.t -> Int.t Rect.t Effect.t
+ val blit : 'src t -> 'dst t Effect.t
+ val blitRect : 'src t -> Int.t Rect.t -> 'dst t -> Int.t Rect.t Effect.t
end
- structure Color : sig
- type t
- val fromRGB : 'any Surface.t -> Word8.t rgb -> t
- val fromRGBA : 'any Surface.t -> Word8.t rgba -> t
- end
-
structure Video : sig
- val setMode : Prop.flags -> {bpp : Int.t} -> wh -> {video : yes} Surface.t
+ val setMode : Prop.flags -> {bpp : Int.t} -> Int.t Dim.t -> {video : yes} Surface.t
val getSurface : {video : yes} Surface.t Thunk.t
val getDriverName : String.t Thunk.t
- val listModes : Prop.flags -> wh List.t Option.t
- val setGamma : Real.t rgb Effect.t
+ val listModes : Prop.flags -> Int.t Dim.t List.t Option.t
+ val setGamma : Real.t RGB.t Effect.t
end
- val fillRect : 'any Surface.t -> Color.t -> xywh Option.t Effect.t
-
- structure ScanCode : sig
- eqtype t
+ structure Key : sig
+ structure Code : sig
+ eqtype t
+ end
+ structure Sym : SDL_KEY_SYM
+ val setRepeat : {delay : Time.t, interval : Time.t} Option.t Effect.t
end
- structure Key : SDL_KEY
-
structure Alt : sig
include FLAGS where type flags_word = Word32.t
val LSHIFT : flags
@@ -99,10 +108,15 @@
datatype t =
KEY of {down : Bool.t,
pressed : Bool.t,
- code : ScanCode.t,
- key : Key.t,
+ code : Key.Code.t,
+ sym : Key.Sym.t,
alt : Alt.flags}
val poll : t Option.t Thunk.t
val wait : t Thunk.t
end
+
+ structure Image : sig
+ val loadBMP : String.t -> {video : no} Surface.t
+ val saveBMP : 'any Surface.t -> String.t Effect.t
+ end
end
More information about the MLton-commit
mailing list