Smart Mobile Studio
  • News
  • Forums
  • Download
  • Store
  • Showcases
    • Featured demos
    • The Smart Contest 2013, Round 1 – Graphics
  • Documentation
    • Get the book
    • System requirements
    • Prerequisites
    • Getting started
      • Introduction
      • Application architecture
      • The application object
      • Forms and navigation
      • Message dialogs
      • Themes and styles
    • Project types
      • Visual project
      • Game project
      • Console project
    • Layout manager
    • Networking
      • TW3HttpRequest
      • TW3JSONP
      • Loading files
  • About

Author Archives: Jon Lennart

Getting ready to rumble

Posted on 22.03.2012 by Jon Lennart Posted in Developers log 1 Comment

We are getting seriously close to a beta here now. Just a couple of more tweaks and some visual goodies and then it’s party time 🙂

Smart Mobile @ 98% complete

Smart Mobile @ 98% complete

I am of-course working overtime in the hope that we can ship the beta before next Friday, just in time for the Pascal game development competition. If you haven’t checked it out yet, visit PGD and have a look!

Debugging smart apps on your mac

Posted on 20.03.2012 by Jon Lennart Posted in Developers log, Documentation

If you happen to own a Mac computer, there is a cool trick i can teach you to make better Smart Mobile applications. It’s also a trick which can benefit native development. In short: the iPhone emulator that ships with Apple’s SDK have many hidden aspects and parameters. One of the most useful is an option to highlight GUI elements that iOS have marked for the GPU. This is a really cool feature and very helpful for both Firemonkey, C#, C++, FreePascal and (drumroll) Javascript apps.

Detecting hardware acceleration

First, make sure the Smart IDE is set to use the built-in server. Now simply load in a project (one of the demos for instance) and execute the application. The server window appears and displays the full URL of your app.

Smart running inside VMWare on a Mac

Smart running inside VMWare on a Mac

Second, go to your Mac and open up a new terminal window. The terminal is more or less what we call a command-line prompt under Windows. On the Mac the terminal is located at “/Applications/Utilities/Terminal”.

In the terminal window punch in the following to start the iPhone emulator with the “magic” setting:

[sourcecode language=”bash”]
CA_COLOR_OPAQUE=1 /Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app/Contents/MacOS/iPhone\ Simulator
[/sourcecode]

Note: The above should be a single line of text. Remove any formatting before pasting it into the terminal.

Punch in the commands and hit enter

Punch in the commands and hit enter

The iPhone emulator should now start up and you will notice that there is a red-tint covering different GUI elements. The elements which have a red tint are those marked for hardware acceleration.

Watching Smart go

Next, click on the safari icon to start Safari Mobile, and when loaded – punch in the URL to your running Smart application. Hit enter and wait for the application to load.

Once your app is safely running inside the iOS emulator, click the shortcut button and select “Add to home screen”. All Smart apps can run in full-screen directly from the iPhone screen – we don’t want to waste 30% of the screen on Safari.

Add the app to the home screen

Everything is HW accelerated here

Now you can start the app directly from the iPhone screen – and you can clearly see which components in your Smart app that uses hardware acceleration. It is also worth noting that elements turn red when they are cached and handled by the GPU. In our case the Buddha below does not turn red until you click the “spin the Buddha” button.

Click the button and hardware rotation takes over

Click the button and hardware rotation takes over

Marking your own controls

If you want to ensure that a custom control (or indeed, any TW3CustomControl descendant) makes use of hardware acceleration, there are two ways of achieving it. Both do the same thing and simply hints to the browser that it needs to cache the element in video memory rather than casual memory:

You can add the following to the control’s CSS:

[sourcecode language=”css”]
-webkit-transform: translateZ(0);
[/sourcecode]

Or, you can set the property directly in your code. Preferably by overriding the StyleTagObject method:

[sourcecode language=”delphi”]
Procedure TMyControl.StyleTagObject;
Begin
inherited;
w3_setStyle(tagRef,’webkitTransform’,’translateZ(0)’);
end;
[/sourcecode]

debugging how-to tips & tricks

Bitmap fonts

Posted on 27.02.2012 by Jon Lennart Posted in Developers log

While we are adding the finished touches to Smart, I thought I could point the finger at a website with loads of bitmap fonts. Bitmap based fonts are important, especially in games, first of all because they add atmosphere – but also since they allow for more processing than ordinary fonts.

Let’s say you want your text to roll over the screen (also known as a “scroll text”) right? If that was all you wanted then you could opt for a normal font. But what if you want the text to follow a nice sinus curve as well? And also be more decorative than a single color typeface? This is where bitmap fonts make it very easy, because you always have full access to it’s pixel buffer. Naturally they don’t scale well, but for games and demos which usually operate with fixed screen sizes they really spice up the final result.

