Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Windows phone 10 black borders
Started by welton-alexandre Mar 24 2016 01:10 PM

34 replies to this topic
windows phone 10
[TOPIC CONTROLS]
Page 1 of 2 1 2
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

welton-alexandre

[GLOBAL: userInfoPane.html]
welton-alexandre
  • Observer

  • 6 posts
  • Corona SDK

Good evening, I began to use the corona with windows phone 10 and I'm with the problem, the windows phone 8.1 the game resolution is perfect, but the windows phone 10 is large black edges and the game screen is very small regardless of what I do, I've tried various solutions more did not work.

On windows phone 8.1 : 

image.jpg

 

Now the windows phone 10

wp_ss_20160324_0001.png

 

 



[TOPIC: post.html]
#2

Joshua Quick

[GLOBAL: userInfoPane.html]
Joshua Quick
  • Moderator

  • 3,397 posts
  • Corona Staff

Are you using Microsoft's preview/beta of Windows 10 Mobile on your device?

 

I ask, because Microsoft did state that there were known scaling bugs with some device models on their end.  Case-in-point:

   http://answers.microsoft.com/en-us/insider/forum/insider_wintp-insider_update/lumia-640-users-check-here-for-windows-10/e45ddf8c-5660-44bf-aa16-4a2d23c59883?auth=1

 

The released version of Windows 10 Mobile shouldn't have these scaling issues.  You can upgrade your phone to the released version of Windows 10 Mobile by downloading Microsoft's "Upgrade Advisor" from the Windows app store.

 

I've also tested WP8 CoronaCards with the release version of Microsoft's Windows 10 Mobile emulators.  There is no scaling issues there either.  You can download these emulators via the link below, by clicking that page's "Download the emulator" link.  That'll download an install program providing several emulators at different resolutions and different amounts of RAM.

   https://dev.windows.com/en-us/downloads



[TOPIC: post.html]
#3

welton-alexandre

[GLOBAL: userInfoPane.html]
welton-alexandre
  • Observer

  • 6 posts
  • Corona SDK

Good evening, thank you for help.
My phone is with the final version of windows phone 10 testing applications made in corona sdk works normal, the problem is only in mine.
Some who have tested and worked regular:
wp_ss_20160324_00021.png
 
wp_ss_20160324_00031.png
 
It works well, am I using the latest version of Corona?
I use v2016.2830


[TOPIC: post.html]
#4

Joshua Quick

[GLOBAL: userInfoPane.html]
Joshua Quick
  • Moderator

  • 3,397 posts
  • Corona Staff

Okay.  So, you're saying that it works fine on all Windows 10 Mobile device except yours?

Can you tell me the make and model of your device please?  (Example: Lumia 950)

 

I'm still thinking it's a bug on Microsoft's end and that they're returning the wrong scale factor on the device as mentioned in the link I posted above.  If this is a Microsoft bug that accidentally got released on some devices, then we'll have to investigate a work-around.  But step 1 is for someone on my end to reproduce this issue.

 

