Search Forums
-
Right, especially since it allows you to do this:
List<Point> points = new List<Point>();
points.Add(new Point(0, 0));
points.Remove(new Point(0, 0));
If it's not X and Y coordinates you're ...
-
If the int arrays in your list always consist of two elements, you could use a struct instead. If those are coordinates, simply use XNA's Point struct, or otherwise write your own with custom Equals() and GetHashCode() implementations.
This would make the List<>.Remove() method behave as expected and also avoid the forming of ...
-
[quote user="Rhys Perkins"]Good point, I've updated the method to the following:
// Clamp to the range [0,3]
row = (row > 3) ? 3 : row;
row = (row < 0) ? 0 : row;
...
-
[quote user="Shawn Hargreaves"]Why multiply the row by 16? There are only four columns per row, so this just needs to multiply by 4 (or shift by 2). It's a minor detail, but making the switch values consecutive without any gaps increases the chance that this will end up translating to an efficient jump table rather than a slower ...
-
Benchmark with 100,000,000 x 16 calls to the method
Mine: 12.12 seconds (11.72 ngen'd)
Yours: 15.89 seconds (16.56 ngen'd)
Whatever GCC does, addition or bitwise or doesn't seem to make a difference to the .NET jitter or ngen.
Given the marginal difference, I'd use the extension method any day, but I'm still ...
-
[quote user="Rhys Perkins"]I have one for Matrix too now. If anyone would like to see it, please shout![/quote]
*shout*
Try to beat this:
/// <summary>Provides helper methods for working with matrices</summary>
...
-
Same here.
Either use XNA's component concept and query your services in Initialize() (or LoadContent() or when needed if you wish, just not in the constructor),
or use dependency injection and add the required services as parameters to your component's constructor, any optional services as properties. Personally, I'm using ...
-
For a similar task in a game I'm working on, I wrote this: Nuclex Framework: PrimitiveBatch.
It's roughly what Shawn says, a 3D SpriteBatch that batches all kinds of primitives. Texture switches, different shaders and graphics device state changes are all supported and vertices will be batched together optimally as long as the drawing ...
-
I don't quite understand where you expect the problem.
You can use svndumpfilter like that to obliterate any path from a repository (if you have access to the repository from the file system). If there's a Graphics directory somewhere beneath the bin folder, it would disappear from the repository, too. It will be as if bin and obj ...
-
You can just delete those folders in your working copy and commit that.
If you're concerned about repository size or want to obliterate those binaries from your repository history, this is only possible if you have access to the repository itself on the file system level.
If you have that kind of access, you can use svndumpfilter to ...