Skip to content

Instantly share code, notes, and snippets.

@johngirvin
Created January 18, 2017 16:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johngirvin/28a5f8dc7f9889c0603dc3b33fc7c956 to your computer and use it in GitHub Desktop.
Save johngirvin/28a5f8dc7f9889c0603dc3b33fc7c956 to your computer and use it in GitHub Desktop.
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