diff options
| author | Jules Laplace <jules@okfoc.us> | 2014-06-03 16:24:10 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2014-06-03 16:24:28 -0400 |
| commit | 607f69c67a5b4dc72d2754192e3cdf67d0ad11d0 (patch) | |
| tree | 6556e7922c5bedb274bb1650e5dd100643a7895d /client/assets/javascripts/rectangles/engine/scenery/_scenery.js | |
| parent | d31259291d807c851de4396921e0c26b6dd8dce2 (diff) | |
partitioning client and serveR
Diffstat (limited to 'client/assets/javascripts/rectangles/engine/scenery/_scenery.js')
| -rw-r--r-- | client/assets/javascripts/rectangles/engine/scenery/_scenery.js | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/client/assets/javascripts/rectangles/engine/scenery/_scenery.js b/client/assets/javascripts/rectangles/engine/scenery/_scenery.js new file mode 100644 index 0000000..867bb6f --- /dev/null +++ b/client/assets/javascripts/rectangles/engine/scenery/_scenery.js @@ -0,0 +1,45 @@ + +var Scenery = new function(){ + + var base = this; + + base.images = [] + + base.mouse = new mouse ({ use_offset: false }) + + base.init = function(){ + base.resize.init() + + var urls = [ + "http://okfocus.s3.amazonaws.com/office/ducks/duck1.jpg", + "http://okfocus.s3.amazonaws.com/office/ducks/duck2.jpg", + "http://okfocus.s3.amazonaws.com/office/ducks/duck3.jpg", + "http://okfocus.s3.amazonaws.com/office/ducks/duck4.jpg", + "http://okfocus.s3.amazonaws.com/office/ducks/duck5.jpg", + ] + var loader = new Loader(function(){ + base.load(loader.images) + }) + loader.preloadImages(urls) + } + + base.load = function(images){ + images.forEach(function(img){ + img.width = 300 + img.height = ~~(300 * img.naturalHeight/img.naturalWidth) + }) + + Rooms.forEach(function(room){ + room.walls.forEach(function(wall){ + var img = choice(images) + if (wall.fits(img)) { + var scene_img = new Scenery.image (wall, img) + base.images.push(scene_img) + scene_img.init() + } + }) + }) + } + + return base +} |
