Most graphics statements in sB multiply the coordinates by 2. That means that a 700 for your y value is actually printing it at 1400. The DRAW PIXEL command is the only one that comes to mind that draws to a single pixel location rather than a dot that is a 2 x2 pixel cluster. So if you drew a pixel with your coordinates, it would be where you expected it.
This was apparently done by Apple to aid in ensuring compatibility of iOS between different devices.
Music Player
- rbytes
- Posts: 1338
- Joined: Sun May 31, 2015 12:11 am
- My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet - Location: Calgary, Canada
- Flag:
- Contact:
Re: Music Player
The only thing that gets me down is gravity...
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: Music Player
DRAW PIXEL is the only command which depends on screen scale, because it works with pixels, not points.ricardobytes wrote:Most graphics statements in sB multiply the coordinates by 2. That means that a 700 for your y value is actually printing it at 1400. The DRAW PIXEL command is the only one that comes to mind that draws to a single pixel location rather than a dot that is a 2 x2 pixel cluster. So if you drew a pixel with your coordinates, it would be where you expected it.
This was apparently done by Apple to aid in ensuring compatibility of iOS between different devices.
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: Music Player
Yes, it should be 700 points from the top.Ramzan wrote:I have a question. When I use BUTTON AT 30,700 it creates a button that is really far down the screen, near the bottom third in fact. I thought 30,700 meant 30 pixels to the right and 700 pixels down. Since the iPad Air 2's resolution is 1536 X 2048 in portrait mode the button should appear in the top third. So what's going on?
If you think this is a bug, please submit it as a bug report with screenshot and the code you used to make a button. Thank you!
Re: Music Player
So let me get this straight. 30,700 does NOT mean 30 PIXELS to the right and 700 PIXELS down...
...instead it means 30 POINTS to the right and 700 POINTS down...
...and 1 point = 2 pixels?
...instead it means 30 POINTS to the right and 700 POINTS down...
...and 1 point = 2 pixels?
Re: Music Player
This "strange" behavior makes the app more
compatible -> device independent ...
Out of the Help File:
In smart BASIC graphics commands are usually Retina-independent, so drawing line from 0,0 to 100,100 will look similar on Retina and on non-Retina screen. But pixel-level commands (for example DRAW PIXEL) are Retina-dependent, because they have access to physical pixels. Screen scale value returned by function SCREEN_SCALE() shows whether screen is Retina or not.
Your actual screen size for all graphics command
beside for xxxx pixel command is:
PRINT SCREEN_HEIGHT()
PRINT SCREEN_WIDTH()
Run this little code starting in landscape and
in portrait orientation...
compatible -> device independent ...
Out of the Help File:
In smart BASIC graphics commands are usually Retina-independent, so drawing line from 0,0 to 100,100 will look similar on Retina and on non-Retina screen. But pixel-level commands (for example DRAW PIXEL) are Retina-dependent, because they have access to physical pixels. Screen scale value returned by function SCREEN_SCALE() shows whether screen is Retina or not.
Your actual screen size for all graphics command
beside for xxxx pixel command is:
PRINT SCREEN_HEIGHT()
PRINT SCREEN_WIDTH()
Run this little code starting in landscape and
in portrait orientation...
Re: Music Player
Ok I've just been reading up about points on iOS.
I have a question.
If I have a BUTTON AT 30,700 will this be in the same position for every iPhone and iPad regardless of its resolution? In other words will Smart Basic automatically scale the size and position of the button to make it appear at the same position?
30,700 means 60 pixels across and 1400 pixels down on iPad Air 2. An iPhone 6 has a resolution of 750 X 1334. Will the button be off the screen or will it be scaled accordingly?
I have a question.
If I have a BUTTON AT 30,700 will this be in the same position for every iPhone and iPad regardless of its resolution? In other words will Smart Basic automatically scale the size and position of the button to make it appear at the same position?
30,700 means 60 pixels across and 1400 pixels down on iPad Air 2. An iPhone 6 has a resolution of 750 X 1334. Will the button be off the screen or will it be scaled accordingly?
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: Music Player
All sB commands operate in points (except couple of pixel commands which work with pixels) in order to maintain equal screen coordinates on any iOS device.Ramzan wrote:Ok I've just been reading up about points on iOS.
I have a question.
If I have a BUTTON AT 30,700 will this be in the same position for every iPhone and iPad regardless of its resolution? In other words will Smart Basic automatically scale the size and position of the button to make it appear at the same position?
30,700 means 60 pixels across and 1400 pixels down on iPad Air 2. An iPhone 6 has a resolution of 750 X 1334. Will the button be off the screen or will it be scaled accordingly?
SCREEN_HEIGHT() function returns number of points of your device screen height.
Re: Music Player
So in other words 30,700 will work on every phone and iPad because it is a retina-independent command?
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: Music Player
Yes. But note that not all iPhones has such big screen.Ramzan wrote:So in other words 30,700 will work on every phone and iPad because it is a retina-independent command?
Re: Music Player
How do I make a button then that will be in the same position on all devices?