Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (481)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (548)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Wide Screen support for games.  (Read 1610 times)
0 Members and 1 Guest are viewing this topic.
Offline zappsweden

Junior Member




Java games rock!


« Posted 2006-12-20 19:50:05 »

Some ppl are complaning that my game shows a streched view when they run with a wide screen display. I am wondering is there any way for me to detrmine that they are using a wide screen display? Is there any resolution (for instance 1440 x 900) that only widescreen display has so that i can determine this and run the game in windowed mode instead?
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 781
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #1 - Posted 2006-12-20 20:08:46 »

float ratio = screen.w/screen.h;

if(ratio is about 4/3) // 1028x1024 is a nasty one
...
else if(ratio is about 16/9)
...
else
...

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline zappsweden

Junior Member




Java games rock!


« Reply #2 - Posted 2006-12-20 20:22:43 »

ok, there seems to be some nice stuff in Toolkit.getDefaultToolkit() to get the dimension of the screen Smiley
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 781
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #3 - Posted 2006-12-20 20:25:55 »

java.awt.GraphicsEnvironment.getDefaultScreenDevice().getDisplayMode() getWidth() | getHeight()

java.awt.Toolkit.getDefaultToolkit().getScreenSize() width | height

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #4 - Posted 2006-12-20 20:53:30 »

>1028x1024 is a nasty one

Thats 5:4. <edit>Or a stupid res used on a 4:3 crt.</edit>

The popular ratios are 4:3, 5:4, 16:10 and 16:9 (rare).

弾幕 ☆ @mahonnaiseblog
Offline zappsweden

Junior Member




Java games rock!


« Reply #5 - Posted 2006-12-20 20:59:31 »

>1028x1024 is a nasty one

Thats 5:4. <edit>Or a stupid res used on a 4:3 crt.</edit>

The popular ratios are 4:3, 5:4, 16:10 and 16:9 (rare).

Currently i am using this

if(ratio<1.4) goto fullscreen;
else run in windowed mode;

Just so that those 16:9 screens wont get odd graphics.
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 781
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #6 - Posted 2006-12-20 21:16:05 »

Is 16:9 really rare?

It's the ratio humans see the outside world Cool

that's why they invented the wide-screen in the first place

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #7 - Posted 2006-12-20 21:34:30 »

Currently i am using this

if(ratio<1.4) goto fullscreen;
else run in windowed mode;

Just so that those 16:9 screens wont get odd graphics.

Or ... just write your GUI properly so that it uses a layout manager and doesnt arbitrarily stretch the screen? [/facetious]

Seriously, though, you should always use a layout manager, even if its just a very simple one that adds borders to the sides or top/bottom and keeps fixed ratios internally. IME its pretty easy to write your own manager that will cope with *any* resolution, and then you dont annoy the people whose large monitors you're wasting Smiley.

malloc will be first against the wall when the revolution comes...
Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #8 - Posted 2006-12-20 22:08:14 »

Is 16:9 really rare?

It's the ratio humans see the outside world Cool

that's why they invented the wide-screen in the first place

Yes, widescreen PC displays are usually 16:10. Not really sure why... guess it makes sense in this context to have at least that much height.

弾幕 ☆ @mahonnaiseblog
Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #9 - Posted 2006-12-21 10:13:19 »

Can you really reliably determine the screen aspect ratio from the resolution? I suppose this makes the assumtion that pixels are of a fixed aspect ratio, which I think they aren't. What if your drivers support 1024:768 on a wide screen?
I suppose you can do a guess at best, but you might still need an option to manually switch between 4:3 and 16:9 displays.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline darkprophet

Senior Member




Go Go Gadget Arms


« Reply #10 - Posted 2006-12-21 10:32:18 »

Look at the maximum resolution from the display modes. That is indicitive of the ratio of the screen. Do not look at the current resolution...

DP

Friends don't let friends make MMORPGs.

Blog | Volatile-Engine
Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #11 - Posted 2006-12-21 10:39:54 »

Oh yea... I made some images a while back to visualize things a bit:
http://kaioa.com/k/ar1.png (scaled to same height)
http://kaioa.com/k/ar2.png (scaled to same width)

弾幕 ☆ @mahonnaiseblog
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

atombrot (27 views)
2014-08-19 09:29:53

Tekkerue (25 views)
2014-08-16 06:45:27

Tekkerue (23 views)
2014-08-16 06:22:17

Tekkerue (15 views)
2014-08-16 06:20:21

Tekkerue (22 views)
2014-08-16 06:12:11

Rayexar (61 views)
2014-08-11 02:49:23

BurntPizza (39 views)
2014-08-09 21:09:32

BurntPizza (31 views)
2014-08-08 02:01:56

Norakomi (37 views)
2014-08-06 19:49:38

BurntPizza (67 views)
2014-08-03 02:57:17
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!