Skip to content

Instantly share code, notes, and snippets.

@KlonD90
Created February 24, 2015 18:30
Show Gist options
  • Save KlonD90/8a56a30ce10139982ef8 to your computer and use it in GitHub Desktop.
Save KlonD90/8a56a30ce10139982ef8 to your computer and use it in GitHub Desktop.
For KSU
/*global famous*/
// import dependencies
var Engine = famous.core.Engine;
var Modifier = famous.core.Modifier;
var Transform = famous.core.Transform;
var ImageSurface = famous.surfaces.ImageSurface;
var Surface = famous.core.Surface;
var StateModifier = famous.modifiers.StateModifier;
var GridLayout = famous.views.GridLayout;
var View = famous.core.View;
// create the main context
var mainContext = Engine.createContext();
function GameView(){
View.apply(this, arguments);
var deskView = new DeskView();
var playerOneView = new PlayerView([[1,2,3,4]], deskView);
var playerTwoView = new PlayerView([[1,2,3,4]], deskView);
var scoreView = new ScoreView(deskView);
}
GameView.prototype = Object.create(View.prototype);
GameView.prototype.constructor = GameView;
GameView.DEFAULT_OPTIONS = {};
function PlayerView(cards, desk){
View.apply(this, arguments);
this.cards = cards;
this.desk = desk;
var grid = new GridLayout({
dimensions: [1, this.cards.length]
});
var cardsSurface = [];
grid.sequenceFrom(cardsSurface);
for(var i=0;i<cards.length;i++)
{
var singleCardSurface = new Surface({
});
cardsSurface.push();
}
this.add(grid);
}
PlayerView.prototype = Object.create(View.prototype);
PlayerView.prototype.constructor = PlayerView;
PlayerView.DEFAULT_OPTIONS = {};
function DeskView(){
View.apply(this, arguments);
}
DeskView.prototype = Object.create(View.prototype);
DeskView.prototype.constructor = DeskView;
DeskView.DEFAULT_OPTIONS = {};
function ScoreView(desk){
View.apply(this, arguments);
this.desk = desk;
}
ScoreView.prototype = Object.create(View.prototype);
ScoreView.prototype.constructor = ScoreView;
ScoreView.DEFAULT_OPTIONS = {};
//// your app here
//var logo = new ImageSurface({
// size: [200, 200],
// content: 'http://code.famo.us/assets/famous_logo.png',
// classes: ['double-sided']
//});
//
//var initialTime = Date.now();
//var centerSpinModifier = new Modifier({
// origin: [0.5, 0.5],
// align: [0.5, 0.5],
// transform : function () {
// return Transform.rotateY(.002 * (Date.now() - initialTime));
// }
//});
//mainContext.add(centerSpinModifier).add(logo);
var gameView = new GameView();
mainContext.add(GameView);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment