Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the new Overlay module #83

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
533 changes: 533 additions & 0 deletions Source/Overlay.cc

Large diffs are not rendered by default.

103 changes: 103 additions & 0 deletions Source/Overlay.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
////////////////////////////////////////////////////////////////////////////////
// -------------------------------------------------------------------------- //
// //
// (C) 2010-2017 Robot Developers //
// See LICENSE for licensing info //
// //
// -------------------------------------------------------------------------- //
////////////////////////////////////////////////////////////////////////////////

//----------------------------------------------------------------------------//
// Prefaces //
//----------------------------------------------------------------------------//

#pragma once

#include "Types.h"
#include <memory>

ROBOT_NS_BEGIN

#ifdef ROBOT_OS_WIN
#pragma warning (push)
// Ignore the VS C4251 warning
#pragma warning (disable:4251)
#endif



//----------------------------------------------------------------------------//
// Classes //
//----------------------------------------------------------------------------//

////////////////////////////////////////////////////////////////////////////////

class ROBOT_EXPORT Overlay
{
public:
explicit Overlay (const Bounds& b);
explicit Overlay (int32 x, int32 y,
int32 w, int32 h);

public:
bool IsValid (void) const;

bool Create (const Bounds& b);
bool Create (int32 x, int32 y,
int32 w, int32 h);
void Destroy (void);

bool IsTopMost (void) const;
void SetTopMost (bool state);

real32 GetOpacity (void) const;
void SetOpacity (real32 opacity);

bool IsVisible (void) const;
void SetVisible (bool visible);

uintptr GetHandle (void) const;

Bounds GetClient (void) const;
void SetClient (const Bounds& b);
void SetClient (int32 x, int32 y,
int32 w, int32 h);

Point MapToClient (const Point& point) const;
Point MapToScreen (const Point& point) const;
Bounds MapToClient (const Bounds& bounds) const;
Bounds MapToScreen (const Bounds& bounds) const;

void Clear (const Color& color = 0);

void Clear (const Bounds& b,
const Color & color = 0);

void Clear (int32 x, int32 y,
int32 w, int32 h,
const Color& color = 0);

void Render (const Image& image,
const Point& target = 0);

void Render (const Image & image,
const Bounds& source,
const Point & target = 0);

public:
bool operator == (const Overlay& overlay) const;
bool operator != (const Overlay& overlay) const;

bool operator == (uintptr handle) const;
bool operator != (uintptr handle) const;

private:
struct Data;
std::shared_ptr<Data> mData; // Shared information
};

#ifdef ROBOT_OS_WIN
#pragma warning (pop)
#endif

ROBOT_NS_END
2 changes: 2 additions & 0 deletions Source/Robot.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,7 @@

#include "Window.h"
#include "Screen.h"
#include "Overlay.h"

