-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmenuScreen.java
executable file
·70 lines (51 loc) · 1.43 KB
/
menuScreen.java
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
// menuScreen.java
// Henry Hu, Nafis Molla
// May 14, 2019
// ICS4U
// Displays the menu screen at the start of the game
package com.mygdx.game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
public class menuScreen implements Screen {
private SpriteBatch batch;
private Menu menu;
private Texture logo;
public menuScreen(Menu g){
batch = new SpriteBatch();
menu = g;
}
@Override
public void show() {
logo = new Texture("menu.png");
}
@Override
public void render(float delta) {
if (Gdx.input.isKeyPressed(Input.Keys.ENTER)){ //enter to go to game
menu.setScreen(menu.getGameScreen());
}
if (Gdx.input.isKeyPressed(Input.Keys.I)){ //"I" to go to instructions
menu.setScreen(menu.getInstructionsDisplay());
}
batch.begin();
batch.draw(logo,0,0,Gdx.graphics.getWidth(),Gdx.graphics.getHeight()); //picture for main menu
batch.end();
}
@Override
public void resize(int width, int height) {
}
@Override
public void pause() {
}
@Override
public void resume() {
}
@Override
public void hide() {
}
@Override
public void dispose() {
}
}