Skip to main content
GameDev.net gamedev.net
🔒 Locked

[java] problems with fullscreen mode

Started by CPeX Feb 3, 2003 at 3:54 AM 0 replies 700+ views
Original Post
CPeX
CPeX
Why does this code don''t work properly. The screen always flips between een with screen with a green rectangle and my windows desktop with a green rectangle tankx Code:
..... 
 
Rectangle bounds = mainFrame.getBounds(); 
   try { System.out.println("1.."); 
     gd.setFullScreenWindow(mainFrame); 
     System.out.println("2.."); 
       mainFrame.createBufferStrategy(2); 
     BufferStrategy bufferStrategy = mainFrame.getBufferStrategy();  
      
      
     for(int i=0;i<10;i++) 
     { Graphics g = bufferStrategy.getDrawGraphics(); 
      g.setColor(Color.black); 
      g.fillRect(0,0,bounds.width, bounds.height); 
      g.setColor(Color.green); 
      g.fillRect(i,i,i+30, i+30); 
      bufferStrategy.show(); 
      g.dispose(); 
      try { 
    Thread.sleep(1000); 
     } catch (InterruptedException e) {} 
     } 
      
     System.out.println("4.."); 
      
      }  
     finally { gd.setFullScreenWindow(null); 
     System.out.println("3.."); 
    } 
..... 
[/CODE] 
 
    
CPeX
CPeX
it was a stupid, stupid fault.

bounds.width and bounds.height were both 0

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.