sabato 26 aprile 2014

2048 with QML

So apparently everyone's crazy about the 2048 game.
I'm probably the last guy on Earth that discovered it but I really enjoy it.

Since my phone doesn't have a data plan I decided to port the game to QML, so I can play it with my Jolla while commuting to work.

To kill two birds with one stone, I started writing a desktop friendly version for Hawaii but it can be used in any desktop environment and once touch support is added it will work on mobile too.

You can find the source code here.

The logic code has been ported straight from this version, which BTW seems the original implementation. It was the easiest part but I must admit that the graphical part didn't take more time thanks to QML.

Colors are from this version but I plan on letting the user change it.

The UI is fully scalable so here's how it is at startup:

but the grid and the text inside tiles is scaled (although calculation is a bit lame) with the window keeping its aspect ratio:

I did this a month ago and never had the time to polish it.

Off the top of my head there are a few important things left to do:

  • Animations
  • Palette loading

Nessun commento: