Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (576)
games submitted by our members
Games in WIP (498)
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 / JOGL Development / reshape on: 2009-11-27 11:50:23
Hi all!
I have a question...
Why use GLEventListener.reshape instead of ComponentListener.componentResized?

2  Game Development / Newbie & Debugging Questions / Re: How do you guys work with graphics? on: 2009-08-23 09:32:39
I use jogl
3  Games Center / Archived Projects / Re: my new physics engine on: 2009-07-27 15:48:58
A platform game where the border is not reachable due to solid static blocks that close the paths
4  Games Center / Archived Projects / Re: Xenplat - full release! 1.05 final! on: 2009-07-26 19:16:38
i prefer jws with fullscreen mode
5  Games Center / Archived Projects / Re: my new physics engine on: 2009-07-26 18:53:22
yes my collision system is a bit severe... if an object touch the border that object will be destroyed!!! Smiley
6  Games Center / Showcase / Re: Millennuim Pac-Man on: 2009-07-25 13:31:12
Hi Cero
I just tried on a winxp with 8.1 audio system and it works fine.
I saw that the oalinst file didnt install the alut dll, that seems not needed...
But you can try to download it from http://connect.creativelabs.com/openal/Downloads/ALUT/freealut-1.1.0-bin.zip
In the zip there is the alut.dll and you can try to copy it in your dll dir.
In the zip there are 2 examples. To make them work i copied it their dir.
7  Games Center / Showcase / Re: Millennuim Pac-Man on: 2009-07-25 12:55:47
The ghosts ai in this game is the same for each lvl. What is different is the speed. Every lvl has a table with start and max values of speeds for each ghost, and duration of blue, scatter and attack mode. The values in the table are not proportional with the lvl number but as i measured.
Of course i adjusted all to reach the max funny playability.  Grin
8  Games Center / Showcase / Re: Millennuim Pac-Man on: 2009-07-25 09:06:56
If you have audio problems try to install openal on your system.

For ubuntu users: install packages libopenal1 and libalut0
For win users: run the installer found at http://connect.creativelabs.com/openal/Downloads/oalinst.zip

The openal home page: http://connect.creativelabs.com/openal/default.aspx


9  Java Game APIs & Engines / JOGL Development / Re: Cursors changing in jogl2 using native window? on: 2009-07-24 18:38:34
sry for my ignorance but how native windows can be used ?
10  Java Game APIs & Engines / JOGL Development / Re: texture highlight on: 2009-07-24 18:30:54
I obtain that effect simply with glColor... If you draw with glColor(1,1,1) you see your texture in the normal state and if you set glColor(1,1,0) before drawing your texture you'll get the highlighted state...

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
package test;

import java.awt.Frame;

import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.IOException;

import javax.media.opengl.GL;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLCanvas;
import javax.media.opengl.GLEventListener;
import javax.media.opengl.GLException;

import com.sun.opengl.util.Animator;
import com.sun.opengl.util.texture.Texture;
import com.sun.opengl.util.texture.TextureCoords;
import com.sun.opengl.util.texture.TextureIO;

public class Test {
   Frame frame;
   GLCanvas glCanvas;
   Animator animator;
   Texture texture;
   TextureCoords coords;
   float t;

   public Test() {
      glCanvas = new GLCanvas();
      animator = new Animator(glCanvas);
      frame = new Frame();
      frame.add(glCanvas);
      glCanvas.addGLEventListener(glel);
      frame.addWindowListener(new WindowAdapter() {
         @Override
         public void windowClosing(WindowEvent e) {
            System.exit(0);
         }
      });
   }

   public void showGui() {
      frame.setBounds(100, 100, 400, 300);
      frame.setVisible(true);
      animator.start();
   }

   GLEventListener glel = new GLEventListener() {
      @Override
      public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
      }

      @Override
      public void init(GLAutoDrawable drawable) {
         GL gl = drawable.getGL();
         gl.glEnable(GL.GL_BLEND);
         gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
         gl.glEnable(GL.GL_LINE_SMOOTH);
         gl.glHint(GL.GL_LINE_SMOOTH_HINT, GL.GL_NICEST);
         gl.glEnable(GL.GL_POINT_SMOOTH);
         gl.glHint(GL.GL_POINT_SMOOTH_HINT, GL.GL_NICEST);
         gl.glEnable(GL.GL_POLYGON_SMOOTH);
         gl.glHint(GL.GL_POLYGON_SMOOTH_HINT, GL.GL_NICEST);
         gl.glLineWidth(0.3f);
         try {
            texture = TextureIO.newTexture(getClass().getResourceAsStream("img.png"), true, "png");
            coords = texture.getImageTexCoords();
         } catch (GLException e) {
            e.printStackTrace();
         } catch (IOException e) {
            e.printStackTrace();
         }
      }

