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   
  Show Posts
Pages: [1]
1  Java Game APIs & Engines / JOGL Development / Re: using "= new GLCanvas()" not GLDrawableFactory.getFactory().createGLCanvas on: 2007-03-13 23:35:07
Yes, new GLCanvas() is now how things are done. What old documentation or examples are you looking at that use the old API style?


No documentation but examples like:

http://jerome.jouvie.free.fr/index.php
http://www.cokeandcode.com/node/9
http://today.java.net/pub/a/today/2003/09/11/jogl2d.html
http://today.java.net/pub/a/today/2004/03/18/jogl-2d-animation.html
http://www.jogl.info/ (one of the few german sites)

the most examples you can find about jogl use the old stuff.
2  Games Center / Archived Projects / Re: My first games! on: 2007-03-10 09:11:17
Well both are download sides containing the stuff he mentioned. They are some kind of wired but finally I found the right links there...
3  Java Game APIs & Engines / JOGL Development / Re: Texture.getImageWidth() / getImageHeight() on: 2007-03-09 07:15:38
Thank for the hint!

Since I only use them for 2D purposes I just create them without mipmap generation and it works fine for me so far.
4  Java Game APIs & Engines / JOGL Development / Re: expected personal packages in jerome.jouvie.free.fr/OpenGl/Tutorials on: 2007-03-09 07:03:12
1  
Maybe you didn't get the basecode form [url=http://jerome.jouvie.free.fr/OpenGl/BaseCode/BaseCode.php]here?
(scroll to the end of the page). This contains the packages you ask for (and some more). I guess thats what you looking for.

btw i would appreciate getting a copy of the fixed source Wink
5  Java Game APIs & Engines / JOGL Development / Texture.getImageWidth() / getImageHeight() on: 2007-03-06 00:10:32
I'm trying to get my Tiles working unter jogl.

I'm loading the Tileimage with the TextureIO class like
1  
2  
file = new File("res/set1.png");
texture = TextureIO.newTexture(file, true);

and try to render them to a quad with
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
texture.enable();
texture.bind();
gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE,   GL.GL_REPLACE);
TextureCoords coords = texture.getImageTexCoords();

gl.glBegin(GL.GL_QUADS);
gl.glTexCoord2f(coords.left(), coords.bottom());
gl.glVertex2f(0, 0);
gl.glTexCoord2f(coords.right(), coords.bottom());
gl.glVertex2f(texture.getImageWidth(), 0);
gl.glTexCoord2f(coords.right(), coords.top());
gl.glVertex2f(texture.getImageWidth(), texture.getImageHeight());
gl.glTexCoord2f(coords.left(), coords.top());
gl.glVertex2f(0, texture.getImageHeight());
gl.glEnd();
texture.disable();

viewport is set up with glu.gluOrtho2D(0, 800, 0, 600); all the rest is form the JOGL demos.texture.

set1.png is 529x387 pixel and I thougt getImageWidth() and getImageHeight would give me those values, instead the return me the same values as getWidth() (1024) and getHeight() (512). trying to get subImages form this Texture with the right Dimension don't even compile.

Can somebody please tell me what wrong with my code?

6  Game Development / Newbie & Debugging Questions / Re: Timebased tile scrolling looks sloppy on: 2007-03-03 15:34:48
Any Idea what can cause this behavior? On my maschine its even worse then Kova describes it.

About the fps:
I will get ~180 with the version released, about ~270 when useing System.setProperty("sun.java2d.d3d","True"); [opengl will not work at all] and whats kinda curious: when changing the max amount of different tiles (which are strored in a simple array) form 192 to 6 about ~500 fps.
7  Game Development / Newbie & Debugging Questions / Timebased tile scrolling looks sloppy on: 2007-03-02 17:05:59
I try to implement a litte tile based 'engine' but by now the scrolling is really a mess.

The main loop is a simple
1  
2  
3  
4  
5  
6  
7  
8  
9  
   public void loop() {
      long lastLoopTime = System.nanoTime();
      while (true) {
         long delta = System.nanoTime() - lastLoopTime;
         lastLoopTime = System.nanoTime();
         logic(delta);
         draw();  
      }
   }


