|
-
Apr 21st, 2011, 08:01 AM
#38
Re: More graphics timing issues -Revived!!
@Shaggy: Naw, the scroll-wheel zooming won't be an issue because you completely control it. Everything in XNA is loaded into the client area as a Texture, and you control the size, shape, rotation, and positions of those textures at all times, 60x a second. You can have it so that when it zooms, the background texture gets bigger, the icons stay the same size and adjust position on the background according to the background's scale. Likewise, if you want static zoom levels, it's no problem either; it just jumps everything to the new scales and positions.
But yes, all your RU's, fish, icons, dividers, keyways, etc. are all just graphic objects loaded in as Textures when the form opens. Tossing them into the XNA Client area happens at the Draw function that is being refreshed at around 60x a second and at this time, the scale, position, rotation, and shading of the texture is set. Since the physical texture data is preloaded and in graphic's card memory, it's extremely fast. The textures as I said can be anything too, even with transparent edges such as a PNG image. So if you have a round RU, just draw it up in your favorite graphics program and clip the background to be transparent. You can detect a mouseclick on transparent or opaque pixels so you're still covered.
The dividers texture could be 2x2 pixel image, and when drawn can be scaled 1x high, 50x wide to fill a 100 pixel wide RU; but in actuality you'd just scale it to the RU size: (TankWidth/2) * TankScaleX. With this formula, it don't matter what scale your RU is, because the formula works for any case.
Quite honestly, I've never used XNA in a Viewport for drag and drop operations from outside the viewport. I'm sure it can be done, let me play around with it a bit and figure it out. I'll whip up another example that's "fishier" and a little more applicable to your case.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|