http://bmf.wz.cz/

 

JSBridge getting there

Posted on 21.02.2012 by Jon Lennart Posted in Developers log

It’s been quite a chore but the IDE is now able to extract properties from components. This involves polling data from the RTL into the designer live (only published properties of-course). I still need to transport the values back and forth but that should be fairly easy. Once the bridge is complete the time has come, finally, to render the graphics and thus technological “push” is complete.

Property extraction in place, now for value transport

Property extraction in place, now for value transport

Cant wait to code some knockout demos!

About the author


Jon Lennart Aasenden is a software architect at Optimale Systemer AS. He is currently the lead developer of Smart Mobile Studio and have been a strong supporter of Delphi and object pascal since the beginning. He is also involved in the evangelizing of object pascal in Norway and is by many called “a Delphi fundamentalist” due to his somewhat radical teaching methods. The views of the author is his own and does not reflect the policy of Optimale Systemer AS.

Bling up your apps

Posted on 18.02.2012 by Jon Lennart Posted in Documentation 2 Comments

Today we are going to visit the wonderful world of webkit animations. I’m going to demonstrate how you can use relatively simple CSS animations to bring your application to life. So start up Smart Mobile Studio and let’s get cracking! We begin by creating a brand new visual project. This is because we want to make use of visual controls rather than drawing stuff directly to the screen ourselves. So start by creating clicking on the “New project” button and fill in a suitable name.

Remember to select the right project type

Remember to select the right project type

Editing the CSS is easy

Editing the CSS is easy

Setting up the animation

Next step is to define the actual animation. This requires some knowledge of CSS but to be honest, it’s very easy and you will find tons of examples and pre-defined effects online. To define our animation first double-click on the “app.css” file in the project treeview. The file opens and you can edit the CSS.

Note: if you are having problems understanding CSS or lack the inspiration to come up with something unique – a great place to find ready made snippets to use is over at CSS Tricks. This is an awsome website with examples for pretty much every effect under the sun. So it’s well worth the visit.

So now comes the fun part – namely: what sort of animation do we want to create? Well, when my app starts I want it to load a picture and then quickly fade this picture into view. I also want it to scale from very small to normal size. This effect sort of comes at you out of nowhere, so a fitting name is “in your face”. So let’s define the animation:

@-webkit-keyframes InYourFace {
  0% {
    opacity: 0.1;
    -webkit-transform: scale(0.1);
  }
  100% {
    opacity: 1.0;
    -webkit-transform: scale(1.0);
  }
}

As you can see above the animation is defined in C style, using curly brackets. It has two sections, one called 0% and another called 100%. These two sections basically represent the state of the object from beginning to end. You can also add as many sections as you like, in which case the sections become “key frames” (hence the tagname). How fast the keyframes play out depends on the duration property you set (see sourcecode example below). So in the CSS above we animate both the opacity of the object from barely visible to normal visibility, and also the scale of the object from 0.1 to 1.0 (which is the same as 100%).

Setting up the animation code

Next, we are going to need a picture to play with, so i’ve added a picture to my project (Buddhas_beauty.jpg), just find a picture that you want to play around with and add it to the project. You do this by right-clicking on the resources node in the project treeview, clicking “add resource file” from the pop-up menu.

Next, double-click on the file “form1”, which brings up the object pascal code for your form. This form is automatically created by the IDE for you – so you dont need to write it all yourself. We will be adding an image and an animation player object. We will also override a couple of methods to trigger the animation at the right time. Here is the interface section of our form:

  TForm1=class(TW3form)
  private
   { Private methods }
    FImage:   TW3Image;
    FAnim:    TW3NamedAnimation;
    Procedure HandleImageLoaded(Sender:TObject);
  protected
    { Protected methods }
    Procedure InitializeObject;override;
    Procedure FinalizeObject;override;
    Procedure StyleTagObject;override;
    Procedure ReSize;override;
  end;

In the constructor (InitializeObject) we setup the objects we want to use. This is more or less identical to ordinary Delphi, except for the names of-course which has been obscured to protect the binary otherwise located (that was a joke).

  Procedure TForm1.InitializeObject;
  Begin
    inherited;
    (* setup the image *)
    FImage:=TW3Image.Create(self);
    FImage.Visible:=False;
    FImage.OnLoad:=HandleImageLoaded;
    FImage.LoadFromURL('/res/buddhas_beauty.jpg');

    (* setup the effect for our image *)
    FAnim:=TW3NamedAnimation.Create;

    (* and tell the object the CSS name *)
    FAnim.AnimName:='InYourFace';
  End;

  Procedure TForm1.FinalizeObject;
  Begin
    FImage.free;
    FAnim.free;
    inherited;
  End;

