问题描述
我正在尝试使用 GOP 绘制光标。光标绘制发生在 while 循环中。
我 GOP 所在的文件:https://drive.google.com/file/d/1neifcwzow4WLGId7LRCzEFx5n43narDi/view?usp=sharing
/*...OTHER CODE...*/
RunGraphics(...); //CLEAR SCREEN
setCursorPosition(&cursor,(UINT32)(Info->HorizontalResolution/2),(UINT32)(Info->VerticalResolution/2));
while (1)
{
UINTN index;
Status = gBS->WaitForEvent(2,&Events,&index);
// INDEX 1 IS KEYBOARD MESSAGE
if (index == 1)
{
Status = gST->ConIn->ReadKeystroke(gST->ConIn,&Key);
if ((UINTN)Key.ScanCode == SCAN_ESC)
{
if(ESC_KEY_DOWN_COUNT == 0)
{
SystemTable->ConIn->Reset(SystemTable->ConIn,FALSE);
SystemTable->RuntimeServices->ResetSystem(EfiResetShutdown,EFI_SUCCESS,NULL);
return EFI_SUCCESS;
}
ESC_KEY_DOWN_COUNT--;
}
else
{
ESC_KEY_DOWN_COUNT = 2;
Print(L"%c",Key.UnicodeChar);
}
}
else if (index == 0)
{
Status = mouse->GetState(mouse,&State);
Print(L"X:%d Y:%d Z:%d L:%d R:%d\n",State.RelativeMovementX,State.RelativeMovementY,State.RelativeMovementZ,State.LeftButton,State.RightButton
);
setCursorPosition(&cursor,cursor.Position.X + State.RelativeMovementX,cursor.Position.Y + State.RelativeMovementY,info->HorizontalResolution,info->VerticalResolution);
DrawCursorClassic(cursor.Position.X,cursor.Position.Y,255,255 /*RGB*/);
//RUNS VERY LAGGY.
}
}
我应该怎么做才能提高我的表现或我在这里做错了什么?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)