好的,我只是想出來。我對Android編碼非常陌生。我也只用AIDE在手機上完成。如何在gdx遊戲中打開另一個課程
我想開標記aboutgame.java
我不知道如何發佈我的代碼另一個類,但在這裏不用。
package com.bernco.screenoff;
import com.badlogic.gdx.*;
import com.badlogic.gdx.graphics.*;
import com.badlogic.gdx.graphics.g2d.*;
import com.badlogic.gdx.scenes.scene2d.*;
import com.badlogic.gdx.scenes.scene2d.ui.*;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton.TextButtonStyle;
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
public class MyGdxGame implements ApplicationListener
{
Texture texture;
Texture pwrdby;
Texture about;
SpriteBatch batch;
SpriteBatch pwrbtch;
SpriteBatch abtbtch;
@Override
public void create()
{
texture = new Texture(Gdx.files.internal("dark-android.jpg"));
about = new Texture(Gdx.files.internal("about.png"));
pwrdby = new Texture(Gdx.files.internal("powered-by.png"));
batch = new SpriteBatch();
abtbtch = new SpriteBatch();
pwrbtch = new SpriteBatch();
}
@Override
public void render()
{
Gdx.gl.glClearColor(0f, 0f, 0f, 0f);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
abtbtch.begin();
abtbtch.draw(about, Gdx.graphics.getWidth() - about.getWidth()/2, Gdx.graphics.getHeight() - about.getHeight()/2,
Gdx.graphics.getWidth()/8, Gdx.graphics.getWidth()/8);
abtbtch.end();
batch.begin();
batch.draw(texture, Gdx.graphics.getWidth()/80, 0,
Gdx.graphics.getWidth()/1, Gdx.graphics.getWidth()/2);
batch.end();
pwrbtch.begin();
pwrbtch.draw(pwrdby, Gdx.graphics.getWidth()/80, 0,
Gdx.graphics.getWidth()/4, Gdx.graphics.getWidth()/3);
pwrbtch.end();
}
@Override
public void dispose()
{
}
@Override
public void resize(int width, int height)
{
}
@Override
public void pause()
{
}
@Override
public void resume()
{
}
}
建議:投資一個好的LibGDX_book_並按照例子逐步進行。我個人非常喜歡「與LibGDX開始遊戲開發」。 – DavidS