Permalink
Browse files

Mini demo merge into main file structure

  • Loading branch information...
DamonOehlman committed Oct 16, 2010
1 parent 677bcaf commit cb633bfd10c54612b3182ca1fa8701c7abd73278
Showing with 100 additions and 197 deletions.
  1. 0 {minigames → }/css/minigames.css
  2. BIN {minigames → }/images/marker_sinkhole2.png
  3. BIN {minigames → }/images/whacka_bg.jpg
  4. +1 −5 {minigames → }/js/games/blinds.js
  5. +2 −2 {minigames → }/js/games/crater.js
  6. +1 −1 {minigames → }/js/games/easingblinds.js
  7. +1 −1 {minigames → }/js/games/easy.js
  8. +1 −1 {minigames → }/js/games/eat.js
  9. +2 −2 {minigames → }/js/games/falling.js
  10. +1 −1 {minigames → }/js/games/test.js
  11. +83 −6 minigames/js/wiw-mini.js → js/mgengine.js
  12. 0 {minigames → }/js/tile5/tests.tile5.js
  13. 0 {minigames → }/js/tile5/tile5.bing.js
  14. 0 {minigames → }/js/tile5/tile5.cloudmade.js
  15. 0 {minigames → }/js/tile5/tile5.decarta.js
  16. 0 {minigames → }/js/tile5/tile5.js
  17. 0 {minigames → }/js/tile5/tile5.lite.js
  18. 0 {minigames → }/js/tile5/tile5.lite.min.js
  19. 0 {minigames → }/js/tile5/tile5.mapbox.js
  20. 0 {minigames → }/js/tile5/tile5.min.js
  21. 0 {minigames → }/js/tile5/tile5.nearmap.js
  22. 0 {minigames → }/js/tile5/tile5.osm.js
  23. +8 −3 minigames/index.htm → minidemo.html
  24. BIN minigames/images/IMG_0832.JPG
  25. BIN minigames/images/cat.png
  26. BIN minigames/images/image1.jpg
  27. BIN minigames/images/image2.jpg
  28. BIN minigames/images/image3.jpg
  29. BIN minigames/images/image4.jpg
  30. BIN minigames/images/image5.jpg
  31. BIN minigames/images/image6.jpg
  32. BIN minigames/images/image7.jpg
  33. BIN minigames/images/image8.jpg
  34. BIN minigames/images/image9.jpg
  35. +0 −21 minigames/js/init.js
  36. +0 −154 minigames/js/jquery-1.4.2.min.js
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,5 +1,5 @@
(function() {
- WIW.Games.initGame('blinds', function(player, canvas, image) {
+ mgengine.initGame('blinds', function(player, canvas, image) {
var MAX_BLIND_WIDTH = 50;
var context = canvas.getContext('2d'),
@@ -30,10 +30,6 @@
} // if
} // reveal
- var self = jQuery.extend(new WIW.Games.Game(canvas), {
-
- });
-
context.drawImage(image, 0, 0);
GT.Loopage.join({
@@ -1,5 +1,5 @@
(function() {
- WIW.Games.initGame('crater', function(player, canvas, image) {
+ mgengine.initGame('crater', function(player, canvas, image) {
// initialise the location count
var LOCATION_COUNT = 4,
THUMB_SIZE = 160,
@@ -16,7 +16,7 @@
currentY = 0,
displaySize = 100,
lastLocation = 0,
- self = new WIW.Games.Game(canvas);
+ self = new mgengine.Game(canvas);
function handleTap(pos) {
GT.Log.info("tapped at: " + pos.x + ", " + pos.y);
@@ -1,5 +1,5 @@
(function() {
- WIW.Games.initGame('easingblinds', function(player, canvas, image) {
+ mgengine.initGame('easingblinds', function(player, canvas, image) {
var context = canvas.getContext('2d'),
imageWidth = image.width,
startWidth = 50;
@@ -1,5 +1,5 @@
(function() {
- WIW.Games.initGame('easy', function(player, canvas, image) {
+ mgengine.initGame('easy', function(player, canvas, image) {
var context = canvas.getContext('2d');
var self = jQuery.extend(new WIW.Games.Game(canvas), {
@@ -1,5 +1,5 @@
(function() {
- WIW.Games.initGame('eat', function(player, canvas, image) {
+ mgengine.initGame('eat', function(player, canvas, image) {
var MAX_BLIND_WIDTH = 50;
var context = canvas.getContext('2d'),
@@ -1,5 +1,5 @@
(function() {
- WIW.Games.initGame('falling', function(player, canvas, image) {
+ mgengine.initGame('falling', function(player, canvas, image) {
// initialise some constants
var THUMB_SIZE = 160;
@@ -63,7 +63,7 @@
} // handleTap
GT.Loopage.join({
- frequency: 400,
+ frequency: 500,
execute: addFaller
});
@@ -1,5 +1,5 @@
(function() {
- WIW.Games.initGame('test', function(player, canvas, image) {
+ mgengine.initGame('test', function(player, canvas, image) {
var context = canvas.getContext('2d');
var self = jQuery.extend(new WIW.Games.Game(canvas), {
@@ -1,9 +1,8 @@
-WIW = {};
-
-WIW.Games = (function() {
+var mgengine = function() {
// initialise constants
- var PAN_RESET = 50;
+ var PAN_RESET = 50,
+ BASE_URL = 'http://api.powerhousemuseum.com/';
// initialise module variables
var games = [
@@ -88,6 +87,82 @@ WIW.Games = (function() {
});
} // populateSelector
+ function run(selectedGame) {
+ GT.Log.info("running");
+
+ var url = BASE_URL + 'api/v1/multimedia/json/?api_key=24ef7a17f5816b4&flickr_id_isblank=1';
+ $.ajax({
+ url: url,
+ dataType: 'jsonp',
+ success: function(data){
+ try {
+ GT.Log.info('received data', data);
+
+ data.multimedia.sort(function() {
+ return (Math.round(Math.random())-0.5);
+ });
+ var items = {};
+ for (var i = 0; i < data.multimedia.length; i++) {
+ var multimedia = data.multimedia[i];
+ if (!multimedia.old_image) {
+ var item_id = multimedia.connections[0];
+ items[item_id] = multimedia.images.thumbnail.url;
+ }
+ }
+
+ var itemNum = 0;
+ var targetItemUrl;
+ var distractorItemUrls = [];
+ for (var itemUrl in items) {
+
+ if (itemNum == 0) {
+ targetItemUrl = items[itemUrl];
+ var itemDetailUrl = BASE_URL + itemUrl;
+
+ GT.Log.info("processig url: " + items[itemUrl]);
+ $.ajax({url: itemDetailUrl, dataType: 'jsonp', success: function(data){
+ // Make array of clues
+ var clues = [];
+ var item = data.item;
+ if (item.dimensions.width) {
+ clues.push("Width: " + item.dimensions.width);
+ clues.push("Height: " + item.dimensions.height);
+ }
+ if (item.subjects.length > 0) {
+ clues.push('About: ' + item.subjects.join(','));
+ }
+ if (item.categories.length > 0) {
+ clues.push('Categories: ' + item.categories.join(','));
+ }
+ if (item.provenance.length > 0) {
+ clues.push('From: ' + item.provenance[0].place + ',' + item.provenance[0].date_latest);
+ }
+ //showClues(clues);
+ }});
+ } else if (itemNum < 11) {
+ GT.Log.info("image url: " + items[itemUrl]);
+ distractorItemUrls.push(items[itemUrl]);
+ } else {
+ break;
+ }
+ itemNum++;
+ }
+
+ new mgengine.Player({
+ images: distractorItemUrls,
+ correctIndex: 0,
+ imageUrl: targetItemUrl,
+ game: selectedGame
+ });
+ }
+ catch (e) {
+ GT.Log.exception(e);
+ }
+ //playGame(targetItemUrl, distractorItemUrls);
+ }
+ });
+ }
+
/* define the player */
var Game = function(canvas, params) {
@@ -231,8 +306,10 @@ WIW.Games = (function() {
initGame: function(gameId, gameCreator) {
loadedGames[gameId] = gameCreator;
- }
+ },
+
+ run: run
};
return module;
-})();
+}();
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -5,15 +5,20 @@
<link rel="stylesheet" href="css/minigames.css" />
<script src="js/jquery-1.4.2.min.js"></script>
<script src="js/tile5/tile5.lite.js"></script>
- <script src="js/wiw-mini.js"></script>
- <script src="js/init.js"></script>
+ <script src="js/mgengine.js"></script>
+ <script>
+ // $(document).ready(mgengine.run);
+ </script>
</head>
<body>
<div id="score">0</div>
<div class="game"></div>
<div class="choose-container">
<ul class="chooser"></ul>
</div>
- <button onclick="game.startGame()">Start Game</button>
+ <div>
+ <button onclick="mgengine.run('falling')">Falling</button>
+ <button onclick="mgengine.run('crater')">Crater</button>
+ </div>
</body>
</html>
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
@@ -1,21 +0,0 @@
-var game = null;
-
-$(document).ready(function() {
- game = new WIW.Games.Player({
- images: [
- 'images/image1.jpg',
- 'images/image2.jpg',
- 'images/image3.jpg',
- 'images/image4.jpg',
- 'images/image5.jpg',
- 'images/image6.jpg',
- 'images/image7.jpg',
- 'images/image8.jpg',
- 'images/image9.jpg'
- ],
- correctIndex: 1,
- imageUrl: 'images/IMG_0832.jpg',
- game: 'falling'
- });
-});
-
Oops, something went wrong.

0 comments on commit cb633bf

Please sign in to comment.