equal
deleted
inserted
replaced
|
1 unit uCursor; |
|
2 |
|
3 interface |
|
4 |
|
5 procedure init; |
|
6 procedure updatePosition; |
|
7 |
|
8 implementation |
|
9 |
|
10 uses SDLh, uVariables; |
|
11 |
|
12 procedure init; |
|
13 begin |
|
14 SDL_WarpMouse(cScreenWidth div 2, cScreenHeight div 2); |
|
15 end; |
|
16 |
|
17 procedure updatePosition; |
|
18 var x, y: LongInt; |
|
19 begin |
|
20 SDL_GetMouseState(@x, @y); |
|
21 |
|
22 if(x <> cScreenWidth div 2) or (y <> cScreenHeight div 2) then |
|
23 begin |
|
24 writeln(x, ', ', y); |
|
25 CursorPoint.X:= CursorPoint.X + x - cScreenWidth div 2; |
|
26 CursorPoint.Y:= CursorPoint.Y - y + cScreenHeight div 2; |
|
27 |
|
28 if cHasFocus then SDL_WarpMouse(cScreenWidth div 2, cScreenHeight div 2); |
|
29 end |
|
30 end; |
|
31 |
|
32 end. |