“belltown” wrote:
The value you should use for ui_resolutions should represent the canvas size that your code is drawing to. It has nothing whatsoever to do with what resolution it will run on. So, if your code assumes a canvas size of 1280x720, then use: ui_resolutions=hd. However, if your code computes sizes and coordinates automatically based on the values of ifDeviceInfo.GetUIResolution() then it may not matter what value you use.
If you have a specific image that is a particular size, assuming it was made to fit within a specific screen canvas size, then you may find it helpful to specify the associated ui_resolutions value (otherwise you’d have to specify multiple image sizes).
When your code runs on any device that is NOT listed in your ui_resolutions list, then the UI will scale AUTOMATICALLY for that device. This automatic scaling ONLY happens for a resolution you do NOT specify. If you specify fhd,hd for example, and you draw a 640x360 image that was designed to take up half the width and height on an HD canvas, the image will render correctly on the hd device (because it was sized for a resolution you specified), will also render somewhat okay on an SD device (because it will be automatically scaled, since you didn’t specify sd), but will NOT render correctly on the FHD device (because it won’t automatically scale if you specified fhd and it’s running on an FHD device – so you’d either need a separate image sized for FHD dimensions, or only specify ui_resolutions=hd).
Man, this makes it SO MUCH easier… Few times I wanted to start a thread how bad is that Roku doesn’t auto scale for whatever resolution. I don’t know how I ended up with ui_resolutions=hd, fhd in the manifest so I had to take care of scaling all elements by hand. Here is some code I wrote to make sure everything looks good in hd and fhd and I call those functions on all UI elements:
function getScaleWH()
di = CreateObject("roDeviceInfo")
ds = di.GetDisplaySize()
return {dw: ds.w, dh: ds.h, w: 1280, h: 720}
end function
function screenWH()
ds = getScaleWH()
return {w: ds.dw, h: ds.dh}
end function
function calculateWH(w as float, h as float)
ds = getScaleWH()
return {w: ((ds.dw * w)/ds.w), h: ((ds.dh * h)/ds.h)}
end function
sub calculateTranslation(obj as object)
ds = getScaleWH()
obj.translation = [((ds.dw * obj.translation[0])/ds.w), ((ds.dh * obj.translation[1])/ds.h)]
end sub
sub calculateObjWH(obj as object)
ds = getScaleWH()
if obj.width <> invalid then
obj.width = ((ds.dw * obj.width)/ds.w)
if obj.height <> invalid then
obj.height = ((ds.dh * obj.height)/ds.h)
end if
else if obj.minWidth <> invalid then
obj.minWidth = ((ds.dw * obj.minWidth)/ds.w)
obj.height = ((ds.dh * obj.height)/ds.h)
else if obj.itemSize <> invalid then
obj.itemSize = [((ds.dw * obj.itemSize[0])/ds.w), ((ds.dh * obj.itemSize[1])/ds.h)]
else
' nothing yet
print "nothing to size"
end if
end sub
I was designing the UI in HD but then it didn’t look well when FHD was in the manifest (which I thought it was necessary to support FHD)… Well, I guess I’ll have to delete some of my code and make everything simpler. BTW, which screen size should I make the UI for (aka "what value should I have in ui_resolutions)? Majority of TVs now are FHD, right?