One more thing.  You *could* try to retarget your project to Windows Phone 8.1.  By doing this, your app will be able to take advantage of 1080P and higher resolution devices (it'll no longer appear scaled and slightly blurry on those devices), but then you'll lose 8.0 support.  Your app will only be able to run on 8.1 and 10.  I don't really recommend it, but it's worth a try in case there is a backward compatibility bug on Microsoft's end.  Here's how to re-target your project:

  1. Open your project in Visual Studio.
  2. Right click on your project in the "Solution Explorer" panel.
  3. Click on "Retarget to Windows Phone 8.1" in the popup menu.
  4. Save and rebuild.


[TOPIC: post.html]
#5

Vitaliy Latypov

[GLOBAL: userInfoPane.html]
Vitaliy Latypov
  • Enthusiast

  • 50 posts
  • Corona SDK

I have the same trouble on my lumia 535. I use released version of Windows 10 with latest updates.

Sometimes the trouble disappears, but reappears after making new build. The reason I can't identify :(



[TOPIC: post.html]
#6

Vitaliy Latypov

[GLOBAL: userInfoPane.html]
Vitaliy Latypov
  • Enthusiast

  • 50 posts
  • Corona SDK

"Retarget to Windows Phone 8.1" doesn't solve the trouble.



[TOPIC: post.html]
#7

welton-alexandre

[GLOBAL: userInfoPane.html]
welton-alexandre
  • Observer

  • 6 posts
  • Corona SDK

I still can not solve, my mobile is also a lumia 535, which I do not understand is why the games of other work, it just happens to my games on my phone, I have an application in the phone windows store and some users are already complaining of this problem.



[TOPIC: post.html]
#8

Joshua Quick

[GLOBAL: userInfoPane.html]
Joshua Quick
  • Moderator

  • 3,397 posts
  • Corona Staff

Can you both do a quick test for me please?

 

Open your "MainPage.xaml.cs" file and add the following lines of code to the bottom of the MainPage() constructor...

System.Diagnostics.Debug.WriteLine("### Resolution Scale: {0}", Windows.Graphics.Display.DisplayProperties.ResolutionScale.ToString());
System.Diagnostics.Debug.WriteLine("### Content Scale: {0}", (double)System.Windows.Application.Current.Host.Content.ScaleFactor / 100.0);

Then run your project in Visual Studio in "Debug" mode on your Lumia 535 device.

The above code will log Microsoft's scale factors to Visual Studio's "Output" panel.

Please post the results to this forum here.

If you can do this by tomorrow, then that would be great... because I *think* I know what the issue is, but I need confirmation from real devices.  If you can do this, then I'll personally jump on this issue tomorrow.  Thanks!



[TOPIC: post.html]
#9

welton-alexandre

[GLOBAL: userInfoPane.html]
welton-alexandre
  • Observer

  • 6 posts
  • Corona SDK

This would be the result:

### Resolution Scale: Scale100Percent
### Content Scale: 1
Platform: Not Supported Yet / ARM / 8.0 / ANGLE (Qualcomm Adreno 305 Direct3D11 vs_2_0 ps_2_0) / OpenGL ES 2.0 (ANGLE 1.2.0.2446) / 2016.2830 / Português (Brasil) | BR | pt-BR | pt


[TOPIC: post.html]
#10

Joshua Quick

[GLOBAL: userInfoPane.html]
Joshua Quick
  • Moderator

  • 3,397 posts
  • Corona Staff

Well there's the problem.  Microsoft is only supposed to return a scale of 1.0 for a 480x800 resolution device.  Corona uses the "Content.ScaleFactor" property (recommended by Microsoft's examples) to calculate the pixel width/height of the screen.  Microsoft documents what the content resolution and scales are here...
   https://msdn.microsoft.com/en-us/library/windows/apps/jj206974(v=vs.105).aspx#BKMK_Supportedresolutions
 
From looking at the Lumia 535 device's specification, it has an unusual resolution of 540x960 pixels...
   https://www.microsoft.com/en/mobile/phone/lumia535/specifications
 
I suspect that Microsoft's APIs are returning 480x800 pixel resolution for that device based on your screenshots, making it a bug on their end.  You can confirm this by adding the following to your MainPage.xaml.cs file.

public MainPage()
{
	// Initialize this page's components that were set up via the UI designer.
	InitializeComponent();

	// Set up Corona to automatically start up when the control's Loaded event has been raised.
	// Note: By default, Corona will run the "main.lua" file in the "Assets\Corona" directory.
	//       You can change the defaults via the CoronaPanel's AutoLaunchSettings property.
	fCoronaPanel.AutoLaunchEnabled = true;

	// Set up the CoronaPanel control to render fullscreen via the DrawingSurfaceBackgroundGrid control.
	// This significantly improves the framerate and is the only means of achieving 60 FPS.
	fCoronaPanel.BackgroundRenderingEnabled = true;
	fDrawingSurfaceBackgroundGrid.SetBackgroundContentProvider(fCoronaPanel.BackgroundContentProvider);
	fDrawingSurfaceBackgroundGrid.SetBackgroundManipulationHandler(fCoronaPanel.BackgroundManipulationHandler);

	this.Loaded += OnLoaded;
}

