Add dark background toggle
parent
2990511cd4
commit
cbdb835dd1
11
as1/as1.cpp
11
as1/as1.cpp
|
|
@ -1,10 +1,12 @@
|
|||
#include "AudioDevice.hpp"
|
||||
#include "Color.hpp"
|
||||
#include "raylib.h"
|
||||
#include <raylib-cpp.hpp>
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
|
||||
static std::function<void()> pingButtonHandler;
|
||||
static bool darkMode = false;
|
||||
|
||||
void PingButton() {
|
||||
pingButtonHandler();
|
||||
|
|
@ -43,7 +45,16 @@ int main() {
|
|||
|
||||
GuiVolumeControl(&guiState);
|
||||
|
||||
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);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue