Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 import 'dart:sky' as sky; | |
|
abarth-chromium
2015/06/18 00:03:52
This file is a "part of" the main game library, wh
iansf
2015/06/20 00:02:38
Done.
| |
| 2 | |
| 1 part of sprites; | 3 part of sprites; |
| 2 | 4 |
| 3 enum SpriteBoxTransformMode { | 5 enum SpriteBoxTransformMode { |
| 4 nativePoints, | 6 nativePoints, |
| 5 letterbox, | 7 letterbox, |
| 6 stretch, | 8 stretch, |
| 7 scaleToFit, | 9 scaleToFit, |
| 8 fixedWidth, | 10 fixedWidth, |
| 9 fixedHeight, | 11 fixedHeight, |
| 10 } | 12 } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 size = constraints.constrain(Size.infinite); | 64 size = constraints.constrain(Size.infinite); |
| 63 } | 65 } |
| 64 | 66 |
| 65 // Event handling | 67 // Event handling |
| 66 | 68 |
| 67 void handleEvent(Event event, BoxHitTestEntry entry) { | 69 void handleEvent(Event event, BoxHitTestEntry entry) { |
| 68 } | 70 } |
| 69 | 71 |
| 70 // Rendering | 72 // Rendering |
| 71 | 73 |
| 72 void paint(RenderObjectDisplayList canvas) { | 74 void paint(sky.Canvas canvas) { |
| 73 // Move to correct coordinate space before drawing | 75 // Move to correct coordinate space before drawing |
| 74 double scaleX = 1.0; | 76 double scaleX = 1.0; |
| 75 double scaleY = 1.0; | 77 double scaleY = 1.0; |
| 76 double offsetX = 0.0; | 78 double offsetX = 0.0; |
| 77 double offsetY = 0.0; | 79 double offsetY = 0.0; |
| 78 | 80 |
| 79 switch(transformMode) { | 81 switch(transformMode) { |
| 80 case SpriteBoxTransformMode.stretch: | 82 case SpriteBoxTransformMode.stretch: |
| 81 scaleX = size.width/_systemWidth; | 83 scaleX = size.width/_systemWidth; |
| 82 scaleY = size.height/_systemHeight; | 84 scaleY = size.height/_systemHeight; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 for (Node child in node.children) { | 178 for (Node child in node.children) { |
| 177 _addNodesAtPosition(child, position, list); | 179 _addNodesAtPosition(child, position, list); |
| 178 } | 180 } |
| 179 // Do the hit test | 181 // Do the hit test |
| 180 Point posInNodeSpace = node.convertPointToNodeSpace(position); | 182 Point posInNodeSpace = node.convertPointToNodeSpace(position); |
| 181 if (node.hitTest(posInNodeSpace)) { | 183 if (node.hitTest(posInNodeSpace)) { |
| 182 list.add(node); | 184 list.add(node); |
| 183 } | 185 } |
| 184 } | 186 } |
| 185 } | 187 } |
| OLD | NEW |