mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-25 23:10:32 +00:00
Make raw-mouse mode task-based instead of global.
This commit is contained in:
parent
5ac73893d2
commit
c97456cfb2
7 changed files with 156 additions and 28 deletions
|
@ -586,24 +586,31 @@ U0 MouseHandler()
|
|||
{
|
||||
Bool button;
|
||||
I64 x;
|
||||
while (TRUE)
|
||||
|
||||
while (MouseRawQueueFind(game_task))
|
||||
{
|
||||
button = mouse_hard.raw_bttns[0];
|
||||
x = mouse_hard.raw_data.x;
|
||||
if (button || x!=0)
|
||||
|
||||
if (button || x != 0)
|
||||
MouseRawReset; // Mark mouse data as consumed
|
||||
if (button)
|
||||
MessagePostWait(game_task,MESSAGE_KEY_DOWN_UP,CH_SPACE,0);
|
||||
if (x != 0) {
|
||||
man_é += (x/mouse_scale)/MICRO_STEPS;
|
||||
}
|
||||
MessagePostWait(game_task, MESSAGE_KEY_DOWN_UP, CH_SPACE, 0);
|
||||
if (x != 0)
|
||||
man_é += (x / mouse_scale) / MICRO_STEPS;
|
||||
|
||||
Sleep(10);
|
||||
}
|
||||
mouse_task = NULL;
|
||||
}
|
||||
|
||||
U0 CastleFrankenstein()
|
||||
{
|
||||
I64 sc;
|
||||
Bool is_raw = TRUE;
|
||||
|
||||
MouseRaw(is_raw);
|
||||
mouse_task = Spawn(&MouseHandler, NULL, "MouseHandler");
|
||||
|
||||
MenuPush(
|
||||
"File {"
|
||||
|
@ -617,6 +624,9 @@ U0 CastleFrankenstein()
|
|||
" Left(,,SC_CURSOR_LEFT);"
|
||||
" Right(,,SC_CURSOR_RIGHT);"
|
||||
" Fire(,CH_SPACE);"
|
||||
" MouseMode(,'m');"
|
||||
" MouseScaleUp(,'+');"
|
||||
" MouseScaleDown(,'-');"
|
||||
"}"
|
||||
);
|
||||
|
||||
|
@ -642,18 +652,22 @@ U0 CastleFrankenstein()
|
|||
break;
|
||||
|
||||
case 'm':
|
||||
if (!mouse_task) {
|
||||
MouseRaw(TRUE);
|
||||
mouse_task=Spawn(&MouseHandler,NULL);
|
||||
}
|
||||
else {
|
||||
if (is_raw)
|
||||
{
|
||||
is_raw = FALSE;
|
||||
MouseRaw(is_raw);
|
||||
Kill(mouse_task);
|
||||
mouse_task=NULL;
|
||||
MouseRaw(FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
is_raw = TRUE;
|
||||
MouseRaw(is_raw);
|
||||
mouse_task = Spawn(&MouseHandler, NULL, "MouseHandler");
|
||||
}
|
||||
break;
|
||||
|
||||
case '+':
|
||||
case '=':
|
||||
mouse_scale *= 0.9;
|
||||
break;
|
||||
|
||||
|
@ -706,10 +720,7 @@ fs_done:
|
|||
RegWrite("ZealOS/CastleFrankenstein", "F64 best_score=%5.4f;\n", best_score);
|
||||
}
|
||||
|
||||
MouseRaw(TRUE);
|
||||
mouse_task=Spawn(&MouseHandler,NULL);
|
||||
CastleFrankenstein;
|
||||
if (mouse_task) Kill(mouse_task);
|
||||
MouseRaw(FALSE);
|
||||
|