Since Javascript is “non blocking” we have to use events to know when a picture has loaded. So to make it short – that’s when we want to trigger our animation. If we tried it before the image was ready we would get an error (or, depending on the object state, nothing would happen).

  Procedure TForm1.HandleImageLoaded(Sender:TObject);
  Begin
    (* image is loaded, now start the effect & make it visible *)
    FAnim.Duration:=0.2;
    FAnim.Execute(FImage);
    FImage.Visible:=True;
  end;

The rest of the code is fairly self describing, especially if you have been following our other examples. The rules are simple: position your controls in the resize method and set styles in the StyleTagObject method. Some rules can be broken and others bent – but these are the ground rules for the VJL.

  Procedure TForm1.StyleTagObject;
  Begin
    inherited;
    StyleClass:='TW3CustomForm';
  End;

  Procedure TForm1.ReSize;
  Begin
    inherited;
    (* position image *)
    FImage.setBounds(10,10,width-20,height-20);
  end;

Another way to trigger an animation on an object is to go low-level. You can for instance run an animation forever using a simple style call as such:

w3_setStyle(FHeader.TagRef,'-webkit-animation',
'TitleGrow 1s infinite alternate');

The above code will execute an animation called “titlegrow” forever. But ofcourse you lose the high level benefits of a pascal interface and also no event callbacks. But if you just want something to move up and down, or some other transformation – then the above one-liner will do the trick.

The final result

Sadly I cant show you a video of the output, but it works just as expected. The application executes, loads the picture – and when the picture is loaded it scales at you out of nowhere into full size (I later added a label to the top of the display). Click here to download the project

Animations are super easy

Animations are super easy

Here is the same app running in iPad mode. I added some simple resize code to make the font scale with the size of the display. Not bad for less than 5 minutes of coding! Put that in your pipe and smoke it Macromedia 😉

iPad galore, anyone for an e-book?

iPad galore, anyone for an e-book? Click for full size image

animation CSS tutorial

Global rename function

Posted on 17.02.2012 by Jon Lennart Posted in Developers log, News and articles 6 Comments
Global rename done

Global rename done

Being able to rename a unit via the project treeview is commonplace in mid to high range editors today. There are a lot of javascript editors out there, some more evolved than others – but the number of object pascal editors is sadly very limited. You have Delphi of-course which is great (and the most advanced object pascal editor on the marked), then there is Lazarus which is the free and open version written in freepascal – and while there are other alternatives, none of them even comes close to the original “Delphi” look and feel.

Believe it or not but this time Smart Mobile Studio actually got something Delphi doesn’t (Delphi 7 was our initial model): global renaming. When you rename a unit under Smart, it doesn’t just alter the source-code for the unit in question – it alters all references to that unit in the entire project. No need to backtrack and update the uses declaration elsewhere, they are all changed in a single sweep.

We can actually map the use of a class or method throughout a whole project, and it’s super quick as well!

Database mapped RTL

But we have more tricks up our sleeve. I took the time to make a recursive database indexer for our RTL files. So the first time you run Smart it will parse and extract every inch of information about the RTL and store it in a database table. This table is kept in memory and used to speedup extraction of data regarding classes, methods and properties.

It also has the benefit of giving me instant access to things like class ancestors, data types, fields, scope, interfaces and all those tiresome look-up chores that makes a mess of a codebase. So armed with a TClientDataset map (what did you expect? No self respecting Delphi app is complete without at least one instance of TClientDataset) of the RTL, it is now super easy to beef up and compliment the compiler. On top of my head here are a few things i’m gunning for:

  • Complete class at cursor
  • Rename class at cursor
  • Add interface to class
  • Merge classes
  • Support for documentation remarks above methods
  • Mouse-over information about symbols

I doubt we will be able to stuff all the goodies into version 1 of Smart Mobile Studio, but rest assured that I will do my best to get as much features into Smart as I can.

Globals

And now that the indexing and background compile is up to speed, the time has come to finish the globals feature. Globals allows you to edit a list of object (of any class) that should be created automatically by TApplication. Very handy if you have a database connection or some game logic you want to be created on startup.

These are exciting days!

Smart Mobile Studio Upcoming features

Big blue, ancient of days

Posted on 17.02.2012 by Jon Lennart Posted in Developers log 6 Comments

All of life follows a certain pattern. You start out very little, the initial spark if you will, and if you don’t buckle under while learning the ropes – you grow to become large and strong. The duration of your life and the level of strength you can exercise greatly depends on how you manage that strength in context with others. But the fact of life is that the “initial spark” that started the formation cant burn forever. So sooner or later the formation looses its cohesion and voila – the formation breaks up. In human terms we call this breaking up death, in business terms we call it foreclosure, retirement or bankruptcy.

