Last active
March 4, 2016 02:18
-
-
Save nenjiru/6fa3396a0e29dd202d60 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 基底クラス | |
* @file base.js | |
*/ | |
function Base () | |
{ | |
this.position = { x:0, y:0, z:0 }; | |
} | |
Base.prototype.update = function () | |
{ | |
console.log('base update'); | |
}; | |
// -------------------------- | |
/** | |
* 常にカメラに向くオブジェクト | |
* @file billbord.js | |
*/ | |
function Billboard () | |
{ | |
Base.apply(this, arguments); | |
this.lookat = 0; | |
} | |
// 継承 | |
Billboard.prototype = new Base; | |
Billboard.prototype.update = function () | |
{ | |
console.log('billboard update'); | |
}; | |
// -------------------------- | |
var frame = (function() | |
{ | |
var totalFrame = 0 | |
, billboard = new Billboard() | |
; | |
return { | |
update: function() | |
{ | |
billboard.update(); | |
totalFrame++; | |
console.log(totalFrame); | |
} | |
}; | |
})(); | |
(function () | |
{ | |
setInterval(function () | |
{ | |
frame.update(); | |
}, 1000/60); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment