Programming Made Simple!
Bringing an easy to learn and use language to the mobile world and the Android platform is the goal of the Simple project. Simple is a BASIC dialect for developing Android applications. It is particularly well suited for non-professional programmers (but not limited to). Simple allows programmers to quickly write Android applications by using the components supplied by its runtime system.
Similar to its 90s relative, Simple programs are form definitions (which contain components) and code (which contains the program logic). The interaction between the components and the program logic happens through events triggered by the components. The program logic consists of event handlers which contain code reacting to the events. In reality it is even simpler than this description.
Let's see how simple it really is. We will quickly write a program simulating the famous Etch-A-Sketch on an Android device. Tilting the device will move the pen, shaking the device will clear the screen. The Simple runtime system gives us three components to provide most of the needed functionality:
- the Canvas component - for drawing
- the OrientationSensor component - to detect tilting
- the Accelerometer component to detect shaking
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 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 |
The code defines two global variables (lines 1 and 2) and two event handlers, one to handle changes in the device's tilt (lines 4 to 17) and another to handle shaking of the device (lines 19 to 21). The code in the firstevent handler makes sure to only react to tilting above a certain degree (lines 6, 8, 11 and 13), and if that is the case then it further ensures that the pen does not run off the drawing surface (lines 7, 9, 12 and 14). And finally a point is drawn at the pen position (line 16). As for the other event handler, the only thing it does is clearing the drawing surface in case of shaking (line 20).
Last part missing is the form definition. It defines the form and its properties (lines 24 to 27), followed by the components it contains (lines 28 to 33).
| 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | $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 |
That's it. The only thing left to do is to compile and deploy the application to an Android device. And voila, here is a screenshot of the application running:
For a definition of the Simple language see the Simple Language Definition (download, 199 KB PDF). For more information on writing Simple applications see the open source project page at code.google.com/p/simple. You can also find information there on contributing to the project, and we encourage you to join our discussion list to provide us feedback.Programming made Simple!
(This is a copy of my original post on the 'Open Source at Google' blog)
I gotta install Java? No thanks. No Java nothing for me, thank you. Java is a pig.
ReplyDeletewow, this looks incredibly easy! Tried to find more tutorials but didn't find much. On the other hand, the project is young ;-) Looking forward to see it mature!
ReplyDelete君子遇窮困,則德益進,道益通。 ..................................................
ReplyDelete用心經營的blog~您的部落格文章真棒!! ........................................
ReplyDelete不能記住往事的,人注定要重蹈覆轍。 ..................................................
ReplyDeletemay the blessing be always with you!!........................................
ReplyDelete0401影音成人影片交流愛撫淫叫色情照片性愛圖片女生如何自慰激突成人論壇美女脫胸罩走光一夜正妹視訊情人性愛論壇85cc影城性伴侶85cc色情影片打手槍情色視訊聊天室色情a片色情色情圖片限制級照片色情電話520sex免費色情網情色性愛一夜情聊天網成人聊天網視訊成人台灣性網av一夜女情色av淫女免費視訊美女挑逗情色影音聊天作愛影片辣妹清涼秀美女做愛成人自拍貼圖成人資訊色論壇台灣色情成人網站色情視訊聊天露三點打砲情色性愛貼圖av成人網成人影片
ReplyDelete書是知識的寶庫,智慧的泉源。......................................................
ReplyDelete激情成人聊天室情色成人辣妹胸部辣妹視訊露奶辣妹自拍三點全露內衣秀台灣成人貼圖成人電影院三點全裸免費視訊辣妹av圖裸體自拍色情聊天美女視訊g點色情訊息淫女火辣av辣妹圖片免費視訊聊天室性情色天空調情上床圖片裸體自拍走光照片走光視訊情色成人18成人區火辣美女成人vcd成人影片下載本土av性愛情慾淫妹美女聊天性愛聊天室女生自慰影片免費看a圖淫婦巨乳辣妹視訊成人女生自慰方法免費情色限制級a片穿幫情色下載情色網站
ReplyDeleteThx ur share........................................
ReplyDeleteut聊天77p2p85cc85st85街視訊視訊聊天ava片a片下載成人情色色情影音視訊聊天洪爺影城洪爺免費視訊免費a片免費一對多utsogo論壇ut聊天室成人片免費看................
ReplyDelete這麼好的文章當然要回應支持(>▽<)........................................
ReplyDeleteI love readding, and thanks for your artical.
ReplyDelete完成一個小目標,會把自己推向一個大目標.............................................
ReplyDelete做愛 淫慾 s18x愛 寫真 77p2p 辣妹 淫婦 av 美女 美女聊天室 後宮聊天 打手槍 視訊 18禁視訊 貼圖 xPlus.av 援交打炮 女優 live173 173 85免費 uthome聊天室 一夜情 xvideo 免費視訊 情色聊天 交友聊天 影音視訊聊天室 情人視訊 a片
ReplyDeleteNem na página do projeto tem tutoriais assim, obrigado.
ReplyDeleteyour son/daughter is so cute............................................................
ReplyDelete喘口氣,看個文章,謝謝您的格子囉~~..................................................
ReplyDelete嘿,你的部落格不錯哦!.................................................................
ReplyDelete如此動感的blog!!!.................................................................
ReplyDelete河水永遠是相同的,可是每一剎那又都是新的。....................................................................
ReplyDeleteIt takes all kinds to make a world.............................................................
ReplyDeleteTks for your kindly sharing.( >з<)..................................................................
ReplyDelete有用的才華若不用,便如同日晷儀放在陰暗之中............................................................
ReplyDelete生活很多細節都要小心點,請多保重 ............................................................
ReplyDelete期待更新,要保持最佳狀況呦............................................................
ReplyDelete「仁慈」二個字,就能讓冬天三個月都溫暖。.......................................................
ReplyDelete到處盡心,即為快事;舉步踏實,便是坦途。.......................................................
ReplyDelete我喜歡用心經營的blog~ ^^..................................................................
ReplyDeletequite touching~~~thx for sharing............................................................
ReplyDeleteWe could learn a lot from crayons. Some are sharp, some are pretty and some are dull, Some have weird names , and all are different colors, but they all have to live in the same box .............................................................
ReplyDeleteLearn wisdom by the follies of others.............................................................
ReplyDelete感動 + 感恩 + 感謝(。-ˍ-。 )............................................................
ReplyDelete從人生中拿走友誼,猶如從生活中移走陽光......................................................................
ReplyDelete河水永遠是相同的,可是每一剎那又都是新的。. . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ReplyDelete回應是最大的支持^^y~~~甘吧嗲............................................................
ReplyDelete到處逛逛~~來繞繞留個言囉~~~~..................................................
ReplyDelete所有的資產,在不被諒解時,都成了負債............................. ....................................
ReplyDeleteI think you are about 2 decades off for the NW software company. That was the 70's that Microsoft developed Applesoft Basic, GWBasic, MSBasic, later QuickBasic and eventually Visual Basic (variants for different platforms and operating systems). It is the application that started Microsoft and to this day still has people using software written in it.
ReplyDelete