xna

XNA and WinForms

元气小坏坏 提交于 2019-12-12 17:32:29
问题 I was wondering If there was a way to have an xna game within a windows forms or in vice versa. I have found several examples online, but I couldn't understand what they were doing. I was also wondering if there was a way to make a sprite act like a button on a winforms...is it possible to click on a sprite? 回答1: Yes, on all. Sprite act like a button on winforms: use the onclick event Xna Game within Windows Forms: You would need to add a reference to the Xna.framework.something ... sorry

XNA MediaPlayer fastforward/rewind

混江龙づ霸主 提交于 2019-12-12 17:26:10
问题 Using XNA 4.0, I am currently playing songs from the user's PC/XBox360 using the following: Microsoft.Xna.Framework.Media.MediaPlayer.Play(Song song); I see that MediaPlayer has a static Property PlayPosition that, as I've researched, used to be a get/set property, but it has been updated to get-only. Are there any other methods/tricks I can use to explicitly set the playing position of a currently playing song? 回答1: It looks liked they added a DynamicSoundEffectInstance class in XNA 4.0. One

XNA How to make xna not to read transparent color

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 17:14:31
问题 I am fairly new to xna. I just created a sprite with transparent background(magenta). Problem is my Rectangle is reading the coordinates of whole sprite not of visible one. How do I make it read only the visible sprite. myrectangle = new Rectangle(0, 0, box.Width, box.Height); I want to place my visible part not transparent at that position. Thanks in advance. 回答1: To transform a color to transparent, go to the texture properties, content processor, and enable Color Key, and set the key Color

When does XNA discard Render Target contents?

倖福魔咒の 提交于 2019-12-12 14:53:36
问题 I understand that Render Targets in XNA are volatile, but how volatile are they? I can't find any documentation that tells when exactly their contents are discarded. Is it just when you start drawing to them, or could it be at any time? I would like to simply draw to a render target once and then use it as a Texture2D indefinitely. Is this possible? Would I need to enable RenderTargetUsage.PreserveContents for this to work properly? I have read that PreserveContents is very slow on Xbox and

Clamping TextureAddressMode in XNA

岁酱吖の 提交于 2019-12-12 14:51:52
问题 I've been working on implementing a 2D lighting system in XNA, and I've gotten the system to work--as long as my window's dimensions are powers of two. Otherwise, the program will fail at this line: GraphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleStrip, Vertices, 0, 2); The exception states that "XNA Framework Reach profile requires TextureAddressMode to be Clamp when using texture sizes that are not powers of two," and every attempt that I've made to slve this problem has failed--the

Realtime Resource Updating in XNA

时光毁灭记忆、已成空白 提交于 2019-12-12 14:47:59
问题 I'm looking for a way to update textures and other content files at runtime in XNA, such that if it's modified outside of the application, it will automatically update in the game when it regains focus. This seems to be possible with Texture2D and loading from a Stream, but I'm unable to get a direct path to a given resource. I realize that this won't work with the content pipeline and .xnb's, but for debugging and development purposes it would be extremely useful. Has anyone seen something

Why is XNA not supported in vs2012? [duplicate]

纵然是瞬间 提交于 2019-12-12 13:56:16
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: How to install XNA game studio on Visual Studio 2012? I would like to make an game application in xna. But after purchasing vs2012 (bought it for almost 800 dollar!!) i can't use the xna game studio environment! That's crazy from MS. They are 2 products of the same company aren't? Does anybody know when vs2012 is supporting xna of monogame? I've tried several options and search the internet already but i can't

“Press Enter to start the game” XNA INTRO SCREEN

末鹿安然 提交于 2019-12-12 13:36:26
问题 I created an introscreen with "Press Enter to start the game",(and exit) ofcourse exit is no problem but to let the game start its a bit harder. Any advice? 回答1: The easiest way to do this would be to set up a State Machine. It would look really simple. enum GameState { TitleScreen = 0, GameStarted, GameEnded, } Something then in the Game1.cs, or wherever you're handling this button click, you can put a variable in you class to store the current game state that you are in. GameState

WP7 XNA displaying 3D FBX model

 ̄綄美尐妖づ 提交于 2019-12-12 13:15:33
问题 I am just begginer so sorry for my silly question. my model looks like this: http://img265.imageshack.us/img265/8291/clipboard01ap.jpg but in result in XNA looks like this: http://www.youtube.com/watch?v=XHxHKZnjgnM I hope you can see the weird transparency... Is the problem connected with "EnableDefaultLighting()" ? Thanks for help 回答1: I think Z-Buffering ( Sorting ) is not enabled or is not initialized in the right way. Found this on the internet: Most likely reasons: Is the

Audio/Video Playback with seeking in XNA

做~自己de王妃 提交于 2019-12-12 12:28:02
问题 I'm developing an XNA rhythm game in C# and because it's a rhythm game it's gonna need a song editor, which is going to need precise video & audio seeking & resuming for the songs. I tried MediaPlayer and VideoPlayer classes but both of them cannot seek a specific position, as PlayPosition is read only. Does anyone know a good way to achieve this? Also, it needs to be able to play .mp3 files, so I can't use XACT. The rhythm game osu! is also coded in XNA and somehow it plays mp3 files and