Music Player

User avatar
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: Canada
Contact:

Re: Music Player

Post by rbytes »

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.
The only thing that gets me down is gravity...

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: Music Player

Post by Mr. Kibernetik »

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.
DRAW PIXEL is the only command which depends on screen scale, because it works with pixels, not points.

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: Music Player

Post by Mr. Kibernetik »

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?
Yes, it should be 700 points from the top.
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!

Ramzan
Posts: 26
Joined: Mon Jan 04, 2016 11:13 pm
My devices: iPad
Flag: Great Britain

Re: Music Player

Post by Ramzan »

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?

Operator
Posts: 138
Joined: Mon May 06, 2013 5:52 am

Re: Music Player

Post by Operator »

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...

Ramzan
Posts: 26
Joined: Mon Jan 04, 2016 11:13 pm
My devices: iPad
Flag: Great Britain

Re: Music Player

Post by Ramzan »

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?

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: Music Player

Post by Mr. Kibernetik »

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?
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.
SCREEN_HEIGHT() function returns number of points of your device screen height.

Ramzan
Posts: 26
Joined: Mon Jan 04, 2016 11:13 pm
My devices: iPad
Flag: Great Britain

Re: Music Player

Post by Ramzan »

So in other words 30,700 will work on every phone and iPad because it is a retina-independent command?

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: Music Player

Post by Mr. Kibernetik »

Ramzan wrote:So in other words 30,700 will work on every phone and iPad because it is a retina-independent command?
Yes. But note that not all iPhones has such big screen.

Ramzan
Posts: 26
Joined: Mon Jan 04, 2016 11:13 pm
My devices: iPad
Flag: Great Britain

Re: Music Player

Post by Ramzan »

How do I make a button then that will be in the same position on all devices?

Post Reply