private void OnLoaded(object sender, RoutedEventArgs e)
{
	var content = System.Windows.Application.Current.Host.Content;
	System.Diagnostics.Debug.WriteLine("### Resolution Scale: {0}", Windows.Graphics.Display.DisplayProperties.ResolutionScale.ToString());
	System.Diagnostics.Debug.WriteLine("### Content Scale: {0}", (double)content.ScaleFactor / 100.0);
	System.Diagnostics.Debug.WriteLine("### Content Size: {0}x{1}", content.ActualWidth, content.ActualHeight);
	System.Diagnostics.Debug.WriteLine("### Page Size: {0}x{1}", this.ActualWidth, this.ActualHeight);
	System.Diagnostics.Debug.WriteLine("### CoronaPanel Size: {0}x{1}", fCoronaPanel.ActualWidth, fCoronaPanel.ActualHeight);
	{
		object result = "null";
		Microsoft.Phone.Info.DeviceExtendedProperties.TryGetValue("RawDpiX", out result);
		System.Diagnostics.Debug.WriteLine("### RawDpiX: {0}", result);
	}
	{
		object result = "null";
		Microsoft.Phone.Info.DeviceExtendedProperties.TryGetValue("RawDpiY", out result);
		System.Diagnostics.Debug.WriteLine("### RawDpiY: {0}", result);
	}
	{
		var size = new System.Windows.Size(0, 0);
		object result = null;
		Microsoft.Phone.Info.DeviceExtendedProperties.TryGetValue("PhysicalScreenResolution", out result);
		if (result is System.Windows.Size)
		{
			size = (System.Windows.Size)result;
		}
		System.Diagnostics.Debug.WriteLine("### PhysicalScreenResolution: {0}x{1}", size.Width, size.Height);
	}
}

The above will log the widths and height from various APIs to Visual Studio's "Output" panel like before.  If the above returns a 480x800 resolution, then unfortunately there is nothing we can do in code to fix this.  All we can do is report it as a Lumia 535 specific bug to Microsoft and hope they'll patch it in the near future.



[TOPIC: post.html]
#11

Joshua Quick

[GLOBAL: userInfoPane.html]
Joshua Quick
  • Moderator

  • 3,397 posts
  • Corona Staff

There is 1 more thing I'd like you to print out.  Please add the following line to your code.

System.Diagnostics.Debug.WriteLine("### Logical DPI: {0}", Windows.Graphics.Display.DisplayProperties.LogicalDpi);

The "LogicalDpi" is the scale factor Microsoft uses to scale fonts and Microsoft typically does dynamic layout based on the system's default font size.  So, I'm thinking that API has to provide the correct scale factor for your phone.

 

For your info, the font scale factor is calculated like this...

   scale = logicalDpi / 96.0

 

So, hopefully the logical DPI is greater than 96.0 for your phone.  (Fingers crossed.)



[TOPIC: post.html]
#12

welton-alexandre

[GLOBAL: userInfoPane.html]
welton-alexandre
  • Observer

  • 6 posts
  • Corona SDK

I understand, but because usually works when the machine is running Windows 8.1 phone?



[TOPIC: post.html]
#13

Joshua Quick

[GLOBAL: userInfoPane.html]
Joshua Quick
  • Moderator

  • 3,397 posts
  • Corona Staff

Right.  I've never heard of any scaling bugs on Windows Phone 8.0 or 8.1.

 

Microsoft did report scaling bugs on Windows Phone 8.x devices that were upgraded to Windows 10 during the beta last year.  You can see that in the link I provided in my 1st forum post up above.  It sounds like Microsoft hasn't fixed these scaling bugs on all devices yet.  I'm guessing that these scaling bugs only happen with Silverlight *.xap applications and not with Universal *.appx applications which were designed for Windows 10.

 

