Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#ActualPlutonium

Posted 29 April 2012 - 05:02 PM

Maybe it will help
//loading image
void loadImages() {
		bg = new ImageIcon(this.getClass().getResource("background.png")).getImage();
	}

//drawing image
  void draw(Graphics2D g2d) {
		g2d.drawImage(bg, 0, 0, null);
	}

//this one on init to create shit
void init()P
	 createBufferStrategy(2);
		strategy = getBufferStrategy();
		g2d = (Graphics2D) strategy.getDrawGraphics();
}

//this one has more code, bet important is this piece of code
private void graphics() {
		strategy = getBufferStrategy();
		g2d = (Graphics2D) strategy.getDrawGraphics();
		strategy.show();
	}
//and in game loop I draw it
  private void gameLoop() {
while (running){
			graphics();
		   draw(g2d);
			g2d.dispose();
		}
	}


#1Plutonium

Posted 29 April 2012 - 05:01 PM

Maybe it will help
//loading image
void loadImages() {
	    bg = new ImageIcon(this.getClass().getResource("background.png")).getImage();
    }
//drawing image
  void draw(Graphics2D g2d) {
	    g2d.drawImage(bg, 0, 0, null);
    }

//this one on init to create shit
	 createBufferStrategy(2);
	    strategy = getBufferStrategy();
	    g2d = (Graphics2D) strategy.getDrawGraphics();
//this one has more code, bet important is this piece of code
private void graphics() {
	    strategy = getBufferStrategy();
	    g2d = (Graphics2D) strategy.getDrawGraphics();
	    strategy.show();
    }
//and in game loop I draw it
  private void gameLoop() {
while (running){
		    graphics();
		   draw(g2d);
		    g2d.dispose();
	    }
    }


PARTNERS