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

Tetris arrives in Sparta

Posted on 03.04.2012 by Jon Lennart Posted in Developers log
A very nice tetris clone!

A very nice Tetris clone!

One of the beta-testers really put the system to it’s test. He received the beta – and the next day he submitted a fully blown Tetris clone to us. It is once again a nice testament to just how easy it is to port over Delphi code and make it spin under HTML5 with Smart.

So hat off to Christian! Talk about getting into the RTL quickly. I wasted my entire lunchtime playing this 🙂 Way to go, cheers!

Game coding under Smart

There are currently 2 ways of creating games under Smart. The first is naturally by creating a game project (clicking “new project” -> Game) which will establish a bare-bones HTML5 canvas application. This means no form designs and is more suitable for low-level coders and people who want to squeeze the last drop of juice out of the browser.

The second way, is to create a normal visual application and then add the unit “w3sprite3d” to the uses list. This gives you access to a class called TW3Sprite. TW3Sprite implements a javascript API called sprite3d (no dependencies, we re-created it in smart), which simply put allows you to easily rotate, scale and move the control around the screen – and it’s all done using hardware acceleration (see older posts about Sprite3d and also check out the docs for the library if you are unsure about it).

I also took the liberty to speed up Sprite3d a bit, using and/or operators rather than ad-hoc string replacements. So you should get better speed under Smart.

Depending on your game type, either solution will serve you well – and you will have a serious advantage over classical JS programmers which must write tons of code to get the same level of control and infrastructure.

For a look at what Sprite3d can do, have a look at this article:  Retro demo coded in Smart

Demo and code

You can download the project source code here:  Tetris.zip

You can find an online demo here:  Tetris demo

(Or simply scan the QR code below with your phone)

qrcode

code demo game tetris
« Keyboard events, how to?
Realtime plasma effect »

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)
© Optimale Systemer AS