If you can tell me what the "LogicalDpi" property returns, then that would be a big help.  I gave you that code snipped in my last forum post on this thread (just above this one).  I'm hoping that property returns the correct scale factor for your device on Windows 10 Mobile.  If it does, then we should be abel to work-around this Microsoft bug.



[TOPIC: post.html]
#14

mimoz

[GLOBAL: userInfoPane.html]
mimoz
  • Observer

  • 14 posts
  • Corona SDK

Hi,

I have the same problem. I am using Lumia 535. Here is output

Platform: Not Supported Yet / ARM / 8.0 / ANGLE (Qualcomm Adreno 305 Direct3D11 vs_2_0 ps_2_0) / OpenGL ES 2.0 (ANGLE 1.2.0.2446) / 2016.2853 
The thread 0x2ec has exited with code 0 (0x0).
The thread 0x16e4 has exited with code 0 (0x0).
### Resolution Scale: Scale100Percent
### Content Scale: 1
### Content Size: 480x800
### Page Size: 741x480
### CoronaPanel Size: 741x480
### RawDpiX: 196,645161290323
### RawDpiY: 196,645161290323
### PhysicalScreenResolution: 480x800
### Logical DPI: 96
 
It would be great if Corona would provide some kind of solution.

Best,
Primoz


[TOPIC: post.html]
#15

welton-alexandre

[GLOBAL: userInfoPane.html]
welton-alexandre
  • Observer

  • 6 posts
  • Corona SDK

It works seamlessly on lumia 535?
Is it any adaptation in the lua code or visual studio project?


[TOPIC: post.html]
#16

Joshua Quick

[GLOBAL: userInfoPane.html]
Joshua Quick
  • Moderator

  • 3,397 posts
  • Corona Staff

Primoz, Welton,

 

If you look at the returned values, notice that the device is returning a 480x800 resolutions with a 1.0 scale factor.  A Lumia 535 is a 540x960 resolution device.  So, Microsoft's APIs are clearly returning the wrong values for that device.  That's the issue.  It's a Microsoft bug that they need to fix.  I don't see how we can work-around this issue on our end.

 

I think the best we can do at this point is report it as a bug to Microsoft.  The only means I know of doing this is to start a "discussion" (aka: forum post) on their website here...

   http://answers.microsoft.com/en-us/mobiledevices

 

 

If you are to report it, then the best description to use is...

Lumia 535 running Windows 10 Mobile returns the wrong pixel resolution and scale factor to Silverlight apps.  This causes Direct3D apps to render at a smaller scale onscreen than they should.

 

The following API returns a 480x800 size when it should return a 540x960 size...

   Microsoft.Phone.Info.DeviceExtendedProperties.TryGetValue("PhysicalScreenResolution", out result);

 

​And the following APIs return a 1.0 scale factor when it should be a larger scale since the "Content" object's ActualWidth/ActualHeight are 480x800...

   System.Windows.Application.Current.Host.Content.ScaleFactor;  // = 100

   Windows.Graphics.Display.DisplayProperties.ResolutionScale;  // = Scale100Percent

   Windows.Graphics.Display.DisplayProperties.LogicalDpi;  // = 96.0



[TOPIC: post.html]

[TOPIC: post.html]
#18

mimoz

[GLOBAL: userInfoPane.html]
mimoz
  • Observer

  • 14 posts
  • Corona SDK

We have tried running our Corona Cards apps on some devices running Windows Phone 10: Lumia 535, Lumia 640XL, Lumia 735 and Lumia 550. There was problem on all of them as in welton-alexandre's first post images (Hello world example). Apps are scaled down and black borders are on top and from side (on Lumia 535 there is diffrent problem, black bar is on the bottom if you hide Windows nav buttons). 
 
You can try to reproduce this by creating new Corona Cards app (Hello World default template) in Visual Studio (2013 or 2015) and deploy it on any Windows 10 phone. 
 
