[Scummvm-cvs-logs] SF.net SVN: scummvm: [24732] scummvm/trunk/engines/cine

sev at users.sourceforge.net sev at users.sourceforge.net
Sat Nov 18 17:26:51 CET 2006


Revision: 24732
          http://svn.sourceforge.net/scummvm/?rev=24732&view=rev
Author:   sev
Date:     2006-11-18 08:26:51 -0800 (Sat, 18 Nov 2006)

Log Message:
-----------
Make input string truly editable

Modified Paths:
--------------
    scummvm/trunk/engines/cine/main_loop.cpp
    scummvm/trunk/engines/cine/various.cpp

Modified: scummvm/trunk/engines/cine/main_loop.cpp
===================================================================
--- scummvm/trunk/engines/cine/main_loop.cpp	2006-11-18 15:16:44 UTC (rev 24731)
+++ scummvm/trunk/engines/cine/main_loop.cpp	2006-11-18 16:26:51 UTC (rev 24732)
@@ -39,7 +39,7 @@
 uint16 mouseRight = 0;
 uint16 mouseLeft = 0;
 
-char lastKeyStroke = 0;
+int lastKeyStroke = 0;
 
 uint16 mouseUpdateStatus;
 uint16 dummyU16;
@@ -112,7 +112,7 @@
 				}
 				break;
 			default:
-				lastKeyStroke = event.kbd.ascii;
+				lastKeyStroke = event.kbd.keycode;
 				break;
 			}
 			break;

Modified: scummvm/trunk/engines/cine/various.cpp
===================================================================
--- scummvm/trunk/engines/cine/various.cpp	2006-11-18 15:16:44 UTC (rev 24731)
+++ scummvm/trunk/engines/cine/various.cpp	2006-11-18 16:26:51 UTC (rev 24732)
@@ -3192,9 +3192,14 @@
 						currentX += characterWidth + 1;
 					}
 				}
+				// draw cursor here
+				if (inputPos == (int)(j + 2))
+					gfxDrawLine(currentX, localY - 1, currentX, localY + 8, color, page1Raw);
+
 			}
 
-			gfxDrawLine(currentX, localY - 1, currentX, localY + 8, color, page1Raw); // cursor
+			if (strlen(inputString) == 0 || inputPos == 1) // cursor wasn't yet drawn
+				gfxDrawLine(x + 4, localY - 1, x + 4, localY + 8, color, page1Raw);
 
 			blitRawScreen(page1Raw);
 			redraw = false;
@@ -3220,16 +3225,31 @@
 			}
 			inputPos--;
 			redraw = true;
-			if (inputPos != 1) {
-				strncpy(tempString, inputString, inputPos - 1);
+		case 127: // del
+			if (inputPos <= inputLength) {
+				if (inputPos != 1) {
+					strncpy(tempString, inputString, inputPos - 1);
+				}
+				if (inputPos != inputLength) {
+					strncat(tempString, &inputString[inputPos], inputLength - inputPos);
+				}
+				strcpy(inputString, tempString);
+				inputLength = strlen(inputString);
+				redraw = true;
 			}
-			if (inputPos != inputLength) {
-				strncat(tempString, &inputString[inputPos], inputLength - inputPos);
+			break;
+		case 276: // left
+			if (inputPos > 1) {
+				inputPos--;
+				redraw = true;
 			}
-			strcpy(inputString, tempString);
-			inputLength = strlen(inputString);
-			redraw = true;
 			break;
+		case 275: // right
+			if (inputPos <= inputLength) {
+				inputPos++;
+				redraw = true;
+			}
+			break;
 		default:
 			if (((ascii >= 'a') && (ascii <='z')) ||
 				((ascii >= '0') && (ascii <='9')) ||


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list