Skip to content

Instantly share code, notes, and snippets.

@kindziora
Last active December 10, 2015 18:29
Show Gist options
  • Save kindziora/4474805 to your computer and use it in GitHub Desktop.
Save kindziora/4474805 to your computer and use it in GitHub Desktop.
ideas on a game framework http://jsfiddle.net/pBERS/13/
-Web Audio API
-three.js
-websocket
-indexedDB
var core = function() {
var self = {
'resources' : {
loader : {
load : function(finished){}
},
api : {
get : function(){},
set : function(){},
del : function(){}
}
},
'audio' : {
sound : {
play : function(){},
pause : function(){},
stop : function(){},
vol : function(){}
/*etc.*/
},
music : {
play : function(){},
pause : function(){},
stop : function(){},
vol : function(){}
/*etc.*/
}
},
'screen' : {
display : {
element : $canvas,
width : integer,
height : integer,
frames : integer
},
render : {
draw : function(vertices){}
},
sprite : new sprite()
},
'input' : {
mouse : {
X : function(){},
Y : function(){},
lock : function(){}
},
keyboard : {
pressed : function(){}
}
},
'network' : {
/*websocket*/
},
'calculate' : {
distance : function(vertices, vertices) {
}
/*etc.*/
},
'game' : {
init : function(config) {},
save : function() {},
load : function() {},
refresh : function(pause) {},
end : function() {},
obj[] : {
sprites[] : sprite{ resource[texture][x] },
vertices: vertices[]
}
}
};
return self;
}
var game = function(parent) {
var self = "jQuery-like".extend({}, parent); // to copy object
self.game.refresh = function() {
parent.game.refresh();
}
self.init = function(){
}
return self;
};
var inst = new game( new core({/*config*/}) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment