xna

How do you programatically find Vista's “Saved Games” folder?

坚强是说给别人听的谎言 提交于 2019-12-08 05:52:33
问题 I am using XNA and I want to save files to Vista's "Saved Games" folder. I can get similar special folders like My Documents with Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) but I cannot find an equivalent for the Saved Games folder. How do I get to this folder? 回答1: http://msdn.microsoft.com/en-us/library/bb200105.aspx#ID2EWD Looks like you'll need to use Microsoft.Xna.Framework.Storage and the StorageLocation class to do what you need to. Currently, the title location

How to draw a circle on 3D terrain in XNA?

こ雲淡風輕ζ 提交于 2019-12-08 05:46:14
问题 So I've been looking across the web to find an answer to this question, but I seem to be missing something. I've got a little project going that dynamically creates 3D terrain in XNA 4.0, but I want be able to draw a circle (or any other shape for that matter, but let's first go with a circle) on the terrain. Now I've read some things about 'projective texturing' but I'll admit I'm at a complete loss when it comes to shader-language. The idea is that I can (dynamically) create a basic shape,

Why does garbage collection in c# / xna not dispose of render targets automatically?

家住魔仙堡 提交于 2019-12-08 05:40:08
问题 I found out that render targets in c# / xna are not automatically disposed of, and you have to call the .dispose() member to get rid of them. I thought garbage collection was suppose to automatically get rid of things after all their references are gone, what gives? Is there anything else that is not disposed of automatically? 回答1: I thought garbage collection was suppose to automatically get rid of things after all their references are gone, what gives? This is incorrect in two ways. Garbage

How to make an object move towards another object in C# XNA

偶尔善良 提交于 2019-12-08 05:13:36
问题 I'm currently trying to make an object move towards another. I have this code so far to try and achieve it. double angleRad = Math.Atan2(mdlPosition.Z+treeTransform.Translation.Z, mdlPosition.X-treeTransform.Translation.X); enemyPos.X += (float)Math.Cos(angleRad) * 0.2f; enemyPos.Z += (float)Math.Sin(angleRad) * 0.2f; Whenever I move my player character, the object moves, but not towards the characters current position. How can I direct it towards current position? 回答1: Normally you should

Draw string with normalized scientific notation (superscripted )

早过忘川 提交于 2019-12-08 04:32:49
问题 I want to draw following string in my game To compare, there are 10^75 particles in the universe. where 10 75 is formatted in a normalized scientific notation (as we've been doing in school). I use SpriteBatch.DrawString method, but I cannot figure out a nite solution. There are a few trivial ones: Draw two strings where the second string's got a smaller font or is scaled. Draw an image. I've been looking at UTF tables, but seems it's not possible. Do I have to have special font for this task

XNA Rectangle intersection

眉间皱痕 提交于 2019-12-08 04:22:30
I recently started on XNA development and having some (very limited) experience with it in the past, I decided to try and make a Pong clone to see how much I could remember. Most of what I knew came back to me, but I am having problems with collision detection between the bats and the ball. I have 3 rectangles set to update position along with the sprites that I am using, and when the ball rectangle intersects with a bat rectangle, I multiply the X speed of the ball by -1. However this produces an unusual effect by which the ball bounces around the bat as shown in this video .What am I doing

XNA on graphics card

杀马特。学长 韩版系。学妹 提交于 2019-12-08 03:17:32
问题 How can I program graphics on a graphics card with XNA? (How do I move the workload onto the graphics card) 回答1: Explained in a very simplified way: All of the graphics are automatically drawn by the graphics card. There is no software rendererer mode in XNA. The way XNA is set up most geometry is transferred to the graphics card Vertex Buffer Objects. A fixed pipeline approximization or shaders are then applied to the data by the graphics card and displayed on screen. In short: If you want

Not sure how to fix this StackOverflow Exception was Unhandled error

∥☆過路亽.° 提交于 2019-12-08 03:15:16
问题 First time posting here and I know I'll probably get flak for my coding, but I'm a Year 12 student and teaching myself this language for my Software Major, I only just started understanding classes today so I tried to re-do my game with this in-mind, game is far from done. sorry for long post of code but I really can't figure out whats wrong, in the game1.cs is just player.LoadContent(Content), player.Update(gameTime) and player.Draw(spriteBatch), with player being the Object for the Player

C# XNA Xbox HashSet and Tuple

你说的曾经没有我的故事 提交于 2019-12-08 03:13:32
问题 C# XNA Xbox, in this case optional parameters are not optional Thanks to help from the above question optional parameters are now working, or at least appear as if they should work. However I'm now stuck on HashSets and Tuples, that don't appear to be available either. I could write my own version of both classes. Tuple from scratch and HashSet using a Dictonary (possibly). However I'd rather keep to using the standard ones. If these classes exist in the PC verstion of the library, then can I

XNA game components

一笑奈何 提交于 2019-12-08 02:25:33
问题 I an confused about how to pass values of variables from 1 gamecomponent to another. I am using xna 4.0. I created two gamecomponents, the drawstring and the inputmanager. I want to read the keyboard input of the user and pass it onto drawstring where it will update the position. I cant add components on drawstring(drawablegamecomponent). I can do it on class but not on gamecomponent. Can you guys post some examples here. For beginners. 回答1: Use GameComponent for something that you would want