Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hover over button cursor graphic request #47

Open
moly opened this issue Aug 30, 2012 · 0 comments
Open

Hover over button cursor graphic request #47

moly opened this issue Aug 30, 2012 · 0 comments

Comments

@moly
Copy link
Owner

moly commented Aug 30, 2012

It would be nice if Flixel had an easy way of changing the cursor when hovering over a button (typically made to look like a hand) built into it.

For now I hacked it in to my project with these changes, but it would be nice if it was supported out of the box:

In FlxButton:
while(i < l)
{
camera = cameras[i++] as FlxCamera;
FlxG.mouse.getWorldPosition(camera,_point);
if(overlapsPoint(_point,true,camera))
{
offAll = false;
if(FlxG.mouse.justPressed())
{
status = PRESSED;
if(onDown != null)
onDown();
if(soundDown != null)
soundDown.play(true);
}
if(status == NORMAL)
{
status = HIGHLIGHT;
FlxG.mouse.load(Assets_Ui.cursor_hand, 1, -9); // added this
if(onOver != null)
onOver();
if(soundOver != null)
soundOver.play(true);
}
}
}
if(offAll)
{
if(status != NORMAL)
{
FlxG.mouse.load(Assets_Ui.cursor_point, 1, -9); // added this
if(onOut != null)
onOut();
if(soundOut != null)
soundOut.play(true);
}
status = NORMAL;
}

In FlxState:
public function create():void
{
FlxG.mouse.load(Assets_Ui.cursor_point, 1, -9);
}

In all of my states that extend FlxState:
override public function create():void
{
super.create();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant