From 6a5f553fea496a12dc383968508bef18d671ccef Mon Sep 17 00:00:00 2001 From: otya128 Date: Sun, 25 Dec 2016 22:05:18 +0900 Subject: [PATCH] Fix DIALOG rendering --- SMILEBASIC/dialog.d | 35 ++++++++++++++++++++++++++++++++--- SMILEBASIC/petitcomputer.d | 2 +- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/SMILEBASIC/dialog.d b/SMILEBASIC/dialog.d index 0fab6b0..26c0431 100644 --- a/SMILEBASIC/dialog.d +++ b/SMILEBASIC/dialog.d @@ -44,20 +44,49 @@ class Dialog : DialogBase this.petitcom = petitcom; } private int result; + private SDL_Rect area; + void renderBackground() + { + int w = 16, h = 16; + glDepthMask(GL_FALSE); + glDisable(GL_TEXTURE_2D); + glColor3ub(248, 248, 248); + glBegin(GL_QUADS); + glVertex2i(0, 0); + glVertex2i(area.w, 0); + glVertex2i(area.w, area.h); + glVertex2i(0, area.h); + glEnd(); + glColor3ub(192, 192, 192); + glBegin(GL_LINES); + for (int y = 0; y < area.h; y += h) + { + glVertex2i(0, y); + glVertex2i(area.w, y); + } + for (int x = 0; x < area.w; x += w) + { + glVertex2i(x, 0); + glVertex2i(x, area.h); + } + glEnd(); + glDepthMask(GL_TRUE); + } override void render() { - + petitcom.chScreen2(area.x, area.y, area.w, area.h); + renderBackground(); } int show(wstring text) { petitcom.dialog = this; - auto area = petitcom.showTouchScreen(); + area = petitcom.showTouchScreen(); while (true) { auto to = petitcom.touchPosition(); - + SDL_Delay(16); } petitcom.hideTouchScreen(); return result; diff --git a/SMILEBASIC/petitcomputer.d b/SMILEBASIC/petitcomputer.d index 11754fc..14a04c2 100644 --- a/SMILEBASIC/petitcomputer.d +++ b/SMILEBASIC/petitcomputer.d @@ -1626,7 +1626,7 @@ class PetitComputer return currentDisplay.rect[1]; } auto rect = currentDisplay.rect[0]; - rect.y = 0; + rect.y += rect.h; currentDisplay.windowSize.height += rect.h; currentDisplay.yoffset = currentDisplay.windowSize.height; updateWindowSize();