xna

XNA - how to tell if a thumb stick was “twitched” in a certain direction

爱⌒轻易说出口 提交于 2020-01-06 10:55:15
问题 Is there anything in the API (3 or 4) to tell me if the stick moved in one direction, as in a menu where it's equivalent to hitting a direction on the DPad? There appear to be some Thumbstick* members in the Buttons enum, but I can't find decent documentation on them. Just want to make sure I'm not missing something obvious before I go and roll my own. Thanks! 回答1: There is no XNA method to tell you if a thumbstick was "twitched" this frame. The easiest method is to store the old thumbstick

How to create a Splash Screen (or such) in XNA (VB.NET)

﹥>﹥吖頭↗ 提交于 2020-01-06 08:19:07
问题 The loading time for my game in XNA is insane (up to 1 minute), and the screen while loading before the first draw is all white, triggering people to believe it's a bug and close the application. I need help creating some kind of message for them (such as a Splash Screen) so they know that the white screen is a loading screen, or better yet, exchange the whitescreen for a picture. The game project is made in XNA, using VB.NET. The answers i found thus far either applies to something else, or

C# function to convert screen-space coordinates to worldspace coordinates, at specific Z position?

痴心易碎 提交于 2020-01-06 02:38:28
问题 I am making a 2D game, rendered as 3D. When clicking on my game, I want it to convert those screen space pixel coordinates into worldspace coordinates, knowing the Z axis point (0) that the point should hit. How can I do this with a function? I am using XNA with C#. 回答1: Converting from 2d to 3d is unprojecting. there is a built in method within xna for this: Vector3 3dWorldPosition = GraphicsDevice.Viewport.Unproject(2DscreenVector & desired Z comp, viewMatrix, projectionMatrix); 来源: https:/

Texture2d.SaveAsPng() Memory Leak

白昼怎懂夜的黑 提交于 2020-01-05 10:18:47
问题 I have found strange issue with method Texture2d.SaveAsPng() Every call 1.5mb disapear. I use this method to save texture to isolated storage public static void SaveTextureToISF(string fileName, Texture2D texture) { using (IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication()) { using ( IsolatedStorageFileStream fileStream = new IsolatedStorageFileStream(fileName, FileMode.Create, file) ) { texture.SaveAsPng(fileStream, texture.Width, texture.Height); fileStream.Close();

Maximize window in XNA 4.0

你说的曾经没有我的故事 提交于 2020-01-05 03:35:43
问题 I am currently using the following code to allow the user to resize and maximize the window: Window.AllowUserResizing = true; Window.ClientSizeChanged += Window_ClientSizeChanged; with the Window_ClientSizeChanged event handling the changes and re-scaling the drawn images etc. This allows me to resize the window however much I want and also maximize it using the standard button in the window's handle. I would like to be able to start the application with the window in its maximized mode but

Windows phone sdk send email with XNA game engine

只谈情不闲聊 提交于 2020-01-05 02:55:09
问题 I am making a game for my windows phone, using Visual Studio 2012 for Windows Phone and it went good from there, I wrote a few classes, and added assets but I encountered a problem. I wanted to make a bug request / idea method, but no-where could I find where to email with XNA. I searched on Google but it came up with stuff like "How to use XNA game studio" and at the bottom it said stuff like "email us" so I never found it out. Basicley I couldn't find it. Can anyone help me out? 回答1: You

Output file locked by another process when building

巧了我就是萌 提交于 2020-01-04 10:10:26
问题 I am using Visual Studio 2010 creating a XNA application with the Kinect SDK 1.6. I have a problem that the build usually fails (not always) after debugging the application. There is a process that is locking KinectDrobePrototype1.exe . Error 12 Unable to copy file "obj\x86\Debug\KinectDrobePrototype1.exe" to "bin\x86\Debug\KinectDrobePrototype1.exe". The process cannot access the file 'bin\x86\Debug\KinectDrobePrototype1.exe' because it is being used by another process. Error 11 Could not

Using HTML/CSS for UI in XNA?

怎甘沉沦 提交于 2020-01-04 05:42:23
问题 Is there any way to use HTML/CSS to do the user interface for a XNA game? I would need to programmatically be able to update the HTML, as well as handle events. Or is there another framework I should be using? This thread looks promising: UI library for XNA Also, whatever I use has to work on the Xbox 360. 回答1: Some of the libraries mentioned in that other SO thread are basically the direction you will need to take (at least for UI rendering). There is no built-in way of taking HTML/CSS and

Monogame: WAV not playing

时光毁灭记忆、已成空白 提交于 2020-01-03 19:14:31
问题 This is MonoGame 3.4 and I'm using it through VS2013. I'm compiling my WAV file using mgcb the same way as my textures. MGCB works fine, but when it comes to playing a sound using SoundEffect class, it doesn't play anything. There is no exception and SoundEffect.Play() function returns true , but I can't hear anything. Here's my code: Loading: JumpSound = content.Load<SoundEffect>("SpinJump"); Playing: var Ins = JumpSound.CreateInstance(); Ins.Volume = 1f; Ins.Play(); The very same code plays

How do I use random numbers in C#?

半世苍凉 提交于 2020-01-03 14:11:18
问题 I'm working on Pong in C# w/ XNA. I want to use a random number (within a range) to determine things such as whether or not the ball rebounds straight, or at an angle, and how fast the ball moves when it hits a paddle. I want to know how to implement it. 回答1: Use the Random class. For example: Random r = new Random(); int nextValue = r.Next(0, 100); // Returns a random number from 0-99 回答2: Unless you need cryptographically secure numbers, Random should be fine for you... but there are two