Permalink
Browse files

Fix things for iPhone4/iOS4

  • Loading branch information...
gfx committed Mar 25, 2012
1 parent d07b5ec commit 8e96c1004fb867a508bc6f1d5e2e8cc7a386861d
Showing with 12 additions and 61 deletions.
  1. +2 −5 shooting.dart
  2. +3 −50 shooting.dart.js
  3. +7 −6 shooting.html
View
@@ -255,7 +255,6 @@ class Status {
void initialize() {
- print("game start!");
for(num px = 0; px < Config.cols; ++px) {
for(num py = 0; py < Config.rows + 1; ++py) {
drawSpace(px, py);
@@ -384,8 +383,6 @@ class Status {
}
void main() {
- window.on.load.add((Event event) {
- Status status = new Status("#scoreboard", "#stage");
- status.tick();
- });
+ Status status = new Status("#scoreboard", "#stage");
+ status.tick();
}
View
@@ -303,18 +303,6 @@ Math.max = function(a, b) {
return (a >= b) ? a : b;
}
// ********** Code for top level **************
-function print$(obj) {
- return _print(obj);
-}
-function _print(obj) {
- if (typeof console == 'object') {
- if (obj) obj = obj.toString();
- console.log(obj);
- } else if (typeof write === 'function') {
- write(obj);
- write('\n');
- }
-}
function _toDartException(e) {
function attachStack(dartEx) {
// TODO(jmesserly): setting the stack property is not a long term solution.
@@ -2860,32 +2848,9 @@ $dynamic("_addEventListener").WebSocket = function(type, listener, useCapture) {
}
// ********** Code for _WheelEventImpl **************
// ********** Code for _WindowImpl **************
-$dynamic("get$on").DOMWindow = function() {
- return new _WindowEventsImpl(this);
-}
$dynamic("_addEventListener").DOMWindow = function(type, listener, useCapture) {
this.addEventListener(type, listener, useCapture);
}
-// ********** Code for _WindowEventsImpl **************
-$inherits(_WindowEventsImpl, _EventsImpl);
-function _WindowEventsImpl(_ptr) {
- _EventsImpl.call(this, _ptr);
-}
-_WindowEventsImpl.prototype.get$load = function() {
- return this._get("load");
-}
-_WindowEventsImpl.prototype.get$mouseDown = function() {
- return this._get("mousedown");
-}
-_WindowEventsImpl.prototype.get$mouseMove = function() {
- return this._get("mousemove");
-}
-_WindowEventsImpl.prototype.get$touchMove = function() {
- return this._get("touchmove");
-}
-_WindowEventsImpl.prototype.get$touchStart = function() {
- return this._get("touchstart");
-}
// ********** Code for _WorkerImpl **************
// ********** Code for _WorkerLocationImpl **************
// ********** Code for _WorkerNavigatorImpl **************
@@ -3055,13 +3020,6 @@ var _cachedBrowserPrefix;
var _pendingRequests;
var _pendingMeasurementFrameCallbacks;
// ********** Library shooting **************
-// ********** Code for Random **************
-function Random() {}
-Random.next = function() {
- $globals.Random_x = $globals.Random_x * (25214903917) + (11);
- $globals.Random_x = $mod$($globals.Random_x, (281474976710655));
- return $globals.Random_x * (3.552713678800501e-15);
-}
// ********** Code for Config **************
function Config() {}
// ********** Code for MovingObject **************
@@ -3299,7 +3257,6 @@ Status.prototype.tick = function() {
}
}
Status.prototype.initialize = function() {
- print$("game start!");
for (var px = (0);
px < (10); ++px) {
for (var py = (0);
@@ -3336,14 +3293,11 @@ Status.prototype.initialize = function() {
}
// ********** Code for top level **************
function random() {
- return Random.next();
+ return Math.random();
}
function main() {
- get$$window().get$on().get$load().add((function (event) {
- var status = new Status("#scoreboard", "#stage");
- status.tick();
- })
- , false);
+ var status = new Status("#scoreboard", "#stage");
+ status.tick();
}
// 202 dynamic types.
// 220 types
@@ -3400,7 +3354,6 @@ function $dynamicSetMetadata(inputTable) {
})();
// ********** Globals **************
function $static_init(){
- $globals.Random_x = (0);
}
var const$0000 = Object.create(_DeletedKeySentinel.prototype, {});
var const$0001 = Object.create(NoMoreElementsException.prototype, {});
View
@@ -1,12 +1,10 @@
<html>
<head>
- <title>Shooting</title>
- <meta name="viewport" content="width=320,user-scalable=no"></script>
+ <title>Shooting Game in Dart</title>
+ <meta name="viewport" content="width=device-width,user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
-
- <script type="application/dart" src="Shooting.dart"></script>
- <script src="http://dart.googlecode.com/svn/branches/bleeding_edge/dart/client/dart.js"></script>
+
<style>
#scoreboard {
position: absolute;
@@ -18,8 +16,11 @@
}
</style>
</head>
- <body style="margin:0;position:relative">
+ <body style="margin:0; position:relative;">
<canvas id="stage"></canvas>
<div id="scoreboard">000000000</div>
+
+ <script type="application/dart" src="shooting.dart"></script>
+ <script src="http://dart.googlecode.com/svn/branches/bleeding_edge/dart/client/dart.js"></script>
</body>
</<html>

0 comments on commit 8e96c10

Please sign in to comment.