“Demonstrate. I want to see a negative before i provide
you with a positive” -Source: Bladerunner, Tyrell on voigt kampf

I find it very interesting that you can take the same pattern, the “rise, adapt, grow, age and die” formula if you will – and apply it to absolutely everything in the universe. Plants, rocks, animals, planets, solar systems, galaxies, people, companies and even software. Everything that is put together will sooner or later fall apart and re-group. Unless the formation can somehow be maintained over decades and millennia – the proverbial quest for IT immortality.

T.J Watson, IBM

T.J Watson, IBM

Big blue, ancient of days

If you are younger than 30 you probably wont have a clue who “big blue” was. It is the nickname for IBM which remained the IT giant par excellence until as little as 20 years ago. If you think Microsoft is big now, or Apple – IBM was for nearly half a century bigger than both of them. But 20 years ago IBM was already ancient, at least compared to the life expectancy of a modern technology company. Big blue was founded as early as the late 1800’s and was only officially registered in 1911, as a producer of typewriters (among many things).That is quite an achievement. This is a company that was founded while the Victorian empire was still ticking! And that means that the older and more mature IBM investors would remember reading in the colonial paper  – how a Jack the ripper was carving his way through London. Imagine that.

And to make it even more astounding, a study in 2010 showed that IBM still has over 40.000 employees worldwide. That is an absolutely mind blowing fact to contemplate. Yet impressive as it may be, IBM is today completely and utterly out of the loop with regards to personal computing.

From hero to zero in two decades? That demands and explanation.

Meanwhile, in our corner of time

When I grew up in the 70’s and 80’s IBM was still synonymous with personal computers and operative systems. There were other machines of-course, I preferred the Amiga and Atari machines because they were more fun, but for business and offices the IBM personal computer was top-dog. And IBM likewise provided their own operative system, OS/2 warp, which sold like hotcakes for a while, a joint effort with Microsoft actually. But we all know Microsoft stabbed them in the back by launching Windows and quickly ran off with the cash. Over the next decade IBM was forced to fire employees in the bucket-loads and began it’s inevitable drift into IT oblivion.

Eniac, the first programmable numerical device, United States Army, 1943

Eniac, the first programmable numerical device, United States Army, 1943

But what killed IBM as the #1 provider of hardware and software? How could they go from being the inventor of the personal computer, to being completely left out of the equation? Well, to run with our nature analogy — it was the rigormortis of business: namely office culture and bureaucracy. When moving a part from A to B takes 2 weeks and 6 forms, then its game over.

I sincerely hope Microsoft and Apple takes the time to learn from big blue. Not just from it’s mistakes but also from what it got right. Apple and Microsoft is using their patents to utterly cripple the IT industry – which means new and exciting technologies will never see the light of day. Apple got many fans because they were the only true alternative to Microsoft, a classical David vs. Goliath scenario. But sadly Apple is about to become an even bigger bully than Microsoft ever was. I truly hope they wake up.

This is why I love developing new software rather than adapting to existing technology – because when you are on the front lines of thought, there are no patents or standards to worry about. The mind can roam free to find the best solution to a real problem. Linux is looking better by the minute.

The dark side of the force

Lets hope no company ever repeats this mistake

Lets hope no company ever repeats this

But speaking of IBM — they did make some really, really big blunders. You could even go so far as to call it the mother of all blunders, like their strategic alliance with Nazi Germany. But to be frank they were not alone about that one, coca-cola company was likewise in bed with the enemy back then, selling coca-cola to the Americans and fanta to the Nazis.

And if you go back 100 years you will find that American and French companies were doing all sorts of nasty business. Especially towards the native population. And let us not forget the devil himself, the British east Indian company who murdered and extinguished entire civilizations in the name of profit.

But those were thankfully different times. Or were they?

We should have a higher standard of conduct in our age (he said while pointing to the child labour camps in Asia where Apple products are made).

Here is an interesting link:

Apple admits using child slave labour, article from the telegraph
[break]
So what is the final verdict? Well I started by describing a pattern of life so it’s only fitting that we end the article on the same note. And that note has to do with longevity. IBM survived as long as they did because – for the better part of a century they were the good guys. It was only after they started to drive their business purely for the sake of profit, bullying smaller companies and selling their soul to the devil if you like – that the original formation fell apart. As is the case with most large companies that breaks down (and again the law applies to people as well) it was not something outside that caused the downfall, but rather something inside them. Their bureaucracy and bought “high and mightiness” got the better of them in the end. Victims of their own greed to be precise.

About the author


