Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (533)
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  
  Am I making my window correctly?  (Read 1176 times)
0 Members and 1 Guest are viewing this topic.
Offline Malohkan

Senior Member




while (true) System.out.println("WOO!!!!");


« Posted 2004-10-14 04:59:47 »

Here's the link to my source so you can see what I'm doing in setting up a window.  The important method is the init() method.

http://www.gamelizard.com/com/RimscapeRunner.java

My problems are that sometimes when going to fullscreen mode, a white screen shows up and no graphics ever get drawn to it.  Also fullscreen mode is much slower at drawing than windowed mode when generally I hear people saying that fullscreen mode should be faster.

Thanks for any help!

Admin and Game Developer at
GameLizard.com
Play Rimscape!    |    Play Conquer!
Offline Malohkan

Senior Member




while (true) System.out.println("WOO!!!!");


« Reply #1 - Posted 2004-10-15 20:52:06 »

Anyone?  please? Smiley

Admin and Game Developer at
GameLizard.com
Play Rimscape!    |    Play Conquer!
Offline Malohkan

Senior Member




while (true) System.out.println("WOO!!!!");


« Reply #2 - Posted 2004-10-21 21:48:00 »

pretty pretty please?  Someone?  Anyone?  How does one properly set up an accelerated fullscreen application?  Could I at least be redirected toward a good tutorial that covers this?

Admin and Game Developer at
GameLizard.com
Play Rimscape!    |    Play Conquer!
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline dranonymous

Junior Member




Hoping to become a Java Titan someday!


« Reply #3 - Posted 2004-10-25 20:24:12 »

Have you looked at the source from Brackeen's book to see how your's differs?

Dr. A>
Offline Malohkan

Senior Member




while (true) System.out.println("WOO!!!!");


« Reply #4 - Posted 2004-10-26 00:25:23 »

Thanks for that link!  I tried out using the JFrame as he had it set up, and I think it's creating fullscreen mode fine with no mishaps, but it's still slower.  Running windowed at 1024x768 yields a pretty constant 100fps.  1024x768 fullscreen gets about 50fps.  That's really weird.  I tried printing the trace in both cases and it seems that everything is working the same as far as I can tell.  Any ideas of what could be going wrong?

Admin and Game Developer at
GameLizard.com
Play Rimscape!    |    Play Conquer!
Offline oNyx

JGO Coder


Medals: 1


pixels! :x


« Reply #5 - Posted 2004-10-26 04:35:10 »

>1024x768 fullscreen gets about 50fps.

Well, it's vsynced in fullscreen mode... so the maximum framerate equals hz.

Since you say 1024x768 and 50fps... I guess you're using a tft display right? Smiley

弾幕 ☆ @mahonnaiseblog
Offline Malohkan

Senior Member




while (true) System.out.println("WOO!!!!");


« Reply #6 - Posted 2004-10-26 19:09:47 »

JFrame's don't create their insets until after I pack the canvas on it, whereas Frames have them created when they're made.  That's created a new and confusing problem with setting a maximized window.  Here's the code I now use to figure out how much room I have to draw on for my game:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
Rectangle bounds = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();

//because you can't add a canvas with size 0,0 because the JFrame will get angry
canvas.setSize((int)bounds.getWidth(), (int)bounds.getHeight());

panel.add(canvas);
frame.pack();
frame.setExtendedState(JFrame.MAXIMIZED_BOTH);

Insets insets = frame.getInsets();
bounds.setFrame(bounds.getX(), bounds.getY(),
        bounds.getWidth(),
        bounds.getHeight() - insets.top + insets.bottom
);

canvas.setSize((int)bounds.getWidth(), (int)bounds.getHeight());

//Here's what my game logic will use
GAME_WIDTH = canvas.getWidth();
GAME_HEIGHT = canvas.getHeight();


And now everything works dandy, and it appears that with the JFrame change, both Windowed and Fullscreen modes are accelerated and now Fullscreen is SLIGHLTY faster for me than windowed mode.  Neat!

Thank you oNyx for your direction Smiley

Admin and Game Developer at
GameLizard.com
Play Rimscape!    |    Play Conquer!
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.

pw (26 views)
2014-07-24 01:59:36

Riven (25 views)
2014-07-23 21:16:32

Riven (20 views)
2014-07-23 21:07:15

Riven (22 views)
2014-07-23 20:56:16

ctomni231 (51 views)
2014-07-18 06:55:21

Zero Volt (46 views)
2014-07-17 23:47:54

danieldean (37 views)
2014-07-17 23:41:23

MustardPeter (40 views)
2014-07-16 23:30:00

Cero (57 views)
2014-07-16 00:42:17

Riven (55 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!