Skip to content

Instantly share code, notes, and snippets.

@rezoner
rezoner / gist:c8e0e9be86d74b36b2aa
Last active August 29, 2015 14:17
Playground.js + Three.js - draft 3
/*
I've decided there will be two levels of integration
1) You get loaders only. You have to create renderers and scenes manually.
2) You get loaders and magically bootstrapped Three.js
Below is level 2 integration example which renders a textured cube:
*/
@rezoner
rezoner / gist:65f8313b156fbd48d467
Created April 2, 2015 23:45
PLAYGROUND.Layer plugin
PLAYGROUND.Layer = {
plugin: true,
app: {
create: function(app, data) {
app.layer = cq().appendTo(app.container);
@rezoner
rezoner / gist:ed86e0a72a13ef58fce5
Created April 3, 2015 18:40
Playground Plugins v3
/*
Here is a simple plugin that creates scanlines image
and draws it after everything has been rendered
I am still not sure what will be the standard for configuration.
*/
PLAYGROUND.Scanlines = function(app) {
@rezoner
rezoner / game.js
Last active August 29, 2015 14:18
save screen in playground.js
/* This will make you a screenshot for later usage whenever you want */
ENGINE.Game = {
showOptionsScreen: function() {
app.screenshot = this.app.layer.cache();
app.setState(ENGINE.Options);
}
var app = new PLAYGROUND.Application({
preload: function() {
/* this is called before create and lets you silently load some assets */
this.loadData("objects/buildings", "objects/subObjects", "objects/townBuildingList");
},
playground({
create: function() {
app.loadData(...);
},
ready: function() {
var app = playground({
create: function() {
app.loadData(...);
},
ready: function() {
@rezoner
rezoner / gist:de8a10ab78f52e4c2f64
Last active August 29, 2015 14:20
Imaginary namespaces for javascript

Namespacing concept for javascript

keyword namespace would replace window as a default global with another object until namespace is escaped.

namespace ENGINE;

Physics = {

 applyForce: function(x, y) { ... },
var offsets = [
[0.0, 1.0],
[0.0, 0.5],
[0.0, 0.0],
[0.5, 0.0],
[0.5, 0.5],
[0.5, 1.0]
[1.0, 0.0],
[1.0, 0.5],
[1.0, 1.0]
class GUIList extends GUIWidget {
constructor(args) {
super(args);
this.scrollable = true;
this.layout = {