LIBGDX创建主菜单 [英] LIBGDX creating a main menu

查看:67
本文介绍了LIBGDX创建主菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我想为我的游戏创建一个主菜单,我被困在下一步该做什么,我已经完成了所有的艺术工作,并且全部都分层了,并打包在一个.pack

So i want to create a mainmenu for my game and i'm stuck on what to do next i have all the art done and it's all in layers and packed in a .pack

public class MainMenu implements Screen {

CrazyZombies game;
Stage stage;
BitmapFont font;
TextureAtlas MainMenu;
Texture road;
Skin skin;
SpriteBatch batch;

public MainMenu(CrazyZombies game){
    this.game = game;
}

@Override
public void render(float delta) {
    Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
    Gdx.gl.glClearColor(0.09f, 0.28f, 0.2f, 1);

    stage.act(delta);

    batch.begin();
    stage.draw();
    batch.end();
}

@Override
public void resize(int width, int height) {
    if(stage == null)
        stage = new Stage(width, height, true);
    stage.clear();

    Gdx.input.setInputProcessor(stage);

}

@Override
public void show() {
    batch = new SpriteBatch();
    skin = new Skin();
    MainMenu = new TextureAtlas("data/mainmenu/MainMenu.pack");

}

@Override
public void hide() {
    dispose();
}

@Override
public void pause() {

}

@Override
public void resume() {

}

@Override
public void dispose() {
    batch.dispose();
    skin.dispose();
    MainMenu.dispose();
    stage.dispose();
}
}

如果有人可以给我一些有关现在该怎么做的指南或教程,那很好,我在很多地方都看过,但是他们没有给我所需的答案.

If anyone could give me some guidelines or tutorials on what to do now it would be great i've looked in a lot of places but they have not given me the required answers.

推荐答案

请看一下本教程,该教程总结了您到底想要什么:

Have a look at this tutorial which sums up what you want exactly:

LibGDX:使用启动屏幕或菜单

这篇关于LIBGDX创建主菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