# HG changeset patch # User unc0rr # Date 1304347151 -14400 # Node ID 6533e5450a21f0edabc020558e694459e48bf159 # Parent 9fa96377a69c031b922544e57b8c9f2ea392cec8# Parent c7000a6b397b06e1686e4349af3aa3b879dd046e Merge cursor_issues into default diff -r 9fa96377a69c -r 6533e5450a21 hedgewars/uCursor.pas --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hedgewars/uCursor.pas Mon May 02 18:39:11 2011 +0400 @@ -0,0 +1,32 @@ +unit uCursor; + +interface + +procedure init; +procedure updatePosition; + +implementation + +uses SDLh, uVariables; + +procedure init; +begin + SDL_WarpMouse(cScreenWidth div 2, cScreenHeight div 2); +end; + +procedure updatePosition; +var x, y: LongInt; +begin + SDL_GetMouseState(@x, @y); + + if(x <> cScreenWidth div 2) or (y <> cScreenHeight div 2) then + begin +writeln(x, ', ', y); + CursorPoint.X:= CursorPoint.X + x - cScreenWidth div 2; + CursorPoint.Y:= CursorPoint.Y - y + cScreenHeight div 2; + + if cHasFocus then SDL_WarpMouse(cScreenWidth div 2, cScreenHeight div 2); + end +end; + +end. diff -r 9fa96377a69c -r 6533e5450a21 hedgewars/uWorld.pas --- a/hedgewars/uWorld.pas Mon May 02 01:55:14 2011 -0400 +++ b/hedgewars/uWorld.pas Mon May 02 18:39:11 2011 +0400 @@ -50,7 +50,8 @@ uUtils, uTextures, uRender, - uCaptions + uCaptions, + uCursor ; var cWaveWidth, cWaveHeight: LongInt; @@ -173,7 +174,7 @@ cWaveHeight:= 32; cGearScrEdgesDist:= Min(cScreenWidth div 2 - 100, cScreenHeight div 2 - 50); -SDL_WarpMouse(cScreenWidth div 2, cScreenHeight div 2); +uCursor.init(); prevPoint.X:= 0; prevPoint.Y:= cScreenHeight div 2; WorldDx:= - (LAND_WIDTH div 2) + cScreenWidth div 2; @@ -211,7 +212,7 @@ AMxShift:= 0 else if AMxShift > MENUSPEED then - dec(AMxShift, MENUSPEED) + dec(AMxShift, MENUSPEED) else AMxShift:= 0; end else @@ -221,7 +222,6 @@ CursorPoint.X:= cScreenWidth shr 1; CursorPoint.Y:= cScreenHeight shr 1; prevPoint:= CursorPoint; - SDL_WarpMouse(CursorPoint.X + cScreenWidth div 2, cScreenHeight - CursorPoint.Y) end; if (cReducedQuality and rqSlowMenu) <> 0 then AMxShift:= AMWidth @@ -252,7 +252,7 @@ dec(y, BORDERSIZE); DrawSprite(sprAMCorners, x - BORDERSIZE, y, 0); for i:= 0 to cMaxSlotAmmoIndex do - DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 0); + DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 0); DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 1); inc(y, BORDERSIZE); @@ -303,12 +303,12 @@ y:= cScreenHeight - AMyOffset; DrawSprite(sprAMCorners, x - BORDERSIZE, y, 2); for i:= 0 to cMaxSlotAmmoIndex + 1 do - DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 1); + DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 1); DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 3); dec(y, AMSlotSize); DrawSprite(sprAMBorderVertical, x - BORDERSIZE, y, 0); for i:= 0 to cMaxSlotAmmoIndex do - DrawSprite(sprAMSlot, x + i * AMSlotSize, y, 2); + DrawSprite(sprAMSlot, x + i * AMSlotSize, y, 2); DrawSprite(sprAMSlot, x + (cMaxSlotAmmoIndex + 1) * AMSlotSize, y, 1); DrawSprite(sprAMBorderVertical, x + AMWidth - AMxOffset, y, 1); @@ -355,7 +355,7 @@ dec(y, BORDERSIZE); DrawSprite(sprAMCorners, x - BORDERSIZE, y, 0); for i:= 0 to cMaxSlotAmmoIndex + 1 do - DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 0); + DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 0); DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 1); {$ENDIF} @@ -1156,16 +1156,12 @@ end; procedure MoveCamera; -var EdgesDist, wdy: LongInt; +var EdgesDist, wdy, shs: LongInt; PrevSentPointTime: LongWord = 0; begin {$IFNDEF IPHONEOS} if (not (CurrentTeam^.ExtDriven and isCursorVisible and not bShowAmmoMenu)) and cHasFocus then -begin - SDL_GetMouseState(@CursorPoint.X, @CursorPoint.Y); - CursorPoint.X:= CursorPoint.X - (cScreenWidth shr 1); - CursorPoint.Y:= cScreenHeight - CursorPoint.Y; -end; + uCursor.updatePosition(); {$ENDIF} if (not PlacingHogs) and (FollowGear <> nil) and (not isCursorVisible) and (not fastUntilLag) then @@ -1200,7 +1196,7 @@ if CursorPoint.Y < AMyOffset + AMSlotSize then CursorPoint.Y:= AMyOffset + AMSlotSize; {$ENDIF} prevPoint:= CursorPoint; - if cHasFocus then SDL_WarpMouse(CursorPoint.X + cScreenWidth div 2, cScreenHeight - CursorPoint.Y); + //if cHasFocus then SDL_WarpMouse(CursorPoint.X + cScreenWidth div 2, cScreenHeight - CursorPoint.Y); exit end; @@ -1230,10 +1226,12 @@ WorldDx:= WorldDx - CursorPoint.X + cScreenWidth div 2 - EdgesDist; CursorPoint.X:= cScreenWidth div 2 - EdgesDist end; - if CursorPoint.Y < EdgesDist then + + shs:= cScreenHeight div 2 - trunc(cScreenHeight / cScaleFactor) + EdgesDist; + if CursorPoint.Y < shs then begin - WorldDy:= WorldDy + CursorPoint.Y - EdgesDist; - CursorPoint.Y:= EdgesDist + WorldDy:= WorldDy + CursorPoint.Y - shs; + CursorPoint.Y:= shs; end else if CursorPoint.Y > cScreenHeight - EdgesDist then @@ -1253,7 +1251,7 @@ // this moves the camera according to CursorPoint X and Y prevPoint:= CursorPoint; -if cHasFocus then SDL_WarpMouse(CursorPoint.X + (cScreenWidth shr 1), cScreenHeight - CursorPoint.Y); +//if cHasFocus then SDL_WarpMouse(CursorPoint.X + (cScreenWidth shr 1), cScreenHeight - CursorPoint.Y); if WorldDy > LAND_HEIGHT + 1024 then WorldDy:= LAND_HEIGHT + 1024; if WorldDy < wdy then WorldDy:= wdy; if WorldDx < - LAND_WIDTH - 1024 then WorldDx:= - LAND_WIDTH - 1024; diff -r 9fa96377a69c -r 6533e5450a21 misc/libfreetype/builds/atari/gen-purec-patch.sh diff -r 9fa96377a69c -r 6533e5450a21 misc/libfreetype/builds/mac/ascii2mpw.py diff -r 9fa96377a69c -r 6533e5450a21 misc/libfreetype/builds/unix/install-sh diff -r 9fa96377a69c -r 6533e5450a21 misc/libfreetype/builds/unix/mkinstalldirs diff -r 9fa96377a69c -r 6533e5450a21 misc/libfreetype/configure diff -r 9fa96377a69c -r 6533e5450a21 misc/libfreetype/src/tools/chktrcmp.py diff -r 9fa96377a69c -r 6533e5450a21 misc/libtremor/autogen.sh