#include "Timer.h"
#include "Clipboard.h"
2 changes: 2 additions & 0 deletions Source/Robot.vs12.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
<ClInclude Include="Memory.h" />
<ClInclude Include="Module.h" />
<ClInclude Include="Mouse.h" />
<ClInclude Include="Overlay.h" />
<ClInclude Include="Point.h" />
<ClInclude Include="Process.h" />
<ClInclude Include="Range.h" />
Expand All @@ -67,6 +68,7 @@
<ClCompile Include="Memory.cc" />
<ClCompile Include="Module.cc" />
<ClCompile Include="Mouse.cc" />
<ClCompile Include="Overlay.cc" />
<ClCompile Include="Point.cc" />
<ClCompile Include="Process.cc" />
<ClCompile Include="Range.cc" />
Expand Down
6 changes: 6 additions & 0 deletions Source/Robot.vs12.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
<ClInclude Include="Mouse.h">
<Filter>Native</Filter>
</ClInclude>
<ClInclude Include="Overlay.h">
<Filter>Native</Filter>
</ClInclude>
<ClInclude Include="Point.h">
<Filter>Types</Filter>
</ClInclude>
Expand Down Expand Up @@ -103,6 +106,9 @@
<ClCompile Include="Mouse.cc">
<Filter>Native</Filter>
</ClCompile>
<ClCompile Include="Overlay.cc">
<Filter>Native</Filter>
</ClCompile>
<ClCompile Include="Point.cc">
<Filter>Types</Filter>
</ClCompile>
Expand Down
2 changes: 2 additions & 0 deletions Source/Robot.vs13.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
<ClInclude Include="Memory.h" />
<ClInclude Include="Module.h" />
<ClInclude Include="Mouse.h" />
<ClInclude Include="Overlay.h" />
<ClInclude Include="Point.h" />
<ClInclude Include="Process.h" />
<ClInclude Include="Range.h" />
Expand All @@ -67,6 +68,7 @@
<ClCompile Include="Memory.cc" />
<ClCompile Include="Module.cc" />
<ClCompile Include="Mouse.cc" />
<ClCompile Include="Overlay.cc" />
<ClCompile Include="Point.cc" />
<ClCompile Include="Process.cc" />
<ClCompile Include="Range.cc" />
Expand Down
6 changes: 6 additions & 0 deletions Source/Robot.vs13.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
<ClInclude Include="Mouse.h">
<Filter>Native</Filter>
</ClInclude>
<ClInclude Include="Overlay.h">
<Filter>Native</Filter>
</ClInclude>
<ClInclude Include="Point.h">
<Filter>Types</Filter>
</ClInclude>
Expand Down Expand Up @@ -103,6 +106,9 @@
<ClCompile Include="Mouse.cc">
<Filter>Native</Filter>
</ClCompile>
<ClCompile Include="Overlay.cc">
<Filter>Native</Filter>
</ClCompile>
<ClCompile Include="Point.cc">
<Filter>Types</Filter>
</ClCompile>
Expand Down
2 changes: 2 additions & 0 deletions Source/Robot.vs15.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
<ClInclude Include="Memory.h" />
<ClInclude Include="Module.h" />
<ClInclude Include="Mouse.h" />
<ClInclude Include="Overlay.h" />
<ClInclude Include="Point.h" />
<ClInclude Include="Process.h" />
<ClInclude Include="Range.h" />
Expand All @@ -67,6 +68,7 @@
<ClCompile Include="Memory.cc" />
<ClCompile Include="Module.cc" />
<ClCompile Include="Mouse.cc" />
<ClCompile Include="Overlay.cc" />
<ClCompile Include="Point.cc" />
<ClCompile Include="Process.cc" />
<ClCompile Include="Range.cc" />
Expand Down
6 changes: 6 additions & 0 deletions Source/Robot.vs15.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
<ClInclude Include="Mouse.h">
<Filter>Native</Filter>
</ClInclude>
<ClInclude Include="Overlay.h">
<Filter>Native</Filter>
</ClInclude>
<ClInclude Include="Point.h">
<Filter>Types</Filter>
</ClInclude>
Expand Down Expand Up @@ -103,6 +106,9 @@
<ClCompile Include="Mouse.cc">
<Filter>Native</Filter>
</ClCompile>
<ClCompile Include="Overlay.cc">
<Filter>Native</Filter>
</ClCompile>
<ClCompile Include="Point.cc">
<Filter>Types</Filter>
</ClCompile>
Expand Down
6 changes: 4 additions & 2 deletions Test/Main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ int main (int argc, const char* argv[])
<< " 7: Window \n"
<< " 8: Memory \n"
<< " 9: Screen \n"
<< " 10: Clipboard\n\n";
<< " 10: Overlay \n"
<< " 11: Clipboard\n\n";

// Ask the user to make a selection
cout << "Enter component(s) to test: ";
Expand All @@ -98,7 +99,8 @@ int main (int argc, const char* argv[])
case 6: result = TestProcess (); break;
case 7: result = TestWindow (); break;
case 9: result = TestScreen (); break;
case 10: result = TestClipboard(); break;
case 10: result = TestOverlay (); break;
case 11: result = TestClipboard(); break;

