Skip to main content
1 of 3
Jerry Coffin
  • 34.1k
  • 4
  • 77
  • 145

I would avoid the testing for calling Begin and End appropriately by creating a separate class that does the begin actions during construction and the end actions during destruction.

As for speeding up the code, I think the first real step is to clarify the code a bit so it's easier to see what's really going on and what's needed. Just for example, you have:

    for( int i = count + 1; i < sprites.size(); i++ )
    {
        if( sprites[count].texture == sprites[i].texture )
        {
            drawCount++;
        }
        else
        {
            break;
        }
    }

It looks like this could be rewritten to use std::find_if instead, and end up quite a bit simpler and more readable.

Jerry Coffin
  • 34.1k
  • 4
  • 77
  • 145