Games development on Smart TV
Kamil Kiełbasa @blackdante90
We talk about JavaScript. Each month in Warsaw, Poland.
Kamil Kiełbasa @blackdante90
Canvas element is part of HTML5 and allows for dynamic, scriptable rendering of 2D shapes and bitmap images. It is a low level, procedural model that updates a bitmap and does not have a built-in scene graph.
// html
<canvas id="example" width="200" height="200"></canvas>
// javascript
var example = document.getElementById('example');
var context = example.getContext('2d');
context.fillStyle = "rgb(255,0,0)";
context.fillRect(30, 30, 50, 50);
WebGL (Web Graphics Library) is a JavaScript API for rendering interactive 3D graphics and 2D graphics within any compatible web browser without the use of plug-ins. WebGL is integrated completely into all the web standards of the browser allowing GPU accelerated usage of physics and image processing and effects as part of the web page canvas. WebGL elements can be mixed with other HTML elements and composited with other parts of the page or page background.
init();
animate();
function init() {
// game bootstrap
}
function animate() {
requestAnimationFrame( animate );
// game update
}
<audio controls>
<source src="Horse.ogg" type="audio/ogg">
<source src="Horse.mp3" type="audio/mpeg">
</audio>
// getting from storage.
var foo = localStorage.getItem("bar");
// save to storage.
localStorage.setItem("bar", foo);
el.addEventListener("click", function () {
// some actions.
});