Jon Lennart Aasenden is a software architect at Optimale Systemer AS. He is currently the lead developer of Smart Mobile Studio and have been a strong supporter of Delphi and object pascal since the beginning. He is also involved in the evangelizing of object pascal in Norway and is by many called “a Delphi fundamentalist” due to his somewhat radical teaching methods. The views of the author is his own and does not reflect the policy of Optimale Systemer AS.

Windows 8, Moriarty at it again

Posted on 16.02.2012 by Jon Lennart Posted in Developers log

A lot of people are wondering if Microsoft have lost it’s proverbial marbles in respect to the Windows 8 “metro” formula. The idea of not being able to write desktop applications sounds just to odd to be true. And when it sounds to odd to be true then it usually is. So Watson – put on your best pipe and let’s investigate!

The context

In order to fully grasp the significance of Windows 8 we need the proper context in which to judge it. And the context is as follows: In one hand Microsoft has the worlds most popular operating system. In the other Microsoft holds the most advanced compiler system on the marked. And while juggling these two factors they have for the past decade or so flirted flamboyantly with alternative hardware combinations. It was about time they jumped into bed with one of them, especially now when mobile computing and instant access to data is central to business philosophy.

The metro UI

The metro UI

Now before my fellow Spartans beat me with sticks for entertaining that Microsoft has the worlds best compiler system – im not actually talking about language here (we all know Delphi is the best). Im talking about the fact that with CLR (common language run-time) and the underlying compiler architecture — you can bake your source to byte-codes which in turn can be re-compiled to machine-code.  In other words its portable in abstract form. This means that if Microsoft author large parts of their new operative system in oh say, C#, they have in effect turned Windows into a truly hardware independent operative system. Moving from Intel x86 processors to a system based on a RISC processor would be a relatively simple chore compared to moving 1 gigabyte of hardcoded C/C++ source code.

So this is the context you have to keep in mind when looking at what Microsoft is doing. By being able to run on cheap ARM processors Microsoft has gained remarkable easy access to technology, not just phones and pad – but also a whole universe of embedded systems. Im thinking wall mounted alarm systems, car entertainment systems and even the kitchen fridge. A marked which is currently rampant with Linux clones.

The missing piece of the puzzle

Now running windows on a fridge would be impractical (to say the least) if you had to fiddle around with a keyboard and mouse. But Windows have had support for touch-screens, gestures and virtual keyboards for years now. And this is where the new “metro” UI comes into its proper setting. Now im not saying that Microsoft will do any of this (!) Im simply scetching out that they can. And if Microsoft’s history is anything to go by – they will do whatever they have to.

Apples victory may be short lived

Apples "victory" may be short lived

So this is where the strange, interactive and “boxed” user interface makes perfect sense. Because its not really a desktop like we are used right now. The only logical conclusion is that this is by design and not some desperate attempt to fix what’s not broken. It’s designed to be an interactive “touch” menu which is fun to look at. And that is a minimal requirement if you want to sell something you can wall mount or integrate into your car. Or, perhaps more likely, put inside a television.

Se the pattern? Microsoft moves through the trenches in almost syncronious opposition to Apple. Pads, mobile phones, abstraction from hardware – and you can bet they will have a stab at television as well. The metro UI is the perfect tv menu.

The web based UI

Good move

Good move

Now, no Windows upgrade is complete without robbing Apple blind, and metro is no different. Unless you have been living under a rock you may have noticed that Apple have thrown tons of money into webkit the past couple of years. As a result Apple and Google are now the kings of mobile browsing. And to be perfectly frank – they also rule the desktop waves (albeit Opera and Safari is not far behind). More and more sites demand that you run a webkit browser these days. Both normal users and developers are sick and tired of browser incompatibility, so I wouldn’t be surprised to see webkit winning by brute force.

What is the significance of this? Why simple. Apple and Google have done what Microsoft was sued for doing to Java, namely taken hold of Javascript and married it to their own intellectual ideas. Better known as HTML5. At the same time we see them pushing Dart in the backdoor, the “so called” javascript replacement. But it’s not really a replacement as much as it is leverage. Who do you think owns dart? Cui bono?

So what does Microsoft do? It flanks them by taking hold of javascript and making it the new, de facto language for UI design. It really is a brilliant move by Microsoft and having learned to love javascript – I sincerely hope they blow apple and Google out of the water with this one.

The game is afoot!

And there you have it. While I don’t suspect to find a start-button on my fridge anytime soon, the UI design adopted by Microsoft, their sudden interest in RISC technology and taking javascript under their wing. These are all strategic moves on a chessboard designed to make them top-dog.

And the rumour about not being able to create desktop applications is not actually true (at least not the way people present it). The confusion is because Microsoft have changed the meaning of the word desktop to mean the metro menu. Your native apps will still run but more akin to the old Amiga where each application had it’s own full-screen view. Microsoft is not in the business of committing suicide.

