This commit is contained in:
Arnaud Jamin
2023-10-04 09:37:35 -04:00
parent 496439fe20
commit 901b92e70c
50 changed files with 861 additions and 592 deletions
@@ -9,8 +9,14 @@
#include "InputMappingContext.h"
//--------------------------------------------------------------------------------------------------------------------------
UCogInputWindow_Actions::UCogInputWindow_Actions()
void UCogInputWindow_Actions::RenderHelp()
{
ImGui::Text(
"This window display the current state of each Input Action. "
"It can also be used to inject inputs to help debugging. "
"The input action are read from a Input Mapping Context defined in '%s' data asset. "
, TCHAR_TO_ANSI(*GetNameSafe(ActionAsset))
);
}
//--------------------------------------------------------------------------------------------------------------------------
@@ -19,27 +25,6 @@ void UCogInputWindow_Actions::PreRender(ImGuiWindowFlags& WindowFlags)
WindowFlags = ImGuiWindowFlags_MenuBar;
}
//--------------------------------------------------------------------------------------------------------------------------
void DrawAxis(const char* Format, const char* ActionName, float CurrentValue, float* InjectValue)
{
ImGui::PushID(Format);
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::Text(Format, ActionName);
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(-1);
ImGui::BeginDisabled();
ImGui::SliderFloat("##Value", &CurrentValue, -1.0f, 1.0f, "%0.2f");
ImGui::EndDisabled();
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(-1);
FCogWindowWidgets::SliderWithReset("##Inject", InjectValue, -1.0f, 1.0f, 0.0f, "%0.2f");
ImGui::PopID();
}
//--------------------------------------------------------------------------------------------------------------------------
void UCogInputWindow_Actions::RenderContent()
{
@@ -120,7 +105,7 @@ void UCogInputWindow_Actions::RenderContent()
const ImVec4 ActiveColor(1, 0.8f, 0, 1);
const ImVec4 InnactiveColor(0.3f, 0.3f, 0.3f, 1);
const ImVec2 ButtonWidth(FCogWindowWidgets::TextBaseWidth * 10, 0);
const ImVec2 ButtonWidth(FCogWindowWidgets::GetFontWidth() * 10, 0);
ImGui::TableNextColumn();
ImGui::BeginDisabled();
@@ -202,3 +187,24 @@ void UCogInputWindow_Actions::RenderTick(float DeltaSeconds)
ActionInfo.Inject(*EnhancedInput, IsTimeToRepeat);
}
}
//--------------------------------------------------------------------------------------------------------------------------
void UCogInputWindow_Actions::DrawAxis(const char* Format, const char* ActionName, float CurrentValue, float* InjectValue)
{
ImGui::PushID(Format);
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::Text(Format, ActionName);
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(-1);
ImGui::BeginDisabled();
ImGui::SliderFloat("##Value", &CurrentValue, -1.0f, 1.0f, "%0.2f");
ImGui::EndDisabled();
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(-1);
FCogWindowWidgets::SliderWithReset("##Inject", InjectValue, -1.0f, 1.0f, 0.0f, "%0.2f");
ImGui::PopID();
}
@@ -8,23 +8,32 @@
class UInputAction;
class UCogInputDataAsset_Actions;
UCLASS()
UCLASS(Config = Cog)
class COGINPUT_API UCogInputWindow_Actions : public UCogWindow
{
GENERATED_BODY()
public:
UCogInputWindow_Actions();
protected:
void RenderHelp()
virtual void PreRender(ImGuiWindowFlags& WindowFlags) override;
virtual void RenderContent() override;
virtual void RenderTick(float DeltaSeconds) override;
virtual void DrawAxis(const char* Format, const char* ActionName, float CurrentValue, float* InjectValue);
TWeakObjectPtr<UCogInputDataAsset_Actions> ActionsAsset;
private:
UPROPERTY(Config)
float RepeatPeriod = 0.5f;
UPROPERTY(Config)
float RepeatTime = 0.0f;
TArray<FCogInjectActionInfo> Actions;
};