Last active
March 30, 2016 00:16
-
-
Save tindzk/2466a5424b474831442624463cc9fcfe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.badlogic.gdx.ApplicationAdapter; | |
import com.badlogic.gdx.Gdx; | |
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application; | |
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration; | |
import com.badlogic.gdx.graphics.Color; | |
import com.badlogic.gdx.graphics.g2d.BitmapFont; | |
import com.badlogic.gdx.scenes.scene2d.Stage; | |
import com.badlogic.gdx.scenes.scene2d.ui.Label; | |
import com.badlogic.gdx.graphics.g2d.Batch; | |
import com.badlogic.gdx.scenes.scene2d.Actor; | |
import org.lwjgl.opengl.GL11; | |
import org.lwjgl.opengl.GL20; | |
class MyActor extends Actor { | |
@Override | |
public void draw(Batch batch, float parentAlpha) { | |
super.draw(batch, parentAlpha); | |
int cp = GL11.glGetInteger(GL20.GL_CURRENT_PROGRAM); | |
GL20.glUseProgram(GL20.glCreateProgram()); | |
GL20.glUseProgram(cp); | |
} | |
} | |
public class HelloWorld { | |
static Stage stage; | |
public static class MainWindow extends ApplicationAdapter { | |
@Override | |
public void create () { | |
stage = new Stage(); | |
Gdx.input.setInputProcessor(stage); | |
stage.getRoot().addActor(new Label("test", | |
new Label.LabelStyle( | |
new BitmapFont(Gdx.files.internal("whitefont.fnt"), false), | |
Color.WHITE | |
))); | |
stage.getRoot().addActor(new MyActor()); | |
} | |
@Override | |
public void render () { | |
stage.act(); | |
stage.draw(); | |
} | |
} | |
public static void main(String[] argv) { | |
Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration(); | |
new Lwjgl3Application(new MainWindow(), config); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment