Hot answers tagged

1

Myself, I'd attack it a little something like this: public enum Direction { Down, Left, None, Right, Up } public static DirectionFromTo(Vector2 from, Vector2 to) { Vector2 offset = to - from; Vector2 absolute = new Vector2(Abs(offset.x), Abs(offset.y)); // In your code, it looks like you have a fudge factor to ignore ...


1

So after like 5 hours of debugging of course I solve it 3 minutes after I write up this answer (as always Stack Exchange is the best rubber duck). The clue is that SDL2.SDL.SDL_MinimizeWindow(Window.Handle) and all other SDL calls work perfectly fine. Turns out FNA is slightly different from XNA in that Window.Handle points to an SDL window, not a Win32 ...


1

What you want is to dynamically scale the camera so you can only see the map. This can be done by passing a different projection matrix to the SpriteBatch: var graphics = /* your GraphicsDeviceManager */; var width = graphics.PreferredBackBufferWidth; var height = graphics.PreferredBackBufferHeight; var windowSize = new Vector2(width, height); var gameSize =...


1

While I have spent years working with XNA across Xbox 360, Windows Phone 7 and PC, this kind of a problem is typical and requires lots of tedious configuration of the target system. While I was once successful in past, it took more effort than to simply update graphics API (say, DX8 to DX11). Every new version of VS links against different libraries. Given ...


1

I'm now using Monogame.Extended, Camera and Sprite classes to detect mouse collision: public RectangleF GetBoundingRectangle() { return Sprite.GetBoundingRectangle(_transform); }


1

Some basics on convex hull tests for folks that might read this later: A convex hull is a volume defined by a number of planes (at least 4, but it could be much more). Testing to see which side of a plane a given point is on is trivial (computationally speaking), it's just a dot-product. Go look up "dot product" if you don't know what that is. Do it now. ...


1

The problem lies in your .spritefont file. --> <CharacterRegions> <CharacterRegion> <Start>&#32;</Start> <End>&#32;</End> </CharacterRegion> </CharacterRegions> <!-- The region starts with character #32 (Space) and ends with character #32. Change the value to #126. This gives you the ...


Only top voted, non community-wiki answers of a minimum length are eligible