Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (522)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (589)
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  
  MAC OSX Fullscreen  (Read 1132 times)
0 Members and 1 Guest are viewing this topic.
Offline chrisethompson

Senior Newbie


Medals: 1
Exp: 5 years



« Posted 2012-12-04 02:56:19 »

Here's a strange one.  I've developed a game on the PC and just tested it on a MAC.  It works fine, except when I press F1 to toggle into Fullscreen mode, the screen spins around and around like crazy.  Toggling back from fullscreen does not stop the spinning.  You have to stop the game and restart.

Anyone else seen this?  I've basically used the fillscreen code from one of the tutorials.  Is there a fix?

thanks

Chris
Offline Ultroman

JGO Knight


Medals: 25
Projects: 1


Snappin' at snizzes since '83


« Reply #1 - Posted 2012-12-04 03:16:00 »

That's really strange...wait, you said OSX, nevermind then.

- Jonas
Offline Regenuluz
« Reply #2 - Posted 2012-12-04 08:56:51 »

That's really strange...wait, you said OSX, nevermind then.

Really helpful. What should anyone do without that kind of comments. Smiley

EDIT:

Maybe provide the code you use for fullscreen? Smiley
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Ultroman

JGO Knight


Medals: 25
Projects: 1


Snappin' at snizzes since '83


« Reply #3 - Posted 2012-12-04 10:34:38 »

That's really strange...wait, you said OSX, nevermind then.

Really helpful. What should anyone do without that kind of comments. Smiley
Sorry, couldn't resist.

Maybe provide the code you use for fullscreen? Smiley
I just forgot to write this. I did come here to help Smiley

- Jonas
Offline gouessej
« Reply #4 - Posted 2012-12-04 13:02:43 »

Hi

AWT full screen mode is semi-broken on all major operating systems:
- it doesn't work at all under Windows with some graphics cards when the Direct3D pipeline is enabled
- it doesn't work at all under GNU Linux with some desktop managers including KDE (since its forth version)
- it doesn't work sometimes under Mac

Please just tell us which version of Mac OS X and Java you use. NEWT (JogAmp native windowing system) works just fine under these operating systems Smiley

Offline chrisethompson

Senior Newbie


Medals: 1
Exp: 5 years



« Reply #5 - Posted 2012-12-05 15:55:51 »

Its OSX 10.6 on a laptop. Everything else runs fine.  The mouse is a bit too sensitive, but that is fixable.

Here is the code.  Like I said, I think it is straight from the tutorial:

/**
    * Set the display mode to be used
    *
    * @param width The width of the display required
    * @param height The height of the display required
    * @param fullscreen True if we want fullscreen mode
    */
   private void setDisplayMode(int width, int height, boolean fullscreen) {

      // return if requested DisplayMode is already set
            if ((Display.getDisplayMode().getWidth() == width) &&
         (Display.getDisplayMode().getHeight() == height) &&
         (Display.isFullscreen() == fullscreen)) {
         return;
      }
      
      try {
         DisplayMode targetDisplayMode = null;
         
         if (fullscreen) {
            DisplayMode[] modes = Display.getAvailableDisplayModes();
            int freq = 0;
            
            for (int i=0;i<modes.length;i++) {
               DisplayMode current = modes;
               
               if ((current.getWidth() == width) && (current.getHeight() == height)) {
                  if ((targetDisplayMode == null) || (current.getFrequency() >= freq)) {
                     if ((targetDisplayMode == null) || (current.getBitsPerPixel() > targetDisplayMode.getBitsPerPixel())) {
                        targetDisplayMode = current;
                        freq = targetDisplayMode.getFrequency();
                     }
                  }

                  // if we've found a match for bpp and frequency against the
                  // original display mode then it's probably best to go for this one
                  // since it's most likely compatible with the monitor
                  if ((current.getBitsPerPixel() == Display.getDesktopDisplayMode().getBitsPerPixel()) &&
                      (current.getFrequency() == Display.getDesktopDisplayMode().getFrequency())) {
                     targetDisplayMode = current;
                     break;
                  }
               }
            }
         } else {
            targetDisplayMode = new DisplayMode(width,height);
         }
         
         if (targetDisplayMode == null) {
            System.err.println("Failed to find valid mode: "+width+"x"+height+" fs="+fullscreen);
            return;
         }

         Display.setDisplayMode(targetDisplayMode);
         Display.setFullscreen(fullscreen);
         
      } catch (LWJGLException e) {
         System.err.println("Unable to setup mode "+width+"x"+height+" fullscreen="+fullscreen + e);
      }
   }
Offline noblemaster

« JGO Spiffy Duke »


Medals: 20
Projects: 10


Age of Conquest makes your day!


« Reply #6 - Posted 2012-12-05 17:53:18 »

Fullscreen Mode on OS X is a major pain. Even if you get it to work on OS 10.6 it might not work on OS 10.8.

This works, then just scale your surface to have the resolution you prefer:
1  
2  
window.setLocation(0, 0);
window.setSize(Toolkit.getDefaultToolkit().getScreenSize().width, Toolkit.getDefaultToolkit().getScreenSize().height);      

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.

trollwarrior1 (27 views)
2014-11-22 12:13:56

xFryIx (69 views)
2014-11-13 12:34:49

digdugdiggy (48 views)
2014-11-12 21:11:50

digdugdiggy (42 views)
2014-11-12 21:10:15

digdugdiggy (36 views)
2014-11-12 21:09:33

kovacsa (60 views)
2014-11-07 19:57:14

TehJavaDev (64 views)
2014-11-03 22:04:50

BurntPizza (62 views)
2014-11-03 18:54:52

moogie (77 views)
2014-11-03 06:22:04

CopyableCougar4 (77 views)
2014-11-01 23:36:41
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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