the logic(delta) is also rather simple
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
   public void logic(long delta) {
      if (keys[KeyEvent.VK_SHIFT]) { dx = 640; dy = 480;}
      else { dx = 2*64; dy = 2*48; }
     
      if (keys[KeyEvent.VK_LEFT])      map.scroll((-delta * dx) / ONE_SECOND, 0);
      if (keys[KeyEvent.VK_RIGHT])      map.scroll((delta * dx) / ONE_SECOND, 0);
      if (keys[KeyEvent.VK_UP])      map.scroll(0, (-delta * dy) / ONE_SECOND);
      if (keys[KeyEvent.VK_DOWN])      map.scroll(0, (delta * dy) / ONE_SECOND);      
   }

   public void scroll(double dx, double dy) {
      screenAnchor.x += dx;
      screenAnchor.y += dy;
     
      // prevent form leaving the map ....
  }

where ONE_SECOND is on sec in nano secs (thus 1000*1000*1000) and dx/dy the moving speed in pixel/sec and screenAnchor a point representing the first viewable point in worldspace...

and finally draw() just calls the map.render method in a double buffered enviroment created with createBufferStrategy(2);
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  
   public void draw() {
      Graphics2D g = (Graphics2D) strategy.getDrawGraphics();
      g.setColor(Color.CYAN);
      g.fillRect(0,0,WIDTH,HEIGHT);
      map.render(g);
      fps.display(g);
      g.dispose();
      strategy.show();
   }

   public void render(Graphics2D g) {
      int tiles_x = screenSpace.width / tileSize.width;
      int tiles_y = screenSpace.height / tileSize.height;
      int sa_x = (int)screenAnchor.x;
      int sa_y = (int)screenAnchor.y;
      int ox = sa_x / tileSize.width;
      int oy = sa_y / tileSize.height;
      for(int y=0;y<tiles_y+1;y++) {
         for(int x=0;x<tiles_x+1;x++) {
            g.drawImage(map[oy+y][ox+x].image,
                  x * tileSize.width - sa_x % tileSize.width,
                  y * tileSize.height - sa_y % tileSize.height,
                  null);
         }
      }
   }


If you wanna see what i mean with 'sloppy' there is a webstart
Maybe you can tell me what happens wrong with my code Sad

8  Game Development / Newbie & Debugging Questions / Re: Splitting Logic/Rendering on: 2007-03-02 12:24:05
Maybe you should check Kevs amazing Space Invaders 103 - Refactoring and OpenGL tutorial there he is explaining how to set up different types of renderer.
9  Game Development / Newbie & Debugging Questions / Re: Problems while loading resources form a jar file on: 2007-03-01 02:49:12
Thank you both.

URL url= this.getClass().getResource(res); will do fine for me w/ leading '/'.
ResourceLoader.class.getClassLoader().getResource(path); will do fine for me w/o leading '/'.

10  Game Development / Newbie & Debugging Questions / Problems while loading resources form a jar file on: 2007-02-28 21:46:57
Hi,

I intended to post about a porblem with my litte Tileengine but when putting a testcase together i got an other problem while making a nice webstart for you.

I'm using Eclipse for development and load my Images (located in a sub folder "res/") like:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
public BufferedImage loadImage(String ref) {
...
  BufferedImage source = null, target = null;
  java.io.File url = new java.io.File(ref);
  try {
    source = ImageIO.read( url );
  }
  catch( IOException ioe )  {
    System.err.print( "Error while loading '" + ref + "': " );
    ioe.printStackTrace();
  }
...
}

where String ref is something like "res/box.png"

java.io.File url = new java.io.File(ref); won't work out for jars so after searching the web a bit I tried:
java.net.URL url = ((java.net.URLClassLoader)ResourceLoader.class.getClassLoader()).findResource( ref );
java.net.URL url = this.getClass().getClassLoader().getResource(ref);
java.net.URL url = Thread.currentThread().getContextClassLoader().getResource(ref);

non of them will work neither directly in eclips nor exported as jar file and I don't have any ideas left.
Maybe you can give me a hint in the right direction.

The full testcase (including Eclipse project files) can be found here (38kb jar file which will not run of course the problems mentioned above).



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.

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!