Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your feedback on a survey! Each completed response supports our community and gives you a chance to win a $25 Amazon gift card!


Member Since 06 Jan 2014
Offline Last Active Jun 19 2014 03:30 AM

Topics I've Started

spriteBatch.Draw slow?

02 March 2014 - 08:24 AM

I'm trying to make a particle system, but I'm having problems when drawing. At around 30 000 particles the program slows down. So I tested by making a new empty program with only a for loop drawing a single pixel texture. I found out that when drawing around 60 000 times it slows down drastically from 60 to 30 FPS. Yet theres videos of particle systems that can handle up to a million particles (not my goal, but at least 100 000 would be nice). How is that possible? Do I have to use pixel shaders or something? And if so, isn't spriteBatch already a shader, and should I just write my own spriteBatch instead then?

Rotate sprites around a point in 2D

06 January 2014 - 04:46 PM

I'm trying to make an entity system where the entity can have multiple components, like arms and legs, or weapon attachments, but I can't figure out how to get all of the components to stay in the right position when the entity is rotated.


With the code I currently have, the rotation works, but I can't place the components where they are supposed to be. When I try to place the component at the mouse position it doesn't go where it is supposed to, and rather seems to stick to a circle path.


                Vector2 newPos = new Vector2(Base.X, Base.Y);

                newPos.X += (float)(PositionRelativeToBase.X * Math.Cos(Rotation - MathHelper.ToRadians(PositionRelativeToBase.Y)));
                newPos.Y += (float)(PositionRelativeToBase.X * Math.Sin(Rotation - MathHelper.ToRadians(PositionRelativeToBase.Y)));


This is code that I found elsewhere, though, so I don't understand it entirely, so I can't really explains my thoughts behind it.