OSX Desktop testing in Corona Simulator-Is it possible? How?

Corona latest newletter has got me really fired up  and excited to get OSX Desktop working… Well done guys.

I guess the title almost says it all though. I am using Outlaw IDE and during testing there are no options to try OSX desktop per-se in the simulator or build. There are options to ‘view as’ to test code and detect the device and OS system levels, but cannot see how to run a simulator  specifically for a desktop. So hence my app runs as built e.g say iphone or ipad [seems a bit random when it chooses one over the other] but hey the app runs on my mac osx, which is great, but looks like an iphone image.

I could change the code to be more specific for OSX but thus far the app is device independant and detects device types and rotations etc very well. I would like to continue to use common code and detect the run environment at start up as per IOS.

I am assuming I will have to provide the user options to ‘rotate’  from portrat or landscape in my own menus.

I would also like to provide ‘stretch’ detections allowing the user to change the view size to any dimension below full screen.

But slowing down the excitement a moment, back to the title here.

How can I do testing in the simulator? If not how do I get the print to the old terminal out during live running of the app [sorry if this is covered elsewhere just very keen to get this going]

Just found Rob’s reply yesterday to a question that may help

https://forums.coronalabs.com/topic/58150-how-to-detect-if-the-game-runs-on-windows/?hl=%2Bdesktop+%2Bmac#entry300682

OK, Have found a workaround to test in simulator and in real environment based on Robs input.

I used the ‘custom device’ menu as an indicator for my app to build and run as a desktop because there is no DeskTop device menu as far as I can tell[Version 2015.2687 (2015.7.21)]

----========================================

– Determine if this app is running in a desktop window.
–during testing in Corona simulator and outside simulator i.e. real

–==========================================
_G.device.isRunningOnDesktop = false

_G.device.platformName = system.getInfo(“platformName”)

    if (_G.device.platformName == “Win”) or (_G.device.platformName == “Mac OS X”) then
      
        _G.device.model=“DeskTop”  —default the real environment

        if (system.getInfo(“environment”) ~= “device”) then
        --running simulator mode -i.e. test mode            
                        
                            _G.device.model = system.getInfo(“model”)  --use selected device to test and build

                            if _G.device.model==“My Custom Device” then  --building for DeskTop screen formatting

                                  — selected from simulator  Window/view as/ Custom device
                                _G.device.model=“DeskTop”
                            end
                end
end

–=============================================

Note – a lot of global variables for this example, but that can be changed if required…

I was wondersing where all the settings and files are now stored when running on desktop. For those also interested they are in the Macintosh HD/ Users/mymacbook name/Library/Application Support/myDeskTopApname/ Caches   or / tmp or / Documents depending on your app.

Now where is the app icon…?

Testing screen sizes during this exercise I have selected a Custom device.

Set the Custom device window to 1200x820

Under the simulator the app detects  only 703x480 in simulator mode.

I then build for mac osx version 10.10.4 (14E46)  and then the app detects only 340x480.!!!

I can’t work out what is happening here, yet, the above setting were default portrait by mistake,

Changing to default landscape in setting gives mac osx version 10.10.4 (14E46) 509*320

Any comments welcome.

Glad you were able to figure out testing in the Simulator.  We’ll probably add a “Desktop” skin but it’ll be pretty much indistinguishable from the “Custom Device” skin you are using.

“Screen” sizes are a little confusing because what is the screen size on a mobile device is really the window size on the desktop.  You set the default window size in your build.settings using:

-- Sets the default launch width and height of the view/client area of the window. -- This is the region within the borders of the window that Corona renders to. -- Ideally, this should match or exceed your "config.lua" content width and height. defaultViewWidth = 640, defaultViewHeight = 960,

We’re having a debate on whether revealing the actual screensize is needed on the desktop and any feedback is welcome.

Thanks. Confusing it is, but that is probably me making too many assumptions. I first thought that using the Custom Device and specifying the screen size there would override any settings somehow- I am not sure yet what size effects what where or when so will keep experimenting. I am looking at display.contentWidth and display.contentHeight in the app that results in the figures above.

My screen sizes are just random selections at this stage.

I am at least getting closer as it shows in landscape but with the settings as follows in simulation I get 908*600 , not 600*420.


I think if you exposed the screensizes it would help me. My app is full of tableviews resized to fit any window.


The settings and config files need to be very carefully set. Even when doing the setting as below the config needed changing also

My config section

local aspectRatio =display.pixelHeight/display.pixelWidth

