Add dark background toggle

master
John Montagu, the 4th Earl of Sandvich 2026-02-08 19:33:43 -08:00
parent 2990511cd4
commit cbdb835dd1
Signed by: sandvich
GPG Key ID: 9A39BE37E602B22D
1 changed files with 12 additions and 1 deletions

View File

@ -1,10 +1,12 @@
#include "AudioDevice.hpp" #include "AudioDevice.hpp"
#include "Color.hpp" #include "Color.hpp"
#include "raylib.h"
#include <raylib-cpp.hpp> #include <raylib-cpp.hpp>
#include <functional> #include <functional>
#include <iostream> #include <iostream>
static std::function<void()> pingButtonHandler; static std::function<void()> pingButtonHandler;
static bool darkMode = false;
void PingButton() { void PingButton() {
pingButtonHandler(); pingButtonHandler();
@ -43,7 +45,16 @@ int main() {
GuiVolumeControl(&guiState); GuiVolumeControl(&guiState);
window.ClearBackground(raylib::Color::RayWhite()); const char *modeText = darkMode ? "Background: Black" : "Background: White";
if (GuiButton((Rectangle){ 24, 328, 256, 24 }, modeText)) {
darkMode = !darkMode;
}
if (darkMode) {
window.ClearBackground(raylib::Color::Black());
} else {
window.ClearBackground(raylib::Color::RayWhite());
}
ping.SetVolume(guiState.SFXSliderValue / 100.0f); ping.SetVolume(guiState.SFXSliderValue / 100.0f);