Simple是一款BASIC风格的编程语言,用来开发Android程序。Simple项目的初衷是为移动领域以及Android平台引入一款简单易学的编程语言。Simple可以提供对Android的手机硬件的直接访问,如加速器、定位仪、手机及电话薄。
Let's take a look at the source code for the famous Etch-A-Sketch application:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | Dim x As Integer Dim y As Integer Event OrientationSensor1.OrientationChanged(yaw As Single, _ pitch As Single, roll As Single) If roll < -20 Then x = Math.Min(Canvas1.Width, x + 1) ElseIf roll > 20 Then x = Math.Max(0, x - 1) End If If pitch < -20 Then y = Math.Min(Canvas1.Height, y + 1) ElseIf pitch > 20 Then y = Math.Max(0, y - 1) End If Canvas1.DrawPoint(x, y) End Event Event AccelerometerSensor1.Shaking() Canvas1.Clear() End Event $Properties $Source $Form $Define EtchSketch $As Form Layout = 3 BackgroundColor = &HFFFFFFFF Title = "EtchSketch: Tilt to draw - Shake to clear" $Define Canvas1 $As Canvas $End $Define $Define OrientationSensor1 $As OrientationSensor $End $Define $Define AccelerometerSensor1 $As AccelerometerSensor $End $Define $End $Define $End $Properties |
没有评论 :
发表评论