Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (491)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (556)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Java Game APIs & Engines / Java 2D / Re: Trouble with Fullscreen mode on: 2006-03-31 22:44:34
Hi, and thanks for all answers!
Yes, it was just a ugly hack, it has been rewritten..  Smiley

The problem was that i checked if it was possible to switch to the requested display-mode BEFORE going to fullscreen.
Thats why "device.isDisplayChangeSupported()" allways return "false"..
Now it's working, in Windows, and only if i render directly to a JFrame. If if I render to a JPanel that is added to the JFrames contentPane I only get a grey screen.
Should it not be possible to render to a JPanel in a JFrame?
Looking forward to Mustang so that I can get Linux support up and running.

Thanks.
2  Java Game APIs & Engines / Java 2D / Re: Trouble with Fullscreen mode on: 2006-02-26 10:21:09
Hi Dmitri!

I have not included the code for going back to window-mode in this post, but the code looks almost like this:
try
{
   setupGameDisplay()
}
finally
{
  device.setDisplayMode(oldDisplayMode);
  device.setFullScreenWindow(null);
}

The problem is not getting back to window-mode, BUT to get into fullscreen-mode...                 Undecided

Any more suggestions??
3  Java Game APIs & Engines / Java 2D / Re: Font loading problems in Windows on: 2006-02-26 10:11:56
Thanks guys(?)!

Yes, i'm trying to catch all exceptions, the code look like this:
 try
        {
            Font tmpFont = Font.createFont(Font.TRUETYPE_FONT, new BufferedInputStream(this.getClass().getClassLoader().getResourceAsStream(GAME_FONT)));       
            mFont = new Font(tmpFont.getName(), tmpFont.getStyle(), FONTSIZE);
        } catch  (IllegalArgumentException exception)
        {
            exception.printStackTrace();
        } catch (FontFormatException exception)
        {
            exception.printStackTrace();
        } catch (IOException exception)
        {
            exception.printStackTrace();
        }

I'll try turning on some more extensive logging, thanks for the tool(oNyx)!
4  Java Game APIs & Engines / Java 2D / Re: Trouble with Fullscreen mode on: 2006-02-25 23:07:59
BTW, Sorry for the native comments! I'll try leaving them out next time!  Smiley
5  Java Game APIs & Engines / Java 2D / Trouble with Fullscreen mode on: 2006-02-25 23:06:04
Hi!

