Files
sphaira/sphaira/include/ui/menus/ghdl.hpp
ITotalJustice 78bda75985 add touch support (#77)
* initial work on touch support

* add touch support to all objects

* add touch scrolling, fix scrollbar, fix appstore search

- when fireing an action, the action array may change. so the loop should break early as soon as an action is handled.
  this fixes the appstore search when pressing B.
- scrollbar no longer goes oob. fixes #76

currently, scrolling has no acceleration.
2025-01-06 22:37:38 +00:00

76 lines
1.5 KiB
C++

#pragma once
#include "ui/menus/menu_base.hpp"
#include "ui/list.hpp"
#include "fs.hpp"
#include "option.hpp"
#include <vector>
#include <string>
namespace sphaira::ui::menu::gh {
struct AssetEntry {
std::string name;
std::string path;
std::string pre_install_message;
std::string post_install_message;
};
struct Entry {
fs::FsPath json_path;
std::string url;
std::string owner;
std::string repo;
std::string tag;
std::string pre_install_message;
std::string post_install_message;
std::vector<AssetEntry> assets;
};
struct GhApiAsset {
std::string name;
std::string content_type;
u64 size;
u64 download_count;
std::string browser_download_url;
};
struct GhApiEntry {
std::string tag_name;
std::string name;
std::vector<GhApiAsset> assets;
};
struct Menu final : MenuBase {
Menu();
~Menu();
void Update(Controller* controller, TouchInfo* touch) override;
void Draw(NVGcontext* vg, Theme* theme) override;
void OnFocusGained() override;
private:
void SetIndex(s64 index);
void Scan();
void LoadEntriesFromPath(const fs::FsPath& path);
auto GetEntry() -> Entry& {
return m_entries[m_index];
}
auto GetEntry() const -> const Entry& {
return m_entries[m_index];
}
void Sort();
void UpdateSubheading();
private:
std::vector<Entry> m_entries;
s64 m_index{};
s64 m_index_offset{};
std::unique_ptr<List> m_list;
};
} // namespace sphaira::ui::menu::gh