mirror of
https://github.com/love2d/love.git
synced 2026-08-12 16:40:57 +02:00
Added love.graphics.getStats. It returns a table with performance-related graphics statistics. Currently it contains these fields:
drawcalls: The number of internal draw calls made so far in the current frame. canvasswitches: The number of times the active Canvas has been changed so far in the current frame. texturememory: The approximate amount of video memory (in bytes) used by OpenGL textures created by Images, Canvases, and Fonts. images: The number of active Image objects. canvases: The number of active Canvas objects. fonts: The number of active Font objects.
This commit is contained in:
@@ -119,6 +119,16 @@ bool Graphics::getConstant(StackType in, const char *&out)
|
||||
return stackTypes.find(in, out);
|
||||
}
|
||||
|
||||
bool Graphics::getConstant(const char *in, StatType &out)
|
||||
{
|
||||
return statTypes.find(in, out);
|
||||
}
|
||||
|
||||
bool Graphics::getConstant(StatType in, const char *&out)
|
||||
{
|
||||
return statTypes.find(in, out);
|
||||
}
|
||||
|
||||
StringMap<Graphics::DrawMode, Graphics::DRAW_MAX_ENUM>::Entry Graphics::drawModeEntries[] =
|
||||
{
|
||||
{ "line", Graphics::DRAW_LINE },
|
||||
@@ -210,5 +220,17 @@ StringMap<Graphics::StackType, Graphics::STACK_MAX_ENUM>::Entry Graphics::stackT
|
||||
|
||||
StringMap<Graphics::StackType, Graphics::STACK_MAX_ENUM> Graphics::stackTypes(Graphics::stackTypeEntries, sizeof(Graphics::stackTypeEntries));
|
||||
|
||||
StringMap<Graphics::StatType, Graphics::STAT_MAX_ENUM>::Entry Graphics::statTypeEntries[] =
|
||||
{
|
||||
{"drawcalls", Graphics::STAT_DRAW_CALLS},
|
||||
{"canvasswitches", Graphics::STAT_CANVAS_SWITCHES},
|
||||
{"canvases", Graphics::STAT_CANVASES},
|
||||
{"images", Graphics::STAT_IMAGES},
|
||||
{"fonts", Graphics::STAT_FONTS},
|
||||
{"texturememory", Graphics::STAT_TEXTURE_MEMORY},
|
||||
};
|
||||
|
||||
StringMap<Graphics::StatType, Graphics::STAT_MAX_ENUM> Graphics::statTypes(Graphics::statTypeEntries, sizeof(Graphics::statTypeEntries));
|
||||
|
||||
} // graphics
|
||||
} // love
|
||||
|
||||
Reference in New Issue
Block a user