Prechádzať zdrojové kódy

Добавить 'README.md'

miket 1 mesiac pred
rodič
commit
814008ac88
1 zmenil súbory, kde vykonal 38 pridanie a 0 odobranie
  1. 38 0
      README.md

+ 38 - 0
README.md

@@ -0,0 +1,38 @@
+На пример кода, будет слежующий вывод 
+```
+    override fun area(): Float {
+        return width * height
+    }
+
+    override fun resize(zoom: Int) {
+        width*=zoom
+        height*=zoom
+    }
+
+    override fun rotate(direction: RotateDirection, centerX: Int, centerY: Int) {
+        var tmpX = x - centerX
+        var tmpY = y - centerY
+        if (direction == RotateDirection.CounterClockwise){
+            val buf = -tmpY
+            tmpY = tmpX
+            tmpX = buf
+        }else{
+            val buf = tmpY
+            tmpY = - tmpX
+            tmpX = buf
+        }
+
+        x = tmpX + centerX;
+        y = tmpY + centerY;
+    }
+```
+
+```
+Rect area:1.0 x:0 y:0 width:1 height:1
+Rect after resize 100.0 x:0 y:0 width:10 height:10
+Circle area:12.56 x:1.0 y:2.0 r:2.0
+Circle after resize area:1256.0 x:1.0 y:2.0 r:20.0
+Circle after rotation area:1256.0 x:2.0 y:1.0 r:20.0
+1256.0
+
+```