Possible code changes to help with alignment

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
jmarshall Offline
Team-XBMC Developer
Posts: 24,523
Joined: Oct 2003
Reputation: 138
Post: #1
hi all,

as you know, scaling stuff for differing resolutions is a pain currently with python. you have to retrieve the width/height and use that info to scale where you place everything. this also has to be handled by python currently (ie in every script).

the ability to do the scaling within xbmc is ofcourse already there. i'm thinking of perhaps adding the ability for you to specify how python controls should be scaled in a single function call (ie basically specify somewhere in your script what resolution it is designed for, and then not have to worry about other resolutions at all)

the idea is you'd do something like:

xbmc.setscriptresolution(pal_4x3)

and if xbmc is running in a different resolution, it'll auto-scale the controls at render time.

please let me know what you think of this idea.

i'll probably also add xbmc.getresolution() at the same time so that if you want to, you can do custom setups for each resolution.

cheers,
jonathan

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]
find quote
C-Quel Offline
Retired Team-XBMC Member
Posts: 1,378
Joined: Aug 2004
Reputation: 0
Post: #2
that is a great idea. would be nice to see that implemented.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]

If scraper related please always grab the latest XML relevant to the content you are trying to grab info for from this link https://xbmc.svn.sourceforge.net/svnroot...m/scrapers

System Specs:

A Computer with loads of shiny things that make a noise and bring life to my tv, and xbmc ofc :)

iNerd Store

iNerd Forum
find quote
Nuka1195 Online
Skilled Python Coder
Posts: 3,917
Joined: Dec 2004
Reputation: 17
Post: #3
yes it is a pain, this would be great.

would this scale just positions or could it also scale control's height and width. that would be nice, cause sometimes a controls position is based on another controls height/width.

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 24,523
Joined: Oct 2003
Reputation: 138
Post: #4
yes, it'll scale both position and width and height. i'll take a look at how xbmc handles it at the moment (been a while since i wrote it) to see how easily it can be done.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]
find quote
Bernd Offline
Senior Member
Posts: 211
Joined: Mar 2005
Reputation: 0
Post: #5
sounds great :thumbsup:

will it also scale according to pal / ntsc?

if i remember right the skin contains different control positions for pal and ntsc.

bernd
find quote
Kain Offline
Senior Member
Posts: 110
Joined: May 2004
Reputation: 0
Post: #6
dude that would be awesome, a lot of my favorite scripts dont have 720p support Sad
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 24,523
Joined: Oct 2003
Reputation: 138
Post: #7
ok, as promised, two new window functions have been added:

getresolution() - returns the current resolution that xbmc is running in. numbers between 0 and 9 inclusive - you can find them in guilib/graphicscontext.h, but here they are for reference anyway, including there frame sizes and pixel ratios.

hdtv_1080i = 0, (1920x1080, 16:9, pixels are 1:1)
hdtv_720p = 1, (1280x720, 16:9, pixels are 1:1)
hdtv_480p_4x3 = 2, (720x480, 4:3, pixels are 4320:4739)
hdtv_480p_16x9 = 3, (720x480, 16:9, pixels are 5760:4739)
ntsc_4x3 = 4, (720x480, 4:3, pixels are 4320:4739)
ntsc_16x9 = 5, (720x480, 16:9, pixels are 5760:4739)
pal_4x3 = 6, (720x576, 4:3, pixels are 128:117)
pal_16x9 = 7, (720x576, 16:9, pixels are 512:351)
pal60_4x3 = 8, (720x480, 4:3, pixels are 4320:4739)
pal60_16x9 = 9 (720x480, 16:9, pixels are 5760:4739)

this should help you to custom design for a particular resolution (eg a widescreen one).

setcoordinateresolution(long resolution)

this sets the coordinate resolution that you are using for the controls.

eg. you just design your script for (say) pal_4x3, thus having all coordinates designed so that it'll fit nicely onto a 720x576 drawing area (remember to allow for overscan!Wink.

then you call setcoordinateresolution(pal_4x3), and if the user running your script is using 720p, xbmc will auto-scale all the control positions and sizes at render time up so that everything fits into 1280x720.

you can call setcoordinateresolution() whenever you like - it doesn't have to be before you create the controls, though that is the logical place to do so.

i haven't tested the above functions, so please test and report back on how fantastically it works Wink

cheers,
jonathan

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]
find quote
EnderW Offline
Skilled Python Coder
Posts: 249
Joined: Feb 2005
Reputation: 0
Post: #8
wonderful, wonderful! nice work

i don't have time to test right now, but i hope somebody else will Smile

xbmcscripts.com administrator
find quote
Kain Offline
Senior Member
Posts: 110
Joined: May 2004
Reputation: 0
Post: #9
sweet dude, ill try it on the xmovie guide tonight when i get home from work :kickass:
find quote
nianhbg Offline
Member
Posts: 85
Joined: Mar 2004
Reputation: 0
Location: sweden
Post: #10
:thumbsup: :bowdown:

Livingroom: MacMini Mid summer 2010 4Gb RAM HDMI to Pioneer PDP-434 Plasma 1080i
Kitchen: one xbox 1.1 executer 2.3 chip 120 GB in HD 720p mode
Bedroom: Computer Intel Quad 9400, 8 GB RAM, NVIDIA GTX260, Vista Ultimate 64, Ubuntu 10.10
find quote
Post Reply