Skip to content

Instantly share code, notes, and snippets.

@johngirvin
Created Jan 18, 2017
Embed
What would you like to do?
public class Game1 : Core
{
protected override void Initialize()
{
base.Initialize();
Input.touch.enableTouchSupport();
Scene.setDefaultDesignResolution(304, 240, Scene.SceneResolutionPolicy.ShowAll);
scene = new TestScene();
}
}
public class TestScene : Scene
{
public override void initialize()
{
addRenderer(new DefaultRenderer());
var canvas = createEntity("ui").addComponent(new UICanvas());
canvas.isFullScreen = false;
var table = canvas.stage.addElement(new Table());
table.setFillParent(true);
table.add(new TextButton("X", TextButtonStyle.create(Color.Black, Color.DarkGray, Color.Gray)))
.setMinWidth(30).setMinHeight(30).setAlign(Align.center)
.getElement<Button>().onClicked += onClicked;
}
private void onClicked(Button obj)
{
Debug.log("OnClicked");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment