Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var clicked,
- pressed,
- keys = {};
- mousePressed = function() {
- clicked = true;
- };
- mouseReleased = function() {
- clicked = false;
- };
- keyPressed = function() {
- keys[keyCode] = true;
- pressed = true;
- };
- keyReleased = function() {
- delete keys[keyCode];
- pressed = false;
- };
- var Icon = function(sprite) {
- this.sprite = sprite;
- };
- Icon.prototype.loadSprite = function() {
- (background)(0, 0);
- this.sprite = this.sprite();
- };
- var App = function(icon) {
- this.icon = new Icon(icon);
- this.active = false;
- this.focused = false;
- };
- var ChatApp = function() {
- App.call(function() {
- fill(0, 200, 150);
- rect(25, 25, 25, 25);
- return get(0, 0, 100, 100);
- });
- };
- ChatApp.prototype = Object.create(App.prototype);
- ChatApp.prototype.init = function() {
- //
- };
- ChatApp.prototype.launch = function() {
- this.active = true;
- };
- ChatApp.prototype.exit = function() {
- this.active = false;
- };
- ChatApp.prototype.focus = function() {
- this.focused = true;
- };
- ChatApp.prototype.unFocus = function() {
- this.focused = false;
- };
- ChatApp.prototype.update = function() {
- if(!this.active) {
- return;
- }
- if(!this.focused) {
- return;
- }
- };
- ChatApp.prototype.display = function() {
- if(!this.focused) {
- return;
- }
- };
- var OS = function() {
- this.apps = {};
- this.activeApps = {};
- this.accounts = {
- admin: {
- username: 'admin',
- password: 'admin',
- settings: {
- theme: 'default'
- }
- }
- };
- if(this.loadImages()) {
- this.init();
- }
- };
- OS.prototype.loadImages = function() {
- // Load images here
- return true;
- };
- OS.prototype.init = function() {
- // Launch EOS
- for(var app in this.apps) {
- this.apps[app].init();
- }
- };
- OS.prototype.update = function() {
- for(var app in this.activeApps) {
- this.activeApps[app].update();
- }
- };
- var EOS = new OS();
- var draw = function() {
- EOS.update();
- };
Add Comment
Please, Sign In to add comment