lvcabral / brs-engine

BrightScript Simulation Engine - Run Roku apps on Browsers and Node.js
https://lvcabral.com/brs/
MIT License
77 stars 14 forks source link

How to check code is running in simulator? #333

Closed alissontenorio closed 5 months ago

alissontenorio commented 5 months ago

This doesn't seem to spilled it

di = CreateObject("roDeviceInfo")
print di.getOSVersion()
print di.getModel()
lvcabral commented 5 months ago

Hi @alissontenorio take a look at the customization document, in particular this "Custom Features" section: https://github.com/lvcabral/brs-engine/blob/master/docs/customization.md#custom-features-parameter

alissontenorio commented 5 months ago

I did @lvcabral .

Seems a little hacky to do this

if di.hasFeature("touch_controls")

But it worked.

Couldnt the device info return its a simulator in di.getOSVersion() or in di.getModel() instead?

lvcabral commented 5 months ago

Did you read the full section, there is a default feature just for that: di.hasFeature("simulation_engine")

lvcabral commented 5 months ago
image
lvcabral commented 5 months ago

@alissontenorio check above!