2023-12-16 17:36:57 +01:00
|
|
|
#pragma once
|
2024-11-27 20:44:36 +01:00
|
|
|
|
2023-12-16 17:36:57 +01:00
|
|
|
#include "CategoryRenderer.h"
|
2024-11-27 20:44:36 +01:00
|
|
|
#include "ConfigDefines.h"
|
|
|
|
#include "ConfigDisplayItem.h"
|
2024-08-04 20:59:07 +02:00
|
|
|
#include "plugin/PluginLoadWrapper.h"
|
2024-11-27 20:44:36 +01:00
|
|
|
#include "utils/input/Input.h"
|
|
|
|
|
|
|
|
#include <cstdint>
|
2024-08-04 20:59:07 +02:00
|
|
|
#include <functional>
|
2023-12-16 17:36:57 +01:00
|
|
|
#include <memory>
|
|
|
|
#include <vector>
|
2024-11-27 20:44:36 +01:00
|
|
|
#include <wups/config.h>
|
2023-12-16 17:36:57 +01:00
|
|
|
|
|
|
|
class ConfigRenderer {
|
|
|
|
|
|
|
|
public:
|
2024-11-27 20:44:36 +01:00
|
|
|
explicit ConfigRenderer(std::vector<ConfigDisplayItem> &&vec);
|
|
|
|
|
|
|
|
~ConfigRenderer();
|
2023-12-16 17:36:57 +01:00
|
|
|
|
|
|
|
ConfigSubState Update(Input &input, const WUPSConfigSimplePadData &simpleInputData, const WUPSConfigComplexPadData &complexInputData);
|
|
|
|
|
|
|
|
void Render() const;
|
|
|
|
|
2024-05-03 11:55:27 +02:00
|
|
|
[[nodiscard]] bool NeedsRedraw() const;
|
|
|
|
|
|
|
|
void ResetNeedsRedraw();
|
|
|
|
|
2024-08-04 20:59:07 +02:00
|
|
|
bool GetActivePluginsIfChanged(std::vector<PluginLoadWrapper> &result);
|
|
|
|
|
2023-12-16 17:36:57 +01:00
|
|
|
private:
|
|
|
|
ConfigSubState UpdateStateMain(const Input &input);
|
|
|
|
|
|
|
|
void RenderStateMain() const;
|
|
|
|
|
2024-08-04 16:42:24 +02:00
|
|
|
void DrawConfigEntry(uint32_t yOffset, const GeneralConfigInformation &configInformation, bool isHighlighted, bool isActive) const;
|
2024-11-27 20:44:36 +01:00
|
|
|
|
|
|
|
void CallOnCloseCallback(const GeneralConfigInformation &info, const std::vector<std::unique_ptr<WUPSConfigAPIBackend::WUPSConfigCategory>> &categories);
|
|
|
|
void CallOnCloseCallback(const GeneralConfigInformation &info, const WUPSConfigAPIBackend::WUPSConfig &config);
|
2023-12-16 17:36:57 +01:00
|
|
|
|
2024-08-04 16:42:24 +02:00
|
|
|
const std::vector<std::reference_wrapper<ConfigDisplayItem>> &GetConfigList() const;
|
|
|
|
|
2023-12-16 17:36:57 +01:00
|
|
|
enum State {
|
|
|
|
STATE_MAIN = 0,
|
|
|
|
STATE_SUB = 1,
|
|
|
|
};
|
|
|
|
|
|
|
|
std::vector<ConfigDisplayItem> mConfigs;
|
2024-08-04 16:42:24 +02:00
|
|
|
std::vector<std::reference_wrapper<ConfigDisplayItem>> mAllConfigs;
|
2024-08-04 15:39:08 +02:00
|
|
|
std::vector<std::reference_wrapper<ConfigDisplayItem>> mActiveConfigs;
|
2023-12-16 17:36:57 +01:00
|
|
|
std::unique_ptr<CategoryRenderer> mCategoryRenderer = {};
|
|
|
|
|
|
|
|
State mState = STATE_MAIN;
|
|
|
|
|
|
|
|
int32_t mCursorPos = 0;
|
|
|
|
int32_t mRenderOffset = 0;
|
|
|
|
int32_t mCurrentOpen = -1;
|
2024-05-03 11:55:27 +02:00
|
|
|
|
2024-08-04 15:39:08 +02:00
|
|
|
bool mNeedRedraw = true;
|
2024-08-04 16:42:24 +02:00
|
|
|
bool mSetActivePluginsMode = false;
|
|
|
|
bool mActivePluginsDirty = false;
|
2023-12-16 17:36:57 +01:00
|
|
|
};
|