Advertisement
Advertisement
| 07.12.2008 at 04:31PM PDT, ID: 23560156 |
|
[x]
Attachment Details
|
||
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: 88: 89: 90: 91: 92: 93: 94: 95: |
package com.abc.ZeldaClone1;
import org.newdawn.slick.*;
import org.newdawn.slick.gui.*;
import org.newdawn.slick.geom.*;
import org.newdawn.slick.fills.*;
import mdes.slick.sui.*;
import mdes.slick.sui.event.ActionEvent;
import mdes.slick.sui.event.ActionListener;
import mdes.slick.sui.event.*;
import mdes.slick.sui.layout.*;
import mdes.slick.sui.event.MouseAdapter;
import mdes.slick.sui.event.MouseEvent;
public class TitleScreen extends BasicGame{
Image backgroundImage = null;
private Display display = null;
private boolean displayPicture = true;
public TitleScreen(){
super("");
}
public void setImage(Image background){
backgroundImage = background;
}
public Image getImage(){
return null;
}
@Override
public void init(final GameContainer container) throws SlickException {
// TODO Auto-generated method stub
//not implemented yet..
backgroundImage = new Image("res/Title.jpg");
container.getGraphics().drawImage(backgroundImage, 0, 0);
display = new Display(container);
Container contents = new Container();
contents.setSize(300,150);
contents.setLocation(250,375);
contents.setOpaque(true);
contents.setBackground(Color.black);
RowLayout layout = new RowLayout(true,RowLayout.LEFT,RowLayout.CENTER);
contents.setLayout(layout);
Button btn = new Button("Press to Start Demo..");
btn.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event){
display.removeAll();
}
});
btn.pack();
contents.add(btn);
//add a label to the contents..
Label label = new Label("Dungeon Crawler");
label.setForeground(Color.white);
label.pack(); //pack the label with current text
label.setHeight(btn.getHeight());
contents.add(label);
display.add(contents);
}
@Override
public void update(GameContainer container, int delta) throws SlickException {
// TODO Auto-generated method stub
display.update(container,delta);
if (container.getInput().isKeyPressed(Input.KEY_ESCAPE))
container.exit();
}
@Override
public void render(GameContainer container, Graphics g) throws SlickException {
// TODO Auto-generated method stub
if(displayPicture == false){
g.clear();
}else{
g.drawImage(backgroundImage, 0, 0);
}
display.render(container,g);
}
}
|