openMSX
ImGuiSpriteViewer.hh
Go to the documentation of this file.
1#ifndef IMGUI_SPRITE_VIEWER_HH
2#define IMGUI_SPRITE_VIEWER_HH
3
4#include "ImGuiPart.hh"
5
6#include "GLUtil.hh"
7#include "gl_vec.hh"
8
9namespace openmsx {
10
11class ImGuiSpriteViewer final : public ImGuiPart
12{
13public:
15
16 [[nodiscard]] zstring_view iniName() const override { return "sprite viewer"; }
17 void save(ImGuiTextBuffer& buf) override;
18 void loadLine(std::string_view name, zstring_view value) override;
19 void paint(MSXMotherBoard* motherBoard) override;
20
21public:
22 bool show = false;
23
24private:
25 int manual = 0; // 0 -> use VDP settings, 1 -> use manual settings
26 int manualMode = 1;
27 int manualSize = 8;
28 int manualMag = 0;
29 int manualTransparent = 0;
30 int manualPatBase = 0;
31 int manualAttBase = 0;
32 int manualVerticalScroll = 0;
33 int manualLines = 0; // 0->192, 1->212, 2->256
34 int zoom = 0; // 0->1x, 1->2x, ..., 7->8x
35 int checkerBoardSize = 4;
36 int boundingBoxOnAll = 0;
37 gl::vec4 gridColor{0.5f, 0.5f, 0.5f, 0.5f}; // RGBA
38 gl::vec4 checkerBoardColor1{0.2f, 0.2f, 0.2f, 0.8f}; // RGBA
39 gl::vec4 checkerBoardColor2{0.4f, 0.4f, 0.4f, 0.8f}; // RGBA
40 gl::vec4 boundingBoxColor {1.0f, 0.0f, 0.0f, 0.8f}; // RGBA
41 bool grid = true;
42 bool drawBoundingBox = true;
43 bool enableLimitPerLine = true;
44 bool enableStopY = true;
45
46 gl::Texture patternTex {gl::Null{}}; // TODO also deallocate when needed
47 gl::Texture gridTex {gl::Null{}};
48 gl::Texture zoomGridTex{gl::Null{}};
49 gl::Texture checkerTex {gl::Null{}};
50 gl::Texture renderTex {gl::Null{}};
51
52 static constexpr auto validSizes = {8, 16};
53 static constexpr auto persistentElements = std::tuple{
55 PersistentElementMax{"override", &ImGuiSpriteViewer::manual, 2},
56 PersistentElementMinMax{"mode", &ImGuiSpriteViewer::manualMode, 1, 3}, // 1 or 2
57 PersistentElementEnum{"size", &ImGuiSpriteViewer::manualSize, validSizes},
58 PersistentElementMax{"mag", &ImGuiSpriteViewer::manualMag, 2},
59 PersistentElementMax{"transparent", &ImGuiSpriteViewer::manualTransparent, 2},
60 PersistentElementMax{"patBase", &ImGuiSpriteViewer::manualPatBase, 0x20000},
61 PersistentElementMax{"attBase", &ImGuiSpriteViewer::manualAttBase, 0x20000},
62 PersistentElementMax{"verticalScroll", &ImGuiSpriteViewer::manualVerticalScroll, 256},
63 PersistentElementMax{"lines", &ImGuiSpriteViewer::manualLines, 3},
64 PersistentElementMax{"zoom", &ImGuiSpriteViewer::zoom, 8},
65 PersistentElement{"showGrid", &ImGuiSpriteViewer::grid},
66 PersistentElementMax{"checkerBoardSize", &ImGuiSpriteViewer::checkerBoardSize, 256},
67 PersistentElement{"gridColor", &ImGuiSpriteViewer::gridColor},
68 PersistentElement{"checkerBoardColor1", &ImGuiSpriteViewer::checkerBoardColor1},
69 PersistentElement{"checkerBoardColor2", &ImGuiSpriteViewer::checkerBoardColor2},
70 PersistentElement{"boundingBox", &ImGuiSpriteViewer::drawBoundingBox},
71 PersistentElement{"boundingBoxColor", &ImGuiSpriteViewer::boundingBoxColor},
72 PersistentElement{"spritesPerLineLimit", &ImGuiSpriteViewer::enableLimitPerLine},
73 PersistentElement{"stopY", &ImGuiSpriteViewer::enableStopY}
74 };
75};
76
77} // namespace openmsx
78
79#endif
Most basic/generic texture: only contains a texture ID.
Definition GLUtil.hh:36
ImGuiPart(ImGuiManager &manager_)
Definition ImGuiPart.hh:12
void save(ImGuiTextBuffer &buf) override
void paint(MSXMotherBoard *motherBoard) override
void loadLine(std::string_view name, zstring_view value) override
zstring_view iniName() const override
Like std::string_view, but with the extra guarantee that it refers to a zero-terminated string.
This file implemented 3 utility functions:
Definition Autofire.cc:9
PersistentElement(zstring_view, T C::*) -> PersistentElement< C, T >