Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Building your First Mobile Game using XNA 4.0

You're reading from   Building your First Mobile Game using XNA 4.0 A fast-paced, hands-on guide to building a 3D game for the Windows Phone 7 platform using XNA 4.0

Arrow left icon
Product type Paperback
Published in Jan 2013
Publisher Packt
ISBN-13 9781849687744
Length 158 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
Thomas Goussaert Thomas Goussaert
Author Profile Icon Thomas Goussaert
Thomas Goussaert
Brecht Kets Brecht Kets
Author Profile Icon Brecht Kets
Brecht Kets
Arrow right icon
View More author details
Toc

2D coordinate system


Before we start drawing, we need to have some knowledge about the 2D coordinate system. The 2D coordinate system uses two axes: x and y. The point of origin (being x = 0 and y = 0) is located at the top left corner. The x axis starts at 0 and increases to the right, and the y axis also starts at 0, but increases to the bottom. Note that the length of each axis is partly determined by the orientation.

Let's assume we have a device that supports an 800 X 480 resolution. In portrait, the x axis will be 480 pixels and the y axis 800. In landscape, x will be 800 pixels and y 480.

The orientation will change automatically depending on how you hold the device. By default, landscape left and landscape right are supported, as this does not affect our code. If we want to enable portrait as well, we can set the SupportedOrientations property of the graphics device manager.

graphics.SupportedOrientations = DisplayOrientation.Portrait |
                            DisplayOrientation...
You have been reading a chapter from
Building your First Mobile Game using XNA 4.0
Published in: Jan 2013
Publisher: Packt
ISBN-13: 9781849687744
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image