Note that there are some explanatory texts on larger screens.

plurals
  1. POIs there a way of placing a video in my Java game main menu
    primarykey
    data
    text
    <p>I have made a simple Java game, when I load the game a start-up menu pops up with a simple play button and a close button, if I press the start button Java changes to another class which takes the user to the game, if I press close the game shuts down. At the moment the game menu is very boring I wish to add a video to the start-up menu, is this possible using Java code and if so, is it complicated?</p> <p>My code so far for my menu is shown bellow, the main two methods are the render and update methods, the render tells java what to add to the screen and the update method tells java what to do if a button is pressed:</p> <pre><code> package javagame; import org.lwjgl.input.Mouse; import org.newdawn.slick.*; import org.newdawn.slick.state.*; public class Menu extends BasicGameState{ //public String mouse= "no input yet";//COORDS if needed Image bg; public Menu(int state){ } public void init(GameContainer gc, StateBasedGame sbg) throws SlickException{ bg = new Image("res/croftbg.png"); } public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException{ bg.draw(0,0); //g.drawString(mouse, 10, 50);//COORDS if needed } public void update(GameContainer gc, StateBasedGame sbg, int delta)throws SlickException{ int posX = Mouse.getX(); int posY = Mouse.getY(); //mouse = "mouse pos:" +posX+" " +posY;//Coords if needed //play now button if((posX&gt;110 &amp;&amp; posX&lt;140) &amp;&amp; (posY&gt;5 &amp;&amp; posY&lt;25)){//checks if mouse is inside play now button if(Mouse.isButtonDown(0)){//checks if left mouse pressed sbg.enterState(1);//change to play state ie(1) } } //exit button if((posX&gt;510 &amp;&amp; posX&lt;535) &amp;&amp; (posY&gt;5 &amp;&amp; posY&lt;25)){ if(Mouse.isButtonDown(0)){ System.exit(0);//closes the widow } } } public int getID(){ return 0; } </code></pre> <p>Also, I do not require any audio, I only need the video.</p> <p>Thank you in advance.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload