56 lines
1.2 KiB
C++
56 lines
1.2 KiB
C++
#include "Cursor.h"
|
||
#include "SquirrelClassEx.h"
|
||
|
||
//譜崔報炎貸辞
|
||
void SetCursorGameLogic() {
|
||
WindowPtr window = Application::GetInstance().GetWindow();
|
||
int X = window->GetPosX();
|
||
int MaxX = window->GetWidth() + X;
|
||
|
||
int Y = window->GetPosY();
|
||
int MaxY = window->GetHeight() + Y;
|
||
|
||
|
||
POINT pt = { 0, 0 };
|
||
GetCursorPos(&pt);
|
||
|
||
if (pt.x >= X && pt.x <= MaxX && pt.y >= Y && pt.y <= MaxY /*&& GetForegroundWindow() == window->GetHandle()*/) {
|
||
ShowCursor(FALSE);
|
||
}
|
||
}
|
||
|
||
Cursor::Cursor()
|
||
{
|
||
this->SetName("GameCursorObject");
|
||
this->Retain();
|
||
|
||
|
||
}
|
||
|
||
void Cursor::OnUpdate(Duration dt)
|
||
{
|
||
static bool Init = false;
|
||
if (!Init) {
|
||
TexturePtr ImageBuf = SquirrelClassEx::GetTexturePtrByImg("sprite/interface/cursor.img",0);
|
||
this->SetFrame(ImageBuf);
|
||
Init = true;
|
||
}
|
||
|
||
////資函補秘
|
||
Input& input = Input::GetInstance();
|
||
|
||
////譜崔"報炎"斤<>恫炎吉噐報炎恫炎
|
||
this->SetPosition(input.GetMousePos());
|
||
|
||
//std::cout << (int)GetCursor() << std::endl;
|
||
//譜崔報炎<E5A0B1>払議貸辞
|
||
if ((int)GetCursor() == 65541) {
|
||
SetCursorGameLogic();
|
||
this->SetVisible(true);
|
||
}
|
||
else {
|
||
this->SetVisible(false);
|
||
}
|
||
}
|
||
|