Setup
document.addEventListener('DOMContentLoaded', () => {
const sdk = new OpenGameSDK({
ui: {
usePointsWidget: true, // Enable the points widget (default: true)
useCustomUI: false, // Set true to disable widget and modals
theme: 'system', // 'light', 'dark', or 'system' (default: 'system')
},
// apiKey is automatically read from the <meta name="x-ogp-key"> tag.
// You can also pass it explicitly here:
// apiKey: 'your-api-key',
});
sdk.on('OnReady', () => {
console.log('OpenGameSDK Ready');
// Start your game here
});
sdk
.init({ gameId: 'your-game-id' })
.then(() => console.log('OpenGameSDK Initialized'))
.catch(console.error);
});Last updated