We have commented out 3 lines 
// Set up the CoronaPanel control to render fullscreen via the DrawingSurfaceBackgroundGrid control.
// This significantly improves the framerate and is the only means of achieving 60 FPS.
/*fCoronaPanel.BackgroundRenderingEnabled = true;
fDrawingSurfaceBackgroundGrid.SetBackgroundContentProvider(fCoronaPanel.BackgroundContentProvider);
fDrawingSurfaceBackgroundGrid.SetBackgroundManipulationHandler(fCoronaPanel.BackgroundManipulationHandler);*/
 
regarding DrawingSurfaceBackgroundGrid and now apps are rendered FINE in fullscreen, not scaled down. 
 
Is this good aproach? Do you use DrawingSurfaceBackgroundGrid in your game Corona Cannon published on MS Store? Can you share VS project of Corona Cannon?
 
Thanks!


[TOPIC: post.html]
#19

Joshua Quick

[GLOBAL: userInfoPane.html]
Joshua Quick
  • Moderator

  • 3,397 posts
  • Corona Staff

I looked up the specs of all the Lumia modes you listed.  The one thing they *all* have in common is that they use an onscreen navigation bar.  So far, this appears to be never an issue with a device that has physical navigation buttons.

 

We don't have those specific devices.  So, can you run the code that I've posted above to retrieve the resolution and scale factor being reported by Microsoft's APIs please?  I suspect that Microsoft's APIs are returning 480x800 resolutions for all of those devices, which would account for the scaling issues.

 

Regarding disabling background rendering, you'll run into 2 issues with that.  First, 60 FPS is impossible because rendering to a Silverlight view/control is the equivalent to taking a screenshot every frame; it's slow, but it'll work.  Second, the touch/tap points Corona reports will likely be wrong because they're based on the resolution reported by Microsoft's APIs I've mentioned above.

Note that the reason that disable background rendering works is because we're rendering to the view's coordinates and letting Silverlight scale up the view for us.  But background rendering involves us rendering straight to the screen in pixels for best performance and this means Microsoft's APIs *need* to return the correct resolution and scale in order for us to render fullscreen.



[TOPIC: post.html]
#20

mimoz

[GLOBAL: userInfoPane.html]
mimoz
  • Observer

  • 14 posts
  • Corona SDK

