■ INTRODUCTION
xxiv
Running a Web Server
To use Pixi, you’ll also have to run a web server in your root project directory. The best
way is to use node.js (nodejs.org) and then install the extremely easy-to-use http-server
(github.com/nodeapps/http-server). However, you have to be comfortable working
with the Unix command line, if you want to do that.
■ Note Are you afraid of the Unix command line? Don’t be! Unix is a wonderfully retro-future
way to scare your parents, and you can learn it in a few hours. Maybe start with the classic
tutorial “Learn Unix in 10 minutes” (freeengineer.org/learnUNIXin10minutes.html) and
follow it up with the “Unix Cheat Sheet” (www.rain.org/~mkummel/unix.html). Install a
great little script called “Z” (github.com/rupa/z) to help you navigate the file system, and
then start playing around. You’ll also find dozens of videos on the Web for Unix for beginners,
including Michael Johnston’s excellent two-part series.
But if you don’t want to mess around with the command line just yet, try the
Mongoose web server (cesanta.com/mongoose.shtml) or just write all your code using
one of the many HTML5-based text editors: Brackets, Light Table, or Atom. Any of these
will launch a built-in web server for you automatically, when you run your code in a
browser.
A Survival Guide for Future Pixi API Versions
This book was written when Pixi was in version 3, but Pixi is a fast-changing, living code
library. What that means is that if you’re using a future version of Pixi and run some
code that isn’t completely compatible with the code in this book, you’ll have to use your
judgment about how to adapt it to the new version. The good news is that Pixi’s core user-
facing API has been stable since version 1, so most of the code and techniques in this
book should be relevant to future versions. But you’ll have to stay on your toes! Following
are some Future Pixi survival tips.
• The object or method you’re trying to use might have been
renamed. Pixi’s development team sometimes likes to rearrange
the furniture a bit, and they’ll do so on a whim. That means
they might change the names of some object or method names
or give them new locations. For example, in version 2.0, the
TextureCache object was located in PIXI.TextureCache, while in
version 3.0, it was moved to PIXI.utils.TextureCache. Likewise,
the setFrame method became the frame property. These aren’t
deal breakers. They’re just cosmetic differences, and the code still
works in the same way. But you’ll have to be prepared to research
possible future changes such as these and update your code if the
JavaScript console gives you any errors or warnings.
www.allitebooks.com