2012年6月12日 星期二

Java Game Development (9) - Loading Pictures for the Movie


import java.awt.*;
import javax.swing.ImageIcon;




public class apples{
public static void main(String[] args){
DisplayMode displaymode = new DisplayMode(1280,800,16, DisplayMode.REFRESH_RATE_UNKNOWN);
apples a = new apples();
a.run(displaymode);
}
private Screen screen;
private Image bg;
private Animation ani;
//Computer加載圖片到Java和添加場景
public void loadPics(){
bg = new ImageIcon("C\\baby.jpg").getImage();
Image face = new ImageIcon("C\\baby1.png").getImage();
Image face1 = new ImageIcon("C\\baby2.png").getImage();
ani = new Animation();
ani.addScene(face, 250);
ani.addScene(face1, 250);
}
//要運
public void run(DisplayMode dm){
screen = new Screen();
try{
screen.setFullScreen(dm, new Frame());
loadPics();
movieLoop();
}finally{
screen.restoreScreen();
}
}
}

沒有留言:

張貼留言