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

add FlxG.watch.addFunction #2500

Merged
merged 3 commits into from
May 10, 2022
Merged

Conversation

Geokureli
Copy link
Member

@Geokureli Geokureli commented Feb 11, 2022

allows you to pass a ()->Dynamic to FlxG.watch that gets displayed each frame
Example

final cam = FlxG.camera;
final scroll = FlxRect.get();
FlxG.watch.addFunction("scrollBounds", ()->
{
    return scroll.set
        ( cam.minScrollX
        , cam.minScrollY
        , cam.maxScrollX - cam.minScrollX
        , cam.maxScrollY - cam.minScrollY
        );
});
// Outputs  something like: "scrollBounds  (x: 50.511 | y: 0 | w: 600 | h: 400)"

@Geokureli Geokureli merged commit 3016dc1 into HaxeFlixel:dev May 10, 2022
@Geokureli Geokureli deleted the watch_function branch May 10, 2022 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant