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;
|
Bool button;
|
||||||
I64 x;
|
I64 x;
|
||||||
while (TRUE)
|
|
||||||
|
while (MouseRawQueueFind(game_task))
|
||||||
{
|
{
|
||||||
button = mouse_hard.raw_bttns[0];
|
button = mouse_hard.raw_bttns[0];
|
||||||
x = mouse_hard.raw_data.x;
|
x = mouse_hard.raw_data.x;
|
||||||
if (button || x!=0)
|
|
||||||
|
if (button || x != 0)
|
||||||
MouseRawReset; // Mark mouse data as consumed
|
MouseRawReset; // Mark mouse data as consumed
|
||||||
if (button)
|
if (button)
|
||||||
MessagePostWait(game_task,MESSAGE_KEY_DOWN_UP,CH_SPACE,0);
|
MessagePostWait(game_task, MESSAGE_KEY_DOWN_UP, CH_SPACE, 0);
|
||||||
if (x != 0) {
|
if (x != 0)
|
||||||
man_é += (x/mouse_scale)/MICRO_STEPS;
|
man_é += (x / mouse_scale) / MICRO_STEPS;
|
||||||
}
|
|
||||||
Sleep(10);
|
Sleep(10);
|
||||||
}
|
}
|
||||||
|
mouse_task = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
U0 CastleFrankenstein()
|
U0 CastleFrankenstein()
|
||||||
{
|
{
|
||||||
I64 sc;
|
I64 sc;
|
||||||
|
Bool is_raw = TRUE;
|
||||||
|
|
||||||
|
MouseRaw(is_raw);
|
||||||
|
mouse_task = Spawn(&MouseHandler, NULL, "MouseHandler");
|
||||||
|
|
||||||
MenuPush(
|
MenuPush(
|
||||||
"File {"
|
"File {"
|
||||||
|
@ -617,6 +624,9 @@ U0 CastleFrankenstein()
|
||||||
" Left(,,SC_CURSOR_LEFT);"
|
" Left(,,SC_CURSOR_LEFT);"
|
||||||
" Right(,,SC_CURSOR_RIGHT);"
|
" Right(,,SC_CURSOR_RIGHT);"
|
||||||
" Fire(,CH_SPACE);"
|
" Fire(,CH_SPACE);"
|
||||||
|
" MouseMode(,'m');"
|
||||||
|
" MouseScaleUp(,'+');"
|
||||||
|
" MouseScaleDown(,'-');"
|
||||||
"}"
|
"}"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -642,18 +652,22 @@ U0 CastleFrankenstein()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'm':
|
case 'm':
|
||||||
if (!mouse_task) {
|
if (is_raw)
|
||||||
MouseRaw(TRUE);
|
{
|
||||||
mouse_task=Spawn(&MouseHandler,NULL);
|
is_raw = FALSE;
|
||||||
}
|
MouseRaw(is_raw);
|
||||||
else {
|
|
||||||
Kill(mouse_task);
|
Kill(mouse_task);
|
||||||
mouse_task=NULL;
|
}
|
||||||
MouseRaw(FALSE);
|
else
|
||||||
|
{
|
||||||
|
is_raw = TRUE;
|
||||||
|
MouseRaw(is_raw);
|
||||||
|
mouse_task = Spawn(&MouseHandler, NULL, "MouseHandler");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '+':
|
case '+':
|
||||||
|
case '=':
|
||||||
mouse_scale *= 0.9;
|
mouse_scale *= 0.9;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -706,10 +720,7 @@ fs_done:
|
||||||
RegWrite("ZealOS/CastleFrankenstein", "F64 best_score=%5.4f;\n", best_score);
|
RegWrite("ZealOS/CastleFrankenstein", "F64 best_score=%5.4f;\n", best_score);
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseRaw(TRUE);
|
|
||||||
mouse_task=Spawn(&MouseHandler,NULL);
|
|
||||||
CastleFrankenstein;
|
CastleFrankenstein;
|
||||||
if (mouse_task) Kill(mouse_task);
|
|
||||||
MouseRaw(FALSE);
|
MouseRaw(FALSE);
|
||||||
|