| e8555c89 Andy McCall |
1 |
#ifndef IMGUI_CHARACTER_HH |
| 2 |
#define IMGUI_CHARACTER_HH |
| 3 |
|
| 4 |
#include "ImGuiPart.hh" |
| 5 |
|
| 6 |
#include "GLUtil.hh" |
| 7 |
#include "gl_vec.hh" |
| 8 |
|
| 9 |
#include <string> |
| 10 |
|
| 11 |
namespace openmsx { |
| 12 |
|
| 13 |
class ImGuiCharacter final : public ImGuiPart |
| 14 |
{ |
| 15 |
public: |
| 16 |
ImGuiCharacter(ImGuiManager& manager_, size_t index); |
| 17 |
|
| 18 |
[[nodiscard]] zstring_view iniName() const override { return title; } |
| 19 |
void save(ImGuiTextBuffer& buf) override; |
| 20 |
void loadLine(std::string_view name, zstring_view value) override; |
| 21 |
void paint(MSXMotherBoard* motherBoard) override; |
| 22 |
|
| 23 |
private: |
| 24 |
static void renderPatterns(int mode, std::span<const uint32_t, 16> palette, |
| 25 |
int fgCol, int bgCol, int fgBlink, int bgBlink, |
| 26 |
VramTable& pat, VramTable& col, int lines, std::span<uint32_t> output); |
| 27 |
void initHexDigits(); |
| 28 |
|
| 29 |
public: |
| 30 |
bool show = true; |
| 31 |
|
| 32 |
private: |
| 33 |
std::string title; |
| 34 |
|
| 35 |
int zoom = 0; |
| 36 |
int overrideColorValue = 0xf1; |
| 37 |
bool overrideAll = false; |
| 38 |
bool overrideMode = false; |
| 39 |
bool overrideFgCol = false; |
| 40 |
bool overrideBgCol = false; |
| 41 |
bool overrideFgBlink = false; |
| 42 |
bool overrideBgBlink = false; |
| 43 |
bool overrideBlink = false; |
| 44 |
bool overridePat = false; |
| 45 |
bool overrideCol = false; |
| 46 |
bool overrideNam = false; |
| 47 |
bool overrideRows = false; |
| 48 |
bool overrideColor0 = false; |
| 49 |
bool grid = true; |
| 50 |
bool nameTableOverlay = false; |
| 51 |
bool overrideColorTable = false; |
| 52 |
bool rasterBeam = false; |
| 53 |
gl::vec4 gridColor{0.0f, 0.0f, 0.0f, 0.5f}; |
| 54 |
gl::vec4 rasterBeamColor{1.0f, 0.0f, 0.0f, 0.8f}; |
| 55 |
|
| 56 |
enum CharScrnMode : int { TEXT40, TEXT80, SCR1, SCR2, SCR3, SCR4, OTHER }; |
| 57 |
int manualMode = 0; |
| 58 |
int manualFgCol = 15; |
| 59 |
int manualBgCol = 4; |
| 60 |
int manualFgBlink = 14; |
| 61 |
int manualBgBlink = 1; |
| 62 |
int manualBlink = 1; |
| 63 |
int manualPatBase = 0; |
| 64 |
int manualColBase = 0; |
| 65 |
int manualNamBase = 0; |
| 66 |
int manualRows = 0; |
| 67 |
int manualColor0 = 16; |
| 68 |
gl::vecN<2, int> gridPosition; |
| 69 |
|
| 70 |
gl::Texture patternTex{gl::Null{}}; |
| 71 |
gl::Texture gridTex {gl::Null{}}; |
| 72 |
gl::Texture smallHexDigits{gl::Null{}}; |
| 73 |
|
| 74 |
static constexpr auto persistentElements = std::tuple{ |
| 75 |
PersistentElement {"show", &ImGuiCharacter::show}, |
| 76 |
PersistentElement {"overrideAll", &ImGuiCharacter::overrideAll}, |
| 77 |
PersistentElement {"overrideMode", &ImGuiCharacter::overrideMode}, |
| 78 |
PersistentElement {"overrideFgCol", &ImGuiCharacter::overrideFgCol}, |
| 79 |
PersistentElement {"overrideBgCol", &ImGuiCharacter::overrideBgCol}, |
| 80 |
PersistentElement {"overrideFgBlink", &ImGuiCharacter::overrideFgBlink}, |
| 81 |
PersistentElement {"overrideBgBlink", &ImGuiCharacter::overrideBgBlink}, |
| 82 |
PersistentElement {"overrideBlink", &ImGuiCharacter::overrideBlink}, |
| 83 |
PersistentElement {"overridePat", &ImGuiCharacter::overridePat}, |
| 84 |
PersistentElement {"overrideCol", &ImGuiCharacter::overrideCol}, |
| 85 |
PersistentElement {"overrideNam", &ImGuiCharacter::overrideNam}, |
| 86 |
PersistentElement {"overrideRows", &ImGuiCharacter::overrideRows}, |
| 87 |
PersistentElement {"overrideColor0", &ImGuiCharacter::overrideColor0}, |
| 88 |
PersistentElementMax{"zoom", &ImGuiCharacter::zoom, 8}, |
| 89 |
PersistentElement {"showGrid", &ImGuiCharacter::grid}, |
| 90 |
PersistentElement {"overlay", &ImGuiCharacter::nameTableOverlay}, |
| 91 |
PersistentElement {"overrideColorTable", &ImGuiCharacter::overrideColorTable}, |
| 92 |
PersistentElement {"overrideColorValue", &ImGuiCharacter::overrideColorValue}, |
| 93 |
PersistentElement {"showRasterBeam", &ImGuiCharacter::rasterBeam}, |
| 94 |
PersistentElement {"rasterBeamColor", &ImGuiCharacter::rasterBeamColor}, |
| 95 |
PersistentElement {"gridColor", &ImGuiCharacter::gridColor}, |
| 96 |
PersistentElementMax{"mode", &ImGuiCharacter::manualMode, OTHER}, |
| 97 |
PersistentElementMax{"fgCol", &ImGuiCharacter::manualFgCol, 16}, |
| 98 |
PersistentElementMax{"bgCol", &ImGuiCharacter::manualBgCol, 16}, |
| 99 |
PersistentElementMax{"fgBlink", &ImGuiCharacter::manualFgBlink, 16}, |
| 100 |
PersistentElementMax{"bgBlink", &ImGuiCharacter::manualBgBlink, 16}, |
| 101 |
PersistentElement {"blink", &ImGuiCharacter::manualBlink}, |
| 102 |
PersistentElementMax{"patBase", &ImGuiCharacter::manualPatBase, 0x20000}, |
| 103 |
PersistentElementMax{"colBase", &ImGuiCharacter::manualColBase, 0x20000}, |
| 104 |
PersistentElementMax{"namBase", &ImGuiCharacter::manualNamBase, 0x20000}, |
| 105 |
PersistentElementMax{"rows", &ImGuiCharacter::manualRows, 3}, |
| 106 |
PersistentElementMax{"color0", &ImGuiCharacter::manualColor0, 16 + 1} |
| 107 |
}; |
| 108 |
}; |
| 109 |
|
| 110 |
} |
| 111 |
|
| 112 |
#endif |