00001
00004
00005
00006 #include "stdafx.h"
00007 #include "VScreen.h"
00008
00010
00012
00021 VScreen::VScreen(const int tlX, const int tlY, const int w, const int h)
00022 {
00023 pointX = 0;
00024 pointY = 0;
00025 width = abs(w);
00026 height = h;
00027 moveScreen(tlX, tlY);
00028 }
00029
00031
00033
00037 void VScreen::moveScreen(const int tlX, const int tlY)
00038 {
00039 screenRgn = CreateRectRgn(
00040 tlX, tlY,
00041 this->width + tlX,
00042 abs(height) + tlY);
00043
00044 GetRgnBox(screenRgn, &screenRect);
00045 }
00046
00057 bool VScreen::PointOnScreen(const int x, const int y)
00058 {
00059 if ( PtInRegion(screenRgn, x, y) ){
00060 pointX = x - screenRect.left;
00061
00062 if( height < 0 )
00063 pointY = -y + screenRect.top - (height + 1);
00064 else
00065 pointY = y - screenRect.top;
00066
00067 return true;
00068 } else {
00069 return false;
00070 }
00071 }
00072
00076 RECT VScreen::getRgnRect() const
00077 {
00078 return screenRect;
00079 }
00080
00084 HRGN VScreen::getRgn() const
00085 {
00086 return screenRgn;
00087 }
00088
00092 void VScreen::invalidate(HWND hWnd, bool Erase)
00093 {
00094 InvalidateRgn(hWnd, screenRgn, Erase);
00095 }
00096
00100 int VScreen::getScreenX() const
00101 {
00102 return pointX;
00103 }
00104
00108 int VScreen::getScreenY() const
00109 {
00110 return pointY;
00111 }
00112
00116 int VScreen::getHeight() const
00117 {
00118 return height;
00119 }
00120
00124 int VScreen::getWidth() const
00125 {
00126 return width;
00127 }