-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainMenu.java
110 lines (63 loc) · 1.88 KB
/
MainMenu.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
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
package com.MainClass.game;
import com.MainClass.game.MainClass;
import com.MainClass.game.Menu;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
public class MainMenu implements Screen {
private MainClass game;
Texture background;
SpriteBatch batch2;
Menu menu;
float width = Gdx.graphics.getWidth();
float height = Gdx.graphics.getHeight();
public MainMenu(MainClass game) {
this.game = game;
game.batch = new SpriteBatch();
background = new Texture("cave.png");
menu = new Menu(game, this);
batch2 = new SpriteBatch();
width = Gdx.graphics.getWidth();
height = Gdx.graphics.getHeight();
}
@Override
public void show() {
}
@Override
public void render(float delta) {
Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batch2.begin();
batch2.draw(background, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
batch2.end();
//game.batch.begin();
//game.batch.draw(background, 0, 0, width, height);
//game.batch.end();
//menu.stage.draw();
menu.render(delta);
game.batch.setProjectionMatrix(menu.stage.getCamera().combined);}
@Override
public void resize(int width, int height) {
menu.stage.getViewport().update(width,height);
this.width = width;
this.height = height;
}
@Override
public void pause() {
}
@Override
public void resume() {
}
@Override
public void hide() {
}
@Override
public void dispose() {
game.batch.dispose();
menu.dispose();
batch2.dispose();
background.dispose();
}
}