Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (593)
Games in Android Showcase (168)
games submitted by our members
Games in WIP (646)
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: Avoidance of Garbage Collection on: 2005-03-01 18:10:17
Yeah, I went to useing a Graphics gotten from the BufferStrategy to render the image, I was a little dissapointed that they did not have the option to draw a single pixel, I decided to just use a fillRect(x, y, 1, 1); Worked at a good speed even at high resolutions like 1600 x 1200.  Although now that I am useing sprites, I am having trouble becasue it seems to take a really long time to draw a buffered image to a Graphics.  Is there any way to move the image into the memory on the graphics card so that it can access it quickly?
2  Java Game APIs & Engines / Java 2D / Re: Avoidance of Garbage Collection on: 2005-02-28 02:58:44
Another thing I was wondering was weather the use of something like a blocking queue to manage FPS is a good idea.

int fps = 30;

LinkedBlockingQueue<Thread> bq = new LinkedBlockingQueue<Thread>(1);

   bq.put(new Thread(updater));

Then have the updater somehow remove it'self from the LinkedBlockingQueue.  It prevents more than one updater from running at the same time, but also makes the wait continue while the thread is running.
3  Java Game APIs & Engines / Java 2D / Avoidance of Garbage Collection on: 2005-02-28 02:44:26
Is it a good idea to avoid creating a new BufferedImage every time an image is refreshed to avoid java garbage collection, and if so, is it a good idea to have a blank image or blank raster to reset the image to when you want to redraw it?  Is there a better way?  What I have is this.

import java.awt.*;
import java.awt.image.*;
import javax.swing.*;
* @author Scott
public class ScreenManager
   private BufferedImage bi;
   private Raster blank;
   private BufferStrategy bs;
   private int width;
   private int height;
   public ScreenManager(int width, int height)
       JFrame screenFrame = new JFrame(String.format("%dx%d", width, height));
       screenFrame.setSize(width+6, height+24);
       this.width = width;
       this.height = height;
       bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
       blank = bi.getData();
       bs = screenFrame.getBufferStrategy();
   public void drawPixel(int x, int y, Color c)
       //bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
   public void refresh()
       render(bs.getDrawGraphics(), bi);;
   public void render(Graphics g, Image i)
       g.drawImage(i, 3, 21, null);


import java.awt.*;

* @author Scott
public class Main
   private int pixelX;
   private int pixelY;
   public static void main(String[] args)
       ScreenManager sm = new ScreenManager(320, 240);
       for(int i = 0;i < 320; i++)
           if(i == 319) i = 0;
           for(int j = 0;j < 240;j++)
               if(j == 240) j = 0;
               sm.drawPixel(i, j, Color.WHITE);
Pages: [1]
deepthought (36 views)
2015-06-30 15:39:44

deepthought (39 views)
2015-06-30 15:39:09

deepthought (52 views)
2015-06-30 15:36:52

Za\'Anzabar (21 views)
2015-06-29 05:44:54

TritonDreyja (40 views)
2015-06-24 17:10:40

CopyableCougar4 (36 views)
2015-06-23 00:34:45

BurntPizza (41 views)
2015-06-21 20:36:46

cookiecompiler (84 views)
2015-06-11 15:42:53

cookiecompiler (47 views)
2015-06-11 15:41:14

NegativeZero (76 views)
2015-06-11 09:49:18
How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30

Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

Resources for WIP games
by kpars
2014-12-18 10:26:14 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‑
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!