Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: sky/examples/game/lib/transform_node.dart

Issue 1164393002: Convert everything in the Sky API from degrees to radians. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/engine/core/painting/Path.idl ('k') | sky/examples/raw/painting.sky » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 part of sprites; 1 part of sprites;
2 2
3 double degrees2radians(double degrees) => degrees * Math.PI/180.8; 3 double degrees2radians(double degrees) => degrees * Math.PI/180.8;
4 4
5 double radians2degrees(double radians) => radians * 180.0/Math.PI; 5 double radians2degrees(double radians) => radians * 180.0/Math.PI;
6 6
7 class TransformNode { 7 class TransformNode {
8 Vector2 _position; 8 Vector2 _position;
9 double _rotation; 9 double _rotation;
10 10
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 prePaint(canvas); 116 prePaint(canvas);
117 paint(canvas); 117 paint(canvas);
118 visitChildren(canvas); 118 visitChildren(canvas);
119 postPaint(canvas); 119 postPaint(canvas);
120 } 120 }
121 121
122 void prePaint(PictureRecorder canvas) { 122 void prePaint(PictureRecorder canvas) {
123 canvas.save(); 123 canvas.save();
124 124
125 canvas.translate(_position[0], _position[1]); 125 canvas.translate(_position[0], _position[1]);
126 canvas.rotateDegrees(_rotation); 126 canvas.rotate(degrees2radians(_rotation));
127 canvas.translate(-_width*_pivot[0], -_height*_pivot[1]); 127 canvas.translate(-_width*_pivot[0], -_height*_pivot[1]);
128 128
129 // TODO: Use transformation matrix instead of individual calls 129 // TODO: Use transformation matrix instead of individual calls
130 // List<double> matrix = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]; 130 // List<double> matrix = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0];
131 // this.transformMatrix.copyIntoArray(matrix); 131 // this.transformMatrix.copyIntoArray(matrix);
132 // canvas.concat(matrix); 132 // canvas.concat(matrix);
133 } 133 }
134 134
135 void paint(PictureRecorder canvas) { 135 void paint(PictureRecorder canvas) {
136 136
137 } 137 }
138 138
139 void visitChildren(PictureRecorder canvas) { 139 void visitChildren(PictureRecorder canvas) {
140 children.forEach((child) => child.visit(canvas)); 140 children.forEach((child) => child.visit(canvas));
141 } 141 }
142 142
143 void postPaint(PictureRecorder canvas) { 143 void postPaint(PictureRecorder canvas) {
144 canvas.restore(); 144 canvas.restore();
145 } 145 }
146 146
147 void update(double dt) { 147 void update(double dt) {
148 148
149 } 149 }
150 } 150 }
OLDNEW
« no previous file with comments | « sky/engine/core/painting/Path.idl ('k') | sky/examples/raw/painting.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698