Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding Menu State Backgrounds

  • Loading branch information...
commit 1c1885ecb0677341642d36201c5765c30d4e3d63 1 parent ead8c9b
Andrew Melton ramielrowe authored
3  resources/images.xml
View
@@ -9,4 +9,7 @@
<resource key="selector" location="images/cog_selector.png" />
<resource key="door" location="images/door.png" />
<resource key="button" location="images/button.png" />
+ <resource key="creditsScreen" location="images/CreditsScreen.png" />
+ <resource key="optionsScreen" location="images/OptionsScreen.png" />
+ <resource key="loadingScreen" location="images/LoadingScreen.png" />
</resources>
BIN  resources/images/CreditsScreen.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  resources/images/LoadingScreen.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  resources/images/OptionsScreen.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 src/com/vulcastudios/TestGame.java
View
@@ -59,9 +59,9 @@ public void initStatesList(GameContainer gc) throws SlickException {
this.addState(new LoadState(this.rm));
this.addState(new MainMenuState());
this.addState(new InGameState());
- this.addState(new ControlsState());
- this.addState(new GameOptionsState());
- this.addState(new CreditsState());
+ this.addState(new ControlsState(this.rm));
+ this.addState(new GameOptionsState(this.rm));
+ this.addState(new CreditsState(this.rm));
this.addState(new TransitionState());
}
8 src/com/vulcastudios/states/ControlsState.java
View
@@ -8,9 +8,16 @@
import org.newdawn.slick.state.StateBasedGame;
import com.vulcastudios.TestGame;
+import com.vulcastudios.util.ResourceManager;
public class ControlsState extends BasicGameState {
+ private ResourceManager rm;
+
+ public ControlsState(ResourceManager rm){
+ this.rm = rm;
+ }
+
@Override
public void init(GameContainer container, StateBasedGame game)
throws SlickException {
@@ -21,6 +28,7 @@ public void init(GameContainer container, StateBasedGame game)
@Override
public void render(GameContainer container, StateBasedGame game, Graphics g)
throws SlickException {
+ g.drawImage(this.rm.getImage("creditsScreen"), 0, 0);
g.drawString("Directional arrows: move", 50, 50);
g.drawString("Space bar: suicide", 50, 75);
g.drawString("Enter: restart level", 50, 100);
9 src/com/vulcastudios/states/CreditsState.java
View
@@ -8,9 +8,15 @@
import org.newdawn.slick.state.StateBasedGame;
import com.vulcastudios.TestGame;
+import com.vulcastudios.util.ResourceManager;
public class CreditsState extends BasicGameState {
-
+
+ private ResourceManager rm;
+
+ public CreditsState(ResourceManager rm){
+ this.rm = rm;
+ }
@Override
public void init(GameContainer container, StateBasedGame game)
throws SlickException {
@@ -21,6 +27,7 @@ public void init(GameContainer container, StateBasedGame game)
@Override
public void render(GameContainer container, StateBasedGame game, Graphics g)
throws SlickException {
+ g.drawImage(this.rm.getImage("creditsScreen"), 0, 0);
g.drawString("Alex Meade", 50, 50);
g.drawString("Forrest Meade", 50, 75);
g.drawString("Andrew Melton", 50, 100);
7 src/com/vulcastudios/states/GameOptionsState.java
View
@@ -9,10 +9,16 @@
import org.newdawn.slick.tiled.TiledMap;
import com.vulcastudios.TestGame;
+import com.vulcastudios.util.ResourceManager;
public class GameOptionsState extends BasicGameState {
private int level = 1;
+ private ResourceManager rm;
+
+ public GameOptionsState(ResourceManager rm){
+ this.rm = rm;
+ }
@Override
public void init(GameContainer container, StateBasedGame game)
@@ -24,6 +30,7 @@ public void init(GameContainer container, StateBasedGame game)
@Override
public void render(GameContainer container, StateBasedGame game, Graphics g)
throws SlickException {
+ g.drawImage(this.rm.getImage("optionsScreen"), 0, 0);
TiledMap tiledMap = ((TestGame)game).getResourceManager().maps.get("level" + level);
tiledMap.render(0, 0);
g.drawString("Level " + level, 50, 50);
6 src/com/vulcastudios/states/LoadState.java
View
@@ -25,6 +25,7 @@
private ResourceManager rm;
private Iterator<Entry<String, Resource>> images, maps;
//private Iterator<Entry<String, Resource>> animations;
+ private Image backgroundImage;
public LoadState(ResourceManager rm){
this.rm = rm;
@@ -37,19 +38,22 @@ public LoadState(ResourceManager rm){
public void init(GameContainer container, StateBasedGame game)
throws SlickException {
rm.startLoad();
+ this.backgroundImage = new Image("./images/LoadingScreen.png");
+ rm.load("loadingScreen", this.backgroundImage);
}
@Override
public void render(GameContainer container, StateBasedGame game, Graphics g)
throws SlickException {
+ g.drawImage(this.backgroundImage, 0, 0);
//g.drawString("Progress: "+this.rm.getProgress(), 50, 50);
/*IntBuffer o = ByteBuffer.allocateDirect(200).asIntBuffer();
GL11.glGetInteger(GL11.GL_MAX_TEXTURE_SIZE, o);
System.err.println("GL_MAX_TEXTURE_SIZE: " + o.get());*/
- LoadingBar lb = new LoadingBar(5, container.getHeight()-35, container.getWidth()-10, 30);
+ LoadingBar lb = new LoadingBar(15, container.getHeight()-50, container.getWidth()-30, 30);
lb.setProgress(this.rm.getProgress());
lb.render(container, game, g);
Please sign in to comment.
Something went wrong with that request. Please try again.