[break]

About the author


Jon Lennart Aasenden is a software architect at Optimale Systemer AS. He is currently the lead developer of Smart Mobile Studio and have been a strong supporter of Delphi and object pascal since the beginning. He is also involved in the evangelizing of object pascal in Norway and is by many called “a Delphi fundamentalist” due to his somewhat radical teaching methods. The views of the author is his own and does not reflect the policy of Optimale Systemer AS.

Export features: zip and ftp

Posted on 12.02.2012 by Jon Lennart Posted in Developers log
Export to FTP

Export to FTP

While not in the original specs I decided we must have FTP publishing support in Smart Mobile Studio. In popular demand from people in the alpha group I also added zip support. This means that you can now export your project either locally or remotely, in either normal file format (backup) or as a compiled project.

This adds to the already built-in functionality to save your entire project as a single file (all external files can be included in the project file).

What is exported?

If you go for the “backup” export then Smart takes you entire project folder, source and resources, and copies it to the target. If you opt for a zip export then all the files are stored into a normal zip archive (native Delphi zip support of-course, no external libraries needed) and saved to the target location.

If you have selected FTP as your mode of export then the zip archive will be shipped off that way.

This will make it a lot easier to maintain X number of mobile applications from your developer machine no matter where you host the files.

It will be a fairly ad-hoc approach in v1.0 but we will add more to the foundation in later versions of Smart Mobile Studio. In the future you will be able to script and automate the IDE to do magical things 🙂

Upcoming features

What can Javascript do?

Posted on 10.02.2012 by Jon Lennart Posted in News and articles
Would you believe its 1k of source?

Would you believe its 1k of source?

A lot has changed since the average programmer had a stab at javascript. As a Delphi developer I played around with it roughly 10 years ago (when everyone was doing scrollers, pop-up windows and the “dark side” of javascript) but a couple of years ago I realized that browser technology had come of age. And thus Smart Mobile Studio was born.

To give people a taste of what modern javascript can do I want to share a link to the JS1K website, which holds a “yearly” competition for the best javascript demos (using the canvas tag). The rules are simple: stuff as much graphical bliss as you can into 1k of source-code. The best effect and technique get’s the price.

My favorite is without a doubt: http://js1k.com/2010-first/demo/171 but all the demos on the website are really spectacular. Especially considering the size of the sourcecode.

So head over to JS1k and have a look!

And who needs webGL when we have hardware acellerated 3d transformation in webkit? Check out Sprite3d (note: requires a webkit browser, like Safari or Chrome) which we aim to wrap for Smart Mobile Studio in v1.2. Here is Mario Cart written in javascript and HTML5.

javascript

Smart device orientation

Posted on 08.02.2012 by Jon Lennart Posted in News

Primoz Gabrijelcic has published some very exciting code for working with iOS device orientation and movement. These features will of-course be a part of our RTL code base on release – but for now you can check out Primoz great examples and familiarize yourself with the concepts.

You can find the device orientation demo here. Also make sure you checkout Primoz website for interesting articles, advanced code and knockout components!

Gematria, playing with numbers

Posted on 07.02.2012 by Jon Lennart Posted in Developers log
The platonic world view

The platonic world view

Ever seen those extremely annoying banner-ads that proclaim that you name has a magical meaning? Ever wonder how they manage to extract values from something as simple as a name? Well if you promise not to make another banner then i’ll share the secret (he said with a scary voice).

Ye old gematria

This is an old routine for calculating those sublime and mystical numbers of ancient lore. It was converted from ordinary Delphi without much problems. It only needed a minor adjustment on the array constants to work. This shows just how easy it can be to port over ordinary object pascal from other systems and get them running on your website or mobile device.

Note: In the charset constant below I have used ordinary, modern Latin characters. This will of-course go terribly wrong if you attempt to decode ancient Greek or Hebrew. You will need to manually replace the modern characters with the unicode versions of the old alphabets (this code out-dates unicode and widechar).

Enjoy the mystery 🙂

[sourcecode language=”delphi”]
type
TJLGematria = (gmCommon,gmHebrew,gmBeatus,gmSepSephos);

const
JL_GEMATRIA_HEBREW: Array [0..25] of Integer =
([0,2,100,4,0,80,3,5,10,10,20,30,40,50,0,
80,100,200,300,9,6,6,6,60,10,7]);

const
JL_GEMATRIA_COMMON: Array [0..25] of Integer =
([1,2,700,4,5,500,3,8,10,10,20,30,40,50,
70,80,600,100,200,300,400,6,800,60,10,7]);

const
JL_GEMATRIA_BEATUS: Array [0..25] of Integer =
([1,2,90,4,5,6,7,8,10,10,20,30,40,50,70,
80,100,200,300,400,6,6,6,60,10,7]);

