Smart Mobile Studio

Beginners who are learning Smart Pascal using Smart Mobile Studio should go straight to these tutorial pages written especially for them.

See Getting Started with Smart Mobile Studio for links to documentation and downloads of the required software and for some simple demonstrations. In this tutorial we will refer to existing demonstrations and tutorials (which are suitable for experienced developers) and provide easier material to get you started.

Follow the links at the foot of the page to the tutorial sections on learning the language, graphics, input and storage. Note that we now use Version 2.1 of Smart Mobile Studio and offer this guidance for coping with changes.

While learning how to use Smart Mobile Studio we have converted existing Pascal programs to web versions. Follow these links to try the student programs and to view the converted code and brief notes. You will see much of the original code, with the major changes being for input and display. (Although most of the converted programs do not have exactly the same functionality as the original versions, they should be sufficiently similar to help Pascal programmers to adapt to the requirements of Smart Pascal).

  • Roller (including the drawing of text, rectangles and a circle);
  • My_first_sdl (including the scaling of a canvas to enable the ArcF procedure to draw ellipses);
  • Invader and its code (including audio, mouse input, the drawing of circles and text and alpha blending);
  • FlyingUK and its code (including the use of a double-quoted multi-line string instead of a small file and the drawing of lines, squares and text);
  • 3D-Driving and its code (including array assignment with square brackets, input from mouse and keyboard and the drawing of lines and text);
  • Knowledge and its code (including array assignment with square brackets, input from mouse and keyboard, ShowDialog and the drawing of images, lines, circles, polygons and text);
  • PixelSort and its code (including arrays, mouse input, random generation of colours and the drawing of coloured lines);
  • SuperHappyFunLand and its code (including keyboard input and the drawing of polygons and customised colours).
  • A-star and its code (including KeyDownEvent, KeyUpEvent, mouse input, the use of several units and the drawing of lines, squares and text).
  • WaveInterference (including labels, edit boxes, a list box containing labels, a button, a check box and the drawing of lines on the canvas of a paint box).
  • Crossword is a console application that demonstrates the use of downloaded text from a file on the server.
  • These web previews demonstrate conversions from Pascal console programs, most of which use the Crt unit:

    Although a few of these do not match the functionality of the original .exe files, they should be adequate for previews.

Converting Smart Pascal Programs to Apps

Adobe PhoneGap Build is a cloud service that enables you to upload your Smart Pascal application for compilation to apps for iOS, Android and Windows Phone. You can install the resulting PhoneGap (or hybrid) apps in the same way as native apps. In an tutorial entitled How to use Cordova, Christian Budde shows you how to use the open source base of PhoneGap to obtain your apps completely free of charge. We followed his instructions for the Android platform and installed on a Hudl2 the apps from the visual components project SelectionDemo and the console projects TransformDemo, MovingBallsWithParticles, RandomPlatformScroller and TowerOfArcher. The following notes should help those of you with enough tenacity to achieve your own conversions.

  • The Cordova build process needed the location of our Android SDK folders. We could supply this temporarily with the commands set ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk and set PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools. For permanent use, we created the user environment variable ANDROID_HOME with the value C:\Program Files (x86)\Android\android-sdk and appended to the user environment variable Path these two folders: C:\Program Files (x86)\Android\android-sdk\tools;C:\Program Files (x86)\Android\android-sdk\platform-tools.
  • We did not edit config.xml and always replaced the test file index.html with our Smart Pascal program named index.html.
  • We copied our res folder to the same folder as index.html.
  • The TowerOfArcher app required a few seconds to become functional.
  • We are able to build WebGL projects but the installed apps do not work, even though original web HTML5 versions display as intended in Hudl2's Chrome browser. A Google search reveals that this is a well-known problem.
  • In order to transfer the Android .apk file from the PC to the Hudl2 and then install it we:
    • connected the running Hudl2 to the running PC by the USB lead;
    • opened in File Explorer the folder containing the .apk file (platforms\android\build\outputs\apk) and changed its name to the project name;
    • opened in another File Explorer window the folder Hudl 2\Internal storage\Download and dragged the .apk file into it;
    • opened in the Hudl2 using ES File Explorer (installed from Google play) the Download folder;
    • touched the icon for the transferred file then touched the Install button.


Programming - a skill for life!

Pascal Programming Tutorials