case 8:
cout << uppercase;
Expand Down
43 changes: 43 additions & 0 deletions Test/Overlay.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
////////////////////////////////////////////////////////////////////////////////
// -------------------------------------------------------------------------- //
// //
// (C) 2010-2017 Robot Developers //
// See LICENSE for licensing info //
// //
// -------------------------------------------------------------------------- //
////////////////////////////////////////////////////////////////////////////////

//----------------------------------------------------------------------------//
// Prefaces //
//----------------------------------------------------------------------------//

#include "Test.h"



//----------------------------------------------------------------------------//
// Locals //
//----------------------------------------------------------------------------//

////////////////////////////////////////////////////////////////////////////////

static bool TestGeneric (void)
{
return true;
}



//----------------------------------------------------------------------------//
// Functions //
//----------------------------------------------------------------------------//

////////////////////////////////////////////////////////////////////////////////

bool TestOverlay (void)
{
cout << "TEST OVERLAY\n"
<< "------------------------------\n";

return TestGeneric();
}
3 changes: 2 additions & 1 deletion Test/Test.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ bool TestTimer (void);
bool TestKeyboard (void);
bool TestMouse (void);
bool TestProcess (void);
bool TestWindow (void);
bool TestMemory (void);
bool TestWindow (void);
bool TestScreen (void);
bool TestOverlay (void);
bool TestClipboard (void);
1 change: 1 addition & 0 deletions Test/Test.vs12.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<ClCompile Include="Main.cc" />
<ClCompile Include="Memory.cc" />
<ClCompile Include="Mouse.cc" />
<ClCompile Include="Overlay.cc" />
<ClCompile Include="Process.cc" />
<ClCompile Include="Screen.cc" />
<ClCompile Include="System.cc" />
Expand Down
3 changes: 3 additions & 0 deletions Test/Test.vs12.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
<ClCompile Include="Mouse.cc">
<Filter>Tests</Filter>
</ClCompile>
<ClCompile Include="Overlay.cc">
<Filter>Tests</Filter>
</ClCompile>
<ClCompile Include="Process.cc">
<Filter>Tests</Filter>
</ClCompile>
Expand Down
1 change: 1 addition & 0 deletions Test/Test.vs13.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<ClCompile Include="Main.cc" />
<ClCompile Include="Memory.cc" />
<ClCompile Include="Mouse.cc" />
<ClCompile Include="Overlay.cc" />
<ClCompile Include="Process.cc" />
<ClCompile Include="Screen.cc" />
<ClCompile Include="System.cc" />
Expand Down
3 changes: 3 additions & 0 deletions Test/Test.vs13.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
<ClCompile Include="Mouse.cc">
<Filter>Tests</Filter>
</ClCompile>
<ClCompile Include="Overlay.cc">
<Filter>Tests</Filter>
</ClCompile>
<ClCompile Include="Process.cc">
<Filter>Tests</Filter>
</ClCompile>
Expand Down
1 change: 1 addition & 0 deletions Test/Test.vs15.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<ClCompile Include="Main.cc" />
<ClCompile Include="Memory.cc" />
<ClCompile Include="Mouse.cc" />
<ClCompile Include="Overlay.cc" />
<ClCompile Include="Process.cc" />
<ClCompile Include="Screen.cc" />
<ClCompile Include="System.cc" />
Expand Down
3 changes: 3 additions & 0 deletions Test/Test.vs15.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
<ClCompile Include="Mouse.cc">
<Filter>Tests</Filter>
</ClCompile>
<ClCompile Include="Overlay.cc">
<Filter>Tests</Filter>
</ClCompile>
<ClCompile Include="Process.cc">
<Filter>Tests</Filter>
</ClCompile>
Expand Down