Guest User

Untitled

a guest
Jan 24th, 2019
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. var clicked,
  2. pressed,
  3. keys = {};
  4. mousePressed = function() {
  5. clicked = true;
  6. };
  7. mouseReleased = function() {
  8. clicked = false;
  9. };
  10. keyPressed = function() {
  11. keys[keyCode] = true;
  12. pressed = true;
  13. };
  14. keyReleased = function() {
  15. delete keys[keyCode];
  16. pressed = false;
  17. };
  18.  
  19. var Icon = function(sprite) {
  20. this.sprite = sprite;
  21. };
  22. Icon.prototype.loadSprite = function() {
  23. (background)(0, 0);
  24. this.sprite = this.sprite();
  25. };
  26.  
  27. var App = function(icon) {
  28. this.icon = new Icon(icon);
  29. this.active = false;
  30. this.focused = false;
  31. };
  32.  
  33. var ChatApp = function() {
  34. App.call(function() {
  35. fill(0, 200, 150);
  36. rect(25, 25, 25, 25);
  37.  
  38. return get(0, 0, 100, 100);
  39. });
  40. };
  41. ChatApp.prototype = Object.create(App.prototype);
  42. ChatApp.prototype.init = function() {
  43. //
  44. };
  45. ChatApp.prototype.launch = function() {
  46. this.active = true;
  47. };
  48. ChatApp.prototype.exit = function() {
  49. this.active = false;
  50. };
  51. ChatApp.prototype.focus = function() {
  52. this.focused = true;
  53. };
  54. ChatApp.prototype.unFocus = function() {
  55. this.focused = false;
  56. };
  57. ChatApp.prototype.update = function() {
  58. if(!this.active) {
  59. return;
  60. }
  61. if(!this.focused) {
  62. return;
  63. }
  64. };
  65. ChatApp.prototype.display = function() {
  66. if(!this.focused) {
  67. return;
  68. }
  69. };
  70.  
  71. var OS = function() {
  72. this.apps = {};
  73. this.activeApps = {};
  74. this.accounts = {
  75. admin: {
  76. username: 'admin',
  77. password: 'admin',
  78. settings: {
  79. theme: 'default'
  80. }
  81. }
  82. };
  83. if(this.loadImages()) {
  84. this.init();
  85. }
  86. };
  87.  
  88. OS.prototype.loadImages = function() {
  89. // Load images here
  90. return true;
  91. };
  92.  
  93. OS.prototype.init = function() {
  94. // Launch EOS
  95. for(var app in this.apps) {
  96. this.apps[app].init();
  97. }
  98. };
  99.  
  100. OS.prototype.update = function() {
  101. for(var app in this.activeApps) {
  102. this.activeApps[app].update();
  103. }
  104. };
  105.  
  106. var EOS = new OS();
  107.  
  108. var draw = function() {
  109. EOS.update();
  110. };
Add Comment
Please, Sign In to add comment