xna

Application deploys to Windows Phone 7 apps rather than xbox live

怎甘沉沦 提交于 2019-12-10 21:55:52
问题 When I deploy my game (which uses XNA/C#) from Visual Studio to a windows phone 7 device it goes to the applications area rather than the xbox live sub directory (if I can call it that?). I know this isn't meant to be like this because sample XNA WP7 applications deploy to the xbox live sub directory. 回答1: Check your game's WMAppManifest.xml file. Make sure the Genre attribute under the App element says Apps.Games and not Apps.Normal . 来源: https://stackoverflow.com/questions/4357820

Work out whether to turn clockwise or anticlockwise from two angles

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-10 21:31:53
问题 Im making a game in XNA. I have enemies and player. The enemies should turn gradually towards the player. They should work out whether they need to turn clockwise or anticlockwise, whichever is shorter. I got the angle the enemy is currently facing and the angle it should be facing (the angle of the line between the enemy and the player) as radians by using Atan2. I get some weird behavior though. Lets say in the scenario below. the enemy might turn all the way around in the wrong direction.

XNA Is Running Slow when focus is removed

做~自己de王妃 提交于 2019-12-10 20:55:10
问题 I'm just wondering, while making a game, I noticed that the GameTime value for IsRunningSlowly returns false when my game has focus (like it should), but when I change applications, it changes to true. I even made a empty game, and even when it losses focus, the GameTime value for IsRunningSlowly returns true as well. I'm wondering why does it do this? Is it just my computer, or did the creators of XNA design it this way? The frame rate seems fine, but the value is true. No big deal really, I

how to Hide XNA 4.0?

梦想与她 提交于 2019-12-10 20:09:21
问题 I'm Trying to hide my XNA game window but i don't seem to be able to here's what I've tried so far from what i could get off google. Form frmXNA = (Form)Form.FromHandle(this.Window.Handle); frmXNA.Hide(); I have also tried Form frmXNA = (Form)Form.FromHandle(this.Window.Handle); frmXNA.Visible = false; I figure I'm doing something very simple wrong and once it's pointed out I'll probably laugh at how i didn't see it. Thanks for the help 回答1: add the System.Windows.Form refrence to the project

XNA and multitouch

戏子无情 提交于 2019-12-10 20:00:09
问题 I use XNA to develop small 2D games. The user should have the ability to interact with the game by using the mutli touch gestures in Windows 7. I want the same multi touch functionality in XNA as WPF provides. Are there any frameworks or built-in features? 回答1: As you probably already know, the XNA touch API does not work on Windows, only on Windows Phone. This blog post explains why and also lists some methods for getting touch input working. 回答2: Try reading this code sample about touch

XNA - How to Exit Game from class other than main?

南笙酒味 提交于 2019-12-10 19:27:31
问题 How do you make it so the game can exit but not have the code in the main class, have it in a different class? 回答1: You can create a method: //Inside of game1.cs public void Quit() { this.Exit() } I'm assuming you want to quit the game on a menu component, in which case you will need to pass the instance of game1 to the component, perhaps add it as a parameter in the menu components update method. public void Update(GameTime gameTime, Game1 game) { if(key is pressed) { game.Quit(); } } I'm

Windows Phone custom shaders error?

自闭症网瘾萝莉.ら 提交于 2019-12-10 18:58:28
问题 In Windows Phone XNA 4.0, I am receiving the following error when compiling: the windows phone platform does not support custom shaders . This is really annoying, because I have an Xbox 360 version of the project, and a Windows version of the project as well. I tried using the compilation based #if !WINDOWS_PHONE and #endif , but with no luck. It seems as if it ignores this. How can I make this file be excluded or ignored when compiled in the Windows Phone project? 回答1: As a workaround, you

XNA draw : using one spritebatch at whole game

允我心安 提交于 2019-12-10 18:33:20
问题 I am developing an XNA game. This is time I am careful about the architecture. Til today, I have always implemented my own draw method in this way: public void Draw(SpriteBatch sb, GameTime gameTime) { sb.Begin(); // ... to draw ... sb.End(); } I was digging the DrawableGameComponent and saw the Draw method comes in this way: public void Draw(GameTime gameTime) { // ... } First of all, I know that SpriteBatch can collect many Texture2D between Begin and End, so that it can be useful to sort

Redraw unchanging background on every Draw?

梦想的初衷 提交于 2019-12-10 18:08:16
问题 This might be a very simple question, but I searched and found no other way to do it. It doesn't make sense to redraw the background on every Draw. Is there a way to draw some things and leave them on the screen? I've tried to comment-out the GraphicsDevice.Clear(Color.CornflowerBlue); But that doesn't help. (What is its purpose?) 回答1: The dark purple colour you are seeing is used by XNA and DirectX to indicate an uninitialised buffer. XNA will also clear buffers to this colour to emulate the

C# XNA Mouse position projected to 3D plane

不羁岁月 提交于 2019-12-10 17:57:57
问题 I'm working on a 3D XNA project, and I've been thinking about this problem for like 2 weeks. So I just decided to ask you. Basically I have a flat plane and i want to project the mouse position to that plane, but how? I tried many ways to do it, calculated angles... But i figured out, that the distance must effect on the X position, maybe some math is needed what I've never heard before. 回答1: I did some code few years ago which returns the position as Vector3(x,y,z), given mouse state: