xna

Using system.windows.forms with XNA

本秂侑毒 提交于 2019-12-05 04:16:45
I am making a game that uses XNA. I would like to add things to the game such as buttons, textboxes, labels, tooltip texts, and other stuff that comes with system.windows.forms. How do I merge system.windows.forms with XNA? Are there any API's or DLL's that I could implement to get this to work? Thanks, BenShums The bad news: in short, no, it is not possible (at least, in a straightforward way). While it is true that you can use a System.Windows.Forms control as a canvas for your game, you cannot use an XNA device as a canvas for your control. The good news: there are already some alternative

Is MonoGame really cross-platform?

爱⌒轻易说出口 提交于 2019-12-05 03:59:16
When I download MonoGame (which I will use in place of XNA since I'm on a Mac) and unzip it, all the MonoDevelop solution files are named MonoGame.Framework.[PLATFORM NAME].sln , with [PLATFORM NAME] being, well, the name of the OS. And the code in the tutorials is different for each platform, so it appears that for a MonoGame app to run on a different machine, it must be ported. Is this correct? If so, what other versions of XNA are there for Mono, preferably that work on the Xbox 360? I've seen MonoXNA, but it doesn't seem mature enough to use as of this post. MonoGame makes your code cross

Sharing Fields in Component-Based Game Design

独自空忆成欢 提交于 2019-12-05 02:55:53
问题 I am at what I believe to be the last big logical leap before completing my component based game engine in C# using XNA. I have my Entity class and abstract components defined. My issue is arising in my EntityFactory. When I want to create a new entity I pass in an EntityType enum to a static method in the factory, and it goes through a switch/case statement finding which components to put together. The problem is, I am trying to create a way that the components can share fields with other

How to store structs of different types without boxing

筅森魡賤 提交于 2019-12-05 02:26:56
I'm creating a messaging system for use in an XNA game. My Message types are structs because I want them to behave in a Value Type way. struct MyMessageType1 : IMessage {} struct MyMessageType2 : IMessage {} List<IMessage> messageQueue = new List<IMessage>(); I want to be able to store Messages of different types in my message queue, but I want to do so without any of them being boxed. If I have the structs implement an interface such as IMessage and I try to store them in a List, they get boxed. I don't know all the possible message types ahead of time, so I can't just hard code one List for

Draw simple circle in XNA

风流意气都作罢 提交于 2019-12-05 02:04:55
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! 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. You could also check out the sample framework that Jeff Weber uses in Farseer: http://www.codeplex.com/FarseerPhysics The

how to enable pause and resume in audio recorder in windows phone 8?(Details Insde)

扶醉桌前 提交于 2019-12-05 02:00:08
问题 I'm working on the audio recorder in windows phone 8. I've done audio recording start and stop functionality but I don't find any pause and resume audio recording feature. Also don't know how to add details to the recorded audio like created DateTime, album art etc., I've seen the Microphone Class but I can't find anything. I've seen Microphone.GetData method and trying to use it, please say me, if somebody knows about this or knows any helpful links. . . 回答1: Try using microphone.State ==

XNA - Getting mouse coordinates with a 2d Camera system with rotation/zoom/translation

社会主义新天地 提交于 2019-12-05 01:51:14
问题 I have a 2d Camera with this translation matrix: Transform = Matrix.CreateTranslation(new Vector3(-Position.X, -Position.Y, 0)) * Matrix.CreateRotationZ(Rotation) * Matrix.CreateScale(new Vector3(Scale, Scale, 0)) * Matrix.CreateTranslation(new Vector3((GraphicsDevice.Viewport.Width * 0.5f), (GraphicsDevice.Viewport.Height * 0.5f), 0)); Which works for Rotation/Zoom where the origin is the center of the camera. Now I am trying to get the mouse coordinates in the world. I tried just using an

Game Programming and Event Handlers

有些话、适合烂在心里 提交于 2019-12-05 01:40:36
I haven't programmed games for about 10 years (My last experience was DJGPP + Allegro), but I thought I'd check out XNA over the weekend to see how it was shaping up. I am fairly impressed, however as I continue to piece together a game engine, I have a (probably) basic question. How much should you rely on C#'s Delegates and Events to drive the game? As an application programmer, I use delegates and events heavily, but I don't know if there is a significant overhead to doing so. In my game engine, I have designed a "chase cam" of sorts, that can be attached to an object and then recalculates

How do I pause the redraw in XNA?

你离开我真会死。 提交于 2019-12-05 00:55:55
I made an XNA image viewer, but it always redraws the scene, even if it's not changing, and it's making my netbook burn like hell, so I'd like it to pause drawing when nothing's changing. Reducing framerate to 1 is one way to keep it cool, but it results in laggy output. How do I prevent the redraw while there is no input? This problem was solved, but another problem was found — the game consumes a lot of CPU when its window is in focus, but when it's not, it only takes about 1% of the CPU. See this question for details on how to solve this other problem: How to reduce XNA game CPU usage while

2D Tile Lighting

寵の児 提交于 2019-12-05 00:35:34
问题 I'm adding lighting to my XNA 2D tile based game. I found this article useful, but the way its done it does not support collision. What I'd like is a method to do the following Have always lit point Collision (If the light ray hits a block, then dim the next block by whatever amount until its dark to simulate shadows) I've been searching around for quite a while but no luck (I did find Catalin's tutorial, but it seemed a bit advanced for me, and didn't apply to tiles well due to redrawing the