I have installed Corona Cannon ( https://www.microsoft.com/pt-br/store/games/corona-cannon/9nblggh5pwvn ) to all my devices. Game works fine, without any scaling.
If I build Corona Cannon from github ( https://github.com/coronalabs-samples/CoronaCannon ) with BackgroundRenderingEnabled as recommended, game is scaled down, on Lumia 640 XL whole game is rendered to only 1/4 of the screen.
 
So I assume that if you were using BackgroundRenderingEnabled in Corona Cannon project, there is a *solution*. Maybe it has something to do with your Visual Studio project setup.
 
Is there a way that you share your Corona Cannon Visual Studio project and Corona Cards version it was build and published with? Which version of Visual Studio and Visual Studio update were you using? I would like to build Corona Cannon as you did.
 
Anyway, a lot of MS Lumia Windows Phone 10 devices are without physical navigation buttons, so we must figure out workaround :).
 
Thanks!
 
Output >>>>>
 
Lumia 535
### Resolution Scale: Scale100Percent
### Content Scale: 1
### Content Size: 480x800
### Page Size: 480x771
### CoronaPanel Size: 480x771
### RawDpiX: 196,645161290323
### RawDpiY: 196,645161290323
### PhysicalScreenResolution: 480x800
### Logical DPI: 96
Platform: Not Supported Yet / ARM / 8.0 / ANGLE (Qualcomm Adreno 305 Direct3D11 vs_2_0 ps_2_0) / OpenGL ES 2.0 (ANGLE 1.2.0.2446) / 2016.2830 / English (United States) | US | en-US | en
 
Lumia 640 XL
### Resolution Scale: Scale150Percent
### Content Scale: 1
### Content Size: 480x800
### Page Size: 480x772
### CoronaPanel Size: 480x772
### RawDpiX: 171.718309859155
### RawDpiY: 171.718309859155
### PhysicalScreenResolution: 480x800
### Logical DPI: 144
Platform: Not Supported Yet / ARM / 8.0 / ANGLE (Qualcomm Adreno 305 Direct3D11 vs_2_0 ps_2_0) / OpenGL ES 2.0 (ANGLE 1.2.0.2446) / 2016.2830 / English (United States) | US | en-US | en
 
Lumia 550
### Resolution Scale: Scale150Percent
### Content Scale: 1
### Content Size: 480x800
### Page Size: 480x768
### CoronaPanel Size: 480x768
### RawDpiX: 210.206896551724
### RawDpiY: 210.206896551724
### PhysicalScreenResolution: 480x800
### Logical DPI: 144
Platform: Not Supported Yet / ARM / 8.0 / ANGLE (Qualcomm Adreno 304 Direct3D11 vs_2_0 ps_2_0) / OpenGL ES 2.0 (ANGLE 1.2.0.2446) / 2016.2830 / English (United States) | US | en-US | en


[TOPIC: post.html]
#21

Joshua Quick

[GLOBAL: userInfoPane.html]
Joshua Quick
  • Moderator

  • 3,397 posts
  • Corona Staff

Interesting.  If you look at the results of the Lumia 550 and 640XL, notice that the "Resolution Scale" and "Content Scale" differ.  A ContentScale of 1.0 is wrong for those devices, but the ResolutionScale of "Scale150Percent" is correct.  And the LogicalDPI of 144 is correct for both of the devices too.  This is good news.  This means we can implement a work-around.  All we have to do is compare the 2 scale factors (which are supposed to be the same; that's the Microsoft bug) and choose the greater value.  Thanks for this @primoz.  :)

 

I was also able to reproduce this bug in the Windows 10 Mobile emulators too, but only if they're set up as follows:

  • Must be a 720P or WXGA resolution Win10 emulator.  (WVGA, 1080P, and QHD scale correctly.)
  • Must be set up to use a software navigation bar.  (Scales correctly if emulating with hardware buttons.)

You can enable the software navigation bar in the Windows Phone emulator by doing the following:

  1. Launch the Windows 10 Mobile emulator via Visual Studio.
  2. Click the [>>] button on the floating toolbar to the right of the emulator to show the "Additional Tools" window.
  3. Click on the "Optional Settings" tab.
  4. Check the "Software buttons" checkbox.
  5. Click the Apply button.  (This will cause the emulator to reboot.)

After doing the above, the emulator reports the same values you've noted on the Lumia 550 and 640 XL where the "ContentScale" property returns the wrong value but the "ResolutionScale" property returns the correct value.  This is a big help to us.

 

So, I'll go ahead and implement a work-around today and try to get you guys a daily build as soon as possible.  Again, thanks for your help on this.

 

Unfortunately, the Lumia 535 appears to be a lost cause.  Notice that all of Microsoft's APIs return the wrong values for that device.  The above mentioned work-around will not work on this device.  The only possible solution that I can think of is to identify that device by its make/model name and if it is a Lumia 535, then assume hardcode the resolution and scale factor on our end.  *ugh* I would prefer not to hardcode hacks like this since they're a maintenance issue on our end, but if it's a popular device then we may consider doing it.  I'll have to ponder our options.

 

Regarding the WP8 version of Corona Cannon, I don't have access to the code either.  But I'll reach out to the developer on how it's set up.  :)



[TOPIC: post.html]
#22

mimoz

[GLOBAL: userInfoPane.html]
mimoz
  • Observer

  • 14 posts
  • Corona SDK

Thank you Joshua! Please let us know when daily build with work-around available. I'll be happy to test.
 

Regarding Lumia 535, it would be great to put hack into daily build. +1 from my side (need to update 40 apps, and don't want to do it twice :-) ).



[TOPIC: post.html]
#23

Joshua Quick

[GLOBAL: userInfoPane.html]
Joshua Quick
  • Moderator

  • 3,397 posts
  • Corona Staff

Okay. I need you to do 1 more test for me. Please run the following code on your Lumia 535 and tell me what it outputs...

System.Diagnostics.Debug.WriteLine("### DeviceManufacturer: {0}", Microsoft.Phone.Info.DeviceStatus.DeviceManufacturer);
System.Diagnostics.Debug.WriteLine("### DeviceName: {0}", Microsoft.Phone.Info.DeviceStatus.DeviceName);

The above is needed in order for me to identify your Lumia 535 device in code. Thanks!



[TOPIC: post.html]
#24

Joshua Quick

[GLOBAL: userInfoPane.html]
Joshua Quick
  • Moderator

  • 3,397 posts
  • Corona Staff

Everyone,

 

Daily build #2860 will provide our work-around for those Windows 10 Mobile scaling bugs you've seen on devices having an onscreen navigation bar.  Just note that this is a "blind fix" since I can't reproduce this issue on my devices.  I can only sort-of reproduce it in the Windows Phone emulators.  Please let me know how it works out for you all.  Also note that it won't solve the problems you are seeing with the Lumia 535 unfortunately.

 

Please test the new build with the following "main.lua" code.  The following project does not need a "config.lua" file.  The content area will be displayed white, and if you do add a "config.lua" file, then the letterbox areas will appear red.

-- Hide the status bar.
display.setStatusBar(display.HiddenStatusBar)

-- Display a black bacground rectangle in Corona's content region and red in the letterbox region.
local backgroundRectangle = display.newRect(0, 0, 0, 0)
--backgroundRectangle:setFillColor(0, 0, 0)
backgroundRectangle:setFillColor(1, 1, 1)
display.setDefault("background", 1, 0, 0)
--display.setDefault("background", 1, 1, 1)

-- Define the rest of our variables.
local textObject = nil
local textGuideLineTop = nil
local textGuideLineBottom = nil
local textGuideLineLeft = nil
local textGuideLineRight = nil

-- Creates a red horizontal line at the given position within the content region.
-- It will not draw the line in the letterbox region.
local function createHorizontalGuidingLineAt(positionY)
	local line = display.newLine(0, positionY, display.contentWidth, positionY)
	line:setStrokeColor(1, 0, 0)
	line.strokeWidth = display.contentScaleY		-- Set line width to 1 pixel.
	return line
end

-- Creates a red vertical line at the given position within the content region.
-- It will not draw the line in the letterbox region.
local function createVerticalGuidingLineAt(positionX)
	local line = display.newLine(positionX, 0, positionX, display.contentHeight)
	line:setStrokeColor(1, 0, 0)
	line.strokeWidth = display.contentScaleX		-- Set line width to 1 pixel.
	return line
end

-- Creates and/or updates all display objects to fit the window.
local function updatePositions()
	-- Update the text object.
	local pixelWidth = display.pixelWidth
	local pixelHeight = display.pixelHeight
	if ((system.orientation == "landscapeRight") or (system.orientation == "landscapeLeft")) then
		local length = pixelWidth
		pixelWidth = pixelHeight
		pixelHeight = length
	end
	local message = "Window Size: " .. tostring(pixelWidth) .. "x" .. tostring(pixelHeight) .. " pixels"
	print(message)
	print("Content Size: " .. tostring(display.contentWidth) .. "x" .. tostring(display.contentHeight))
	print("Orientation: " .. tostring(system.orientation) .. ", Content Scale: " .. tostring(display.contentScaleX))
	if textObject then
		textObject.text = message
		textObject.size = 0
		textObject.x = display.contentCenterX
		textObject.y = display.contentCenterY
	else
		local textSettings =
		{
			x = display.contentCenterX,
			y = display.contentCenterY,
			text = message,
			align = "center",
		}
		textObject = display.newText(textSettings)
--		textObject = display.newEmbossedText(textSettings)
textObject:setFillColor(0, 0, 0)
	end

-- To prevent text blurriness, make sure it is displayed on a whole pixel.
local xInPixels = textObject.x * display.contentScaleX
local yInPixels = textObject.y * display.contentScaleY
local xOffset = (math.floor(xInPixels) - xInPixels) / display.contentScaleX
local yOffset = (math.floor(yInPixels) - yInPixels) / display.contentScaleY
textObject:translate(xOffset, yOffset)


	-- Update the black background rectangle to fit the content region.
	backgroundRectangle.x = display.contentCenterX
	backgroundRectangle.y = display.contentCenterY
	backgroundRectangle.width = display.contentWidth
	backgroundRectangle.height = display.contentHeight
	
	-- Re-position the text object's guiding lines.
	local bounds = textObject.contentBounds
	if (textGuideLineTop) then textGuideLineTop:removeSelf() end
	if (textGuideLineBottom) then textGuideLineBottom:removeSelf() end
	if (textGuideLineLeft) then textGuideLineLeft:removeSelf() end
	if (textGuideLineRight) then textGuideLineRight:removeSelf() end
	textGuideLineTop = createHorizontalGuidingLineAt(bounds.yMin)
	textGuideLineBottom = createHorizontalGuidingLineAt(bounds.yMax)
	textGuideLineLeft = createVerticalGuidingLineAt(bounds.xMin)
	textGuideLineRight = createVerticalGuidingLineAt(bounds.xMax)
end
updatePositions()

-- Called when the window has been resized. Re-layouts the app display objects to fit.
local function onResized(event)
	updatePositions()
end
Runtime:addEventListener("resize", onResized)

-- Called when a key has been pressed/released.
local function onKey(event)
	-- If this is a Windows app, then toggle fullscreen mode via the F11 key.
	if (system.getInfo("platformName") == "Win") and (event.keyName == "f11") and (event.phase == "down") then
		local windowMode = native.getProperty("windowMode")
		if (windowMode == "fullscreen") then
			native.setProperty("windowMode", "normal")
		elseif (windowMode ~= nil) then
			native.setProperty("windowMode", "fullscreen")
		end
	end
end
Runtime:addEventListener("key", onKey)

system.activate( "multitouch" )
local touchCircles = {}
local function onTouch(event)
	if (event.phase == "began") then
		local circle = display.newCircle(event.x, event.y, display.contentWidth * 0.2)
		circle:setFillColor(0, 0, 1, 0.75)
		touchCircles[event.id] = circle
	elseif (event.phase == "moved") then
		local circle = touchCircles[event.id]
		if circle then
			circle.x = event.x
			circle.y = event.y
		end
	elseif (event.phase == "ended") or (event.phase == "canceled") then
		local circle = touchCircles[event.id]
		if circle then
			touchCircles[event.id] = nil
			circle:removeSelf()
		end
	end
end
Runtime:addEventListener("touch", onTouch)

The above project will display a circle when you touch the screen.  Can you please drag your finger from top to bottom on the screen to verify that the circle is always centered around your finger please?  This tests that our touch coordinates are being correctly converted to pixels.

 

Also note that I *suspect* that your Lumia 550 and 640 XL might display a red or black rectangle onscreen.  I say this because the height being reported by Microsoft's APIs are a little short for those devices.  I'm guessing that Microsoft made it that way on purpose and that the bottom navigation bar no longer overlays on top of Silverlight apps like how it did on Windows Phone 8.1.



[TOPIC: post.html]
#25

mimoz

[GLOBAL: userInfoPane.html]
mimoz
  • Observer

  • 14 posts
  • Corona SDK

Thank you! I am unable to download #2860. It is not visible yet... Will test when available.

 

Lumia 535 output with DeviceName >>>

### Resolution Scale: Scale100Percent
### Content Scale: 1
### Content Size: 480x800
### Page Size: 480x771
### CoronaPanel Size: 480x771
### RawDpiX: 196,645161290323
### RawDpiY: 196,645161290323
### PhysicalScreenResolution: 480x800
### Logical DPI: 96
### DeviceManufacturer: Microsoft
### DeviceName: RM-1089_1024
Platform: Not Supported Yet / ARM / 8.0 / ANGLE (Qualcomm Adreno 305 Direct3D11 vs_2_0 ps_2_0) / OpenGL ES 2.0 (ANGLE 1.2.0.2446) / 2016.2830



[topic_controls]
Page 1 of 2 1 2
 
[/topic_controls]