Avatar of James Hancock
James Hancock
Flag for United States of America asked on

What is the correct strategy for coding the GUI of phone/tablet/browser games?

Hi
Probably an obvious question, but considering the differences between phones and tablets for javascript games..

... Is the proper way to do browser + device games' object locations in fractions of device height and width? And size game objects as ratios also? What must I do concerning strategies for phone/tablet+browser? AND device rotation accommodations?
How does Javascript detect phone / tablet/ browser?

I don't have a tablet. Which is the best to get for game dev? many ... iPad, Surface . . . not necessary, any?
Let's consider a word game like Wordscapes. The main interface is the circular  object to select letters for a word-answer. Is that just 1/4 of width distance from border and x% width for the circle diameter?
How different is it, really, on phone/tablet? What is the proper solution for all this?

Thanks
iPadGame ProgrammingTabletsJavaScriptiOS

Avatar of undefined
Last Comment
James Hancock

8/22/2022 - Mon
David Johnson, CD

you query the viewport size https://ryanve.com/lab/dimensions/
James Hancock

ASKER
Can this be used to determine the environment type? browser / phone / tablet? Specific device? Could I compare the width and height values to known device measurements, or is there a better way? What if it is a new device, with new dimensions I don't have waiting to compare to?

DO you think I should ground my object placement in pixels or fractions of the width/height?

Thanks
David Johnson, CD

just scale your output for the viewport.  google responsive web app
you could use the useragent supplied by the browser (can be spoofed)
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
James Hancock

ASKER
Do you mean window. width,. . height, etc? and locate game objects based on fractions of width and height?

What help would a Goog responsive web app provide?

Thanks
ASKER CERTIFIED SOLUTION
Jackie Man

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
James Hancock

ASKER
Thanks all
James Hancock

ASKER
Thanks
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.