      @Override
      public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {
      }

      @Override
      public void display(GLAutoDrawable drawable) {
         GL gl = drawable.getGL();
         gl.glLoadIdentity();
         gl.glOrtho(-3, 3, -2, 2, -1, 1);
         gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);

         float blue = (float) (0.5 + Math.sin(t += 0.1));
         if (blue < 0) {
            blue = 0;
         }
         if (blue > 1) {
            blue = 1;
         }

         texture.enable();
         texture.bind();
         gl.glColor3f(1, 1, blue); //set the yellow (when blue==0) or white (when blue==1)
        gl.glBegin(GL.GL_QUADS);
         gl.glTexCoord2f(coords.right(), coords.top());
         gl.glVertex2f(1, 1);
         gl.glTexCoord2f(coords.left(), coords.top());
         gl.glVertex2f(-1, 1);
         gl.glTexCoord2f(coords.left(), coords.bottom());
         gl.glVertex2f(-1, -1);
         gl.glTexCoord2f(coords.right(), coords.bottom());
         gl.glVertex2f(1, -1);
         gl.glEnd();
         texture.disable();
      }
   };

   public static void main(String[] args) {
      new Test().showGui();
   }
}
11  Games Center / Showcase / Re: Millennuim Pac-Man on: 2009-07-24 17:58:25
hi
I use jogl joal and jinput.

Quote
It seems like a faithful if slow translation of the originals in the early 1980s.
Some days was spent to study ghost psychology and game speeds from the original, i used a timer while playing to measure times in many lvl  persecutioncomplex
Do you mean slow refresh rate? Tell me your pc configuration plz...

I have best results on my old pc with a Athlon 1300Mhz processor, a Ati x800 graphic card and a CRT monitor with 100hz of refresh rate.
With this configuration i have 100 frames per second and i use almost all the cpu.

12  Games Center / Showcase / Re: Millennuim Pac-Man on: 2009-07-24 07:00:44
1 month + some time for debugging and deploying.

The source is not public. There is an online score system and the client must not to be modified.

 If you are interested in some part of the game, this is the place where you can ask Smiley
13  Games Center / Archived Projects / Re: my new physics engine on: 2009-07-23 13:47:07
Mousepicking and tack constraint added...
14  Games Center / Archived Projects / my new physics engine on: 2009-07-22 18:15:53
Hi all!
here is a little demo of my new physics engine!
http://www.cortegaia.com/pacman/thegame.jnlp
15  Java Game APIs & Engines / Java 2D / Re: Hiding the mouse cursor in fullscreen mode on: 2009-07-20 17:41:45
Toolkit.getDefaultToolkit().createCustomCursor(Toolkit.getDefaultToolkit().createImage(""), new Point(), null);
16  Games Center / Showcase / Re: Millennuim Pac-Man on: 2009-07-19 19:14:04
For ubuntu users: System -> Preferences -> Sun Java 6 Plugin Control Panel
17  Games Center / Showcase / Re: Millennuim Pac-Man on: 2009-07-19 11:24:33
And where this option can be set?
18  Games Center / Showcase / Re: Millennuim Pac-Man on: 2009-07-18 11:38:51
In the jnlp file you can specify if the icon should be added to the start menu and/or to the desktop.
I don't know if it's possible how to make the jnlp let the user choose...
Anyone can tell me how to do that?
It seems that I need further study about jnlp...
19  Games Center / Showcase / Re: Millennuim Pac-Man on: 2009-07-17 15:20:32
And i put it on java game tome  Grin
http://www.javagametome.com/game.html?id=180

plz vote and leave comment
20  Games Center / Showcase / Re: Millennuim Pac-Man on: 2009-07-17 14:12:55
I improved joystick controls.
Now all the devices are scanned and you can start with a device then continue with the other, just press a button to use joystick...
Also added rz and z axis for directions...
The keyboard input device is still there, just press space to start and arrows to move
the mouse imput device is no longer enabled
21  Games Center / Showcase / Re: Millennuim Pac-Man on: 2009-07-15 18:25:46
I disabled the v,f end d keys.
Only f11 and esc are now enabled.
22  Games Center / Showcase / Re: Millennuim Pac-Man on: 2009-07-11 20:36:34
Ummm...
The jarsigner output is: The signer certificate will expire within six months.
And i signed it today...

Is there anybody that knows what that exception means?

 Huh
23  Games Center / Showcase / Re: Millennuim Pac-Man on: 2009-07-11 11:06:00
I made it just to make the experience of developing a complete game in java, with jogl joal and jinput.
And i put it here because i want to test the online score system. The server is running on my pc and is visible through dyndns.

