Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (404)
games submitted by our members
Games in WIP (289)
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: Check this Java game out on: 2002-11-05 17:44:11
Hello,

 Anyone interested in some great physics demos go here -->http://www.tokamakphysics.com/  .
The ragdoll demo is really good.
2  Java Game APIs & Engines / Java 2D / Check this Java game out on: 2002-10-26 18:07:24
Hello,

 Check out this link ,
http://www.motionplayground.com/sssjava/javademo.html

 Anyone know how to make the player fall around like that?
3  Java Game APIs & Engines / Java 2D / Re: Automatic Image Question on: 2002-10-21 19:57:45
Hello,

 Thanks again for the info. When I used ImageIcon then the above code worked fine.


,
Steve
4  Java Game APIs & Engines / Java 2D / Re: Automatic Image Question on: 2002-10-19 15:38:47
Hello,

 Thanks for the info. I was getting rather confused on how to take advantage of hardware and somehow got it in my mind that by default all rendering would be in software. The archived posts I read kept talking about that createCompatibleImage method. So I should be okay by just using the toolkit?  

following is the code I am using and still cannot draw to the buffered image can anyone see what I am doing wrong? (Although I don't really need to do it anyway)

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  
import java.awt.geom.*;
import java.awt.event.*;
import java.awt.image.*;
import java.awt.*;


public class test implements ImageObserver
{

      private Image _image;
      private int _intImageCount;
     
      public void start()
      {
                  Frame f = new Frame();
                  f.setIgnoreRepaint(true);
                  f.setUndecorated(true);
                  f.setBackground(Color.BLACK);
                  GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(f);
                  f.createBufferStrategy(2);
                  BufferStrategy buffer = f.getBufferStrategy();
                  loadImage();
                  int frames = 0;
                  long lStartRenderingTime = System.currentTimeMillis();
                  while(frames < 2000)
                  {
                        Graphics2D graphics = (Graphics2D) buffer.getDrawGraphics();
                        clear(graphics);
                        AffineTransform at = new AffineTransform();
                        graphics.drawImage(_image,at,f);
                        buffer.show();
                        graphics.dispose();
                        frames++;
                  }
                  long lEndRenderingTime = System.currentTimeMillis();
                  GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(null);
                  f.dispose();
                 
                  System.out.println("Rendering Loop Time --> " + (lEndRenderingTime - lStartRenderingTime));
                  System.out.println("Frames --> " + frames);
                  System.out.println("FPS --> " + (1000 / ((lEndRenderingTime - lStartRenderingTime) / frames)) );
      }
     
      protected void clear(Graphics2D graphics)
      {
            graphics.setColor(Color.BLACK);
        graphics.setClip(0,0,1024,768);
        graphics.fillRect(0,0,1024,768);
      }
     
      public void loadImage()
      {
            Image image = Toolkit.getDefaultToolkit().createImage("c:\\corsairImages\\Corsair.png");
            while(image.getHeight(null) == -1 && image.getWidth(null) == -1)
            {
                  //Just Wait
           }
            //_image = image;
           _image = createCompatibleImage(image);
            _intImageCount++;
      }
     
      private Image createCompatibleImage(Image loadedImage)
      {
            GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
            BufferedImage image = gc.createCompatibleImage(loadedImage.getWidth(null),loadedImage.getHeight(null),Transparency.BITMASK);
            image.createGraphics().drawImage(loadedImage,new AffineTransform(),this);
            return image;
      }
     
      public static void main(String args[])
      {
            test t = new test();
            t.start();
      }
     
      public boolean imageUpdate(Image img,int infoflags,int x,int y,int width,int height)
      {
            int intResult = infoflags & ImageObserver.ALLBITS;
            if(intResult == ImageObserver.ALLBITS)
                  System.out.println("Buffered Image Loaded");
            else
                  System.out.println("image loading...........");
            return true;
      }

}
5  Java Game APIs & Engines / Java 2D / Automatic Image Question on: 2002-10-19 06:48:17
Hello,

 Does anyone know how to actually create one of those automatic images? I have searched through the archives but couldn't find any specific examples.  I am currently using Toolkit.createImage() .  But how do I actually get the loaded image into my BufferedImage that I get from the createCompatibleImage method?  I tried getting the Graphics2D from the BufferedImage and drawing the loaded image to it but it didn't work(no errors just no Image).

Thanks,
Steve
Pages: [1]
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars and Titan!

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

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (43 views)
2013-05-17 21:29:12

alaslipknot (52 views)
2013-05-16 21:24:48

gouessej (80 views)
2013-05-16 00:53:38

gouessej (80 views)
2013-05-16 00:17:58

theagentd (89 views)
2013-05-15 15:01:13

theagentd (82 views)
2013-05-15 15:00:54

StreetDoggy (124 views)
2013-05-14 15:56:26

kutucuk (148 views)
2013-05-12 17:10:36

kutucuk (148 views)
2013-05-12 15:36:09

UnluckyDevil (158 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
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!
Page created in 0.257 seconds with 21 queries.