Foreword
- What makes the Russian people in a crisis?
- Spends all your money as quickly as possible.Piece of iron
I bought myself a LG LG lb671v TV and, following the old tradition of writing something for each new piece of hardware, decided to write a game, especially since LG already has its own online application store and an open SDK for third-party developers.
I go to the online store and, what do you think, I do not find there my beloved good old tube ... (to substitute my) Tetris. Need to fix.
Instruments
Go to
the developers site in the
section for SmartTV and download the SDK. The development tools package includes: command line tools, emulator, development environment (using eclipse). If there are problems with the installation, then look at the section "Troubleshooting" on the
SDK page. Installing special difficulties should not cause.
')
The webOS platform supports several types of applications: Web, Native, Unity, Flash, etc. Some of them are not available for third-party developers. In my case, the application is of type web (html5).
Code
Canvas full page. Found in the expanses of stackoverflow.<html> <head> <title>Tetris</title> <meta charset='utf-8' /> <style> html, body { width: 100%; height: 100%; margin: 0; } canvas { display: block; position: absolute; top: 0; left: 0; right: 0; bottom: 0; width: 100%; height: 100%; } </style> </head> <body onload="initGame()" <canvas id='myCanvas' height='1080' width='1920'>Not support</canvas> <script>…</script> </body> </html>
A game
Describe the implementation of Tetris does not see the point. Every self-respecting programmer in his life should write tag, snake and tetris. I will give a screenshot:

Assembly
1) We put all the files in a separate folder;
2) Create a JSON file with a description of the application:
Example { "id": "myapp", "version": "1.0.0", "vendor": "mycompany", "type": "web", "main": "index.html", "title": "Tetris", "icon": "icon80.png", "largeIcon": "icon130.png", "appDescription": "Classic Tetris game. Enjoy it!", "splashBackground": "splashScreen.png", "bgImage": "bgImage.png", "bgColor": "#d0dbbd", "iconColor": "#343829" }
3) In the command line, go to this folder and run the build script from the SDK: 'ares-package'. After that, if there are no errors, a file with the * .ipk extension is created;
4) If we want to run on the emulator, then we run the emulator and execute the command: 'ares-install file_name.ipk';
5) If we want to run on TV, then we need:
5.1) sign the application on the lg website (download our * .ipk and download the signed application as an archive);
5.2) create a directory on a flash drive / developer / apps / usr / palm / applications /;
5.4) unpack the archive downloaded from the site into this directory;
5.5) after connecting the USB flash drive to TV, yours should appear in the list of applications. At the same time to start, you must have access to the Internet on TV.
Rake
Some difficulties arose in the fight against anti-aliasing, and the old-school design style suggests clear pixels. I will give a solution immediately:
a. the only option that guaranteed removes artifacts on all browsers is to insert a transparent pixel between the tiles (this is true if the images use transparency);
b. draw images only by whole pixels.
There were such notes: fill in the correct / full description and test result, remove the transparency of the icon, handle the back / home buttons, add splashScreen, add buttons to the UI. Regarding the latter: LG has a requirement for TV applications - to control the TV, the MRCU (mouse) cursor should be enough. Magic Remote Control Unit is a special remote, an analogue of the Nintendo Wii gamepad.
Several stones in the garden LG
1) Authorization on sites is reset after 30 minutes (quite often you have to re-enter, the Remember my ID checkbox doesn’t affect anything). At the same time, it is necessary to register separately on the developers website and in the store.
2) Playing
sfx sounds is delayed by 0.5 seconds, which makes it difficult to use sound effects in games. The official position of LG: we have been working on this problem (they have been working for more than a year), use graphic special effects instead of sound ones. I had to abandon the sound.
3) I do not know how things are with this in other online stores, but filling out the description and test results is tiring. Most of the items in the test plan look like this: “The application is described properly,” “The application does not contain malicious code,” “No calls for violence and racial discrimination,” “The application works fine, without error messages,” etc.
Support
Pleased support. I could not understand the remark from QA: "UI must be navigable with MRCU (Cursor + OK + Back)". I sent a letter of support in English, but answered me in Russian. Either determined by my location, or by crooked English. If a specialist from support sits on Habré - thank you.
Few numbers
2 pm on the development of the prototype;
1 month for revision;
5 months to put in the market, because the interesting part of the work (coding) was over, but the QA refusals did not add inspiration.
Pareto's law: 20% of the project takes 80% of the time.
[
source ]