UI.js 887 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. 'atomic component';
  2. var fd = new Atomic.UIFontDescription();
  3. fd.id = "Vera";
  4. fd.size = 22;
  5. function createButton(self, text, event, layout) {
  6. var button = new Atomic.UIButton();
  7. button.text = text;
  8. button.fontDescription = fd;
  9. button.gravity = Atomic.UI_GRAVITY_RIGHT;
  10. button.onClick = function() {
  11. self.sendEvent(event);
  12. }
  13. layout.addChild(button);
  14. }
  15. exports.component = function(self) {
  16. // root view
  17. self.uiView = new Atomic.UIView();
  18. var layout = new Atomic.UILayout();
  19. layout.rect = self.uiView.rect;
  20. layout.axis = Atomic.UI_AXIS_Y;
  21. layout.layoutPosition = Atomic.UI_LAYOUT_POSITION_GRAVITY;
  22. self.uiView.addChild(layout);
  23. createButton(self, "Play Hearts", "PlayHearts", layout);
  24. createButton(self, "Play Snow", "PlaySnow", layout);
  25. createButton(self, "Play Spark", "PlaySpark", layout);
  26. }