xna

Convert A XNA Color object to a string

故事扮演 提交于 2019-12-07 08:56:56
问题 I know how to convert a string to an XNA Color object, but how do I convert a C# Color object like Color.Blue into its string representation(e.g. "Blue"). 回答1: You need to do the reverse of what was done in your previous question: Convert from XNA color to System color Try and convert the system color to a known color If the conversion worked, call ToString on the known color e.g. // Borrowed from previous question using XnaColor = Microsoft.Xna.Framework.Graphics.Color; System.Drawing.Color

XNA Redistributable missing from Publish Prerequisites options

大兔子大兔子 提交于 2019-12-07 07:57:03
问题 I've gotten XNA running perfectly fine on Visual Studio 2012 and publishing, installing and running the game works fine as well on any computers that already have the XNA Framework Redistributable 4.0 installed but when I attempt to install on a computer that doesn't already have it, the install fails due to it being missing. Furthermore, it isn't even an option in the Prerequisites menu on the program's publish properties. When I open up an older project, the option exists but with a yellow

Changing RenderTarget Results in Purple Screen?

↘锁芯ラ 提交于 2019-12-07 06:19:56
问题 I'm attempting to change RenderTargets at runtime, so I can draw some elements at runtime, manipulate them and then finally draw the texture to the screen. Problem is, the screen turns purple if I change the RenderTarget at runtime. Here's the code I've got in Draw: RenderTarget2D tempTarget = new RenderTarget2D(GraphicsDevice, 128, 128, 1, GraphicsDevice.DisplayMode.Format, GraphicsDevice.PresentationParameters.MultiSampleType, GraphicsDevice.PresentationParameters.MultiSampleQuality,

How can I tint a sprite to white in XNA?

≯℡__Kan透↙ 提交于 2019-12-07 04:44:47
问题 I don't think this is possible just using the color setting in SpriteBatch, so I'm trying to work out a simple shader that would take every pixel and make it white, while respecting the alpha value of the pixel. The answer Joel Martinez gave looks right, but how do I incorporate that when I draw the sprite with SpriteBatch? 回答1: I think this is what you're looking for sampler2D baseMap; struct PS_INPUT { float2 Texcoord : TEXCOORD0; }; float4 ps_main( PS_INPUT Input ) : COLOR0 { float4 color

How can I watch for file changes in a UWP project?

ぃ、小莉子 提交于 2019-12-07 03:38:48
问题 I am porting my game to UWP from the full desktop .net and one thing I need to work out is how to live load texture, shaders etc... into the UWP version of the game. In the desktop version I use a FileSystemWatcher to do this but FileSystemWatcher doesn't exist in UWP, even on directory's that I have full control over. Is there an equivalent for UWP? What is the best way to implement this with the limited set of API's in UWP? 回答1: Is there an equivalent for UWP? You can subscribe the

Ambiguous reference between MonoGame & Microsoft.XNA.Framework namespaces

杀马特。学长 韩版系。学妹 提交于 2019-12-07 03:32:35
问题 MonoGame (a framework which basically brings XNA to Windows Phone 8) has all it's namespaces prefixed with Microsoft.Xna.Framework I believe to minimise the amount of code changes required when porting your XNA app to MonoGame. My issue is, I wish to access the Microphone class, which, because has not been created in MonoGame yet, I have to utilize it from within in the official Microsoft XNA class, this requires taking out the explicit forced removal of the standard Microsoft.XNA.Framework

Jint + XNA (C#)

好久不见. 提交于 2019-12-07 03:32:08
问题 Is it possible to use jint to manipulate a 3D environment created with XNA (C#), and to add functionality to this environment (again using jint)? 回答1: As a contributor to Jint, I would recommend you Jint. Jint makes it more simple than what Lua does. Moreover, I don't know if this is possible with Lua, but you can give it .NET objects and play with them in javascript (Jint stands for Javascript INTpreter). You can also secure your application with Permissions Set. Here is the same code

How to load Image from user's computer

佐手、 提交于 2019-12-07 02:00:52
问题 Is it possible to load image to XNA game from user computer? For example, I want to load "C:\Images\Box.png" to sprite texture. Is it possible? If yes, how? 回答1: In XNA 4.0 use Texture2D.FromStream Texture2D fileTexture; using(FileStream fileStream = new FileStream(@"C:\Images\Box.png", FileMode.Open)) { fileTexture = Texture2D.FromStream(GraphicsDevice, fileStream); } If you're using XNA before 4.0 then you can use Texture2D.FromFile. 回答2: System.IO.FileStream stream = new System.IO

Draw simple circle in XNA

守給你的承諾、 提交于 2019-12-06 23:37:46
问题 I want to draw a 2d, filled, circle. I've looked everywhere and cannot seem to find anything that will even remotely help me draw a circle. I simply want to specify a height and width and location on my canvas. Anyone know how? Thanks! 回答1: XNA doesn't normally have an idea of a canvas you can paint on. Instead you can either create a circle in your favorite paint program and render it as a sprite or create a series vertexes in a 3D mesh to approximate a circle and render that. 回答2: You could

What's the difference between a Windows Game Library and a Class Library?

心已入冬 提交于 2019-12-06 18:09:35
问题 What's the difference between a Windows Game Library and a Class Library ? Is it just that one starts off by including the XNA Framework? Also, where are the differences between the Windows / Xbox360 / Zune Game Libraries ? They all seem to start off with the same References ( Microsoft.Xna.Framework, Microsoft.Xna.Framework.Game ). 回答1: There is no real difference. It is just a project template, it helps you get all the project settings right. Yes, the assembly references are one of the