From a9194c0c0d59250b1fe8b3bcdc57736d3bc9b9d6 Mon Sep 17 00:00:00 2001 From: otya128 Date: Wed, 19 Aug 2015 11:59:58 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=B3=E3=83=B3=E3=82=BD=E3=83=BC=E3=83=AB?= =?UTF-8?q?=E3=81=AE=E3=82=AB=E3=83=BC=E3=82=BD=E3=83=AB=E3=82=92=E5=AE=9F?= =?UTF-8?q?=E8=A3=85.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SMILEBASIC/petitcomputer.d | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/SMILEBASIC/petitcomputer.d b/SMILEBASIC/petitcomputer.d index b781dc7..ee5f2e4 100644 --- a/SMILEBASIC/petitcomputer.d +++ b/SMILEBASIC/petitcomputer.d @@ -451,10 +451,20 @@ class PetitComputer auto c = ImmAssociateContext(wm.info.win.window, null); } } - + int loopcnt; while(true) { auto profile = SDL_GetTicks(); + if(showCursor) + { + loopcnt++; + //30フレームに一回 + if(loopcnt >= 30) + { + animationCursor = !animationCursor; + loopcnt = 0; + } + } glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); renderConsoleGL(); SDL_GL_SwapWindow(window); @@ -621,6 +631,7 @@ GOTO @LOOP`*/ printConsole(prompt); clearKeyBuffer(); wstring buffer; + showCursor = true; while(true) { auto oldpos = keybufferpos; @@ -636,6 +647,8 @@ GOTO @LOOP`*/ kbp = oldpos; } wchar k; + //文字入力中はカーソルを表示する + animationCursor = true; foreach(key; keybuffer[oldpos..kbp]) { printConsole(key); @@ -652,12 +665,15 @@ GOTO @LOOP`*/ break; } } + showCursor = false; return buffer; } int CSRX; int CSRY; int CSRZ; int consoleForeColor, consoleBackColor; + bool showCursor; + bool animationCursor; Mutex consolem; void renderConsoleGL() @@ -677,6 +693,14 @@ GOTO @LOOP`*/ glVertex3f((x * 8 + 8) / 200f - 1, 1 - (y * 8) / 120f, 0.9f); glVertex3f((x * 8 + 8) / 200f - 1, 1 - (y * 8 + 8) / 120f, 0.9f); } + if(showCursor && animationCursor) + { + glColor4ubv(cast(ubyte*)&consoleColorGL[15]); + glVertex3f((CSRX * 8) / 200f - 1, 1 - (CSRY * 8 + 8) / 120f, -0.9f); + glVertex3f((CSRX * 8) / 200f - 1, 1 - (CSRY * 8) / 120f, -0.9f); + glVertex3f((CSRX * 8 + 2) / 200f - 1, 1 - (CSRY * 8) / 120f, -0.9f); + glVertex3f((CSRX * 8 + 2) / 200f - 1, 1 - (CSRY * 8 + 8) / 120f, -0.9f); + } glEnd(); glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND);