Now that our Nintendo Wii U game is able to render entities, let's use HTML5's canvas API and draw actual images to the screen. The image class will abstract the native image element from HTML 1, as well as abstract away the possibility to use a single image file as an atlas. This way we can have a lot of images in the same png file, and only render a cropped out section of it. This technique is supported by the canvas context API, and is very handy because we only need to load one resource from the server. This works especially well when doing animation, which we'll do in the next tutorial. Note that the image class is not a component. We can thing of it as a general purpose utility class. But since this class actually has a very specific purpose, I guess we shouldn't dump it within other broadly defined classes. Thus, I'm putting it within a graphics package. Copyright (c) 2013 Rodrigo Silveira http://www.easylearntutorial.com
Copyright © 2014-2017 EasyLearnTutorial. All rights reserved.