xna-4.0

ResolveTexture2D - The nightmare in XNA 4

淺唱寂寞╮ 提交于 2019-12-12 01:59:21
问题 I have the following declaration: ResolveTexture2D rightTex; And I use it in the Draw method like so: GraphicsDevice.ResolveBackBuffer(rightTex); Now, I then draw it out using the SpriteBatch : spriteBatch.Draw(rightTex, new Rectangle(0, 0, 800, 600), Color.Cyan); This works fantastic in XNA 3.1. But, now I'm converting to XNA 4, ResolveTexture2D and the ResolveBackBuffer method have been removed. How would I re-code this in order to work in XNA 4.0? EDIT So, here is some more code to maybe

WP7 Application.getResourceStream retunring null every time

我们两清 提交于 2019-12-12 01:37:19
问题 Im trying to load a .txt file into a 2D array which i can do from a temp in isolated storage but our level builder writes to .txt files and moving them to isolated storage for each one is out of the question. It is a windows phone game. The text files Build action is set to content. The Copy to output is set to Do Not Copy. The file is in the base content folder. var ResrouceStream = Application.GetResourceStream(new Uri("grid_map;component/Data.txt", UriKind.Relative)); if (ResrouceStream !=

Clickonce application won't run after installation in XNA 4.0

末鹿安然 提交于 2019-12-11 19:04:36
问题 I've recently read about converting an XNA game into a stand-alone executable file, and found out that publishing it through Visual Studio enables me to simply distribute it. I understand the process to publish and have done so without problems. And when the publishing finishes, I get three files: a folder, the installation file, and the clickonce file. I run and am able to install my game, yet when it runs, only about a second of the intro music plays, then it stops. And when I try running

MonoGame - Have an object circle around a point

末鹿安然 提交于 2019-12-11 18:49:55
问题 I have an object with a Vector2 Position , and a cursor with Vector2 Position . When I hold a certain key, I want the object to circle around the object, but I'm having trouble calculating the correct coordinates. I've managed to make the object circle around the cursor (but it's not going in a perfect circle, but more of a spiral) with this code: Vector2 diff= Vector2.Normalize(cursor.Location - this.Location); float angle = (float)Math.Atan2(diff.Y, diff.X) + (float)(90 * (Math.PI / 180));

Only last made member of a list is updating

时光毁灭记忆、已成空白 提交于 2019-12-11 18:02:32
问题 I have a game in which blocks are added in a style similar to Minecraft. Lately, I've been running into a bit of a snag with these blocks. There is one block called a power generator, and basically if it is on, and another block (light) is in the area, the light turns on. This is achieved through the following code, which is rather simple. foreach (Block b in game.blphys.blocklist9) { foreach (Block v in game.blphys.blocklist7) { if (b.powerboxon == true && b.powerarea.Intersects(v

Transferring a list of a list to a 2D array

限于喜欢 提交于 2019-12-11 17:48:45
问题 Ok, so i'm trying to get a 2D array to serialize in an xml file and then be able to load it. The main part works but I have found (possibly false) that you can't use a 2d array in the content pipeline readers and writers. I have replaced the 2d array with a List<List<string>> but I still need the data as a 2d array. This is what I have so far but it throws an null reference exception: TILArray = new string[Width, Height];// I do initialize the array for (int x = 0; x < Width; x++) { for (int

How do I draw a rectangle from one render target onto another without losing data?

一笑奈何 提交于 2019-12-11 17:31:39
问题 I asked a question earlier in the week (here) regarding transferring data from a rendertarget to the CPU so that collisions could be tested on it. From the responses I got there, I decided that drawing a section of the render target to a smaller render target and then retrieving that data would be a valid solution and tried to implement that. After drawing the full sized render target (1280x1024), I switch the active render target to a smaller one (59X47 - the collision size of my players)

How to remove splash screen?

对着背影说爱祢 提交于 2019-12-11 16:46:17
问题 Right, hi guys, I recently followed a tutorial http://xnadevelopment.com/tutorials/thestateofthings/thestateofthings.shtml where I wanted to create a sort of splash screen, and it worked I managed to get a two different screens interchanging between one another (so, if I press A, it goes to TitleScreen, and if I press B, it returns back to ControllerDetectScreen) Here's the code http://paste.org/43859 Obviously there is no actual game, but if you could show me how to get rid of the

install xna on visual studio 2012 on windows 8

。_饼干妹妹 提交于 2019-12-11 11:37:38
问题 I just installed windows 8 ultimate and visual studio 2012 ultimate on it. Later I download windows phone 8 sdk and installed for on it so that i will get xna game studio 4.0. Now I am able to create all kind of apps except xna game for windows and xbox. That one template is missing. I tried browsing for it and seen is couple of post that Microsoft is discontinuing with XNA? Is is true? I want to create a touch aware windows desktop game for windows 8. Is there any work around? Thanks in

Garbage collector behaviour

亡梦爱人 提交于 2019-12-11 11:16:57
问题 I use C# (with XNA 4 and MonoGame). I load assets (textures, audio) using the Load() method of the Content Manager. When these assets are no longer needed, how can I properly Unload() them from memory? I assume that once all references to the loaded assets are overwritten (or set to null) the assets are automatically removed by the Garbage collector. Is this correct or are the assets still locked due to the fact that they were loaded through the ContentManager? Is it necessary to call