const
JL_GEMATRIA_SEPSEPHOS: Array [0..25] of Integer =
([1,2,3,4,5,6,7,8,10,100,10,20,30,40,50,
3,70,80,200,300,400,6,80,60,10,800]);

Function JL_CharToGematria(Value:String;
Const Codex:TJLGematria):Integer;
const
Charset = ‘abcdefghijklmnopqrstuvwxyz’;
var
FIndex: Integer;
FTemp: String;
Begin
result:=0;
FTemp:=value;
FTemp:=lowercase(FTemp);
FIndex:=pos(FTemp,Charset);
If FIndex>0 then
Begin
dec(FIndex);
Case codex of
gmCommon: inc(result,JL_GEMATRIA_COMMON[FIndex]);
gmHebrew: inc(result,JL_GEMATRIA_HEBREW[FIndex]);
gmBeatus: inc(result,JL_GEMATRIA_BEATUS[FIndex]);
gmSepSephos: inc(result,JL_GEMATRIA_SEPSEPHOS[FIndex]);
end;
end;
end;

Function JL_StrToGematria(Value:String;
Const Codex:TJLGematria):Integer;
var
x: Integer;
Begin
result:=0;
value:=lowercase(trim(value));
If length(value)>0 then
for x:=1 to length(value) do
inc(result,JL_CharToGematria(Value[x],Codex));
end;
[/sourcecode]

The final battle begins, persians on the run

Posted on 06.02.2012 by Jon Lennart Posted in Developers log

For those that have been following Smart Mobile Studio from idea to realization, I am happy to announce that the final piece of the IDE is now under way. I am ofcourse talking about the visual designer -which is more than a brain teaser since it has to talk with Javascript in real-time. We have also added skin support to the next alpha release (and yes you can turn it off) and all the latest compiler switches. Smart linking is also working now, so your compiled apps will be as small and fast as possible.

Look and feel is now in the hands of the user

Look and feel is now in the hands of the user

Spartans

Bring it on

Bring it on

If you are new to Object Pascal you might be wondering about all the references to Greek myth and history that always seem to follow pascal coders. As you probably know Delphi was the capital of ancient Greece in its golden days, typically refered to as “the navel of the world” as this was where Apollo killed the serpent. Since the most famous and popular object pascal studio is called Delphi – then naturally object pascal coders the world over adopted this. And yes, we had the spartan helmet long before the movie “300” came out.

It is also a re-occuring phenomenon that if you challenge a pascal programmer, he will respond with a quote from 300 – especially if he hears the word “impossible”.

Impossible to compile to javascript you say? THIS IS SPARTA!

What can smart offer me?

Posted on 06.02.2012 by Jon Lennart Posted in News and articles

Smart Mobile Studio has a lot to offer modern developers. If you are looking for a way to maximize the potential of the HTML5 platform then Smart has a recipe unlike any other on the market. No matter what industry or field of expertise you focus on – Smart provides benefits that saves time. It makes technological and financial sense.

Beginners will discover a language that has withstood
the test of time with unparalleled elegance.

Advertising

You need an edge in what you do

You need an edge in what you do

The world of advertising and content production operates with high demands. The market is constantly changing and the tools of the trade you have relied on for years – might not even be there tomorrow. Some vendors have consciously banned technologies like Adobe Flash in favour of HTML5 – which means you better start looking for a new method. A method which enables you to deliver quality content, on time, according to your clients expectations. Customers are simply not interested in flash banners any more.

Smart Mobile Studio allows you to take your HTML5 code to the next level. We provide a rich set of visual components ready for use out of the box. No fiddling with styles to get that native look, no experimental hacks to get it working and no shortcuts. This means you can spend your time focusing on delivering rich content and lasting impressions straight away.

As a bonus all your web skills remains relevant as ever before. Smart can interact with other frameworks and you can easily add your own, native javascript code.

With Smart Mobile Studio you finally have a tool that can deliver HTML5 friendly advertising with no dependencies. No plugins, no custom browser extensions needed. What you get is cutting edge javascript which runs incredibly fast.

Entertainment and multimedia

With touch based devices like the iPad (or the rapidly expanding Android based market) almost everywhere these days, the future of tablet based gaming and multimedia is golden. But moving code from a classical programming environment to the web requires time, patience and money. Javascript is a fantastic language that commands great power and potential, but compared to C# or Object Pascal you will find yourself cutting corners.

Browser games are getting more and more advanced

Browser games are getting more and more advanced

Smart Mobile Studio means you don’t have to cut corners. You get all the missing pieces of a real programming language, like actual object inheritance, variants, var parameters and interfaces. This means that converting already existing code from Visual Studio, Flash or C# to HTML5 is radically faster.

