@echo off
setlocal
echo ========================================
echo   Screen Dimmer - Build Script
echo ========================================

set "GCC=C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\g++.exe"

if not exist "%GCC%" (
    echo ERROR: g++ not found at %GCC%
    echo Please install MinGW-w64 or update the path in this script.
    exit /b 1
)

echo.
echo Compiling Dimmer.cpp ...
"%GCC%" -O2 -std=c++17 -mwindows -Wall -o "%~dp0Dimmer.exe" "%~dp0Dimmer.cpp" -luser32 -lgdi32 -lshell32

if %ERRORLEVEL% EQU 0 (
    echo.
    echo Build successful: %~dp0Dimmer.exe
    echo.
    echo Usage:
    echo   Ctrl+Alt+Down   = Increase dim (darker)
    echo   Ctrl+Alt+Up     = Decrease dim (brighter)
    echo   Ctrl+Alt+Space  = Toggle on/off
    echo   Right-click tray icon for menu
) else (
    echo.
    echo Build FAILED with error code %ERRORLEVEL%
)

endlocal
