yaze 0.2.0
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
input.h
Go to the documentation of this file.
1#ifndef YAZE_APP_CORE_INPUT_H
2#define YAZE_APP_CORE_INPUT_H
3
4#define IMGUI_DEFINE_MATH_OPERATORS
5
6#include <cstddef>
7#include <cstdint>
8#include <functional>
9#include <optional>
10#include <string>
11#include <vector>
12
13#include "absl/strings/string_view.h"
14#include "app/gfx/bitmap.h"
16#include "app/gfx/snes_tile.h"
17#include "app/gui/canvas.h"
18#include "app/gui/color.h"
19#include "imgui/imgui.h"
20#include "imgui/misc/cpp/imgui_stdlib.h"
21#include "imgui_memory_editor.h"
22
23namespace yaze {
24namespace app {
25namespace gui {
26
27constexpr ImVec2 kDefaultModalSize = ImVec2(200, 0);
28constexpr ImVec2 kZeroPos = ImVec2(0, 0);
29
30IMGUI_API bool InputHex(const char* label, uint64_t* data);
31IMGUI_API bool InputHex(const char* label, int* data, int num_digits = 4,
32 float input_width = 50.f);
33
34IMGUI_API bool InputHexShort(const char* label, uint32_t* data);
35IMGUI_API bool InputHexWord(const char* label, uint16_t* data,
36 float input_width = 50.f, bool no_step = false);
37IMGUI_API bool InputHexWord(const char* label, int16_t* data,
38 float input_width = 50.f, bool no_step = false);
39IMGUI_API bool InputHexByte(const char* label, uint8_t* data,
40 float input_width = 50.f, bool no_step = false);
41
42IMGUI_API bool InputHexByte(const char* label, uint8_t* data, uint8_t max_value,
43 float input_width = 50.f, bool no_step = false);
44
45IMGUI_API bool ListBox(const char* label, int* current_item,
46 const std::vector<std::string>& items,
47 int height_in_items = -1);
48
49bool InputTileInfo(const char* label, gfx::TileInfo* tile_info);
50
51using ItemLabelFlags = enum ItemLabelFlag {
52 Left = 1u << 0u,
53 Right = 1u << 1u,
54 Default = Left,
55};
56
57IMGUI_API void ItemLabel(absl::string_view title, ItemLabelFlags flags);
58
59IMGUI_API ImGuiID GetID(const std::string& id);
60
61void FileDialogPipeline(absl::string_view display_key,
62 absl::string_view file_extensions,
63 std::optional<absl::string_view> button_text,
64 std::function<void()> callback);
65
66} // namespace gui
67} // namespace app
68} // namespace yaze
69
70#endif
SNES 16-bit tile metadata container.
Definition snes_tile.h:50
bool InputHexByte(const char *label, uint8_t *data, float input_width, bool no_step)
Definition input.cc:175
void ItemLabel(absl::string_view title, ItemLabelFlags flags)
Definition input.cc:195
constexpr ImVec2 kDefaultModalSize
Definition input.h:27
bool InputHex(const char *label, uint64_t *data)
Definition input.cc:142
bool InputTileInfo(const char *label, gfx::TileInfo *tile_info)
Definition input.cc:250
void FileDialogPipeline(absl::string_view display_key, absl::string_view file_extensions, std::optional< absl::string_view > button_text, std::function< void()> callback)
Definition input.cc:266
bool InputHexShort(const char *label, uint32_t *data)
Definition input.cc:155
ImGuiID GetID(const std::string &id)
Definition input.cc:264
enum ItemLabelFlag { Left=1u<< 0u, Right=1u<< 1u, Default=Left, } ItemLabelFlags
Definition input.h:51
constexpr ImVec2 kZeroPos
Definition input.h:28
bool ListBox(const char *label, int *current_item, const std::vector< std::string > &items, int height_in_items)
Definition input.cc:238
bool InputHexWord(const char *label, uint16_t *data, float input_width, bool no_step)
Definition input.cc:161
Definition common.cc:22