Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[PoC] Simple DAW-Style Segmented VU Meter/Progress Bar

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Extensions
View previous topic :: View next topic  
Author Message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1681

PostPosted: Thu Jul 16, 2026 6:16 am    Post subject: [PoC] Simple DAW-Style Segmented VU Meter/Progress Bar Reply with quote

Hi everyone,

I just wanted to share a small architectural experiment I’ve been playing around with inside Cheat Engine. As many of you know, customizing the visual look of the built-in TProgressBar in CE/Lazarus can sometimes be a bit stiff and limited to the default Windows styles.

To overcome this, I worked on a small Proof of Concept (PoC) to build a custom, highly responsive DAW-style Segmented VU Meter from scratch. Instead of fighting with OnPaint canvas redraws or overriding Windows UXThemes, this script directly manipulates an array of small child TPanel components packed inside a main container.

It is very lightweight and fully reactive. I have attached a simple test script that links a standard TTrackBar (with top ticks) to this custom progress bar to showcase the real-time visual update. I hope this might be useful for anyone looking to build a cleaner, modern Dark/DAW theme for their multimedia trainers or custom GUIs.

How to Use:
1. Open the Cheat Engine Lua Engine (Ctrl + Alt + L).
2. Paste the script below into the editor.
3. Click "Execute script".
4. Drag the slider knob to watch the blocks light up dynamically!

Feedback and optimizations from the community are always welcome!

Best regards,
Corroder


Code:

-- =============================================================================
-- 1. GUI INITIALIZATION & DAW THEME LAYOUT
-- =============================================================================
if testForm then testForm.destroy() end
testForm = createForm()
testForm.setSize(420, 180)
testForm.Position = 'poScreenCenter'
testForm.Caption = 'DAW VU Meter & Control Slider Linkage'
testForm.Color = 0x2A2A2A -- Charcoal Dark DAW Background

local labelOutput = createLabel(testForm)
labelOutput.setPosition(25, 42)
labelOutput.Caption = "Output Level"
labelOutput.Font.Color = 0xDDDDDD
labelOutput.Font.Size = 9

-- =============================================================================
-- 2. BUILDING THE CUSTOM VU METER CONTAINER & SEGMENTS
-- =============================================================================
local segmentCount = 25
myVUMeter = createPanel(testForm)
myVUMeter.setPosition(110, 40)
myVUMeter.setSize(270, 18)
myVUMeter.Color = 0x141414 -- Inner dark track background
myVUMeter.BevelOuter = 'bvNone'
myVUMeter.BorderStyle = 'bsNone'

-- Create individual block segments inside a global array for direct access
allBlocks = {}
local totalGapSpace = (segmentCount - 1) * 2
local segWidth = math.floor((270 - totalGapSpace) / segmentCount)

for i = 1, segmentCount do
    local box = createPanel(myVUMeter)
    box.Height = 18
    box.Width = segWidth
    box.setPosition((i - 1) * (segWidth + 2), 0)
    box.BevelOuter = 'bvNone'
    box.BorderStyle = 'bsNone'
    box.Color = 0x222222 -- Default OFF color (Dim Gray)
   
    table.insert(allBlocks, box)
end

-- =============================================================================
-- 3. CONTROLLER SLIDER CREATION
-- =============================================================================
sliderControl = createTrackBar(testForm)
sliderControl.Left = 110
sliderControl.Top = 85
sliderControl.Width = 270
sliderControl.Height = 40
sliderControl.Min = 0
sliderControl.Max = 100
sliderControl.Position = 0
sliderControl.TickStyle = 'tsTop' -- Position the tick marks on top
sliderControl.TickFrequency = 10

testForm.show()

-- =============================================================================
-- 4. LOGIC LINKAGE & EVENT HANDLERS
-- =============================================================================
R = 0

function vuMeterChange(sender)
    -- Grab the current trackbar position directly from the sender object
    R = sliderControl.Position
    print("Current Slider Position: " .. tostring(R))
   
    -- Calculate how many blocks should light up based on the position percentage
    local activeCount = math.floor((R / 100) * segmentCount)
   
    -- Loop through the panels array and update color memory states instantly
    for i = 1, segmentCount do
        if i <= activeCount then
            -- DAW Color Gradient Logic (BGR Hex Format for Cheat Engine)
            if i <= math.floor(segmentCount * 0.6) then
                allBlocks[i].Color = 0x00FF00 -- Neon Green (0% - 60%)
            elseif i <= math.floor(segmentCount * 0.85) then
                allBlocks[i].Color = 0x00D7FF -- Golden Yellow (61% - 85%)
            else
                allBlocks[i].Color = 0x0055FF -- Studio Orange/Red (86% - 100%)
            end
        else
            allBlocks[i].Color = 0x222222 -- Revert to OFF state color
        end
    end
end

function exit()
    closeCE()
    return caFree
end

-- Assign clean callbacks to explicit LCL events
sliderControl.OnChange = vuMeterChange
testForm.OnClose = exit

-- Trigger initial execution to sync layout on startup
vuMeterChange(sliderControl)

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Extensions All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites