-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathMouseHighlight.cpp
91 lines (73 loc) · 2 KB
/
MouseHighlight.cpp
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#include "MouseHighlight.h"
#include "OverlayConfig.h"
CColor CGAPalette[] =
{
0xffaa0000, 0xffff5555,
0xff000000, 0xff555555,
0xff0000aa, 0xff5555ff,
0xff00aa00, 0xff55ff55,
0xff00aaaa, 0xff55ffff,
0xffaa00aa, 0xffff55ff,
0xffaa5500, 0xffffff55,
0xffaaaaaa, 0xffffffff
};
CString CGAPaletteNames[] =
{
"red", "lightred",
"black", "gray",
"blue", "lightblue",
"green", "lightgreen",
"cyan", "lightcyan",
"magenta", "lightmagenta",
"brown", "yellow",
"lightgray", "white"
};
void GW2MouseHighlight::OnDraw( CWBDrawAPI* API )
{
if ( !Config::GetValue( "MouseHighlightVisible" ) )
return;
POINT pos;
GetCursorPos( &pos );
::ScreenToClient( (HWND)App->GetHandle(), &pos );
CPoint cp( pos.x, pos.y );
if ( ( GetKeyState( VK_RBUTTON ) & 0x100 ) != 0 )
cp = lastpos;
else
cp = ScreenToClient( cp );
lastpos = cp;
if ( cp == lastchangedpos )
{
numSameFrames++;
}
else
{
numSameFrames = 0;
lastchangedpos = cp;
}
CRect cl = GetClientRect();
int Color = Config::GetValue( "MouseHighlightColor" );
if ( Config::GetValue( "MouseHighlightOutline" ) )
{
API->DrawRect( CRect( cp.x - 1, cl.y1, cp.x + 2, cl.y2 ), 0xff000000 );
API->DrawRect( CRect( cl.x1, cp.y - 1, cl.x2, cp.y + 2 ), 0xff000000 );
}
API->DrawRect( CRect( cp.x, cl.y1, cp.x + 1, cl.y2 ), CGAPalette[ Color ] );
API->DrawRect( CRect( cl.x1, cp.y, cl.x2, cp.y + 1 ), CGAPalette[ Color ] );
//int t = globalTimer.GetTime();
//CPoint p = cp + CPoint((int)(sin(t*0.01f) * 30), (int)(cos(t*0.01f) * 30));
//API->DrawRect(CRect(p + CPoint(-5, -5), p + CPoint(5, 5)), 0xffff0000);
}
GW2MouseHighlight::GW2MouseHighlight( CWBItem* Parent, CRect Position ) : CWBItem( Parent, Position )
{
}
GW2MouseHighlight::~GW2MouseHighlight()
{
}
CWBItem* GW2MouseHighlight::Factory( CWBItem* Root, CXMLNode& node, CRect& Pos )
{
return new GW2MouseHighlight( Root, Pos );
}
TBOOL GW2MouseHighlight::IsMouseTransparent( CPoint& ClientSpacePoint, WBMESSAGE MessageType )
{
return true;
}