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 { getPlatform, isPlatformInitialized } from '../platform/base';
/** Optional host score submission, independent of friends/open-data boards. */
export const Scores = {
get available(): boolean {
return isPlatformInitialized() && getPlatform().submitScore !== undefined;
},
/** A resolved submission means sent; host validation may still reject the score. */
async submit(score: number): Promise<void> {
if (!Number.isFinite(score)) throw new Error('Score must be finite');
const platform = getPlatform();
if (!platform.submitScore) throw new Error('Score submission unavailable on this host');
await platform.submitScore(score);
},
};