application =
{
    content =
    {
        graphicsCompatibility = 1,  – Turn on V1 Compatibility Mode
    width = aspectRatio > 1.5 and 600 or math.ceil(420 /aspectRatio),
    height = aspectRatio<1.5 and 420 or math.ceil (600*aspectRatio),
        scale = “letterbox”,
        fps = 60,
        
        imageSuffix = {
            ["@2x"] = 1.5,
            ["@3x"] = 2.5,
        antialias = false

I have settings as follows

 
settings =
{
    orientation =
    {
         default = “landscapeLeft”,—“portrait”,
       supported = { “portrait”,“landscapeLeft”, “landscapeRight”,“portraitUpsideDown”
         },
         window = {

        – Sets up how the window should be launched on startup; default is “normal”.
        – Supports “normal”, “minimized”, “maximized”, or “fullscreen”.
        defaultMode = “fullscreen”,

     
        defaultViewWidth = 600,
        defaultViewHeight = 420,

    
        resizable = true,

       
        minViewWidth = 500,
        minViewHeight = 350,

Just found Rob’s reply yesterday to a question that may help

https://forums.coronalabs.com/topic/58150-how-to-detect-if-the-game-runs-on-windows/?hl=%2Bdesktop+%2Bmac#entry300682

OK, Have found a workaround to test in simulator and in real environment based on Robs input.

I used the ‘custom device’ menu as an indicator for my app to build and run as a desktop because there is no DeskTop device menu as far as I can tell[Version 2015.2687 (2015.7.21)]

----========================================

– Determine if this app is running in a desktop window.
–during testing in Corona simulator and outside simulator i.e. real

–==========================================
_G.device.isRunningOnDesktop = false

_G.device.platformName = system.getInfo(“platformName”)

    if (_G.device.platformName == “Win”) or (_G.device.platformName == “Mac OS X”) then
      
        _G.device.model=“DeskTop”  —default the real environment

        if (system.getInfo(“environment”) ~= “device”) then
        --running simulator mode -i.e. test mode            
                        
                            _G.device.model = system.getInfo(“model”)  --use selected device to test and build

                            if _G.device.model==“My Custom Device” then  --building for DeskTop screen formatting

                                  — selected from simulator  Window/view as/ Custom device
                                _G.device.model=“DeskTop”
                            end
                end
end

–=============================================

Note – a lot of global variables for this example, but that can be changed if required…

I was wondersing where all the settings and files are now stored when running on desktop. For those also interested they are in the Macintosh HD/ Users/mymacbook name/Library/Application Support/myDeskTopApname/ Caches   or / tmp or / Documents depending on your app.

Now where is the app icon…?

Testing screen sizes during this exercise I have selected a Custom device.

Set the Custom device window to 1200x820

Under the simulator the app detects  only 703x480 in simulator mode.

I then build for mac osx version 10.10.4 (14E46)  and then the app detects only 340x480.!!!

I can’t work out what is happening here, yet, the above setting were default portrait by mistake,

Changing to default landscape in setting gives mac osx version 10.10.4 (14E46) 509*320

Any comments welcome.

Glad you were able to figure out testing in the Simulator.  We’ll probably add a “Desktop” skin but it’ll be pretty much indistinguishable from the “Custom Device” skin you are using.

“Screen” sizes are a little confusing because what is the screen size on a mobile device is really the window size on the desktop.  You set the default window size in your build.settings using:

-- Sets the default launch width and height of the view/client area of the window. -- This is the region within the borders of the window that Corona renders to. -- Ideally, this should match or exceed your "config.lua" content width and height. defaultViewWidth = 640, defaultViewHeight = 960,

We’re having a debate on whether revealing the actual screensize is needed on the desktop and any feedback is welcome.

Thanks. Confusing it is, but that is probably me making too many assumptions. I first thought that using the Custom Device and specifying the screen size there would override any settings somehow- I am not sure yet what size effects what where or when so will keep experimenting. I am looking at display.contentWidth and display.contentHeight in the app that results in the figures above.

My screen sizes are just random selections at this stage.

I am at least getting closer as it shows in landscape but with the settings as follows in simulation I get 908*600 , not 600*420.


I think if you exposed the screensizes it would help me. My app is full of tableviews resized to fit any window.


The settings and config files need to be very carefully set. Even when doing the setting as below the config needed changing also

My config section

local aspectRatio =display.pixelHeight/display.pixelWidth

application =
{
    content =
    {
        graphicsCompatibility = 1,  – Turn on V1 Compatibility Mode
    width = aspectRatio > 1.5 and 600 or math.ceil(420 /aspectRatio),
    height = aspectRatio<1.5 and 420 or math.ceil (600*aspectRatio),
        scale = “letterbox”,
        fps = 60,
        
        imageSuffix = {
            ["@2x"] = 1.5,
            ["@3x"] = 2.5,
        antialias = false

I have settings as follows

 
settings =
{
    orientation =
    {
         default = “landscapeLeft”,—“portrait”,
       supported = { “portrait”,“landscapeLeft”, “landscapeRight”,“portraitUpsideDown”
         },
         window = {

        – Sets up how the window should be launched on startup; default is “normal”.
        – Supports “normal”, “minimized”, “maximized”, or “fullscreen”.
        defaultMode = “fullscreen”,

     
        defaultViewWidth = 600,
        defaultViewHeight = 420,

    
        resizable = true,

       
        minViewWidth = 500,
        minViewHeight = 350,