Skip to main content
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
Results tagged with
Search options not deleted user 8390

XNA is a game framework by Microsoft that allows deployment for Windows, Windows Phone & Xbox 360.

1 vote

In XNA 4, how can I access SpriteBatch's transformMatrix in my shader?

That is explained here by Shawn Hargreaves, the Xna lead coder https://shawnhargreaves.com/blog/spritebatch-and-custom-shaders-in-xna-game-studio-4-0.html …
Blau's user avatar
  • 3,386
1 vote

How can I improve the performance of handling many objects to draw in XNA?

1) You don't need to calculate the visible objects in a single frame, you may use a bit bigger viewport, and calcultate only 500 objects per frame, if you have 20000 objects and your framerate is 50f …
Blau's user avatar
  • 3,386
2 votes
Accepted

Why are my sprite outlines partially rendering in the wrong place?

Pixel color addresing is bad, it will work on a square but not on a rectangle. Change this: colors[ x * texture.Width + y ] = borderColor; colors[ x * texture.Height + y ] = Color.Transparent; T …
Blau's user avatar
  • 3,386
1 vote
Accepted

Get highest (Y-axis) vertices from primitive d20 dice in xna

If you have the rotation matrix, I think the the easier is to get the cos between the normals and forget the vertex position. The cos will be max and near 1 when the angle among the two vectors is ne …
Blau's user avatar
  • 3,386
0 votes

(XNA) Possible to hide, compress, or rename .XNB files?

http://romsteady.blogspot.com.es/2011/07/use-zip-files-to-hold-your-xna-content.html public class ZipContentManager : ContentManager { private ZipFile zipFile = null; public ZipContentManager(IServiceProvider …
Blau's user avatar
  • 3,386
4 votes

How can I create a resizeable 2D camera with parallax scrolling?

The X position of the background have to be calculated with the X position of the player and a speed factor. Texture2D ParallaxTex; Rectangle ParallaxBounds = graphics.Viewport.Bounds; spriteBatc …
Blau's user avatar
  • 3,386
1 vote
Accepted

Why is the player not resting in the center of the camera?

I think should do the trick: ScaleX = vp.X / gameWorldSize.X; ScaleY = vp.Y / gameWorldSize.Y; Scale = Math.Min(ScaleX, ScaleY); camera = Matrix.CreateTranslation(-Player.Position) * Matrix. …
Blau's user avatar
  • 3,386
1 vote

Collide with rotation of the object

You should determine what side of the rectangle is colliding with the ball, and get the normal N of that side. If the ball movement vector is V, then the reflected vector is: var reflected = Vector …
Blau's user avatar
  • 3,386
0 votes

XNA Creating a directional vector from two other vectors

1) Figuring out mouse position: I think is easier using a Ray/Plane intersection. Seems that your plane is Y=0, then the code is: nearsourceV = graphicsDevice.Viewport.Unproject(new Vector3(mouse. …
Blau's user avatar
  • 3,386
2 votes
Accepted

"retro"-look in 3d-XNA-game

Change the sampler state to Point clamp or wrap before drawing. GraphicsDevice.SamplerStates[0] = SamplerState.PointClamp;
Blau's user avatar
  • 3,386
0 votes

XNA: Auto-populate content within the content project based on current folder/file structure...

But seems easy to code a standalone application to manage it, you need to use a FileSystemWatcher, built it again with a tool like the Xna 4.0 content compiler, or made by yourself (see Winform series … This is the link to the Xna 4.0 to the Content Tracker project …
Blau's user avatar
  • 3,386
2 votes
Accepted

xna model scaling - model is bigger than world

You should first scale and rotate, and then translate: Vector3 objPos = new Vector3(0, -50, 0); Vector3 camPos = objPos - Vector3.One * cameraDistance; Matrix view = …
Blau's user avatar
  • 3,386
1 vote

Trouble using Ray.Intersect method on bounding boxes in a 2D XNA game

The problem is that the bounding box has the same Z in Max and Min, so there is no volume. Changing this: box = new BoundingBox( new Vector3(box.Position, 0), new Vector3( new Vector2(box. …
Blau's user avatar
  • 3,386
2 votes

Xna menu navigation with controller

You can do it in a similar way to keyboard, storing the state by yourself: enum States {None, GoingDown, GoingUp } States Current, Previous; void Update() { Previous = Curren …
Blau's user avatar
  • 3,386
3 votes
Accepted

render sprites with a transparent background (XNA)

You are drawing all sprites in the same postition and same size, if textures don't have alpha channel you will only see one of them. Test this to draw a grid with 8 columns: var size = 100; …
Blau's user avatar
  • 3,386

1
2 3 4 5
8
15 30 50 per page