I have trouble getting my game running in fullscreen.. =(
When starting up the game should try to enter 800x600x32 fullscreen-mode, if thats not possible it should fallback to 800x600x32 windowed mode.
But now it's allways running in windowed mode, what am i doing wrong??  Yes, i have read the Sun Java API FullScreen-stuff..
Below is the method setting up the screen. It's get called by the constructor of the maingame class which extends Canvas.
I'm i missing something??


private void setupGameDisplay()
    {
        mGameWindow = new JFrame("JPlane");     // Skapar spelfönstret.
        mGameWindow.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);  // Vi lyssnar på WindowsClosing()-event istället, så att vi kan få stänga ner programmet själva.
       
        // Sätter upp panelen i vilken spelet ritas upp.
        JPanel gamePanel = (JPanel)mGameWindow.getContentPane();
        gamePanel.setPreferredSize(new Dimension(getGameSettingsElement(WINDOW_WIDTH),getGameSettingsElement(WINDOW_HEIGHT)));
        gamePanel.setLayout(null);
        setBounds(0, 0, getGameSettingsElement(WINDOW_WIDTH), getGameSettingsElement(WINDOW_HEIGHT));
       
        gamePanel.add(this);
       
        setIgnoreRepaint(true);   // Eftersom vi aktivt uppdaterar bildskärmen själva så är det onödigt att JVM också försöker.
        setFocusable(true);         // Se för säkerhetsskull till att vi kan få fokus.
        requestFocus();               // Och begär sedan fokus.
        mGameWindow.pack();
       
        mGameWindow.setResizable(false);  // Spelfönstret har en fix storlek.
        mGameWindow.setVisible(true);        // Visa fönstret.
       
        // Ok, nu har vi ett fönster. Här näst testar vi om vi kan få spela i fullskärmsläge.
        GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice device = environment.getDefaultScreenDevice();
       
        // Bildskärmsläget spelet är gjort för(800x600x32@unknown).
        DisplayMode requestedDisplayMode = new DisplayMode(getGameSettingsElement(WINDOW_WIDTH), getGameSettingsElement(WINDOW_HEIGHT), 32, 0);
       
        // Kontrollerar om spelet kan köras i fullskärmsläge, annars faller vi tillbaka till fönsterläge.
        if (device.isFullScreenSupported())
        {
            DisplayMode currentDisplayMode = device.getDisplayMode();   // Hämtar nuvarande bildskärmsläge
           
            // Om vi redan befinner oss i rätt bildskärmsläge(upplösning) skall vi bara skifta om till fullskärm.
            if ((currentDisplayMode.getWidth() == requestedDisplayMode.getWidth()) && (currentDisplayMode.getHeight() == requestedDisplayMode.getHeight()) && (currentDisplayMode.getBitDepth() == requestedDisplayMode.getBitDepth()))
            {
                mGameWindow.setUndecorated(true);            // Ta bort menyrader och annat i fullskärmsläge.
                mOldDisplayMode = currentDisplayMode;        // Spara undan nuvarande bildskärmsläge.
                System.out.println("Skiftar till fullskärmsläge!");
                device.setFullScreenWindow(mGameWindow); // Skifta till fullskärmsläge.
            }
           
            // Om vi inte befinner oss i rätt bildskärmsläge(upplösing) kontrollera om vi får skifta bildskärmsläge. Annars blir det fönsterläge..
            else if (device.isDisplayChangeSupported())
            {
                DisplayMode[] avaibleModes = device.getDisplayModes();  // Hämtar alla bildskärmslägen som är tillgängliga
                int index = 0;
               
                // Loopar igenom och kontrollerar om vårt efterfrågade bildskärmsläge finns bland dessa.
                while ((index < avaibleModes.length) && (!avaibleModes[index].equals(requestedDisplayMode)))
                {
                    index++;
                }
               
                // Hittade vi vårt bildskärmsläge?? I så fall byt till det läget och skifta till fullskärmsläge.
                if (currentDisplayMode.equals( requestedDisplayMode))
                {
                    mGameWindow.setUndecorated(true);            // Ta bort menyrader och annat i fullskärmsläge.
                    mOldDisplayMode = currentDisplayMode;        // Spara undan nuvarande bildskärmsläge, så att vi kan gå tillbaka till denna när spelet avslutas.
                    System.out.println("Skiftar till fullskärmsläge!");
                    device.setFullScreenWindow(mGameWindow); // Skifta till fullskärmsläge.
                    System.out.println("Byter till önskad bildskärmsläge: " + requestedDisplayMode.getWidth() + "x" + requestedDisplayMode.getHeight() + "x" + requestedDisplayMode.getBitDepth());
                    device.setDisplayMode(requestedDisplayMode);
                }
            }
        }
       
        if (mOldDisplayMode == null)
            System.out.println("Kunde inte växla till fullskärmsläge, spelet körs i fönsterläge i stället!");
       
        createBufferStrategy(2);      // 1st virtuell och 1st fysisk.
        mStrategy = getBufferStrategy();
    }
6  Java Game APIs & Engines / Java 2D / Re: Font loading problems in Windows on: 2006-02-25 15:53:15
No takers? Anyone?
7  Java Game APIs & Engines / Java 2D / Font loading problems in Windows on: 2006-02-18 01:02:13
TrueType-fonts in my game does'nt get loaded in M$ Windows, but the same code is working great in Linux and OS X.
Only if i install the font in windows does it work, how come? Weird if the users have to install the font themself just to get your application working, it can't be that stupid, i must do SOMETHING wrong!

Sample-code:
 Font tmpFont = Font.createFont(Font.TRUETYPE_FONT, new BufferedInputStream(this.getClass().getClassLoader().getResourceAsStream(GAMECONSTANTS.GAME_FONT)));       
            mFont = new Font(tmpFont.getName(), tmpFont.getStyle(), FONTSIZE);

oh, it's a Java Webstart game if it matters.

Thanks!

// Henrik
8  Java Game APIs & Engines / Java 2D / Re: BufferStrategy in JApplet on: 2005-05-30 12:08:27
Grin

I was looking for answers in the deepest of dungeons..
9  Game Development / Game Play & Game Design / Game Profiling on: 2005-05-25 19:34:46
Hi!

What tools do you use for profiling your games??
Beside simple System.out.println() and System.currentMillis() are there any good programs you could recommend? Maybe one that could give statistics about different classes and methods CPU-usage.

Thanks.
10  Java Game APIs & Engines / Java 2D / Re: BufferStrategy in JApplet on: 2005-05-19 08:18:27
Does anyone have a clue?
11  Java Game APIs & Engines / Java 2D / Re: Indexed Colors in Java on: 2005-05-18 09:43:10
OK, 2 bad!

Thanks anyway..
12  Java Game APIs & Engines / Java 2D / Indexed Colors in Java on: 2005-05-17 19:18:54
Hi!

In the DOS-days, asm mov ax,13h; int 10h; end; would get me into graphicmode 13. Presenting me with 320x200 resolution and 256 beautiful indexed colors.  The nice thing about indexed colors was how simple one could animate a picture by just rotating parts of the palette.  There seems to be a IndexedColor model in Java, but how close is this to the "old thing"??
Do i get a 8-bit palette or a full 32-bit one? Can i render a image(Sprite) in IndexedColor model on the screen at the same time with other images in other ColorModels, or do they all then have to be indexed?

Rotating the palette in mode 13 was a very cheep operation, is it still in Java? Or is mixing all those colormodels killing all the performance??

Does anyone have some examplecode showing how to access the palette and setting a pixel(putpixel(x,y))?   (I just need a few sprites in my game to have indexedcolors)

MANY THANKS! (and sorry for my bad english!)

// Henrik
13  Java Game APIs & Engines / Java 2D / BufferStrategy in JApplet on: 2005-05-11 10:38:56
Hi!
I'm making a simple game just to learn Java.
I'm making it a Applet, but to improve speed i would like to make use of BufferStrategy. It's easy with an JFrame, but how should i getBufferStrategy() in a klass extending JApplet. Do i have to use a JPanel?? A short example would be nice.

Thanks!
14  Game Development / Game Play & Game Design / Re: KeyListener Why? on: 2005-05-09 13:24:52
Thanks for all replies! I think i get the picture now..
Cheesy
15  Game Development / Game Play & Game Design / KeyListener Why? on: 2005-05-08 22:33:05
I know this topic has been talked about over and over again, but as a newbee i don't yet get it.

Most example games i've seen use a KeyListener when detecting a pressed key and set a boolean variable like downArrow or k_button. Later some method do something like "if (downArrow) positionY += 1;"   The question is why can't we do this simple thing right when we detect the keypress?? Why all these booleans?? I can understand if there is a lot code for a keystroke that you want to move that block of code to another place making i cleaner. But for the example above it would only make it less readable.  Also if you got several Threads running i can understand it, but for single threaded apps?

What am i missing? PLEASE. =)
16  Game Development / Game Play & Game Design / Applet acceleration on: 2005-05-07 21:28:47
Hi!

I'm wondering if hardware accelerated images, BufferedImage, works on Applets too, or is it only on "native" JFrames?? Trying to speed up a 2D game i'm working on.
Pages: [1]
 

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

The first screenshot will be displayed as a thumbnail.

Nickropheliac (15 views)
2014-08-31 22:59:12

TehJavaDev (23 views)
2014-08-28 18:26:30

CopyableCougar4 (29 views)
2014-08-22 19:31:30

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

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

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

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

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

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

BurntPizza (49 views)
2014-08-09 21:09:32
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!