HUD.js 813 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. 'atomic component';
  2. exports.component = function(self) {
  3. var game = Atomic.game;
  4. var view = game.uiView;
  5. var UI = Atomic.UI;
  6. var UIButton = Atomic.UIButton;
  7. var UITextField = Atomic.UITextField;
  8. var UILayout = Atomic.UILayout;
  9. var layout = new Atomic.UIWidget();
  10. layout.load("UI/Hud.ui.txt");
  11. layout.setSize(game.graphics.width, game.graphics.height);
  12. view.addChild(layout);
  13. self.cleanup = function() {
  14. view.removeChild(layout);
  15. };
  16. var scoretext = layout.getWidget("scoretext");
  17. //UI.debugShowSettingsWindow(view);
  18. self.updateScore = function(value) {
  19. scoretext.text = "Score: " + value;
  20. };
  21. self.updateHealth = function(value) {
  22. //healthText.text = "Health: " + value;
  23. };
  24. self.updateGameText = function(text) {
  25. //gameText.text = text;
  26. };
  27. };