官术网_书友最值得收藏!

HTML5 and game development

Most HTML rendering is done through the HTML Document Object Model (DOM). The DOM is what is known as a retained mode graphical library. Retained mode graphics retain a tree known as a scene graph. This scene graph keeps track of all the graphical elements in our model and how to render them. The nice thing about retained mode graphics is that they are straightforward for a developer to manage. The graphical library does all the heavy lifting and keeps track of our objects for us as well as where they render. The downside is that a retained mode system takes up a lot more memory and provides a lot less control to the developer. When we write HTML5 games, we could take images rendered in the DOM using <IMG> HTML elements and move those elements around using JavaScript or CSS animations to manipulate the positions of those images within the DOM directly.

However, this would, in most circumstances, make the game painfully slow. Every time we move an object in our DOM, it forces our browser to recalculate the position of all other objects within our DOM. Because of this, manipulating objects from within our DOM to make web games is usually a non-starter.

主站蜘蛛池模板: 柳河县| 台州市| 宜黄县| 平安县| 隆昌县| 大埔区| 台北市| 温泉县| 漾濞| 芒康县| 田阳县| 嘉禾县| 乐昌市| 临沧市| 天峨县| 大冶市| 福鼎市| 平和县| 阿巴嘎旗| 苍溪县| 丘北县| 响水县| 宣武区| 高要市| 普陀区| 馆陶县| 望谟县| 抚远县| 化州市| 桓仁| 浠水县| 曲麻莱县| 定襄县| 义马市| 高邑县| 临武县| 华池县| 新竹市| 如东县| 苍南县| 益阳市|