mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-26 12:16:20 +00:00
working volume
This commit is contained in:
parent
347ed3681b
commit
4f1d0f306f
1 changed files with 603 additions and 584 deletions
|
@ -15,6 +15,7 @@
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
#include "Core/Slippi/SlippiPlayback.h"
|
#include "Core/Slippi/SlippiPlayback.h"
|
||||||
#include "VideoCommon/OnScreenDisplay.h"
|
#include "VideoCommon/OnScreenDisplay.h"
|
||||||
|
#include "AudioCommon/AudioCommon.h"
|
||||||
|
|
||||||
#ifdef IS_PLAYBACK
|
#ifdef IS_PLAYBACK
|
||||||
#ifndef IMGUI_DEFINE_MATH_OPERATORS
|
#ifndef IMGUI_DEFINE_MATH_OPERATORS
|
||||||
|
@ -235,9 +236,13 @@ bool SeekBarBehavior(const ImRect& bb, ImGuiID id, int* v, int v_min, int v_max,
|
||||||
bool isActive = g.ActiveId == id;
|
bool isActive = g.ActiveId == id;
|
||||||
static bool isHeld = false;
|
static bool isHeld = false;
|
||||||
const bool hovered = ImGui::ItemHoverable(bb, id);
|
const bool hovered = ImGui::ItemHoverable(bb, id);
|
||||||
|
if (hovered) {
|
||||||
|
INFO_LOG(SLIPPI, "is Hovered: %d", id);
|
||||||
|
}
|
||||||
|
|
||||||
if (!isDown && isActive)
|
if (!isHeld && isActive) {
|
||||||
ImGui::ClearActiveID();
|
ImGui::ClearActiveID();
|
||||||
|
}
|
||||||
|
|
||||||
// Calculate mouse position if hovered
|
// Calculate mouse position if hovered
|
||||||
int new_value = 0;
|
int new_value = 0;
|
||||||
|
@ -279,6 +284,7 @@ bool SeekBarBehavior(const ImRect& bb, ImGuiID id, int* v, int v_min, int v_max,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isHeld) {
|
if (isHeld) {
|
||||||
|
ImGui::SetActiveID(id, window);
|
||||||
isHeld = isHeld && isDown;
|
isHeld = isHeld && isDown;
|
||||||
// If no longer held, slider was let go. Trigger mark edited
|
// If no longer held, slider was let go. Trigger mark edited
|
||||||
if (!isHeld) {
|
if (!isHeld) {
|
||||||
|
@ -344,8 +350,7 @@ bool SeekBarBehavior(const ImRect& bb, ImGuiID id, int* v, int v_min, int v_max,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VolumeBarBehavior(const ImRect& bb, ImGuiID id, int* v, int v_min, int v_max, float power,
|
bool VolumeBarBehavior(const ImRect& bb, ImGuiID id, int* v, int v_min, int v_max, float power,
|
||||||
ImGuiSliderFlags flags, ImVec4 color, ImVec2 valuesize, const char* label,
|
ImGuiSliderFlags flags, ImVec4 color)
|
||||||
char* value)
|
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
const ImGuiStyle& style = g.Style;
|
const ImGuiStyle& style = g.Style;
|
||||||
|
@ -373,15 +378,20 @@ bool VolumeBarBehavior(const ImRect& bb, ImGuiID id, int* v, int v_min, int v_ma
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool isDown = g.IO.MouseDown[0];
|
const bool isDown = g.IO.MouseDown[0];
|
||||||
|
const bool hovered = ImGui::ItemHoverable(bb, id);
|
||||||
|
static bool isHeld = false;
|
||||||
bool value_changed = false;
|
bool value_changed = false;
|
||||||
bool isActive = g.ActiveId == id;
|
bool isActive = g.ActiveId == id;
|
||||||
|
|
||||||
if (!isDown && isActive)
|
if (!isHeld && isActive)
|
||||||
ImGui::ClearActiveID();
|
ImGui::ClearActiveID();
|
||||||
|
|
||||||
|
if (isHeld)
|
||||||
|
ImGui::SetActiveID(id, window);
|
||||||
|
|
||||||
// Calculate mouse position if clicked or held
|
// Calculate mouse position if clicked or held
|
||||||
int new_value = 0;
|
int new_value = 0;
|
||||||
if (isDown)
|
if (isHeld || hovered)
|
||||||
{
|
{
|
||||||
const float mouse_abs_pos = g.IO.MousePos[axis];
|
const float mouse_abs_pos = g.IO.MousePos[axis];
|
||||||
float clicked_t = (slider_sz > 0.0f) ?
|
float clicked_t = (slider_sz > 0.0f) ?
|
||||||
|
@ -411,63 +421,49 @@ bool VolumeBarBehavior(const ImRect& bb, ImGuiID id, int* v, int v_min, int v_ma
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*v = ImLerp(v_min, v_max, clicked_t);
|
new_value = ImLerp(v_min, v_max, clicked_t);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only change value if left mouse button is actually down
|
// Only change value if left mouse button is actually down
|
||||||
if (*v != new_value && isDown)
|
if (*v != new_value && isDown)
|
||||||
{
|
{
|
||||||
|
value_changed = true;
|
||||||
*v = new_value;
|
*v = new_value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float new_grab_t = ImGui::SliderCalcRatioFromValueT<int, float>(
|
isHeld = isHeld ? isHeld && isDown : hovered && isDown;
|
||||||
ImGuiDataType_S32, new_value, v_min, v_max, power, linear_zero_pos);
|
|
||||||
float curr_grab_t = ImGui::SliderCalcRatioFromValueT<int, float>(ImGuiDataType_S32, *v, v_min,
|
float grab_t = ImGui::SliderCalcRatioFromValueT<int, float>(ImGuiDataType_S32, *v, v_min,
|
||||||
v_max, power, linear_zero_pos);
|
v_max, power, linear_zero_pos);
|
||||||
if (axis == ImGuiAxis_Y)
|
if (axis == ImGuiAxis_Y)
|
||||||
{
|
{
|
||||||
new_grab_t = 1.0f - new_grab_t;
|
grab_t = 1.0f - grab_t;
|
||||||
curr_grab_t = 1.0f - curr_grab_t;
|
|
||||||
}
|
}
|
||||||
const float new_grab_pos = ImLerp(slider_usable_pos_min, slider_usable_pos_max, new_grab_t);
|
|
||||||
const float curr_grab_pos = ImLerp(slider_usable_pos_min, slider_usable_pos_max, curr_grab_t);
|
const float grab_pos = ImLerp(slider_usable_pos_min, slider_usable_pos_max, grab_t);
|
||||||
ImRect new_grab_bb;
|
ImRect grab_bb;
|
||||||
ImRect curr_grab_bb;
|
|
||||||
if (axis == ImGuiAxis_X)
|
if (axis == ImGuiAxis_X)
|
||||||
{
|
{
|
||||||
new_grab_bb = ImRect(ImVec2(new_grab_pos, bb.Min.y), ImVec2(new_grab_pos, bb.Max.y));
|
grab_bb = ImRect(ImVec2(grab_pos, bb.Min.y), ImVec2(grab_pos, bb.Max.y));
|
||||||
curr_grab_bb = ImRect(ImVec2(curr_grab_pos, bb.Min.y), ImVec2(curr_grab_pos, bb.Max.y));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
new_grab_bb = ImRect(ImVec2(bb.Min.x, new_grab_pos), ImVec2(bb.Max.x, new_grab_pos));
|
grab_bb = ImRect(ImVec2(bb.Min.x, grab_pos), ImVec2(bb.Max.x, grab_pos));
|
||||||
curr_grab_bb = ImRect(ImVec2(bb.Min.x, curr_grab_pos), ImVec2(bb.Max.x, curr_grab_pos));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw all the things
|
|
||||||
|
|
||||||
// Grey background line
|
// Grey background line
|
||||||
window->DrawList->AddLine(
|
window->DrawList->AddLine(
|
||||||
ImVec2(bb.Min.x, bb.Max.y - 6), ImVec2(bb.Max.x, bb.Max.y - 6),
|
ImVec2(bb.Min.x, bb.Min.y + 5), ImVec2(bb.Max.x, bb.Min.y + 5),
|
||||||
ImGui::ColorConvertFloat4ToU32(ImVec4(1.0f, 1.0f, 1.0f, 0.5f * style.Alpha)), 4);
|
ImGui::ColorConvertFloat4ToU32(ImVec4(1.0f, 1.0f, 1.0f, 0.5f * style.Alpha)), 4);
|
||||||
|
|
||||||
|
// Colored line and circle indicator
|
||||||
|
window->DrawList->AddLine(ImVec2(bb.Min.x, bb.Min.y + 5), ImVec2(grab_bb.Min.x, bb.Min.y + 5), ImGui::ColorConvertFloat4ToU32(ImVec4(1.0f, 1.0f, 1.0f, 0.8f * style.Alpha)), 4);
|
||||||
|
|
||||||
if (isDown)
|
if (isHeld)
|
||||||
window->DrawList->AddText(ImVec2(new_grab_bb.GetCenter().x - valuesize.x / 2, bb.Max.y - 30),
|
|
||||||
ImColor(255, 255, 255), GetTimeForFrame(new_value).c_str());
|
|
||||||
|
|
||||||
// Colored line, circle indicator, and text
|
|
||||||
if (isDown)
|
|
||||||
{
|
|
||||||
window->DrawList->AddCircleFilled(
|
window->DrawList->AddCircleFilled(
|
||||||
ImVec2(new_grab_bb.Min.x, new_grab_bb.Max.y - 6), 6,
|
ImVec2(grab_bb.Min.x, grab_bb.Min.y + 5), 6,
|
||||||
ImGui::ColorConvertFloat4ToU32(ImVec4(0.0f, 1.0f, 0.0f, 1.0)));
|
ImGui::ColorConvertFloat4ToU32(ImVec4(1.0f, 1.0f, 1.0f, 0.8f * style.Alpha)));
|
||||||
}
|
|
||||||
|
|
||||||
window->DrawList->AddLine(
|
|
||||||
ImVec2(bb.Min.x, bb.Max.y - 6), ImVec2(curr_grab_bb.Min.x, bb.Max.y - 6),
|
|
||||||
ImGui::ColorConvertFloat4ToU32(ImVec4(0.0f, 1.0f, 0.0f, style.Alpha)), 4);
|
|
||||||
|
|
||||||
return value_changed;
|
return value_changed;
|
||||||
}
|
}
|
||||||
|
@ -475,16 +471,16 @@ bool VolumeBarBehavior(const ImRect& bb, ImGuiID id, int* v, int v_min, int v_ma
|
||||||
bool SeekBar(const char* label, ImVec4 color, int* v, int v_min, int v_max, float power, const char* format)
|
bool SeekBar(const char* label, ImVec4 color, int* v, int v_min, int v_max, float power, const char* format)
|
||||||
{
|
{
|
||||||
ImGuiWindow* window = ImGui::GetCurrentWindow();
|
ImGuiWindow* window = ImGui::GetCurrentWindow();
|
||||||
if (window->SkipItems)
|
if (window->SkipItems) {
|
||||||
|
INFO_LOG(SLIPPI, "skip");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
ImGuiContext& g = *GImGui;
|
|
||||||
const ImGuiStyle& style = g.Style;
|
|
||||||
const ImGuiID id = window->GetID(label);
|
const ImGuiID id = window->GetID(label);
|
||||||
const float w = ImGui::CalcItemWidth();
|
const float w = ImGui::GetWindowWidth() - 10;
|
||||||
|
|
||||||
const ImVec2 label_size = ImGui::CalcTextSize(label, NULL, true) * 1.0f;
|
const ImVec2 label_size = ImGui::CalcTextSize(label, NULL, true) * 1.0f;
|
||||||
const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y));
|
const ImRect frame_bb(window->DC.CursorPos + ImVec2(5, 0), window->DC.CursorPos + ImVec2(w, label_size.y));
|
||||||
|
|
||||||
const bool hovered = ImGui::ItemHoverable(frame_bb, id);
|
const bool hovered = ImGui::ItemHoverable(frame_bb, id);
|
||||||
if (hovered)
|
if (hovered)
|
||||||
|
@ -493,80 +489,28 @@ bool SeekBar(const char* label, ImVec4 color, int* v, int v_min, int v_max, floa
|
||||||
if (!format)
|
if (!format)
|
||||||
format = "%d";
|
format = "%d";
|
||||||
|
|
||||||
bool start_text_input = false;
|
|
||||||
const bool tab_focus_requested = ImGui::FocusableItemRegister(window, g.ActiveId == id);
|
|
||||||
if (tab_focus_requested || (hovered && g.IO.MouseClicked[0]))
|
|
||||||
{
|
|
||||||
ImGui::SetActiveID(id, window);
|
|
||||||
ImGui::FocusWindow(window);
|
|
||||||
|
|
||||||
if (tab_focus_requested || g.IO.KeyCtrl)
|
|
||||||
{
|
|
||||||
start_text_input = true;
|
|
||||||
g.ScalarAsInputTextId = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (start_text_input || (g.ActiveId == id && g.ScalarAsInputTextId == id))
|
|
||||||
return ImGui::InputScalarAsWidgetReplacement(frame_bb, id, label, ImGuiDataType_S32, v, format);
|
|
||||||
|
|
||||||
char value_buf[64];
|
char value_buf[64];
|
||||||
const char* value_buf_end = value_buf + ImFormatString(value_buf, IM_ARRAYSIZE(value_buf), format, *v);
|
const char* value_buf_end = value_buf + ImFormatString(value_buf, IM_ARRAYSIZE(value_buf), format, *v);
|
||||||
const bool value_changed = SeekBarBehavior(frame_bb, id, v, v_min, v_max, power, ImGuiSliderFlags_None, color, ImGui::CalcTextSize(value_buf, NULL, true), value_buf_end, value_buf);
|
const bool value_changed = SeekBarBehavior(frame_bb, id, v, v_min, v_max, power, ImGuiSliderFlags_None, color, ImGui::CalcTextSize(value_buf, NULL, true), value_buf_end, value_buf);
|
||||||
|
|
||||||
if (label_size.x > 0.0f)
|
|
||||||
ImGui::RenderText(ImVec2(frame_bb.Min.x + style.ItemInnerSpacing.x, frame_bb.Min.y + 25), label);
|
|
||||||
|
|
||||||
return value_changed;
|
return value_changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VolumeBar(const char* label, ImVec4 color, int* v, int v_min, int v_max, float power,
|
bool VolumeBar(const char* label, ImVec4 color, int* v, int v_min, int v_max, float power)
|
||||||
const char* format)
|
|
||||||
{
|
{
|
||||||
ImGuiWindow* window = ImGui::GetCurrentWindow();
|
ImGuiWindow* window = ImGui::GetCurrentWindow();
|
||||||
if (window->SkipItems)
|
if (window->SkipItems)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ImGuiContext& g = *GImGui;
|
|
||||||
const ImGuiStyle& style = g.Style;
|
|
||||||
const ImGuiID id = window->GetID(label);
|
const ImGuiID id = window->GetID(label);
|
||||||
const float w = ImGui::CalcItemWidth();
|
const ImRect frame_bb(window->DC.CursorPos + ImVec2(0, -6), window->DC.CursorPos + ImVec2(50, 5));
|
||||||
|
|
||||||
const ImVec2 label_size = ImGui::CalcTextSize(label, NULL, true) * 1.0f;
|
|
||||||
const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y));
|
|
||||||
|
|
||||||
const bool hovered = ImGui::ItemHoverable(frame_bb, id);
|
const bool hovered = ImGui::ItemHoverable(frame_bb, id);
|
||||||
if (hovered)
|
if (hovered) {
|
||||||
ImGui::SetHoveredID(id);
|
ImGui::SetHoveredID(id);
|
||||||
|
|
||||||
if (!format)
|
|
||||||
format = "%d";
|
|
||||||
|
|
||||||
bool start_text_input = false;
|
|
||||||
const bool tab_focus_requested = ImGui::FocusableItemRegister(window, g.ActiveId == id);
|
|
||||||
if (tab_focus_requested || (hovered && g.IO.MouseClicked[0]))
|
|
||||||
{
|
|
||||||
ImGui::SetActiveID(id, window);
|
|
||||||
ImGui::FocusWindow(window);
|
|
||||||
|
|
||||||
if (tab_focus_requested || g.IO.KeyCtrl)
|
|
||||||
{
|
|
||||||
start_text_input = true;
|
|
||||||
g.ScalarAsInputTextId = 0;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (start_text_input || (g.ActiveId == id && g.ScalarAsInputTextId == id))
|
|
||||||
return ImGui::InputScalarAsWidgetReplacement(frame_bb, id, label, ImGuiDataType_S32, v, format);
|
|
||||||
|
|
||||||
char value_buf[64];
|
|
||||||
const char* value_buf_end =
|
|
||||||
value_buf + ImFormatString(value_buf, IM_ARRAYSIZE(value_buf), format, *v);
|
|
||||||
const bool value_changed =
|
const bool value_changed =
|
||||||
VolumeBarBehavior(frame_bb, id, v, v_min, v_max, power, ImGuiSliderFlags_Vertical, color,
|
VolumeBarBehavior(frame_bb, id, v, v_min, v_max, power, ImGuiSliderFlags_None, color);
|
||||||
ImGui::CalcTextSize(value_buf, NULL, true), value_buf_end, value_buf);
|
|
||||||
|
|
||||||
if (label_size.x > 0.0f)
|
|
||||||
ImGui::RenderText(ImVec2(frame_bb.Min.x + style.ItemInnerSpacing.x, frame_bb.Min.y + 25),
|
|
||||||
label);
|
|
||||||
|
|
||||||
return value_changed;
|
return value_changed;
|
||||||
}
|
}
|
||||||
|
@ -602,9 +546,8 @@ void DrawSlippiPlaybackControls()
|
||||||
ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoBackground |
|
ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoBackground |
|
||||||
ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoFocusOnAppearing))
|
ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoFocusOnAppearing))
|
||||||
{
|
{
|
||||||
ImGui::PushItemWidth(ImGui::GetWindowWidth());
|
|
||||||
ImGui::SetCursorPos(ImVec2(0.0f, ImGui::GetWindowHeight() - 44));
|
ImGui::SetCursorPos(ImVec2(0.0f, ImGui::GetWindowHeight() - 44));
|
||||||
if (SeekBar("", ImVec4(1.0f, 0.0f, 0.0f, 1.0f), &frame, Slippi::PLAYBACK_FIRST_SAVE, g_playbackStatus->lastFrame, 1.0, "%d")) {
|
if (SeekBar("SlippiSeek", ImVec4(1.0f, 0.0f, 0.0f, 1.0f), &frame, Slippi::PLAYBACK_FIRST_SAVE, g_playbackStatus->lastFrame, 1.0, "%d")) {
|
||||||
INFO_LOG(SLIPPI, "seeking to %d", g_playbackStatus->targetFrameNum);
|
INFO_LOG(SLIPPI, "seeking to %d", g_playbackStatus->targetFrameNum);
|
||||||
Host_PlaybackSeek();
|
Host_PlaybackSeek();
|
||||||
}
|
}
|
||||||
|
@ -624,7 +567,17 @@ void DrawSlippiPlaybackControls()
|
||||||
Host_PlaybackSeek();
|
Host_PlaybackSeek();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::SameLine(0.0f, 0.0f);
|
if (ImGui::IsItemHovered()) {
|
||||||
|
ImGui::GetWindowDrawList()->AddRectFilled(
|
||||||
|
ImVec2(6.0f, ImGui::GetWindowHeight() - 62.0f),
|
||||||
|
ImVec2(175.0f, ImGui::GetWindowHeight() - 42.0f),
|
||||||
|
ImGui::ColorConvertFloat4ToU32(ImVec4(0.0f, 0.0f, 0.0f, 0.9f)));
|
||||||
|
ImGui::SetCursorPos(ImVec2(8.0f, ImGui::GetWindowHeight() - 60.0f));
|
||||||
|
ImGui::Text("Jump Back (Shift + Left Arrow)");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step back
|
||||||
|
ImGui::SetCursorPos(ImVec2(32.0f, ImGui::GetWindowHeight() - 30));
|
||||||
if (ButtonCustom(ICON_FA_STEP_BACKWARD, ImVec2(32.0f, 32.0f))) {
|
if (ButtonCustom(ICON_FA_STEP_BACKWARD, ImVec2(32.0f, 32.0f))) {
|
||||||
INFO_LOG(SLIPPI, "step back");
|
INFO_LOG(SLIPPI, "step back");
|
||||||
if (g_playbackStatus->targetFrameNum == INT_MAX) {
|
if (g_playbackStatus->targetFrameNum == INT_MAX) {
|
||||||
|
@ -632,7 +585,17 @@ void DrawSlippiPlaybackControls()
|
||||||
Host_PlaybackSeek();
|
Host_PlaybackSeek();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::SameLine(0.0f, 0.0f);
|
if (ImGui::IsItemHovered()) {
|
||||||
|
ImGui::GetWindowDrawList()->AddRectFilled(
|
||||||
|
ImVec2(6.0f, ImGui::GetWindowHeight() - 62.0f),
|
||||||
|
ImVec2(131.0f, ImGui::GetWindowHeight() - 42.0f),
|
||||||
|
ImGui::ColorConvertFloat4ToU32(ImVec4(0.0f, 0.0f, 0.0f, 0.9f)));
|
||||||
|
ImGui::SetCursorPos(ImVec2(8.0f, ImGui::GetWindowHeight() - 60.0f));
|
||||||
|
ImGui::Text("Step Back (Left Arrow)");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step forward
|
||||||
|
ImGui::SetCursorPos(ImVec2(64.0f, ImGui::GetWindowHeight() - 30));
|
||||||
if (ButtonCustom(ICON_FA_STEP_FORWARD, ImVec2(32.0f, 32.0f))) {
|
if (ButtonCustom(ICON_FA_STEP_FORWARD, ImVec2(32.0f, 32.0f))) {
|
||||||
INFO_LOG(SLIPPI, "step forward");
|
INFO_LOG(SLIPPI, "step forward");
|
||||||
if (g_playbackStatus->targetFrameNum == INT_MAX) {
|
if (g_playbackStatus->targetFrameNum == INT_MAX) {
|
||||||
|
@ -640,7 +603,17 @@ void DrawSlippiPlaybackControls()
|
||||||
Host_PlaybackSeek();
|
Host_PlaybackSeek();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::SameLine(0.0f, 0.0f);
|
if (ImGui::IsItemHovered()) {
|
||||||
|
ImGui::GetWindowDrawList()->AddRectFilled(
|
||||||
|
ImVec2(12.0f, ImGui::GetWindowHeight() - 62.0f),
|
||||||
|
ImVec2(162.0f, ImGui::GetWindowHeight() - 42.0f),
|
||||||
|
ImGui::ColorConvertFloat4ToU32(ImVec4(0.0f, 0.0f, 0.0f, 0.9f)));
|
||||||
|
ImGui::SetCursorPos(ImVec2(14.0f, ImGui::GetWindowHeight() - 60.0f));
|
||||||
|
ImGui::Text("Step Forward (Right Arrow)");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Jump forward
|
||||||
|
ImGui::SetCursorPos(ImVec2(96.0f, ImGui::GetWindowHeight() - 30));
|
||||||
if (ButtonCustom(ICON_FA_FAST_FORWARD, ImVec2(32.0f, 32.0f))) {
|
if (ButtonCustom(ICON_FA_FAST_FORWARD, ImVec2(32.0f, 32.0f))) {
|
||||||
INFO_LOG(SLIPPI, "fast_foward");
|
INFO_LOG(SLIPPI, "fast_foward");
|
||||||
if (g_playbackStatus->targetFrameNum == INT_MAX) {
|
if (g_playbackStatus->targetFrameNum == INT_MAX) {
|
||||||
|
@ -648,20 +621,43 @@ void DrawSlippiPlaybackControls()
|
||||||
Host_PlaybackSeek();
|
Host_PlaybackSeek();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::SameLine(ImGui::GetWindowWidth() - 64.0f);
|
if (ImGui::IsItemHovered()) {
|
||||||
|
ImGui::GetWindowDrawList()->AddRectFilled(
|
||||||
|
ImVec2(30.0f, ImGui::GetWindowHeight() - 62.0f),
|
||||||
|
ImVec2(222.0f, ImGui::GetWindowHeight() - 42.0f),
|
||||||
|
ImGui::ColorConvertFloat4ToU32(ImVec4(0.0f, 0.0f, 0.0f, 0.9f)));
|
||||||
|
ImGui::SetCursorPos(ImVec2(32.0f, ImGui::GetWindowHeight() - 60.0f));
|
||||||
|
ImGui::Text("Jump Forward (Shift + Right Arrow)");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Volume
|
||||||
|
static bool isIconHovered = false;
|
||||||
|
static bool isVolumeVisible = false;
|
||||||
|
int* volume = &SConfig::GetInstance().m_Volume;
|
||||||
|
static int prev;
|
||||||
|
ImGui::SetCursorPos(ImVec2(128.0f, ImGui::GetWindowHeight() - 30));
|
||||||
|
if (ButtonCustom(*volume == 0 ? ICON_FA_VOLUME_OFF : ICON_FA_VOLUME_UP, ImVec2(32.0f, 32.0f))) {
|
||||||
|
INFO_LOG(SLIPPI, "muting");
|
||||||
|
if (*volume == 0) {
|
||||||
|
*volume = prev == 0 ? 30 : prev; // todo: find good default value
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
prev = *volume;
|
||||||
|
*volume = 0;
|
||||||
|
}
|
||||||
|
AudioCommon::UpdateSoundStream();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::SetCursorPos(ImVec2(160.0f, ImGui::GetWindowHeight() - 15));
|
||||||
|
if (VolumeBar("SlippiVolume", ImVec4(1.0f, 0.0f, 0.0f, 1.0f), volume, 0, 100, 1.0)) {
|
||||||
|
AudioCommon::UpdateSoundStream();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Help
|
||||||
|
ImGui::SetCursorPos(ImVec2(ImGui::GetWindowWidth() - 64.0f, ImGui::GetWindowHeight() - 30));
|
||||||
if (ButtonCustom(ICON_FA_QUESTION_CIRCLE, ImVec2(32.0f, 32.0f))) {
|
if (ButtonCustom(ICON_FA_QUESTION_CIRCLE, ImVec2(32.0f, 32.0f))) {
|
||||||
showHelp = !showHelp;
|
showHelp = !showHelp;
|
||||||
}
|
}
|
||||||
ImGui::SameLine(ImGui::GetWindowWidth() - 32.0f);
|
|
||||||
if (ButtonCustom(ICON_FA_EXPAND, ImVec2(32.0f, 32.0f))) {
|
|
||||||
INFO_LOG(SLIPPI, "fullscreen");
|
|
||||||
Host_Fullscreen();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g_playbackStatus->isHardFFW) {
|
|
||||||
INFO_LOG(SLIPPI, "Ffw");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (showHelp) {
|
if (showHelp) {
|
||||||
ImGui::GetWindowDrawList()->AddRectFilled(
|
ImGui::GetWindowDrawList()->AddRectFilled(
|
||||||
ImVec2(ImGui::GetWindowWidth() - 300.0f, ImGui::GetWindowHeight() - 200.0f),
|
ImVec2(ImGui::GetWindowWidth() - 300.0f, ImGui::GetWindowHeight() - 200.0f),
|
||||||
|
@ -682,11 +678,34 @@ void DrawSlippiPlaybackControls()
|
||||||
ImGui::SetCursorPos(ImVec2(ImGui::GetWindowWidth() - 290.0f, ImGui::GetWindowHeight() - 70.0f));
|
ImGui::SetCursorPos(ImVec2(ImGui::GetWindowWidth() - 290.0f, ImGui::GetWindowHeight() - 70.0f));
|
||||||
ImGui::Text("Big jumps/seeks may take several seconds.");
|
ImGui::Text("Big jumps/seeks may take several seconds.");
|
||||||
}
|
}
|
||||||
|
if (ImGui::IsItemHovered()) {
|
||||||
|
ImGui::GetWindowDrawList()->AddRectFilled(
|
||||||
|
ImVec2(ImGui::GetWindowWidth() - 75.0f, ImGui::GetWindowHeight() - 62.0f),
|
||||||
|
ImVec2(ImGui::GetWindowWidth() - 16.0f, ImGui::GetWindowHeight() - 42.0f),
|
||||||
|
ImGui::ColorConvertFloat4ToU32(ImVec4(0.0f, 0.0f, 0.0f, 0.9f)));
|
||||||
|
ImGui::SetCursorPos(ImVec2(ImGui::GetWindowWidth() - 73.0f, ImGui::GetWindowHeight() - 60.0f));
|
||||||
|
ImGui::Text("View Help");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fullscreen
|
||||||
|
ImGui::SetCursorPos(ImVec2(ImGui::GetWindowWidth() - 32.0f, ImGui::GetWindowHeight() - 30));
|
||||||
|
if (ButtonCustom(ICON_FA_EXPAND, ImVec2(32.0f, 32.0f))) {
|
||||||
|
INFO_LOG(SLIPPI, "fullscreen");
|
||||||
|
Host_Fullscreen();
|
||||||
|
}
|
||||||
|
if (ImGui::IsItemHovered()) {
|
||||||
|
ImGui::GetWindowDrawList()->AddRectFilled(
|
||||||
|
ImVec2(ImGui::GetWindowWidth() - 172.0f, ImGui::GetWindowHeight() - 62.0f),
|
||||||
|
ImVec2(ImGui::GetWindowWidth() - 6.0f, ImGui::GetWindowHeight() - 42.0f),
|
||||||
|
ImGui::ColorConvertFloat4ToU32(ImVec4(0.0f, 0.0f, 0.0f, 0.9f)));
|
||||||
|
ImGui::SetCursorPos(ImVec2(ImGui::GetWindowWidth() - 170.0f, ImGui::GetWindowHeight() - 60.0f));
|
||||||
|
ImGui::Text("Toggle Fullscreen (Alt + Enter)");
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::PopStyleVar();
|
ImGui::PopStyleVar();
|
||||||
ImGuiWindow* window = ImGui::GetCurrentWindow();
|
|
||||||
ImGui::SetCursorPos(ImVec2(135.0f, window->DC.CursorPosPrevLine.y + 6.0f));
|
|
||||||
|
|
||||||
|
// Time text
|
||||||
|
ImGui::SetCursorPos(ImVec2(220.0f, ImGui::GetWindowHeight() - 23.5f));
|
||||||
auto playbackTime = GetTimeForFrame(g_playbackStatus->currentPlaybackFrame);
|
auto playbackTime = GetTimeForFrame(g_playbackStatus->currentPlaybackFrame);
|
||||||
auto endTime = GetTimeForFrame(g_playbackStatus->lastFrame);
|
auto endTime = GetTimeForFrame(g_playbackStatus->lastFrame);
|
||||||
auto timeString = playbackTime + " / " + endTime;
|
auto timeString = playbackTime + " / " + endTime;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue