1. Anders Ruud
  2. love
  3. Issues

Issues

Issue #531 wontfix

draw calls count in C++

Antonio Moder
created an issue

Make records in C++ - how many times the LOVE2D is draw stuff.


Example:

In C + +:

void Graphics::rectangle(DrawMode mode, float x, float y, float w, float h)
{
    quad (mode, x, y, x, y + h, x + w, y + h, x + w, y);
    debug.drawCalls += 1;
}

In LOVE script:              

love.graphics.draw(sprite, 0,0);
love.graphics.draw(sprite2, 0,0);
print(love.drawCalls())           -- print 2

It is not easy to do in Lua:              

love.graphics.draw(sprite, 0,0); 
debug.drawCalls = debug.drawCalls+1;
love.graphics.draw(sprite2, 0,0); 
debug.drawCalls = debug.drawCalls+1;
print(debug.drawCalls)            -- print 2

Comments (7)

  1. Bart van Strien

    What's the use? It's also really easy to wrap things like this:

    drawCalls = 0
    function wrapDrawCall(name)
      local func = love.graphics[name]
      function love.graphics[name](...)
        drawCalls = drawCalls + 1
        return func(...)
      end
    end
    
    wrapDrawCall("draw")
    -- etc
    
  2. Matthias Richter

    It's probably slower, but you will likely not be able to notice any difference. To fix the error:

     love.graphics[name] = function (...)
    

    But I have to agree with bartbes: What's the use?

  3. Log in to comment