Advertisement



Go Back   Zune Boards > Zune Discussions > Zune Games > Development Discussions

New Member?



 
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Development Discussions All developers who are coding games may stop by here for any help, suggestions, and everything development related.

Reply
 
LinkBack Thread Tools
Old 09-08-2008, 10:52 AM   #1 (permalink)
Experienced Zuner
 
Rockman87's Avatar
 
Join Date: Nov 2007
Location: UT, USA
Posts: 199
Reputation: 25
Send a message via MSN to Rockman87
Default Drawing Textures at different aspect ratios


I have a checkers board that I'm working on that is 400 by 400. You of coarse know that the zune resolution is 240 by 320. I want to be able to let the user decide on what zoom level they want to play checkers at. Default would be to fit the 400 by 400 at a square ratio on the screen. It of coarse won't use the whole screen. Then the user can hold the play button and the up button to zoom into a custom resolution to 400 by 400, It will only display 240 by 320 of the 400 by 400 texture at a time, but I will make it scroll around the board.

What is the code to draw textures at the different zoom levels? I have tried coding it but, either it doesn't draw my texture or it fits the texture to the screen.

Manic Miner uses this zoom/ scroll technique somewhat.



__________________

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.



To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.




Rockman87 is offline   Reply With Quote
Old 09-08-2008, 10:59 AM   #2 (permalink)
ad majorem dei gloriam
Administrator
Ultimate Zuner
 
Deiparous's Avatar
 
Join Date: Jan 2007
Posts: 6,610
Reputation: 474
Send a message via AIM to Deiparous Send a message via MSN to Deiparous Send a message via Yahoo to Deiparous Send a message via Skype™ to Deiparous
Awards Showcase
Most Flamboyant Personality 
Total Awards: 1
Default

you just adjust the parameters of your rectangle...

Code:
new Rectangle(0,0,200,200); //zoomed out
new Rectangle(0,0,400,400);//zoomed into top left
new Rectangle(-160,-80,400,400);//zoomed into bottom right
that should work unless I'm mistaken. More efficient would be to draw the checkerboard by square and only draw squares that should be on the screen
__________________

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.



Deiparous is online now   Reply With Quote
Old 09-09-2008, 09:36 AM   #3 (permalink)
Experienced Zuner
 
Rockman87's Avatar
 
Join Date: Nov 2007
Location: UT, USA
Posts: 199
Reputation: 25
Send a message via MSN to Rockman87
Default

Thank you very much... That is exactly what I needed... How did you figure out that -160 , -80 would draw the texture zoomed in at the bottom right?
__________________

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.



To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.

Last edited by Rockman87 : 09-09-2008 at 10:15 AM.




Rockman87 is offline   Reply With Quote
Old 09-09-2008, 10:37 AM   #4 (permalink)
Jr. Member
 
Join Date: Jun 2007
Location: Mass
Posts: 312
Reputation: 78
Default

What you would use this:

Code:
Rectangle destination = new Rectangle(0, 0, 240, 320);
Rectangle source = new Rectangle();

Spritebatch.Draw(texture, destination, source);
You should adjust the source rectangle, which will in turn zoom in/out inversely. As in making the source smaller, will cause a larger zoom.

Hope this helps!
__________________
~Shutout5591~

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.

If you like me work or I have helped you, + Rep me!

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.




shutout5591 is offline   Reply With Quote
Old 09-09-2008, 11:37 AM   #5 (permalink)
ad majorem dei gloriam
Administrator
Ultimate Zuner
 
Deiparous's Avatar
 
Join Date: Jan 2007
Posts: 6,610
Reputation: 474
Send a message via AIM to Deiparous Send a message via MSN to Deiparous Send a message via Yahoo to Deiparous Send a message via Skype™ to Deiparous
Awards Showcase
Most Flamboyant Personality 
Total Awards: 1
Default

honestly I think this is one thing there's a few ways to do it. Mine works just as well as long as you aren't sloppy and makes more intrinsic sense to me.

I figured those numbers by 240-400=-160
320-400=-80
__________________

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.



Deiparous is online now   Reply With Quote
Old 09-10-2008, 10:02 AM   #6 (permalink)
Jr. Member
 
Join Date: Jun 2007
Location: Mass
Posts: 312
Reputation: 78
Default

yea, theres definitely more than 1 way to do it. Some feedback from OP would be great!
__________________
~Shutout5591~

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.

If you like me work or I have helped you, + Rep me!

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.




shutout5591 is offline   Reply With Quote
Old 09-12-2008, 08:44 PM   #7 (permalink)
Experienced Zuner
 
Rockman87's Avatar
 
Join Date: Nov 2007
Location: UT, USA
Posts: 199
Reputation: 25
Send a message via MSN to Rockman87
Default

Right now I'm using nurta's recommendation... I havn't had time to try others... been working like crazy. But, everything is working fine. thanks for the help
__________________

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.



To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.




Rockman87 is offline   Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT -8. The time now is 08:21 PM.

 
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0 RC8
vB Ad Management by =RedTyger=
(C) ZuneBoards 2006-2007
Copyright © 2006 - 2008 Zune Boards | About Zune Boards | Legal | A member of the Crowdgather Forum Community