Click here to Skip to main content
15,885,767 members
Everything / WIA / XNA4.0

XNA4.0

XNA4.0

Great Reads

by Steve Hoult
Creation of an Audio analysis framework to enable developers with little to no understanding of audio analysis to develop audio-driven games
by Tyler Forsythe
IceCream1945 is a demonstration of XNA and the IceCream 2D library in a 2D top-down scrolling shooter similar to 1942 for the NES.
by Simon Jackson
Some of the other frameworks which use XNA as a baseline.
by sajjad kardani moghadam
Octa Tree is a 3D space partitioning algorithm

Latest Articles

by Steve Hoult
Creation of an Audio analysis framework to enable developers with little to no understanding of audio analysis to develop audio-driven games
by sajjad kardani moghadam
Octa Tree is a 3D space partitioning algorithm
by zoyobar
Using Label class to display text in XNA
by Daniel M. Kane
A RenderTarget2D-derived class to blend textures at runtime that internally deals with some common headaches.

All Articles

Sort by Score

XNA4.0 

15 Jul 2021 by Steve Hoult
Creation of an Audio analysis framework to enable developers with little to no understanding of audio analysis to develop audio-driven games
8 Aug 2012 by Tyler Forsythe
IceCream1945 is a demonstration of XNA and the IceCream 2D library in a 2D top-down scrolling shooter similar to 1942 for the NES.
16 Jan 2013 by Simon Jackson
Some of the other frameworks which use XNA as a baseline.
28 Jul 2014 by sajjad kardani moghadam
Octa Tree is a 3D space partitioning algorithm
20 Oct 2011 by N_tro_P
You are making a common mistake for random numbers.See the MSDN Documentation on Random[^] Seeding.Random numbers are actually pseudo random and the clock is used by default for its seed (you can provide your own though).To solve, you can make a single random object and have your own...
1 Nov 2014 by OriginalGriff
"can you reply with an example"Assuming your screen is 1000 pixels wide:int x = 700; // BAD!int x = (WidthOfScreen * 700) / 1000; // Better!int xPercent = 70;int x = (widthOfScreen * xPercent) / 100; // Best!
5 Nov 2012 by Sergey Alexandrovich Kryukov
Please see my comment to the question and read on Unicode just a bit, to have an idea. You don't need any special to do to support it. Nearly all modern systems support Unicode by default, and of course, such a popular "Unicode range" as Greek is included, also by default. Some weird fonts which...
8 Nov 2012 by haitrieu749
I've solved this myself! In my class spritefont. I've been edit it flowing: & #32; & #126; & #913; & #969; ...
31 Dec 2012 by DinoRondelly
This might help,http://www.gavindraper.co.uk/2010/11/25/how-to-loadsave-game-state-in-xna/[^]
5 Feb 2013 by fjdiewornncalwe
The syntax error you are receiving is because of the semi-colon at the end of your function declaration which causes the spriteBatch variable on the next line to be out of scope.public void Draw(SpriteBatch spriteBatch);
3 Mar 2013 by Richard MacCutchan
Try using the Rectangle.Intersect Method[^].
14 Jul 2012 by codiemorgan
When you want your Texture2D resource to download from the Internet
22 Sep 2012 by ely_bob
You need to do two things.First. draw 3D before 2Dprotected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.DeepSkyBlue); //Reset Graphics Device here#region 3D //Draw Models Ship ship.Draw();#endregion ...
15 Oct 2012 by CDP1802
Sorry, but it's not quite clear what you are looking for. My best guess is that you want a visual editor for shaders that gives you a sample of what the result looks like.Wow. I just searched for HLSL editors and only got results for text editors with syntax highlighting or intellisense....
22 Oct 2012 by ely_bob
I don't remember the exact Spec., however I know that the API cross section for shadows was very picky as to which hardware capabilities it works with. you can start with these...
4 Nov 2012 by Abhinav S
These links might help you get startedhttp://www.jeffblankenburg.com/2010/10/29/31-days-of-windows-phone-day-29-animations/[^]Windows Phone 7 Animations — Alternatives, Performance[^]http://mobile.dzone.com/articles/create-simple-animation-your[^]
5 Nov 2012 by haitrieu749
I want to draw special characters like: "π,Ω,θ,ξ" in XNA by using method spriteBatch.DrawString() but unsuccessful. Problem in file SpriteFont? Have any solution for it?
10 Nov 2012 by haitrieu749
http://msdn.microsoft.com/en-u...
1 Dec 2012 by Thomas Daniels
Hi,Have a look here:http://www.xnaresources.com/default.asp?page=tutorial:stardefense:2[^]http://rbwhitaker.wikidot.com/2d-tutorials[^]http://www.c-sharpcorner.com/uploadfile/iersoy/particle-animations-using-microsoft-xna-part-ii/[^]
16 May 2016 by Staffan Bruun
To figure out the best-fitting square, you can use something like the following:// This will compute the number of columns needed to fit all the units in the// squarest rectangle possible.int columnCount = (int)(Math.Ceiling(Math.Sqrt(Entities.Count)));// The number of rows may...
26 May 2016 by OriginalGriff
This is one of the most common problems we get asked, and it's also the one we are least equipped to answer, but you are most equipped to answer yourself.Let me just explain what the error means: You have tried to use a variable, property, or a method return value but it contains null -...
12 Oct 2011 by Tokisan
Hi everyone,I am a newbie in xna game .My trouble is having a group of sprites and i want to change its state by second, as after 10 seconds one of them will change from a bush to a tree in 5 seconds then change to bush. In next 10 seconds of previous sprite will change.i merely want...
20 Oct 2011 by Tokisan
Hi everyone,I am developing my own game and I have a problem with Random().When game runs, the Random() merely gives me a same number. if (seconds % 5 == 0 && seconds != 0 && animal_appearance == false) { animal_appearance = true; ...
23 Oct 2011 by Tokisan
thx^^.Sr for being late.I have been busy recently. Thx for ur answer.I will try my best.Thx alot. Sincerely.
11 Dec 2011 by ge-force
Well guys, it's me again.First of all:I got PacMan working. Yay! It is now a (almost) complete game with pellets and powerups...Now to the question.I am upgrading the Racing Game starter kit to XNA 4.0, because I am going to totally redo it. But for some reason, it will not run...
11 Dec 2011 by LanFanNinja
Congratulation...
11 Dec 2011 by Sergey Alexandrovich Kryukov
What else would you expect of f is negative? The value f is to be raised in the power e. Everyone should know from elementary school algebra, that power operation is not defined on the whole set of real numbers. (It is defined on complex numbers which is not the case.)Consider this (square...
25 Dec 2011 by Sergey Alexandrovich Kryukov
You complain is that there is no GraphicDevice.Present(IntPtr). There is no such method as GraphicDevice.Present(Nullable,Nullable,IntPtr). Your question shows, the problem is not that you don't know how to use one or another method. Your problems is that you don't understand language which...
10 Jan 2012 by NuttingCDEF
I'm trying to render a 3D scene to an off-screen image, so that I can then do some post-processing to apply a Gaussian blur to the final image before rendering it to the screen. I've posted the body of the main Draw method below.The DoDraw method contains all the detailed scene...
28 Jan 2012 by ge-force
Are you saying you want to change a bush to a tree, or is that a bug that you are trying to fix?If it is the first one, you would have multiple groups of sprites (or tilesets), and have an enum in your class stating which tileset you are currently using.Then, you use DateTime.UtcNow to...
9 Feb 2012 by HypoXxX
Hello,so i just started with developing games with XNA 4.0. I already made 2d game. Now i want to make one game minecraft styled for my own experience. So as i heard its made out of voxels. Can someone point me to the right way how to start with this voxels etc?Many thanks!
10 Jul 2012 by ReneDLM89
How I can draw a 3D object represented by his points in a DrawingSurface? The object represent an irregular hole.
29 Aug 2012 by C.CoderCreator
I know how to load simple 2d sprites.I have been looking over the internet and all i can find is demos on terrain getting destroyed, but i just want to know how they do this, how did they make it so when, for example, worms open warefare, how they destroy terrain, how did they do it?? I...
8 Oct 2012 by harindup
Platform.csclass Platform { Texture2D texture; Vector2 position; public Rectangle rectangle; public Platform(Texture2D newTexture, Vector2 newPosition) { texture = newTexture; position =...
15 Oct 2012 by haitrieu749
I'm beginner in HLSL(High Level Shader Language XNA 4.0). Write code HLSL is very hard beause it's not have function Visual Intelligence and formula's optical is very hard . Write code HLSL in Visual Studio like write in notepad. Can you tell me program write code HLSL best and explain...
3 Nov 2012 by CR@!G
Hey,First off, i'm new to coding.I'm looking to develop an asteroids game for the windows phone.I would like to get the ship moving via a virtual thumbstick on the left and shooting by a button on the right.Where would I find a tutorial on how to implement this?All I have...
4 Nov 2012 by Richard MacCutchan
You already posted this question here[^]; please post once only. If you need to add information then edit your original. If you want to find some sample code or tutorials then go to the articles section, especially the category labelled Windows Phone 7/[^].
4 Nov 2012 by haitrieu749
How to measure sound frequency using c# or XNA?? Have any library do it? I want to record sound and identify the frequency of this sound.
4 Nov 2012 by ridoy
Sound visualizer in C#[^]
8 Nov 2012 by haitrieu749
In XNA 4.0 3D. I want to Drag and Drop one model 3D.So,I must check mouse in a Model or not. My problem is I don't know change position and rate this Model from 3D to 2D. It's related Matrix View and Matrix Projection of camera?? This is my code: my code
26 Nov 2012 by MaXx0r
I want to move the sprite in the direction it's rotated.if (newState.IsKeyDown(Keys.W)) { airplanePos += new Vector2(Convert.ToInt32(Math.Sin(airplaneAngle * 360)), Convert.ToInt32(Math.Cos(airplaneAngle * 360))); }
26 Nov 2012 by entilete
I BELIEVE it should be like this, although I haven't tested it:if (newState.IsKeyDown(Keys.W)) { airplanePos += new Vector2(Convert.ToInt32(Math.Cos(airplaneAngle * 360)), Convert.ToInt32(Math.Sin(airplaneAngle * 360))); }
1 Dec 2012 by haitrieu749
How can I create effects such as smoke, fire, and explosions, in my game using XNA 4.0? If it uses the Reach Profile, that is ok because my graphics card is very bad!
24 Dec 2012 by haitrieu749
My Graphic Card: Intel (R) 82945G Express Chipset Family (256Mb) and it's not run on Hidef Profile in XNA 4.0. I want to upgrade my Graphic Card by a cheap Graphic card but do not know it is appropriate for this profile?? Can you tell me the list of Graphic cards support HiDef Profile in XNA4.0?
25 Dec 2012 by Alviss_H
hi(sorry I'm using English very bad)ExampleI have one model in project xna, I want rotate model from slow to fast and After 20s i want rotate model from fast to slow.To solve I using "GameTime" but I can't :((.Please help me!
26 Dec 2012 by austinbox
Check out these links on rotation...http://stackoverflow.com/questions/8200021/getting-a-proper-rotation-from-a-vector-direction[^]http://stackoverflow.com/questions/10527730/microsoft-xna-texture2d-and-rotation[^]
2 Jan 2013 by Paul Wangdali Jr.
I am currently working on a Kinect application which allows recording of movements then later be played on an Avatar in XNA.I know that the movements captured from the Kinect must be adjusted first and be converted to Matrices as bone transformations before applying it to the Avatar Model.I...
7 Jan 2013 by Sanjay Patel
i can not run silverlight 3d application in my visual studio 2012..
21 Jan 2013 by F.moghaddampoor
Hello friends I'm using this code to play sounds in mp3 and wav format in xna, I don't know how i can find out if the sound is completely played or not?//Putting a sound in buffer for playing fncPutAWavSoundOnBuffer(1); fncPutAWavSoundOnBuffer(2);public bool songbuffer = false; ...
22 Jan 2013 by F.moghaddampoor
As it wasn't any helper i was forced to write my code:This is my Text struct:public struct Text{ public int key; public string myText; public int FontSize; public Rectangle rect; public Color mycolor; public string strplaceOfUse; public bool...
23 Jan 2013 by BullaR
Hey guys, i've been trying to port my XNA game to Android using this tot: http://www.youtube.com/watch?v=S4kbqU6feiA[^]The problem is that when i run the program. I'm getting an error:"Could not create OpenGLES 2.0 frame buffer"Does anyone know what i should do? I have absolutly no...
23 Jan 2013 by Mohsan Raza Ali
You can use free service provided by CodePorting.com to port your C# code to Java:http://codeporting.com/[^]
22 Feb 2013 by Alireza ghasemi
Hello DearsI work in XNAI try to simulate ball motionI want to call Update method Every microsecond and Call Draw method 60 Frame per Second.Which codes I must use in my Project?Please Help me...
22 Feb 2013 by Chris Reynolds (UK)
Duplicate question, someone has the same home work? : how to manage Time Step in XNA[^]
23 Feb 2013 by haitrieu749
I have a sample code for particle explosion here. I tried to move the camera away and zoom explosion 10 times. This is my code. In my code I changed following:In class ExplosionParticleSystem.cs. I changed: settings.MinEndSize = 700; settings.MaxEndSize = 1400;In class...
15 Mar 2013 by Sergey Alexandrovich Kryukov
Not a valid question. What do you mean "how"? By doing hard work. Please review the rules for asking questions.—SA
30 Apr 2013 by Vishvesh Roach
there are lots of other ways...see Game State Management and if you want to continue with winforms.....try using "System.Diagnostic.Process.Start("C:\Windows\System32\taskkill.exe","/f /im [yourappname] /silent");" instead of "this.Exit();"
30 Apr 2013 by Vishvesh Roach
minimum requirement is a "DirectX 10" compatible gpu.....any gpu other than "intel" can run HiDef Profile
7 May 2013 by alireza ghasemi
Hello dearI want to draw a line between to point in XNA.for example my first point is: Point1= new vector3(10,10) and my second point is: Point2= new vector3(200, 200).I want to draw a line with statrt position of (10,10) and end position of (200, 200).Help me.Thank you.
7 May 2013 by CPallini
See this question at Stack Overflow: How do I draw lines using XNA?[^].
11 May 2013 by ultradoi
Now, I download 3d model from http://www.crazy3dfree.com/Model/Clothes/3d-model-of-male-cotton-clothes--2.html[^]I want to import that to xna for make game.my game is real-time with kinect.I can tracking skeleton same that...
23 Jun 2013 by Member 9096381
Hi there and welcome to this thread. Let me introduce you a layout first:1. Program background2. The problem I have (music lagging)3. My ideas how to solve itPlease notice, that the third point (My ideas how to solve it), were ideas that failed to solve the problem. However, it is...
23 Jun 2013 by Ron Beyer
Why are you using a new thread to play each sound effect? SoundEffectInstance.Play() plays the music in the background, its not blocking. I think you are getting caught up in threads, spawning too many. Try it without spawning a thread and see if your performance improves.
23 Jul 2013 by mansurmojom
I installed the Microsoft XNA framework redistributable 4.0 but I am not able to find any of its assemblies to work with in Visual Studio 2010. My window crashed and I have to get it downloaded from net. Before window crashed it was working fine. Please help me in this issue!
8 Oct 2013 by OmniSource
Hi,I am working on a Silverlight 5 business application, which will be running OOB occasionally. it has hardware interaction and thus at times a device externally can trigger a sound in application. well that's what is intended anyway.for sound playback, I am using AUDIO namespace from...
30 Jan 2014 by saikirru
Here is a strange thought I got regarding my project. I am supposed to model different gestures in XNA framework witkout using animated fbx files, meaning coding the animations. I loaded the 3D fbx model in xna framework, I am able to mode rotate and translate the entire model as such....
4 Feb 2014 by saikirru
I wrote a code to update the position of one of the bones in XNA.Mycode consists of three partsFirst part is Loadcontent() firstmodel = Content.Load("Models\\second-sample-"); worldtransforms = new Matrix[firstmodel.Bones.Count]; ...
4 Feb 2014 by johannesnestler
I think you have formulated a good and valid question. But anyway, for this kind of "mind bugs" I'd always try to read the docu first (even more if I use a specific technology (API)).so have a look at http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.game.update.aspx[^]Read...
6 Feb 2014 by saikirru
I am using XNA model viewer which is hosted here https://modelviewer.codeplex.com/[^]It basically displays a FBX model and we can see the movement of individual parts of model by moving the bones in the model.I created a 3D model from Blender 2.9 with armature. I exported as FBX...
15 Feb 2014 by sachin patil
ITS WINDOWS PHONE APP...FileStream fileread;FileStream filewrite;StreamReader scoreread;StreamWriter scorewitte;public void gethighscxore(){Boolean boolwork = true;// create fofileread = new FileStream("ok.txt", FileMode.Open, FileAccess.Read);scoreread = new...
10 Mar 2014 by Suraci19
I am working on a tutorial part for my game for moves. Each move requires 1 or more keyboard keys to be pressed. Once the move is pressed, the next move to be pressed is displayed on the screen. How do I go about creating predefined lists of these and cycle through them based on...
26 Mar 2014 by PianoMastR64
I have the solution to my problem. Make sure you are running Visual studio as an administrator. To make Visual Studio always run as an administrator:-Right click the shortcut that leads to Visual Studio.-Click "Properties".-Go to the "Compatibility" tab.-Check the box "Run this...
26 Mar 2014 by ashok rathod
1) It looks like from the application message is that your application is going to use some memory location that it should not going to use or not provided access(visual studio has less privileged mode or application (Tetris) is runnning in less privileged mode.)so can try with running...
27 Mar 2014 by Suraci19
I have posted a sample XML file at the bottom for use in an Xbox 360 Game I'm designing. The XML file is intended to be read in and then each combo will be displayed on the screen after the last one is correctly input. Each move is one or more different "spells," which are keyboard keys. ...
12 May 2014 by qbao2291
I want to record sound from sound card. I think of using DirectSound but it's no longer support in Visual C#2012. Then I think of XNA but it seem that it only record from microfone (correct me if I 'm wrong). My question is: How can I record sound ( from microfone, external sound card connected...
20 Oct 2014 by OriginalGriff
No.We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.Try it yourself, you may...
25 Oct 2014 by Dimitri Nostarik
Hello Codeproject,I'm using the following code to draw a 2D sprite on the screen. However, my game uses Vector3(Allowing 3D if I adjusted the Z.)This code is the matrix I use for my camera: SpriteBatchMatrix = Matrix.CreateTranslation(-CameraPosition) * ...
1 Nov 2014 by swapnil999
See,I'm making a game for my computer project(in XNA 4).So,I do the programming at home and test it on the school computer in school.I placed several objects at many points in my game for example some at vector2(500,300),(700,1000) etc.All these items fit perfectly on my home computer's...
2 Nov 2014 by BillWoodruff
"in my game,I have drawn maybe 400-500 objects.Will I have to adjust all of them?It will surely take a lot of time."You absolutely will want to find a "general" solution that will take care of scaling your Window (or whatever XNA calls its display), and all the objects in it. I bet that can be...
2 Nov 2014 by Anthony Mushrow
If you're not familiar with the different matrices used in rendering and their purpose then I suggest you do some reading. But generally speaking you should have a Model matrix, a View matrix and a Projection matrix.The Model matrix represents the position of an object in the scene and is...
18 Dec 2014 by T Hutton
Take a look at the XNA Creators Club Samples there is a project which already does exactly what you have described...As I mentioned previously there is actually an XNA Sample named 'Input Sequence Sample' which can be found in the education samples catalog made available to developers on...
26 Dec 2014 by swapnil999
So I have a game that I made 1-2 months ago.At that time when I placed my mouse at the bottom-right corner of the screen and checked the mouse's X and Y positions,it showed 1360 and 760(so my full screen size was 1360*760).Now I recently updated to Windows 8.But now When I place my mouse in the...
5 Jan 2015 by swapnil999
Please help me you all.I beg you.I was working on my C# project in Visual C# 2010.Then suddenly the computer hanged very badly and I had to force shut it down.When I reopened the computer and opened my Project file,it showed the error that the project file could not be loaded because the root...
5 Jan 2015 by CHill60
Try solutions from here...http://blogs.msdn.com/b/zainnab/archive/2010/06/30/autorecover-vstipenv0019.aspx[^]http://stackoverflow.com/questions/7622901/recover-a-cs-class-file-after-crash[^]http://stackoverflow.com/questions/6250390/visual-studio-lost-current-code-on-sudden-crash[^]
5 Jan 2015 by OriginalGriff
Ok. First try restoring from your backup.You do have backups, don't you? You don't...OK. First off, take this as a lesson. Backups are important. Very, very important, and it's well worth making sure you have them, and they are done regularly enough that if there is a problem you lose no more...
29 Jan 2015 by CDP1802
It will simply not work, at least not yet. XNA is nothing else than a library, based on DirectX. The 'commands' you are looking for most probably don't exist in Xamarin yet, if they ever will. Simply recompiling the libraries will not be enough in this case. It would have to be ported to...
11 Feb 2015 by CDP1802
No, there must not be a way, sorry. Not every possible mode must be available. That actually is determined by your graphics card drivers and monitor drivers. After moving on to Win 8, the old graphics mode was not available anymore and you now get the closest mode fitting to your...
6 Mar 2015 by alireza ghasemi
I Programmed a game in XNA that there are many boxes. If we assume that the box 2 is placed on (0,0,0) and Box 1 is placed on (0,0,1) when I placed a camera on (0,0,3) and looking at -Z direction (looking at the boxes), Unfortunately I will see that the Box 2 is in front of box 1.as you see...
6 Mar 2015 by Subramanyam Shankar
if your application is taking lot of time and you know that it may take a longer time.It would be better to implement asynchronous calls and multithreading. you may not neccessarily need to use a service.
22 Jan 2016 by littleGreenDude
I'm porting a WP7 game to WP8.1 and Windows 8 using Monogame 3.4I chose the solution template that is for both Windows 8 and Windows Phone 8.1I've imported my textures. However, the issue I'm having is that when the game is running on a phone device my textures are distorted (tall and...
15 May 2016 by It's Eddie!
Hey Codeproject,I wasn't sure how to phrase the question as I am not sure what this is exactly called. Anyways, to quickly get to the point I have a list of entities (players, ships, whatnot) that I send to a specific point using:GoToTarget(Entity Entity, Vector2 Position){ ...
27 May 2016 by Member 12544459
I just want to load the image at a particular address but on running the program there is a error which telling me An unhandled exception of type ;Microsoft.Xna.Framework.Content.ContentLoadException; occurred in MonoGame.Framework.dll" Please Help me understand my mistake.What I have...
27 May 2016 by Member 12544459
Just put burger = new Burger(Content, @"Graphics / burger", WindowWidth / 2, WindowHeight / 8, null); in the function loadContent();
13 Jul 2016 by Member 11841791
Hey Codeproject,I've already figured out that there's 86400 seconds in a day, and I'd like to make a color more black towards the 86400 mark.So, I started by doing the following:// pseudo code// Color * 0f = Completely Transparent// BackgroundColor = ColorColor.Black * (1f /...
13 Jul 2016 by Patrice T
Rather than using the number of seconds since midnight.Use the number of seconds around (before or after) 12 o clock.abs((86400/2)-DateTime.TotalSeconds)[Update]Pay attention to the fact that the maximum result of my formula is 43200.
17 Jul 2016 by Member 11841791
Hello Monogame/XNA Developers,As you all may be well aware there's no rotation functionality to a rectangle or a bounding-box. I've went through tons of articles all stating that you're better off making your own.So I'm doing this right now. I've made my own class with all the properties...
7 Aug 2016 by ANKIT KHOKHAR
Hello, I am creating a cad application to create pettern draft. But this thing(draw) is new to me so i dont kown how can i achive this.I want to create a vertical hexagonal grid and map each hex with index. Then i draw a straight line from top to bottom then user can edit that line by...
2 Dec 2020 by Member 11841791
Hey Codeproject,I'm wondering how you blend two colors like you would with paint in real life. For instance, blending red and blue would result in purple. I'm wondering this because I'd also like the opacity of the color to play in as a component (meaning that if the alpha is 255 it would...
13 Aug 2016 by Patrice T
You can try to calc the mean of the 2 colorsCol.Red= (One.Red+ Two.Red)/ 2;...