xna

Position 3d objects in xna

不问归期 提交于 2019-12-25 04:40:47
问题 I'm pretty new to xna development and want to position the Cubes from the Primitives3D sample by passing a position vector to the constructor .. unfortunatly it does not work .. instead it is just spinning arround.. Thats how i modified the code of the cubeprimitive class: public class CubePrimitive : GeometricPrimitive { public Vector3 position; /// <summary> /// Constructs a new cube primitive, using default settings. /// </summary> public CubePrimitive(GraphicsDevice graphicsDevice) : this

moving rectangles one by one

╄→尐↘猪︶ㄣ 提交于 2019-12-25 04:24:51
问题 I have made several rectangles in my XNA program. The next step is to choose them and move them one by one. To choose them, I use the code MouseState mouse = Mouse.GetState(); bool IsSelect1=false; bool IsSelect2 = false; bool IsSelect3 = false; int IsSelectNum=0; //To set the value of IsSelectNum if ((mouse.X > drawRectangle.X && mouse.X <= mouse.X + currentCharacter.Width && mouse.Y >= drawRectangle.Y && mouse.Y <= drawRectangle.Y + currentCharacter.Height) && (mouse.LeftButton ==

Converting a frequency into a -1..1 float

雨燕双飞 提交于 2019-12-25 03:53:53
问题 I'm trying to play back a sound at a given pitch using (C#) XNA audio framework's SoundEffect class. So far, I have this (very basic) public void playSynth(SoundEffect se, int midiNote) { float pitch = (float)functions.getMIDIFreq(midiNote) / ((float)functions.getMIDIFreq(127)/2); pitch-=1F; Debug.WriteLine("Note: {0}. Float: {1}",midiNote,pitch); synth = se.CreateInstance(); synth.IsLooped = false; synth.Pitch = pitch; synth.Play(); } Currently, the pitch played back is very off-key, because

Windows 7 or Windows Vista with XNA for game development

时间秒杀一切 提交于 2019-12-25 03:53:19
问题 I am on Windows XP 32-bit. I want to learn XNA with a book that by the way, recommends Windows Vista or Windows 7. Is it worth the trouble to transfer to those? Thank you 回答1: Hardware and OS requirements for XNA: http://msdn.microsoft.com/en-us/library/bb203925.aspx In short, you should be fine with XP unless you're targeting Windows Phone 7. The tools for that are not supported on XP. 来源: https://stackoverflow.com/questions/7221906/windows-7-or-windows-vista-with-xna-for-game-development

Windows 7 or Windows Vista with XNA for game development

十年热恋 提交于 2019-12-25 03:52:58
问题 I am on Windows XP 32-bit. I want to learn XNA with a book that by the way, recommends Windows Vista or Windows 7. Is it worth the trouble to transfer to those? Thank you 回答1: Hardware and OS requirements for XNA: http://msdn.microsoft.com/en-us/library/bb203925.aspx In short, you should be fine with XP unless you're targeting Windows Phone 7. The tools for that are not supported on XP. 来源: https://stackoverflow.com/questions/7221906/windows-7-or-windows-vista-with-xna-for-game-development

Rotation axis to perform rotation

房东的猫 提交于 2019-12-25 03:01:18
问题 Having a first-person camera looking at direction d. In order to let the camera point to a target t (with associated direction d2) I would have to rotate d around some axis, right ? This axis should go through the camera and should be perpendicular to the plane formed by d and d2, right ? Suppose I am rotating the vector d by some degree per frame the rotation axis shouldn't change because though d is slowly approaching d2 their corresponding plane doesn't change, right ? Well, if that's all

IntermediateSerializer XNA 4. How do I deserialize List of lists or List of dictionaries?

白昼怎懂夜的黑 提交于 2019-12-25 02:56:17
问题 How do I deserialize List of lists or List of dictionaries? Here is C# code: public enum Values : byte { One, Two, Three, Four } public class Something { public int Some_int { get; set; } } public class Test { public List<List<Something>> ListOfSomethingLists { get; set; } public List<Dictionary<Values, Something>> ListOfSomethingDictionaries { get; set; } } And here is XML which doesn't work cuz I don't know how to deserialize it: <?xml version="1.0" encoding="utf-8" ?> <XnaContent> <Asset

Animating a polygon drawn with vertices

我的梦境 提交于 2019-12-25 01:43:23
问题 First off: I had another question Creating a 2D polygon in XNA but I answered it myself after a day of frustrating research and testing. There you can find the code I have right now. So here is my next question, as I can't find anything about it. How do I animate a VertexPositionColor[] . 回答1: To animate a VertexPositionColor[], all you really need to do is modify the elements of the array appropriately and then use the new values in your DrawUserPrimitives() call. For example, in the Update

Windows Phone 7 crash when accessing directory

放肆的年华 提交于 2019-12-25 00:14:11
问题 I am having trouble getting info on a directory in Windows Phone 7 with C#. My application freezes or crashes when I call: System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo("Content/Levels"); It also freezes when I try to determine the path of the application so I think this is where the problem lies. What am I possibly doing wrong and what can I do to fix this? Update: It seems this problem is related to a sequirity issue but I don't know how to resolve this. Is there possibly

XNA Home Screen

ぐ巨炮叔叔 提交于 2019-12-24 22:24:33
问题 In my XNA project I have a Game class but I wish to add a Menu screen which will be shown upon application launch. Does anyone know how I can add this? I can't seem to find anything in the project which will do this... Any help will be highly appreciated. 回答1: Nothing comes with XNA by default for game screens. However, there is an official XNA sample which covers this topic and has useful code to tackle multiple game screens. 来源: https://stackoverflow.com/questions/15714366/xna-home-screen