I'd like to share it with the whole world but i don't know if there are copyrights on pac-man.
24  Games Center / Showcase / Millennuim Pac-Man on: 2009-07-10 19:17:18
Hi all!

Here is my version of pac-man!!!

space = start and arrows to move
a joystick button = start and x,y axis to move

f11=toggle fullscreen, default on

f = toggle fps, default off

d = toggle debug mode, default off: shows the frame duration in yellow, the display time in orange and the update time in red when fps are on

v = toggle vsync, default on (i strongly recommend to enable vsync in the video card option, and don't touch the v key, for very smooth movements. And if you are really a pac-maniac use a crt monitor!!!)

esc = quit

enjoy and send feedback

http://www.cortegaia.com/pacman/pacman.jnlp


25  Game Development / Newbie & Debugging Questions / Re: Toggle fullscreen - Lists and textures lost on: 2009-07-08 09:25:06
Finaly i have solved it.  persecutioncomplex
The problem is that the display of the new canvas must be forced before disposing the old one.
Just call tmpCanvas.display() after tmpCanvas.requestFocus() and before frame.dispose()

This works on all computers where i tested it.

Thx. Hope this will help.
26  Game Development / Newbie & Debugging Questions / Re: Toggle fullscreen - Lists and textures lost on: 2009-07-07 23:42:40
The solution with pbuffer works well in 1 pc and not in the other 2...
But i cant make the second work!!!
Sharing context between 2 GLCanvas seems to be harder than expected  Shocked

This is the code i wrote:
   public synchronized void setFullScreen(boolean fullScreen) {
      try {
         this.fullscreen = fullScreen;

         animator.stop();
         glCanvas.removeGLEventListener(this);
         glCanvas.removeKeyListener(this);

         GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
         GraphicsDevice[] gd = env.getScreenDevices();
         DisplayMode originalDisplayMode0 = gd[0].getDisplayMode();
         GLCapabilities glc = new GLCapabilities();

         Frame tmpFrame = new Frame("Millennium Pac-Man");
         tmpFrame.setUndecorated(fullscreen);

         GLCanvas tmpCanvas = new GLCanvas(glc, null, glCanvas.getContext(), gd[0]);
         tmpFrame.add(tmpCanvas);

         size = new Dimension(originalDisplayMode0.getWidth(), originalDisplayMode0.getHeight());
         location = new Point();
         if (!fullScreen) {
            location = new Point((size.width - 300) / 2, (size.height - 400) / 2);
            size = new Dimension(300, 400);
         }

         tmpFrame.setSize(size);
         tmpFrame.setLocation(location);
         tmpCanvas.addGLEventListener(this);
         tmpCanvas.addKeyListener(this);
         tmpFrame.setVisible(true);
         tmpCanvas.requestFocus();

         frame.dispose();

         frame = tmpFrame;
         glCanvas = tmpCanvas;
         animator = new Animator(glCanvas);
         animator.start();

      } catch (Exception e) {
         e.printStackTrace();
         System.exit(-1);
      }
   }

What's wrong?
27  Game Development / Newbie & Debugging Questions / Re: Toggle fullscreen - Lists and textures lost on: 2009-07-07 12:27:04
With pbuffers i made it work. This is the code.
Let me know if there is a better way.

Thx


package util.studio;

import java.awt.Dimension;
import java.awt.Frame;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Point;
import java.awt.Toolkit;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;

import javax.media.opengl.GL;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLCanvas;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLDrawableFactory;
import javax.media.opengl.GLEventListener;
import javax.media.opengl.GLPbuffer;

import com.sun.opengl.util.texture.Texture;
import com.sun.opengl.util.texture.TextureCoords;
import com.sun.opengl.util.texture.TextureIO;

public class ProvaPBuffer {
   GLPbuffer pbuffer;
   GLCanvas glCanvas;
   Frame frame;
   boolean fullscreen;
   Dimension size;
   Point location;
   Texture texture;
   TextureCoords coords;

   public ProvaPBuffer() {
      pbuffer = GLDrawableFactory.getFactory().createGLPbuffer(new GLCapabilities(), null, 512, 512, null);
      pbuffer.addGLEventListener(new GLEventListener() {
         public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
         }

         public void init(GLAutoDrawable drawable) {
            try {
               texture = TextureIO.newTexture(new File("gfx/fungo.png"), true);
               coords = texture.getImageTexCoords();
            } catch (Exception e) {
               e.printStackTrace();
            }
         }

         public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {
         }

         public void display(GLAutoDrawable drawable) {
         }
      });
      pbuffer.display();
      GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
      GraphicsDevice[] gd = env.getScreenDevices();
      GLCapabilities glc = new GLCapabilities();
      glCanvas = new GLCanvas(glc, null, pbuffer.getContext(), gd[0]);
      glCanvas.addGLEventListener(new GLEventListener() {
         public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
         }

         public void init(GLAutoDrawable drawable) {
         }

         public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {
         }

         public void display(GLAutoDrawable drawable) {
            GL gl = drawable.getGL();
            gl.glLoadIdentity();
            gl.glEnable(GL.GL_BLEND);
            gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
            texture.enable();
            texture.bind();
            gl.glBegin(GL.GL_QUADS);
            gl.glTexCoord2f(coords.left(), coords.bottom());
            gl.glVertex2f(-1, -1);
            gl.glTexCoord2f(coords.left(), coords.top());
            gl.glVertex2f(-1, 1);
            gl.glTexCoord2f(coords.right(), coords.top());
            gl.glVertex2f(1, 1);
            gl.glTexCoord2f(coords.right(), coords.bottom());
            gl.glVertex2f(1, -1);
            gl.glEnd();
         }
      });
   }

   void showGui() {
      glCanvas.addKeyListener(new KeyAdapter() {
         @Override
         public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
               System.exit(0);
            }
            setFullScreen(!fullscreen);
         }
      });
      frame = new Frame("PorcaProva");
      frame.add(glCanvas);
      frame.setBounds(100, 100, 300, 400);
      frame.setVisible(true);
      glCanvas.requestFocus();
      frame.addWindowListener(new WindowAdapter() {
         @Override
         public void windowClosing(WindowEvent e) {
            System.exit(0);
         }
      });
   }

   public void setFullScreen(boolean fullScreen) {

      this.fullscreen = fullScreen;

      frame.dispose();

      size = Toolkit.getDefaultToolkit().getScreenSize();

      if (fullScreen) {
         frame.setUndecorated(true);
         location = new Point(0, 0);
      } else {
         frame.setUndecorated(false);
         location = new Point((size.width - 300) / 2, (size.height - 400) / 2);
         size = new Dimension(300, 400);
      }

      frame.setSize(size);
      frame.setLocation(location);

      frame.setVisible(true);
      glCanvas.requestFocus();
   }

   public static void main(String[] args) {
      ProvaPBuffer p = new ProvaPBuffer();
      p.showGui();
   }
}
28  Game Development / Newbie & Debugging Questions / Re: Toggle fullscreen - Lists and textures lost on: 2009-07-07 11:32:29
I load too many textures that it takes too much time to reload all  Cry

