Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
XNA is a game framework by Microsoft that allows deployment for Windows, Windows Phone & Xbox 360.
5
votes
Accepted
(XNA) Checking coordinates, directly vs List<Vector2> vs Dictionary<X, List<Y>>
bool[,] Rooms = new Rooms[Width, Height];
bool IsPositionAvalaible(int x, int y) { return !Rooms[x,y];}
bool SetPositionValue(int x, int y, bool Avalaible) { Rooms[x,y] = !Avalaible; }
0
votes
Cleaner implementation of this draw call
This is a similar way of doing that, but next time your sprite sheets shoud follow the ascii layout to make it easier... :)
public static class Font
{
private static String chars = "0123456789.,! …
2
votes
Accepted
string and int concatenation resulting in null for a Tetris clone?
You should change the var i to j here
7 for (int j = 1; j <= 4; j++)
8 {
9
Maybe you should use the step trace to debug your execution flow... worth it... :)
Anyway is a common copy/paste …
3
votes
XNA Tile from Screen Location
You can use Viewport.UnProject with two source values:
A(MouseX, MouseY, 0)
B(MouseX, MouseY, 1)
You will get the two unprojects points that can be used to get a ray, then you have to get the ray in …
5
votes
Accepted
elongate or scale limbs of a model in XNA
Xna offers you a Model class that let you access to the Bones, but you have to recalcultate the bone transform by yourself. …
3
votes
Accepted
How can I get a list of sprites which are being drawn in the current viewport using XNA?
You can check if the object's bounding is inside of the camera frustum.
you have the class BoundingFrustum that can manage intersections with BoundingBoxes or BoundingSpheres.
3
votes
Polygon editor to draw collision data over image
InkScape is a good choice for vectorial images.
Size your document to 1m x 1m...
Add the bitmap...
Draw the polyline...
Save as .svg or .xaml document... whose are text based...
Develop a light p …
3
votes
How do I add Different Screens to my C#/XNA Game?
maybe this method not the best, but for pong game could be enough, and is easy to understand.
Make a enum with your states:
enum States { Menu, Playing, Pause, Lost, Win, Intro }
In your update …
1
vote
SpriteBatch.Draw() rectangle is different from destinationRectangle passed in
When you resize, the backbuffer changes... so you have to recalc your control sizes...
in the game class you can subscribe to this event to recalc your controls:
this.Window.ClientSizeChanged+= R …
1
vote
Can SpriteBatch be used to fill a polygon with a texture?
if you have to use the spritebatch, only accepts to draw rectangles, and you define the polygon in a map editor, why don't precalc the texture?
You can still use your polygon for physics, only have t …
2
votes
In XNA, is there an issue with copying/pasting the using statements to each .cs file?
is not used to cause problems.
the greatest problem is class or struct name collision.
if you have this:
using System.Drawing;
usign Microsoft.Xna.Framework.Graphics;
these namespaces both cont …
3
votes
Accepted
XNA - Update vertices property stored in a VertexBuffer
To change a vertex buffer it can't be active:
GraphicsDevice.SetVertexBuffer(null);
To transfer vertex data to the gpu memory:
VertexBuffer.SetData<VertexPositionColor>(VertexData);
To act …
1
vote
Interpolating from Current- to Target-value every frame
A lerp function is something like this:
NewCurrentValue = SourceValue + (TargetValue - SourceValue) * Ratio;
Many times I choose a constant ratio, and work over current value, this way I have not …
7
votes
What can I do to render generated 2D terrain in XNA?
You can create a Texture2D this way.
Texture2D Mountain = new Texture2D( GraphicsDevice, Width, Height);
Color[] PixelData = new Color[Width * Height];
Color colA,colB;
…
12
votes
Accepted
How do I get the height of an XNA SpriteFont?
MeasureString() returns to you a Vector2 where the X is the width and Y is the height of the text.
Also the SpriteFont class has a LineSpacing member that gives you the height of a line, including te …