--------------- Stack.class -----------------
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package java.util;
public class Stack<E> extends Vector<E> {
private static final long serialVersionUID = 1224463164541339165L;
public Stack() {
}
public E push(E var1) {
this.addElement(var1);
return var1;
}
public synchronized E pop() {
int var2 = this.size();
Object var1 = this.peek();
this.removeElementAt(var2 - 1);
return var1;
}
public synchronized E peek() {
int var1 = this.size();
if (var1 == 0) {
throw new EmptyStackException();
// первыйat java.util.Stack.peek (Stack.java:102) //
} else {
return this.elementAt(var1 - 1);
}
}
public boolean empty() {
return this.size() == 0;
}
public synchronized int search(Object var1) {
int var2 = this.lastIndexOf(var1);
return var2 >= 0 ? this.size() - var2 : -1;
}
}
--------------------- GameStateManager.java--------------------
package com.flappy.game.States;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import java.util.Stack;
public class GameStateManager {
private Stack<State> states;
public GameStateManager(){
states = new Stack<State>();
}
public void push(State state){
states.push(state);
}
public void pop(){
states.pop();
}
public void set(State state){
states.pop();
states.push(state);
}
public void update(float dt){
states.peek().update(dt);
// секунда на com.flappy.game.States.GameStateManager.update (GameStateManager.java:28) //
}
public void render(SpriteBatch sb){
states.peek().render(sb);
}
}
---------- Flappy.java ----------
package com.flappy.game;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.flappy.game.States.GameStateManager;
import com.flappy.game.States.MenuState;
public class Flappy extends ApplicationAdapter {
public static final int WIDTH = 480;
public static final int HEIGHT = 800;
public static final String TITLE = "Cioara" ;
private GameStateManager gsm;
private SpriteBatch batch ;
@Override
public void create () {
batch = new SpriteBatch();
gsm = new GameStateManager();
Gdx.gl.glClearColor(1, 0, 0, 1);
}
@Override
public void render () {
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
gsm.update(Gdx.graphics.getDeltaTime());
// at com.flappy.game.Flappy.render (Flappy.java:33) //
gsm.render(batch);
}
}
--------------- LwjglApplication.java ----------------
https://pastebin.com/6gRkiz0y
сначала в строке 225 com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop (LwjglApplication.java:225)
секунда в строке 126кнопка в центре
Приложение, разработанное на основе libGDX Framework в соответствии с данным руководством: https://www.youtube.com/watch?v=rzBVTPaUUDg&list=PLZm85UZQLd2TPXpUJfDEdWTSgszionbJy&index=1