Skip to content

Commit

Permalink
Merge branch 'master' into tga-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
y4my4my4m authored Feb 25, 2023
2 parents 5063b2a + e65f27c commit 4ee2f7f
Show file tree
Hide file tree
Showing 4 changed files with 4,656 additions and 4,568 deletions.
49 changes: 48 additions & 1 deletion src/Demo/Games/CastleFrankenstein.ZC
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,29 @@ U0 RotateMan(F64 d)
}
}

CTask *mouse_task = NULL;
CTask *game_task = Fs;
F64 mouse_scale = 32.0;

U0 MouseHandler()
{
Bool button;
I64 x;
while (TRUE)
{
button = mouse_hard.raw_bttns[0];
x = mouse_hard.raw_data.x;
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;
}
Sleep(10);
}
}

U0 CastleFrankenstein()
{
I64 sc;
Expand Down Expand Up @@ -618,6 +641,26 @@ U0 CastleFrankenstein()
Fire;
break;

case 'm':
if (!mouse_task) {
MouseRaw(TRUE);
mouse_task=Spawn(&MouseHandler,NULL);
}
else {
Kill(mouse_task);
mouse_task=NULL;
MouseRaw(FALSE);
}
break;

case '+':
mouse_scale *= 0.9;
break;

case '-':
mouse_scale *= 1.1;
break;

case '\n':
Init;
break;
Expand Down Expand Up @@ -663,7 +706,11 @@ 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);
&
 
 
Expand Down Expand Up @@ -837,4 +884,4 @@ D\DdT0T8THL0LLd d

  

        
        
Expand Down
Loading

0 comments on commit 4ee2f7f

Please sign in to comment.