Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Coding4Fun
A Note Regarding Supplemental Files
Preface
Who This Book Is For
What You Need to Use This Book
How This Book Is Organized
Conventions Used in This Book
About the Code
Using Code Examples
Comments and Questions
SafariĀ® Books Online
Acknowledgments
From Dan Fernandez
From Brian Peek
I. Gaming
1. Alien Attack
Overview
Setup
Windows Version
Screens
Title screen
InputManager
Back to the Game
Seeing the Title Screen
Game Screen
Adding GameScreen to the main game
Sound engine
Player ship and sprites
Player shots
Scoring and lives remaining
Enemies
EnemyGroup
Collision detection and explosions
Running the Application
Xbox 360 and Zune Support
Xbox 360
Zune
Final Thoughts
2. LEGO Soldier: A 2-D LEGO Side-Scroller Popfly Game
Overview
Popfly Game Creator Terms
Building LEGO Soldier Step-by-Step
Building the Popfly Game
Designing Custom Actors
Designing a LEGO Model Using LEGO Digital Designer
Exporting a LEGO Model
Cropping out Empty Space
Upload Images to Popfly
Building an Actor in the Actor Designer
Adding a Health Bar and a Scoreboard
Importing Actors
Designing the Main Scene
Designing the Main Scene
Adding the Two Cave Background Actor Files
Tiling the Background
Tiling the Ground Floor
Designing the First Half of the Scene
Designing the Second Half of Our Scene
Building Game Properties
Building Behaviors
Renaming Behaviors
Building the Main Scene Behaviors
Using Shortcuts to Build the Main Scene Behaviors
Building a Property Change Behavior to Reset the Health Property
Creating a Custom Code Behavior
Adding Main Actor Behaviors Using Shortcuts
Building the Catapult Behavior
Building the LEGO Security Actor Behaviors
Adding Gravity and Jump Behaviors Using Shortcuts
Setting a Random Jump Behavior
Adding a Random Motion Behavior
Adding a Shooting Behavior
Adding a Disappear Behavior
Building the Fire Bullet Projectile Behaviors
Updating the DisappearOnCollision Behavior
Creating a Custom Code Behavior to Lower the Health Property
Building the LEGO Skeleton Behavior
Adding Gravity and Jump Behaviors Using Shortcuts
Updating the Jump Behavior
Creating a Behavior to Follow the Main Actor
Setting the Skeleton Disappear Behavior
Creating a Custom Code Behavior to Lower the Health Value
Adding Behaviors for the Barrel Actor
Adding the Gravity Shortcut for the Barrel Actor
Adding the Disappear Behavior
Building the HealthBar Behaviors
Building a Custom Code Behavior for Updating the HealthBar's HealthValue
Creating a Scene Change Behavior to End the Game
Adding the Blind Scientist Behaviors
Adding a Custom Code Behavior to Call the Grow Animation Storyboard
Adding Random Left and Right Motion Behaviors
Adding a Behavior to Lower the Health Value
Adding the Scene Change Behavior to Win the Game
Publishing Your Game
Publishing to Facebook
Final Thoughts
3. FEED READER: An In-Game RSS Reader for World of Warcraft
Overview
Running Feed Grabber
Feed Reader
Feed Reader Slash Commands
Before We Get Started
A Quick Tour of the Lua Programming Language
Lua types
Variable scopes
Lua functions
Understanding Lua tables
Feed Reader's Lua table
FrameXML 101
Layout
AddOn Studio for designing FrameXML
Templates
Events
Understanding the Feed Reader Addon
Dissecting Feed Reader
How Feed Reader and Feed Grabber Work
The Feed Reader UI
Frames
Adding Code for Frame.xml
Global variables
Defining a variable as a saved variable
Registering for Warcraft events
The SelectFeed and SelectFeedItems functions
The SelectFeedItem function
The UpdateFeeds and UpdateFeedItems functions
The UpdateFeeds function
The UpdateFeedItems function
Updating the summary
OnClick event for Feed buttons
OnClick event for FeedItem buttons
Adding a basic slash command
Feed Grabber
Common Feed List
Programmatically getting feeds
Serializing to Lua
Sneaking in data updates by monitoring the Saved Variables file
Final Thoughts
II. Software and Web
4. InnerTube: Download, Convert, and Sync YouTube Videos
Overview
InnerTube's Main UI
Running InnerTube for the First Time
Adding Videos
How InnerTube Works
How YouTube's API Works
Standard YouTube Feeds
User-Specific YouTube Feeds
YouTube Search
Optional Query String Parameters
Other Important YouTube URLs
Building Classes for YouTube Feeds and Videos
Calling the InnerTubeService Class
Converting YouTube XML into .NET Objects
Downloading Videos from YouTube
Downloading a YouTube Video with Your Browser
YouTube Blocks You (by Design)
Getting a Session Token from JavaScript
Houston, We Have a Token!
Getting a Token Programmatically
Downloading the Video
Downloading a Video's Thumbnail Image
Converting YouTube Videos Using ffmpeg
Syncing YouTube Videos to iTunes and Zune
Syncing Videos to iTunes
Syncing Videos to Zune
Zune monitored folders
Putting It All Together
Calling InnerTubeFeedWorker
Setting Up the InnerTube WPF Application
Global Variables
Application Settings
Building the InnerTube UI
InnerTube Skeleton
Dissecting MainWindow.xaml
Setting the MainWindow.xaml data context
Part 1: The Feed List ListBox
Data binding the feedList ListBox
Part 2: The VideoList ListBox
The Data Template UI
Data Binding the Video List ListBox
Binding to an Image
Building the Image Value Converter
Setting Up a Class As a Static Resource
Part 3: The Details Pane
Formatting Numbers in WPF
Data Binding in the Details Pane
Data Binding to User Controls
MediaPlayer User Control UI
MediaPlayer Data Binding
Playing and Pausing Video
Final Thoughts
5. PeerCast: Watch Videos on Your PC Anywhere in the World
Overview
A Tour of PeerCast
Client or Server Mode
Server mode
Client mode
How PeerCast Works
How Peer Channel Applications Work
Key P2P terms
Peer Channel by example
Building a Peer Channel Application
Listening to P2P messages asynchronously
Structuring messages from the background thread to the UI thread
The NetworkManager Class
NetworkManager variables and constructor
Starting a connection
Running on a background thread
Subscribing to P2PLib events
Reporting progress to the UI thread while we wait for a connection
Keeping the BackgroundWorker thread alive
Listening to P2P Events Using Network Manager
Understanding how the login process works
The StatusChanged event
Sending commands using chat messages
Understanding how chat messages work
Receiving chat messages in the ChatChanged event handler
Processing commands on the server
The GetList ChatCommand
Using C4FP2P to Stream Videos
Understanding how video streaming works
Setting up a video stream
Two different StreamChanged events
The P2PLib StreamChanged event
Logging messages when streaming a video
Finished streaming a video
Ending a connection
Building the Application UI
Choosing the Application Mode
Storing the PeerCast mode
Building the MainWindow.xaml UI
Defining the four-cell grid
The login cell
The Message cell
The Client controls cell
Server controls and the media player cell
Adding the MainWindow.xaml Code
MainWindow properties
MainWindow constructor
Signing in
Receiving UI updates from ProgressChanged
Toggling the UI
Receiving a video list
Deserializing the file list
Playing a video
Sending a Play message
Sending a full-screen play message
Getting a list of videos from the server
Selecting the video streaming directory
When P2pWorker completes
Final Thoughts
6. TwitterVote
Overview
Twitter Rules and Limitations
Building TwitterVote
Twitter: Under the Hood
The Twitter API
Twitter Implementation
Voting Implementation
Displaying Results with Popfly
Embedding the Popfly Results Graph
Running the Application
Sample Poll and Results
Final Thoughts
7. WHSMail: An Outlook Webmail Add-in for Windows Home Server
Overview
Understanding the Setup
Architecture
Building the Host Application
Windows Communication Foundation (WCF)
Contracts and Entities
Configuration
Using Outlook and MAPI
ASP.NET "Client"
Deployment
WHSMailWeb
Running the Application
Final Thoughts
III. Hardware
8. Wiimote-controlled Car
Overview
Building the Hardware
Phidgets
Phidget 0/0/4 Interface Kit
Phidget 0/16/16 Interface Kit
Building the Software
Software Requirements
Software Implementation
Special steps for 64-bit Windows users
Using the Application
Pairing the Wiimote
Installing the Phidget Interface Kit
Driving the Car
Final Thoughts
9. Wiimote Whiteboard
Overview
Defining an Interactive Whiteboard
Using the Wii Remote Infrared Camera
Using IR Pens
Building the Circuit
Preparing the Dry-Erase Marker
Setting Up Your Project
Warping the Camera Coordinates
Touch Calibration
Putting It All Together
Parsing Data from the IR Camera
Using the Software
Final Thoughts
10. Animated Musical Holiday Lights
Overview
Building the Hardware
Information on Amperages
Writing the Software
Software Requirements
Software Implementation
Sequence
Grid display
Playing music
Recording data
Playing a sequence
Creating a Show
Final Thoughts
A. Using the C4fStyle File for WPF Projects
C4fStyle Overview
Adding the C4fStyle File to Your Application
Generic and named styles
Style reference
Before and after
Index
About the Authors
Colophon
← Prev
Back
Next →
← Prev
Back
Next →