Environment API
Quick Start
import RundotGameAPI from '@series-inc/rundot-game-sdk/api'
// Quick platform checks
const isMobile = RundotGameAPI.system.isMobile()
const isWeb = RundotGameAPI.system.isWeb()
if (isMobile) {
enableTouchControls()
} else {
enableKeyboardControls()
}Device Information
const device = RundotGameAPI.system.getDevice()
// device contains:
// {
// screenSize: { width: 1920, height: 1080 },
// viewportSize: { width: 1280, height: 720 },
// orientation: 'landscape',
// pixelRatio: 2,
// fontScale: 1,
// deviceType: 'phone',
// hapticsEnabled: true,
// haptics: { supported: true, enabled: true }
// }
// Responsive layout based on screen size
if (device.screenSize.width < 768) {
renderMobileLayout()
} else {
renderDesktopLayout()
}
// Handle high-DPI displays
if (device.pixelRatio > 1) {
loadHighResAssets()
}
// Adapt to font scaling (accessibility)
if (device.fontScale > 1.2) {
useCompactUI()
}Environment Information
Platform Quick Checks
Use Cases
Responsive Design
Conditional Feature Enabling
Platform-Specific Assets
API Reference
Method
Returns
Description
DeviceInfo Properties
Property
Type
Description
EnvironmentInfo Properties
Property
Type
Description
Best Practices
Last updated