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

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.

主站蜘蛛池模板: 工布江达县| 浏阳市| 江源县| 澄迈县| 淮安市| 徐州市| 肃南| 盘山县| 通海县| 宿迁市| 襄汾县| 田林县| 东明县| 中卫市| 大足县| 邓州市| 科尔| 福海县| 藁城市| 景德镇市| 南岸区| 延寿县| 台南县| 福州市| 德阳市| 济源市| 祁阳县| 乌拉特前旗| 绥江县| 青海省| 富宁县| 札达县| 蒙阴县| 西宁市| 高邮市| 葵青区| 绥滨县| 南康市| 儋州市| 宿松县| 澄迈县|