xna

Correctly getting key being pressed for chat in XNA

北慕城南 提交于 2019-12-20 03:48:08
问题 So, I'm going to cut straight to it, I'm trying to make a chat system in an XNA game I'm making. I can easily figure out what keys are being pressed BUT I have no way of knowing what is actually being typed. To me, it looks like they are saying: OemShifthello billOemPeriod OemShifthow are youOemQuestion which should look like Hello bill. How are you? (or something along those lines). Whats the best way to handle all of this? 回答1: For the PC there's nothing built in to the XNA framework making

Dividing two numbers always equals zero?

十年热恋 提交于 2019-12-20 03:18:23
问题 In my Xna game, I am trying to have my playfield scale to the screen that it is running on. To do this, I use proportions to find the percent that the real window is scaled relative to my playfield. To do this, I divide the real width by the virtual width: float _percent = _realViewport.Width / this._viewport.Width; I always get 0, though, in the _percent variable. I set up a debug stop point at that line in my code, and analyzed the variables. this._viewport.Width equals 640, and

How Can I Make Xbox Live Indie Games At No Cost?

为君一笑 提交于 2019-12-20 02:52:06
问题 Is there a way I can make free Xbox Live Indie Games? Now I don't mean to publish it to the world on the marketplace but I just mean to test it on my Xbox for free. I know you have to download the XNA app on your Xbox and PC but do I need the XNA Creators Club subscription to test the games on my Xbox? If I do, is there an alternative way to make and test Xbox games? I know you can make a student account on the Microsoft website and get the subscription for free but I am still in high school

HLSL 3 Can a Pixel Shader be declared alone?

我的梦境 提交于 2019-12-20 01:45:23
问题 I've been asked to split the question below into multiple questions: HLSL and Pix number of questions This is asking the first question, can I in HLSL 3 run a pixel shader without a vertex shader. In HLSL 2 I notice you can but I can't seem to find a way in 3? The shader will compile fine, I will then however get this error from Visual Studio when calling SpriteBatch Draw(). "Cannot mix shader model 3.0 with earlier shader models. If either the vertex shader or pixel shader is compiled as 3.0

Adding more music to the Windows Phone 7 emulator?

旧巷老猫 提交于 2019-12-19 20:49:54
问题 The emulator has something like 3 songs which isn't enough to make sure the song selection code I'm working on will manage more than said 3 songs. So just wondering if it's possible? 回答1: Unfortunately there is no way to add songs to the emulator. You'll have to use a real device to test this. 回答2: Actually you can using an app to do that: Uri file = new Uri("Assets/Happy.mp3", UriKind.Relative); //copy file to isolated storage var myIsolatedStorage = IsolatedStorageFile

XNA Rotate Texture 2D

时光怂恿深爱的人放手 提交于 2019-12-19 18:38:01
问题 I'd like to rotate a Texture in XNA. I know I can rotate it when it is drawn, but I would like the Texture2D variable to be the rotated texture. Is there any way to do this? 回答1: Use RenderTarget, draw your texture rotated into the RenderTarget, take the texture and save it. 回答2: You should provide a new shader that manage texture coords rotation. As the HLSL code of the basiceffect is public, it should be pretty easy to add this behaviour. Basic Effect HLSL code Passing an angle parameter to

XNA Rotate Texture 2D

≯℡__Kan透↙ 提交于 2019-12-19 18:37:03
问题 I'd like to rotate a Texture in XNA. I know I can rotate it when it is drawn, but I would like the Texture2D variable to be the rotated texture. Is there any way to do this? 回答1: Use RenderTarget, draw your texture rotated into the RenderTarget, take the texture and save it. 回答2: You should provide a new shader that manage texture coords rotation. As the HLSL code of the basiceffect is public, it should be pretty easy to add this behaviour. Basic Effect HLSL code Passing an angle parameter to

After Writing to a RenderTarget, How to Efficiently Clone the Output?

天大地大妈咪最大 提交于 2019-12-19 15:58:32
问题 XNA noob here, learning every day. I just worked out how to composite multiple textures into one using a RenderTarget2D. However, while I can use the RenderTarget2D as a Texture2D for most purposes, there's a critical difference: these rendered textures are lost when the backbuffer is resized (and no doubt under other circumstances, like the graphics device running low on memory). For the moment, I'm just copying the finished RenderTarget2D into a new non-volatile Texture2D object. My code to

What is the benefit of using out/ref versus returning?

喜你入骨 提交于 2019-12-19 15:19:32
问题 I'm making a game using XNA framework, so I use a lot functions that operate on vectors. (especially Vector2 (64bit struct)). What bothers me is that most of the methods are defined with ref and out parameters. Here is an example: void Min(ref Vector2 value1, ref Vector2 value2, out Vector2 result) which looks a bit strange too me. There is also another Min which is more obvious public static Vector2 Min(Vector2 value1, Vector2 value2); Basically, almost all the functions have overloads with

How do I implement word wrap?

不羁的心 提交于 2019-12-19 09:08:36
问题 XNA has Spritefont class, which has a MeasureString method, which can return the Width and Height of a string . I'm trying to understand how to create a method that will efficiently return a string with Environment.Newline inserted in the right places, so that if fits a certain Width and Height (Rectangle is used as a parameter for that). 回答1: I found following code: XNA - Basic Word Wrapping public string WrapText(SpriteFont spriteFont, string text, float maxLineWidth) { string[] words =