From 3d10d6d052ae611e64e2e6fb84182dd40b9800c5 Mon Sep 17 00:00:00 2001 From: iamevn Date: Mon, 5 Apr 2021 17:09:25 -0700 Subject: [PATCH] v cycles through graph views (both -> time -> memory -> both -> ...) --- draw.lua | 24 ++++++++++++++++++------ main.lua | 5 +++++ 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/draw.lua b/draw.lua index 4a8155b..d436e3f 100644 --- a/draw.lua +++ b/draw.lua @@ -13,6 +13,13 @@ draw.nextGraphMean = { harmonic = "max", } +draw.graphView = "both" +draw.nextGraphView = { + both = "time", + time = "memory", + memory = "both", +} + draw.flameGraphType = "time" -- so far: "time" or "memory" local rootPath = {} @@ -50,6 +57,7 @@ do L, "Space: ", R, "Switch between 'time' and 'memory' mode.\n\n", L, "Alt: ", R, "Cycle through graph averaging modes.\n\n", + L, "v: ", R, "Cycle through graph views.\n\n", } end @@ -318,13 +326,17 @@ function love.draw() end if #frames > 1 then - lg.setLineWidth(1) - lg.setColor(const.timeGraphColor) - lg.line(graphs.time) + if draw.graphView == "time" or draw.graphView == "both" then + lg.setLineWidth(1) + lg.setColor(const.timeGraphColor) + lg.line(graphs.time) + end - lg.setLineWidth(2) - lg.setColor(const.memGraphColor) - lg.line(graphs.mem) + if draw.graphView == "memory" or draw.graphView == "both" then + lg.setLineWidth(2) + lg.setColor(const.memGraphColor) + lg.line(graphs.mem) + end end lg.setColor(const.textColor) diff --git a/main.lua b/main.lua index 5214a0a..25d2ad5 100644 --- a/main.lua +++ b/main.lua @@ -75,6 +75,11 @@ function love.keypressed(key) draw.graphMean = draw.nextGraphMean[draw.graphMean] draw.notice("graph mean: " .. draw.graphMean) end + + if key == "v" then + draw.graphView = draw.nextGraphView[draw.graphView] + draw.notice("graph show: " .. draw.graphView) + end end local function pickFrameIndex(x)