mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Render grid
This commit is contained in:
1 parent
c2e8577756
commit
4395da7c7e
1 file changed
+25
@@ -213,6 +213,30 @@ private:
|
||||
float &spacing_;
|
||||
};
|
||||
|
||||
class SnapGrid : public UI::View {
|
||||
public:
|
||||
SnapGrid(int leftMargin, int rightMargin, int topMargin, int bottomMargin, u32 color) {
|
||||
x1 = leftMargin;
|
||||
x2 = rightMargin;
|
||||
y1 = topMargin;
|
||||
y2 = bottomMargin;
|
||||
col = color;
|
||||
}
|
||||
|
||||
void Draw(UIContext &dc) override {
|
||||
if (g_Config.bTouchSnapToGrid) {
|
||||
for (int x = x1; x < x2; x += g_Config.iTouchSnapGridSize)
|
||||
dc.Draw()->vLine(x, y1, y2, col);
|
||||
for (int y = y1; y < y2; y += g_Config.iTouchSnapGridSize)
|
||||
dc.Draw()->hLine(x1, y, x2, col);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
int x1, x2, y1, y2;
|
||||
u32 col;
|
||||
};
|
||||
|
||||
TouchControlLayoutScreen::TouchControlLayoutScreen() {
|
||||
pickedControl_ = 0;
|
||||
};
|
||||
@@ -455,6 +479,7 @@ void TouchControlLayoutScreen::CreateViews() {
|
||||
for (size_t i = 0; i < controls_.size(); i++) {
|
||||
root_->Add(controls_[i]);
|
||||
}
|
||||
root_->Add(new SnapGrid(leftColumnWidth+10, bounds.w, 0, bounds.h, 0x7FFFFFFF));
|
||||
}
|
||||
|
||||
// return the control which was picked up by the touchEvent. If a control
|
||||
|
||||
Reference in new issue
Block a user