You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
enumclassRLLinearGaugePointerStyle {
FILL_BAR, // Filled bar from min to current value (default)
TRIANGLE, // Triangle pointer at current value
LINE_MARKER // Line marker at current value
};
Range Bands
structRLLinearGaugeRangeBand {
floatmMin{0.0f}; // Start of the rangefloatmMax{100.0f}; // End of the range
Color mColor{GREEN}; // Color for this range
};
Style Configuration
structRLLinearGaugeStyle {
// Track appearance
Color mTrackColor{60, 60, 70, 255};
Color mTrackBorderColor{80, 80, 90, 255};
floatmTrackThickness{24.0f};
floatmTrackBorderThickness{1.0f};
floatmCornerRadius{4.0f};
// Fill/indicator appearance
Color mFillColor{0, 180, 255, 255};
Color mPointerColor{255, 74, 74, 255};
floatmPointerSize{12.0f};
// Target marker appearance
Color mTargetMarkerColor{255, 220, 80, 255};
floatmTargetMarkerThickness{3.0f};
floatmTargetMarkerLength{8.0f};
// Tick marksintmMajorTickCount{5};
intmMinorTicksPerMajor{4};
Color mMajorTickColor{220, 220, 230, 255};
Color mMinorTickColor{150, 150, 160, 255};
floatmMajorTickLength{12.0f};
floatmMinorTickLength{6.0f};
floatmMajorTickThickness{2.0f};
floatmMinorTickThickness{1.0f};
// Labels
Color mLabelColor{220, 220, 230, 255};
Color mTitleColor{180, 190, 210, 255};
Color mValueColor{255, 255, 255, 255};
floatmLabelFontSize{12.0f};
floatmTitleFontSize{16.0f};
floatmValueFontSize{18.0f};
Font mLabelFont{};
// Layout paddingfloatmPadding{10.0f};
floatmTickLabelGap{4.0f};
// AnimationboolmSmoothAnimate{true};
floatmAnimateSpeed{10.0f};
RLEaseMode mEaseMode{RLEaseMode::SMOOTH}; // Animation easing mode (LINEAR, SMOOTH, SNAPPY, SPRINGY, ELASTIC)// Display optionsboolmShowTicks{true};
boolmShowTickLabels{true};
boolmShowTitle{true};
boolmShowValueText{true};
boolmShowRangeBands{true};
boolmShowTargetMarker{false};
intmValueDecimals{1};
// Background
Color mBackgroundColor{30, 30, 36, 255};
boolmShowBackground{true};
};
Tick positions are precomputed when geometry changes (bounds, range, or tick count)
Minimal per-frame allocations
Efficient raylib primitive drawing
Suitable for multiple gauges on screen simultaneously
VU Meter Mode
The linear gauge supports a VU Meter mode for audio-style volume visualization with multi-channel support.
VU Meter Mode Enum
enumclassRLLinearGaugeMode {
STANDARD, // Normal single-value gauge (default)
VU_METER // Multi-channel VU meter with peak hold
};
VU Meter Channel
structRLVuMeterChannel {
floatmValue{0.0f}; // Current channel value
std::string mLabel{}; // Channel label (e.g., "L", "R", "C", "LFE")
};
VU Meter Style
structRLVuMeterStyle {
// Gradient colors (green -> yellow -> red)
Color mLowColor{80, 200, 120, 255}; // Green zone
Color mMidColor{255, 200, 80, 255}; // Yellow zone
Color mHighColor{255, 80, 80, 255}; // Red zone// Thresholds for color zones (normalized 0.0 - 1.0)floatmLowThreshold{0.6f}; // Below this: greenfloatmMidThreshold{0.85f}; // Below this: yellow, above: red// Peak indicator
Color mPeakMarkerColor{255, 255, 255, 255};
floatmPeakMarkerThickness{2.0f};
floatmPeakHoldTime{1.5f}; // Seconds to hold peakfloatmPeakDecaySpeed{0.5f}; // Units per second after hold// Clip indicator
Color mClipIndicatorColor{255, 0, 0, 255};
floatmClipFlashDuration{0.3f}; // How long clip indicator flashesfloatmClipIndicatorSize{8.0f}; // Size of clip indicator// Channel layoutfloatmChannelSpacing{4.0f}; // Gap between channel barsboolmShowChannelLabels{true};
floatmChannelLabelFontSize{10.0f};
// dB scale optionboolmUseDbScale{false};
floatmDbMin{-60.0f}; // Minimum dB value (silence)floatmDbMax{0.0f}; // Maximum dB value (full scale)
};
// 6-channel surround sound meter
std::vector<RLVuMeterChannel> lChannels = {
{0.0f, "L"}, // Front Left
{0.0f, "R"}, // Front Right
{0.0f, "C"}, // Center
{0.0f, "LFE"}, // Subwoofer
{0.0f, "Ls"}, // Rear Left
{0.0f, "Rs"} // Rear Right
};
lVuMeter.setChannels(lChannels);
VU Meter Example: dB Scale
// Enable logarithmic dB scale for authentic audio metering
lStyle.mVuStyle.mUseDbScale = true;
lStyle.mVuStyle.mDbMin = -60.0f; // -60 dB = silence
lStyle.mVuStyle.mDbMax = 0.0f; // 0 dB = full scale
lStyle.mVuStyle.mLowThreshold = 0.7f; // Adjust for dB curve
lStyle.mVuStyle.mMidThreshold = 0.9f;