HTML + CSS + JS is Good
Posted on 28 Jan 2014, tagged web
UI
frontend
These days I’m using Libgdx to write a mobile game. While I’m writing it, I find that the modern web tech is very good: HTML + CSS + JS. Let me talk about the details.
The drawing part of the game is split into two parts:
- Init all the objects.
- Update these objects in every frame.
Why not do all the things in every frame? Because init objects need more time than change the states of an object in most cases. Init object need to allocate memory, read configuration, load assets, and so on.
Init part also need to specify the position of every objects, or the layout of the stage. I write lots of code to init the position of every object. It is annoying. For example, when the width is changed, I have to change its position to make it in the center or something like that. And the position specification is messed with the code. So it is better to make the position and layout data split from the code.
In web tech, here it is:
- HTML is what it has in the first place (init objects).
- CSS is the position and layout of the objects (data split from code).
- JS update the objects when some events occurs (update objects).
Everybody say and say that again. But I didn’t understand that until I really wrote an application that render graphics to the screen.
So code is better than talk.