# HG changeset patch # User koda # Date 1247057616 0 # Node ID 2e8251933b71e1d17bb862cf464ad4e08225cc83 # Parent 7992f7ba388dfe9e628824ac57449c06a09073c9 initial support for touch input diff -r 7992f7ba388d -r 2e8251933b71 hedgewars/SDLh.pas --- a/hedgewars/SDLh.pas Tue Jul 07 22:02:13 2009 +0000 +++ b/hedgewars/SDLh.pas Wed Jul 08 12:53:36 2009 +0000 @@ -96,6 +96,10 @@ SDL_QUITEV = 12; SDL_VIDEORESIZE = 16; +{$IFDEF SDL13} + SDL_MOUSEMOTION = 5; +{$ENDIF} + SDL_APPINPUTFOCUS = 2; SDL_GL_DOUBLEBUFFER = 5; @@ -210,11 +214,23 @@ state: Byte; keysym: TSDL_KeySym; end; + + {$IFDEF SDL13} + TSDL_MouseMotionEvent = record + type_: byte; + which: byte; + state: byte; + x : LongInt; + y : LongInt; + xrel : LongInt; + yrel : LongInt; + end; + {$ENDIF} TSDL_QuitEvent = record type_: Byte; end; - TSDL_ResizeEvent = record + TSDL_ResizeEvent = record type_: Byte; w, h: LongInt; end; @@ -227,7 +243,10 @@ SDL_KEYDOWN, SDL_KEYUP: (key: TSDL_KeyboardEvent); SDL_QUITEV: (quit: TSDL_QuitEvent); SDL_VIDEORESIZE: (resize: TSDL_ResizeEvent); - end; + {$IFDEF SDL13} + SDL_MOUSEMOTION: (motion: TSDL_MouseMotionEvent); + {$ENDIF} + end; PByteArray = ^TByteArray; TByteArray = array[0..65535] of Byte; @@ -274,10 +293,13 @@ {$IFDEF SDL13} function SDL_GetKeyboardState(numkeys: PLongInt): PByteArray; cdecl; external SDLLibName; -function SDL_GetMouseState(index: LongInt; x, y: PInteger): Byte; cdecl; external SDLLibName; +function SDL_GetMouseState(index: LongInt; x, y: PLongInt): Byte; cdecl; external SDLLibName; +function SDL_SelectMouse(index: LongInt): LongInt; cdecl; external SDLLibName; +function SDL_GetRelativeMouseState(index: LongInt; x, y: PLongInt): Byte; cdecl; external SDLLibName; +function SDL_GetNumMice : LongInt; cdecl; external SDLLibName; {$ELSE} function SDL_GetKeyState(numkeys: PLongInt): PByteArray; cdecl; external SDLLibName; -function SDL_GetMouseState(x, y: PInteger): Byte; cdecl; external SDLLibName; +function SDL_GetMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName; {$ENDIF} function SDL_GetKeyName(key: Longword): PChar; cdecl; external SDLLibName; procedure SDL_WarpMouse(x, y: Word); cdecl; external SDLLibName; diff -r 7992f7ba388d -r 2e8251933b71 hedgewars/uMisc.pas --- a/hedgewars/uMisc.pas Tue Jul 07 22:02:13 2009 +0000 +++ b/hedgewars/uMisc.pas Wed Jul 08 12:53:36 2009 +0000 @@ -569,8 +569,10 @@ RectToStr:= '(x: ' + inttostr(rect.x) + '; y: ' + inttostr(rect.y) + '; w: ' + inttostr(rect.w) + '; h: ' + inttostr(rect.h) + ')' end; +{$IFNDEF IPHONEOS} var i: LongInt; {$ENDIF} +{$ENDIF} initialization cDrownSpeed.QWordValue:= 257698038;// 0.06 @@ -600,7 +602,7 @@ finalization //uRandom.DumpBuffer; -writeln(f, 'halt at ',GameTicks,' ticks'); +writeln(f, 'halt at ', GameTicks, ' ticks'); flush(f); close(f)