Jump to content


Member Since 03 Sep 2006
Offline Last Active Mar 15 2013 10:29 PM

Topics I've Started

RenderTarget2D and minimizing fullscreen application

14 March 2013 - 12:19 PM

Hi there,

I recently noticd that when I have my game minimized during initialization, it seems to fail in creating RenderTarget2D surfaces.  It has no error message and the game itself looks fine, but any draw call (using spritebatch) that explicitly draws RenderTarget2D objects created during initialization are not visible... as if the pixel data is completely wiped, or never actually initialized due to the application being minimized.  I'm not interested in better ways to draw or whatever... i'm interested in knowing if this specific situation is normal, perhaps it is the reason there are better ways of drawing and saving pixel data.  If anyone can shed light on this, i'd be grateful.


Thank you.


XNA 4.0 Replacing Pixel Color

19 January 2013 - 02:01 PM

Hi there,

I was hoping to simply get some direction.I want independent images to have an effect applied to them, where a y value parameter (which will increase/decrease) determines where the effect should be applied to the image.  For example:


- Let's say the example image has a height of 100 pixels

- We'll start the y value at 0


Because the y value is at 0 the effect should be applied along the first row of pixels in the image (row 0).  The game will update the y value, thus moving the effect up/down the image (like a scan animation, I suppose).


Now.. the effect I'm looking to do seems simple. I just want to replace a single color, a range of colors,or all the colors of the row, specified by y, with another single color.  I can figure this part out.


The main problem for me, is figuring out how to apply and updating value, like y, to the effect on a single image... among many images.  If anyone could point me in a good direction, I'd be grateful.  It's also probably worth mentioning that i'm using XNA 4.0, and this game is using 2D spritebatch. Thanks for reading.



XACT Waves Audio Spectrum in XNA

29 December 2012 - 03:09 PM

Hi there,

I'm using XNA 4.0 with C#... and am using XACT to play sound clips in my game.  I'm also using MediaPlayer to play mp3's in the background. What I want to do is show a visual audio spectrum of specific sounds which are .wav format.  I can get the visual data for the mp3's playing the background using:


VisualizationData visData = new VisualizationData();



How do i get the same data from my XACT wave files?  I have no need for the visual spectrum of the background music, i want to show the visual data when certain sounds play.  Does XNA have an easy way to do this? If not, I'd like a suggestion as to what I would need to research in order to do this.



Question with regards to releasting a demo.

24 April 2012 - 11:00 AM

Hi all,
I'm not sure if this is the right forumn to post this question in, but here it is... I'm releasing a game demo in about a month, and I have a very limited amount of legit 2D sprites to use. I found some that were clearly ripped from old snes games and such. I realize this is a problem, but I'm not entirely sure if it is a problem for just a demo. Basically... Yay or Nay?

Thank you.

Apologies, I found my answer.

Problems with Blending Images XNA 3.1

02 April 2012 - 05:26 PM

Hi there,
I've been working on a 2D tile-based game. The whole thing is created in C#, XNA 3.1 and uses spritebatch to draw everything. Lately I've been trying to add a bit of depth to the game with some basic lighting technique that blends images over the current map. This seemed to work nicely at first, but then I realized that after the game has been running for a few minutes the FPS drops by half or more, and begins to run sluggishly. Also note, the only time the FPS drops is when the lighting is on, and when i turn the lighting off... the FPS jumps right back up to 60.

I've attatched a screenshot that shows what the lighting looks like, and what it looks like without. I'm at a loss. I can't figure out why it begins to run sluggishly... Any help/suggestions would be appreciated.

				 this.GraphicsDevice.SetRenderTarget(0, this.region.lightMap);
				 //clear to some small ambient light
				 //where Alpha is 0, nothing will be written
				 this.spriteBatch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Immediate, SaveStateMode.SaveState);
				 this.spriteBatch.GraphicsDevice.RenderState.DestinationBlend = Blend.One;
				 this.spriteBatch.GraphicsDevice.RenderState.SourceBlend = Blend.DestinationAlpha;
				 this.spriteBatch.GraphicsDevice.RenderState.BlendFunction = BlendFunction.Add;
				 this.spriteBatch.GraphicsDevice.RenderState.SeparateAlphaBlendEnabled = true;

				 foreach (LightSource light in this.region.regionLightSourceInstances)
				 this.GraphicsDevice.SetRenderTarget(0, null);

Thank you.