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

[ENHANCEMENT] Add Script Events for losing/gaining focus #3721

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

AbnormalPoof
Copy link
Contributor

This PR adds callbacks to Modules for when the game loses/gains focus. Mods can use these callbacks like so:

import funkin.modding.module.Module;

/**
 * A test of the focus events.
 *
 * Delete this later.
 */
class FocusTest extends Module {
  public function new() {
    super('FocusTest');
  }

  function onFocusLost(event) {
    trace("LOST FOCUS!");
  }

  function onFocusGained(event) {
    trace("FOCUS GAINED!");
  }
}

Issues

  • The game fires the FOCUS_LOST event when the game is closed/exited, though I'm pretty sure this is a Flixel bug since the events ride off of Flixel's existing onFocus() and onFocusLost() functions.

@github-actions github-actions bot added medium A medium pull request with 100 or fewer changes haxe Issue/PR modifies game code labels Oct 17, 2024
Copy link
Contributor

@JVNpixels JVNpixels left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is cool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
haxe Issue/PR modifies game code medium A medium pull request with 100 or fewer changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants