UI.js 938 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 Idle", "PlayIdle", layout);
  24. createButton(self, "Play Walk", "PlayWalk", layout);
  25. createButton(self, "Play Run", "PlayRun", layout);
  26. createButton(self, "Play Attack", "PlayAttack", layout);
  27. }