forked from Kromster80/kam_remake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
KM_GameCursor.pas
63 lines (47 loc) · 1.47 KB
/
KM_GameCursor.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
unit KM_GameCursor;
interface
uses
Classes, KM_Defaults, KM_Points;
type
TKMGameCursor = class
private
fMode: TKMCursorMode; //Modes used in game (building, unit, road, etc..)
procedure Reset;
procedure SetMode(aMode: TKMCursorMode);
public
Pixel: TKMPoint; //Cursor position in screen-space
Float: TKMPointF; //Precise cursor position in map coords
Cell: TKMPoint; //Cursor position cell
PrevCell: TKMPoint; //Cursor previous position cell
SState: TShiftState; //Thats actually used to see if Left or Right mouse button is pressed
Tag1: Byte; //Tag to know building type, unit type etc.
DragOffset: TKMPoint; //used to adjust actual Cursor Cell
ObjectUID: Integer; //Object found below cursor
MapEdDir: Byte;
MapEdShape: (hsCircle, hsSquare);
MapEdSlope: Byte;
MapEdSize: Byte;
MapEdSpeed: Byte;
constructor Create;
property Mode: TKMCursorMode read fMode write SetMode;
end;
var
gGameCursor: TKMGameCursor;
implementation
{TKMGameCursor}
constructor TKMGameCursor.Create;
begin
Reset;
end;
procedure TKMGameCursor.Reset;
begin
DragOffset := KMPOINT_ZERO;
// Actually we need reset all fields when changing mode,
// but lets reset only DragOffset for now, need to do lots of tests for other fields
end;
procedure TKMGameCursor.SetMode(aMode: TKMCursorMode);
begin
fMode := aMode;
Reset;
end;
end.