A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { Focusable, UIEventType, type FocusManagerState, type UIEventQueue, type World } from 'esengine';
/** Returning to gameplay gives Space back to the game instead of the last menu button. */
export function releaseTrainingFocus(world: World, events: UIEventQueue, focus: FocusManagerState): void {
const previous = focus.blur();
if (previous === null || !world.valid(previous) || !world.has(previous, Focusable)) return;
world.update(previous, Focusable, data => { data.isFocused = false; });
events.emit(previous, UIEventType.Blur);
}