// ToggleButton.cpp: implementation of the CToggleButton class. // ////////////////////////////////////////////////////////////////////// #include "ToggleButton.h" ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// CToggleButton::CToggleButton(int x,int y,UINT uiImg,UINT uiBase) { ix=x; iy=y; CToggleButton::uiImg=uiImg; HINSTANCE _hInstance=GameEngine::GetEngine()->GetInstance(); HWND _hWnd=GameEngine::GetEngine()->GetWindow(); HDC _hDC=GetDC(_hWnd); bmpMain=new Bitmap(_hDC,uiImg,_hInstance); for(int i=0;i<4;i++){ bmpButton[i]=new Bitmap(_hDC,uiBase+i,_hInstance); } iCurrentMode=0; iwidth=bmpButton[0]->GetWidth(); iheight=bmpButton[0]->GetHeight(); bMouseInside=false; iEarlyMode=0; //ReleaseDC(_hWnd,_hDC); } CToggleButton::~CToggleButton() { delete bmpMain; } void CToggleButton::DrawScreen(HDC hDC){ bmpButton[iCurrentMode]->Draw(hDC,ix,iy); bmpMain->Draw(hDC,ix+iwidth/2-bmpMain->GetWidth()/2,iy+iheight/2-bmpMain->GetHeight()/2,true); } void CToggleButton::MouseButtonUp(int x,int y,bool bLeft){ if(x>ix && xiy && yix && xiy && yix && xiy && y