omer boyaci. (c) 2010 pearson education, inc. all rights reserved. omer boyaci

25
COMPUTER GRAPHICS THROUGH GAME PROGRAMMING Omer Boyaci

Upload: eric-francis

Post on 17-Jan-2016

225 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Omer Boyaci. (C) 2010 Pearson Education, Inc. All rights reserved. Omer Boyaci

COMPUTER GRAPHICS THROUGH GAME PROGRAMMING

Omer Boyaci

Page 2: Omer Boyaci. (C) 2010 Pearson Education, Inc. All rights reserved. Omer Boyaci

(C) 2010 Pearson Education, Inc. All rights reserved.

IMAGE LOADING, VISUAL EFFECTS AND ANIMATION

Omer Boyaci

Page 3: Omer Boyaci. (C) 2010 Pearson Education, Inc. All rights reserved. Omer Boyaci

(C) 2010 Pearson Education, Inc. All rights reserved.

private BufferedImage im;im = ImageIO.read( getClass().getResource("ball.gif"));

Image Loading

Page 4: Omer Boyaci. (C) 2010 Pearson Education, Inc. All rights reserved. Omer Boyaci

(C) 2010 Pearson Education, Inc. All rights reserved.

public BufferedImage loadImage(String fnm){/* Load the image from <fnm>, returning it as a BufferedImagewhich is compatible with the graphics device being used. Uses ImageIO. */

try {GraphicsEnvironment ge =

GraphicsEnvironment.getLocalGraphicsEnvironment( );GraphicsConfiguration gc =

ge.getDefaultScreenDevice( ).getDefaultConfiguration( );BufferedImage im = ImageIO.read(getClass( ).getResource(fnm));int transparency = im.getColorModel( ).getTransparency( );BufferedImage copy = gc.createCompatibleImage(

im.getWidth( ),im.getHeight( ),transparency );// create a graphics contextGraphics2D g2d = copy.createGraphics();// copy imageg2d.drawImage(im,0,0,null);g2d.dispose( );return copy;

}catch(IOException e) {

System.out.println("Load Image error for " + fnm + ":\n" + e);return null;

}} // end of loadImage( )

Page 5: Omer Boyaci. (C) 2010 Pearson Education, Inc. All rights reserved. Omer Boyaci

(C) 2010 Pearson Education, Inc. All rights reserved.

Image Names

Page 6: Omer Boyaci. (C) 2010 Pearson Education, Inc. All rights reserved. Omer Boyaci

(C) 2010 Pearson Education, Inc. All rights reserved.

You can load individual imagesimage stripsmultiple image files that represent an

animation sequence.

Animation

Page 7: Omer Boyaci. (C) 2010 Pearson Education, Inc. All rights reserved. Omer Boyaci

(C) 2010 Pearson Education, Inc. All rights reserved.

Animation Types

Page 8: Omer Boyaci. (C) 2010 Pearson Education, Inc. All rights reserved. Omer Boyaci

(C) 2010 Pearson Education, Inc. All rights reserved.

// imsInfo.txt images

o atomic.gif

o balls.jpg

o bee.gif

o cheese.gif

o eyeChart.gif

o house.gif

o pumpkin.png

o scooter.gif

o ufo.gif

o owl.png

n numbers*.gif 6

n figure*.gif 9

g fighter left.gif right.gif still.gif up.gif

s cars.gif 8

s cats.gif 6

s kaboom.gif 6

o basn6a08.png

o basn6a16.png

o <fnm>n <fnm*.ext> <number>s <fnm> <number>g <name> <fnm> [ <fnm> ]*

Page 9: Omer Boyaci. (C) 2010 Pearson Education, Inc. All rights reserved. Omer Boyaci

(C) 2010 Pearson Education, Inc. All rights reserved.

Strip file

Page 10: Omer Boyaci. (C) 2010 Pearson Education, Inc. All rights reserved. Omer Boyaci

(C) 2010 Pearson Education, Inc. All rights reserved.

Swing Timer

Page 11: Omer Boyaci. (C) 2010 Pearson Education, Inc. All rights reserved. Omer Boyaci

(C) 2010 Pearson Education, Inc. All rights reserved.

ImagePlayer

Page 12: Omer Boyaci. (C) 2010 Pearson Education, Inc. All rights reserved. Omer Boyaci

Java Games

Page 13: Omer Boyaci. (C) 2010 Pearson Education, Inc. All rights reserved. Omer Boyaci

Runescape

http://www.runescape.com/

Page 14: Omer Boyaci. (C) 2010 Pearson Education, Inc. All rights reserved. Omer Boyaci

Stellar Dawn

http://www.stellardawn.com/

Page 15: Omer Boyaci. (C) 2010 Pearson Education, Inc. All rights reserved. Omer Boyaci

Wakfu

http://www.wakfu.com/

Page 16: Omer Boyaci. (C) 2010 Pearson Education, Inc. All rights reserved. Omer Boyaci

Tribal Trouble 2

http://tribaltrouble2.com/

Page 17: Omer Boyaci. (C) 2010 Pearson Education, Inc. All rights reserved. Omer Boyaci

Pirate Galaxy http://us.pirategalaxy.net

Page 18: Omer Boyaci. (C) 2010 Pearson Education, Inc. All rights reserved. Omer Boyaci

Resistance Force http://www.resistanceforce.com/

Page 19: Omer Boyaci. (C) 2010 Pearson Education, Inc. All rights reserved. Omer Boyaci

Urban Galaxy http://www.urbangalaxyonline.com/

Page 20: Omer Boyaci. (C) 2010 Pearson Education, Inc. All rights reserved. Omer Boyaci

Poisenville http://www.poisonville.com/

Page 21: Omer Boyaci. (C) 2010 Pearson Education, Inc. All rights reserved. Omer Boyaci

Chrome http://www.techland.pl/?

id=produkty&produkt=179

Page 22: Omer Boyaci. (C) 2010 Pearson Education, Inc. All rights reserved. Omer Boyaci

Wurm http://wurmonline.com/

Page 23: Omer Boyaci. (C) 2010 Pearson Education, Inc. All rights reserved. Omer Boyaci

Cell Invaders - TowerDefense http://

www.krautsoft.vs241092.vserver.de/virchow/index.html

Page 24: Omer Boyaci. (C) 2010 Pearson Education, Inc. All rights reserved. Omer Boyaci

Wezzle

http://couchware.ca/www/wezzle/

Page 25: Omer Boyaci. (C) 2010 Pearson Education, Inc. All rights reserved. Omer Boyaci

CEPHEI - HOSTILE PLANET

http://jalex.se/Cephei/bin/game.html