Author Topic: Mouse cursor in Mode  (Read 2453 times)

crooked

  • Guest
Mouse cursor in Mode
« on: Mon, Jun 8, 2009 »
Hi. I was wondering how would you show the mouse cursor in Mode? The cursor is visible in the menu, but  becomes disabled when you enter the game. I want the cursor to be visible in the game. I tried using FlxG.setCursor in the PlayState but that didn't work.

crooked

  • Guest
Re: Mouse cursor in Mode
« Reply #1 on: Tue, Jun 9, 2009 »
The cursor appears in the wrong position (usually offscreen) due to the game camera following the player. To fix the mouse cursor you need to edit FlxGame.as by changing this at line 346
Code: [Select]
_cursor.x = FlxG.mouse.x;
_cursor.y = FlxG.mouse.y;
to this:
Code: [Select]
if(_cursor != null)
{
if ( FlxG.followTarget )
{
_cursor.x = FlxG.mouse.x + FlxG.scroll.x;
_cursor.y = FlxG.mouse.y + FlxG.scroll.y;
}
else
{
_cursor.x = FlxG.mouse.x;
_cursor.y = FlxG.mouse.y;
}
}
This should adjust the cursor to camera movements.

You also need to call FlxG.setCursor again in the PlayState or else the cursor won't show up at all.

Adam Atomic

  • Founder
  • Key Contributor
  • *****
  • Posts: 852
  • Karma: +0/-0
  • new dad
    • View Profile
    • Adam Atomic
Re: Mouse cursor in Mode
« Reply #2 on: Tue, Jun 9, 2009 »
Oooh woops good catch, this is definitely a bug!