mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-02 23:00:42 -07:00
overlay: OBS control window via WebSocket API (#773)
## Link to GitHub Issue or related Pull Request, if one exists n/a ## Description of change Adds an overlay window widget for controlling OBS over WebSocket. Add new lines to the FPS widget that shows recording / streaming timers. Show notifications for major state changes (stream started/stopped, recording started/paused/resumed/stopped) ## Testing
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "extensions.h"
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
#include "external/imgui/imgui.h"
|
||||
@@ -161,6 +162,19 @@ namespace ImGui {
|
||||
return clicked;
|
||||
}
|
||||
|
||||
bool ColoredButton(const char* label, const ImVec4& base, const ImVec2& size) {
|
||||
const auto brighten = [](const ImVec4& c, float d) {
|
||||
return ImVec4((std::min)(c.x + d, 1.0f), (std::min)(c.y + d, 1.0f),
|
||||
(std::min)(c.z + d, 1.0f), c.w);
|
||||
};
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, base);
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, brighten(base, 0.12f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, brighten(base, 0.22f));
|
||||
const bool clicked = ImGui::Button(label, size);
|
||||
ImGui::PopStyleColor(3);
|
||||
return clicked;
|
||||
}
|
||||
|
||||
bool ClearButton(const std::string& tooltip) {
|
||||
ImGui::PushID(tooltip.c_str());
|
||||
// same colors as a checkbox
|
||||
|
||||
@@ -22,6 +22,11 @@ namespace ImGui {
|
||||
bool ClearButton(const std::string& tooltip);
|
||||
void HighlightTableRowOnHover();
|
||||
|
||||
// a Button with the given base fill color; the hovered/active shades are
|
||||
// derived by brightening the base. size defaults to auto (fit the label).
|
||||
bool ColoredButton(const char* label, const ImVec4& base,
|
||||
const ImVec2& size = ImVec2(0, 0));
|
||||
|
||||
// Config tab bar with extra label padding and uniform, centered tab widths.
|
||||
// Wrap items in BeginPaddedTabItem between BeginPaddedTabBar/EndTabBar.
|
||||
bool BeginPaddedTabBar(const char* str_id, ImGuiTabBarFlags flags = 0);
|
||||
|
||||
Reference in New Issue
Block a user