And maybe that's not a good idea to do this feature, but is a good idea to learn how to do  Smiley
Many apps has it (try f11 if you are using firefox)
And many games has a menu where select the screen mode, and when you press apply, they change on the fly without reloading.

I think the way is to make a context that is not disposed and to make it accessible from my glcanvas, but i dont know how to do this.
I'm trying to share context with pbuffers, but dunno if they are widely supported.

 Huh
29  Game Development / Newbie & Debugging Questions / Toggle fullscreen - Lists and textures lost on: 2009-07-07 08:53:17
Hi all

I'm trying to add the toggle fullscreen functionality to my jogl app.
I just want to make a key listener that make my frame switch between fullscreen and windowed mode.

With awt or swing apps i call a method like this from my listener:

   public void setFullScreen(boolean fullScreen) {

      frame.dispose();

      size = Toolkit.getDefaultToolkit().getScreenSize();

      if (fullScreen) {
         frame.setUndecorated(true);
         location = new Point(0,0);
      } else {
         frame.setUndecorated(false);
         location = new Point((size.width - 300) / 2, (size.height - 400) / 2);
         size = new Dimension(300, 400);
      }

      frame.setSize(size);
      frame.setLocation(location);

      frame.setVisible(true);

   }

But if i have a GLCanvas on my frame i have the problem that all the lists and textures i loaded get lost.
Can you tell me what's the right way to preserve previously loaded data during the dispose of the frame?
Are there examples to see?

Thanks
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.

xsi3rr4x (15 views)
2014-04-15 18:08:23

BurntPizza (14 views)
2014-04-15 03:46:01

UprightPath (27 views)
2014-04-14 17:39:50

UprightPath (12 views)
2014-04-14 17:35:47

Porlus (29 views)
2014-04-14 15:48:38

tom_mai78101 (51 views)
2014-04-10 04:04:31

BurntPizza (110 views)
2014-04-08 23:06:04

tom_mai78101 (211 views)
2014-04-05 13:34:39

trollwarrior1 (179 views)
2014-04-04 12:06:45

CJLetsGame (185 views)
2014-04-01 02:16:10
List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:05:20
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!