xna

Textbox in a C# XNA Game

只谈情不闲聊 提交于 2020-01-16 03:29:08
问题 I'm new to XNA. I'm making a game which needs level editor. I need a textbox to get a level name and its description. So I wrote a code like this: if (isSaveBox) { KeyboardState ks = Keyboard.GetState(); Keys[] keys = ks.GetPressedKeys(); Keys tempKey = Keys.None; foreach (Keys key in keys) { Keys currentKey = key; if (ks.IsKeyUp(lastKey)) { string toadd = key.ToString(); if (!(key == Keys.None) && key != Keys.Space && key != Keys.Back && key != Keys.Enter) { levelName += toadd; } else if

Wait for all child processes of a ran process to finish C#

社会主义新天地 提交于 2020-01-16 01:27:10
问题 I'm developing a Launcher application for games. Much like XBOX Dashboard in XNA. I want to open back my program when the process which it started(the game) exits. With a simple game this is working: [DllImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] static extern bool SetForegroundWindow(IntPtr hWnd); [DllImportAttribute("User32.DLL")] private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); private const int SW_SHOW = 5; private const int SW_MINIMIZE = 6; private

Monogame XNA transform matrix for a single object?

落爺英雄遲暮 提交于 2020-01-15 12:38:12
问题 I have read a few tutorials explaining transform matrices for XNA/Monogame. The problem is that these matrices are applied to SpriteBatch.Begin(...matrix); This means that all Draw code will be transformed. How do I apply a transformation matrix to a single drawable object? In my case I want to transform a scrolling background so that it automatically wraps. SpriteBatch.Draw(.. this has no transform matrix parameter?); 回答1: If you want to use a specific spritebatch begin call for some drawing

Projection and View matrices to match the Kinect RGB camera perspective

早过忘川 提交于 2020-01-15 09:54:32
问题 Does anybody know what are the correct values to setup the projection and view matrix for a XNA rendering in order to match with the Kinect RGB camera? For example, if the skeleton head joint coordinates are (X,Y,Z) then if I draw a sphere at these coordinates in my 3D space, the rendering should overlap the head in the RGB image. 回答1: In the end I took a trial and error approach and determined the parameters. You can find more details here: http://www.mindtreatstudios.com/our-projects/kinect

FormatException with IsolatedStorageSettings

≡放荡痞女 提交于 2020-01-15 09:22:10
问题 I have a problem when serializing a Dictionary<string,Person> to IsolatedStorageSettings. I'm doing the following: public Dictionary<string, Person> Names = new Dictionary<string, Person>(); if (!IsolatedStorageSettings.ApplicationSettings.Contains("Names")) { //Add to dictionary Names.Add("key", new Person(false, new System.Device.Location.GeoCoordinate(0, 0), new List<GeoCoordinate>() { new GeoCoordinate(35.8974, 14.5099), new GeoCoordinate(35.8974, 14.5099), new GeoCoordinate(35.8973, 14

XNA BlendState with SpriteBatch

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-15 09:18:29
问题 We are needing a BlendState to act as the following: Transparent PNGs are drawn as expected, with anything behind them preserved We use Color.White to draw a PNG as-is We will change the alpha channel of the color to change the "opacity" of the texture To get this effect, BlendState.AlphaBlend is close, but draws white as the transparent part if we set alpha to 100 or any number other than 255. So we attempted this: _blendState = new BlendState(); _blendState.AlphaSourceBlend = Blend

Microphone does not exist in current context

ぐ巨炮叔叔 提交于 2020-01-15 08:14:08
问题 In reference to this article on MSDN. The assembly, microsoft.xna.framework.dll , has been added to the references and I'm using the namespace Microsoft.Xna.Framework.Audio , however I receive an immediate error on the first step, shown below: Microphone [error 1] mic = Microphone.Default [error 2]; Error 1: The type or namespace name 'Microphone' could not be found (are you missing a using directive or an assembly reference?) Error 2: The name 'Microphone' does not exist in the current

XNA DrawString() draws only a partial string

余生长醉 提交于 2020-01-14 19:15:19
问题 I have a problem with DrawString() in XNA . I use multiple SpriteBatches for several logical layers. For example: background, objects, menus and so on. In my menu batch, I draw a menu (the big grey box in the background), the buttons (the smaller grey boxes on the menu) and the strings for the buttons. The Problem: http://ompldr.org/vaGw4YQ/Unbenannt.png But for some reason, the strings aren't drawn completely. Does anyone know why? EDIT: _menuLayer.Begin(SpriteSortMode.BackToFront,

Embed xna game in a webpage

被刻印的时光 ゝ 提交于 2020-01-14 18:47:47
问题 Is there a way to run an xna game from a web page without installing anything? Something similiar to java, silverlight or very close to a wpf browser applications (XBAP). Scenario: Go on webpage, Get asked to install the game. Game installs, game screen shows up in webpage. Can full screen, etc. The game is a full blown xna framework game, using 3d, has access to the system calls such as directx and other low level networking api. This is probably more of having javascript working with

Unit testing XNA: Do I need to Mock my GraphicsDevice

回眸只為那壹抹淺笑 提交于 2020-01-14 14:32:49
问题 I'm fooling around with the XNA framework. To help me around I made a helper class that looks like this: ActorHolder + SpriteBatch (SpriteBatch) + ContentManager (ContentManager) - drawables (IList<IDrawable>) - updatables (IList<IUpdatable>) + ActorHolder(GraphicsDevice, ContentManager) + Draw(GameTime) + Update(GameTime) + AddActor(IActor) + RemoveActor(IActor) + GetCollidingActors(IActor) Now I want to unit test this class. But as you see my constructor needs a graphics device and a