Hello, I'm learning some good ol' game development and I came across the need to change the boring black background to a static image. The only problem is that the background overlaps all other images/labels/else and is the only thing visible. Here is my "render" of the class/state called "Menu.java" (Slightly modified to simplify the reading):
@Override public void render(GameContainer gameContainer, StateBasedGame stateBasedGame, Graphics g) throws SlickException { Image background = new Image("res/MenuBG.png"); //The background g.drawImage(background, 0, 0, null); //Rendering the background g.drawString(VariableNameHere, 360, 10); //A string displayed on the screen g.drawString(AnotherVariableHere, 10, 450); //Another one g.drawRect(500, 150, 75, 225); //A rectangle shape g.drawImage(HereIsAnImage, 500, 150); //An image g.drawString(YetAnotherVariable, 100, 175); //A string g.drawString(GuessWhatThisIs, 100, 275); //Yet again, a string }
The only thing visible is the background, everything else is ignored, why is that so!?
When I'm done with learning game development, I will hopefully publish a thread with source code for classic games like Pong, Snake, and Pacman.