Finally you can focus on getting your game or multimedia app out there. Need an off-screen bitmap? No problem. Need a high speed drawing surface? No problem.

With Smart, creating online games becomes far easier because all the boring stuff is already done. You have classes for drawing graphics, both on-screen and off-screen. You get classes for communicating with your web service and you get a native looking GUI skin out of the box. Altering the look of your GUI is just a matter of editing a CSS style-sheet.

Business software

No matter if you are focusing solely on the mobile market or want to create dynamic browser applications, Smart will help you get started straight away. As a modern developer with a background in C#, C++, object pascal or java – first contact with the alien landscape of javascript is often a culture shock. It has been said that going from Delphi or Visual Studio to javascript is almost like trading in your PC or Mac for a Commodore 64.

Javascript can now deliver serious applications

Javascript can now deliver serious applications

As a language javascript has no support for OOP in the true sense of the word, no virtual methods, no abstract methods, no interfaces and absolutely no var parameters. These restrictions alone makes it very difficult to create and maintain large scale applications in native javascript. When we add the fact that you must create, or buy, a GUI framework on top of this, the financial aspects involved in “going native” can hardly be justified.

Smart Mobile Studio removes 2/3 of the challenge straight away. You get a language which is very popular, has a massive code-base the world over, is easy to learn (especially if you have OOP background) and which supports modern concepts like interfaces, classes, inheritance and other “must have” features. So instead of spending months learning in-depth javascript, circumventing it’s pitfalls through trial and error, buying a ton of books and basically re-inventing the wheel — You can pick up Smart and deliver a killer app in no time.

Smart will take your object pascal code (the same flavour as made popular by Delphi and Free-pascal) and compile it into cutting edge javascript. The compiler even sculpts the missing language features, like interfaces and inheritance, in javascript itself. So the generated code have no dependencies. You don’t need a plugin or browser extension at all. It will run “as is” in any webkit based browser (Chrome, Safari, Safari Mobile and more).

Further reading

  • What is Smart Mobile Studio
  • Understanding Smart
  • Take advantage of classical programming
  • Tired of handcrafting your javascript apps?
  • Documentation and sourcecode examples
HTML5 javascript Pascal Smart Mobile Studio

iPhone accelerometer in Smart

Posted on 05.02.2012 by Jon Lennart Posted in News

Primoz Gabrijelcic have published a steady stream of examples since we released Smart Mobile Studio to the test group. This time he has coded a very nice app that demonstrates using the accelerometer and getting the orientation vectors of your iPhone or iPad.

You can find the acceleration demo here. Also make sure you checkout Primoz website for interesting articles, advanced code and knockout components

Pages

  • About
  • Feature Matrix
  • Forums
  • News
  • Release History
  • Download
  • Showcases
    • The Smart Contest 2013, Round 1 – Graphics
  • Store
  • Documentation
    • Creating your own controls
    • Debugging, exceptions and error handling
    • Differences between Delphi and Smart
    • Get the book
    • Getting started
      • Introduction
      • Local storage, session storage and global storage
      • Application architecture
      • The application object
      • Forms and navigation
      • Message dialogs
      • pmSmart Box Model
      • Themes and styles
    • Layout manager
    • Networking
      • Loading files
      • TW3HttpRequest
      • TW3JSONP
    • Prerequisites
    • Real data, talking to sqLite
    • System requirements
    • Project types
      • Visual project
      • Game project
      • Console project

Archives

  • December 2019
  • December 2018
  • November 2018
  • July 2018
  • June 2018
  • February 2018
  • September 2017
  • April 2017
  • November 2016
  • October 2016
  • September 2016
  • April 2016
  • March 2016
  • January 2016
  • October 2015
  • September 2015
  • July 2015
  • April 2015
  • January 2015
  • December 2014
  • October 2014
  • September 2014
  • August 2014
  • July 2014
  • June 2014
  • March 2014
  • February 2014
  • January 2014
  • December 2013
  • November 2013
  • October 2013
  • August 2013
  • July 2013
  • June 2013
  • May 2013
  • April 2013
  • March 2013
  • February 2013
  • January 2013
  • December 2012
  • November 2012
  • August 2012
  • July 2012
  • June 2012
  • May 2012
  • April 2012
  • March 2012
  • February 2012
  • January 2012
  • November 2011
  • October 2011
  • September 2011

Categories

  • Announcements (25)
  • Developers log (119)
  • Documentation (26)
  • News (104)
  • News and articles (16)

WordPress

  • Register
  • Log in
  • WordPress

Subscribe

  • Entries (RSS)
  • Comments (RSS)
  • Prev
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • Next
© Optimale Systemer AS