|
Blender
V2.59
|
00001 /* 00002 * $Id: SCA_KeyboardSensor.cpp 35169 2011-02-25 13:32:11Z jesterking $ 00003 * 00004 * ***** BEGIN GPL LICENSE BLOCK ***** 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software Foundation, 00018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 * 00020 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. 00021 * All rights reserved. 00022 * 00023 * The Original Code is: all of this file. 00024 * 00025 * Contributor(s): none yet. 00026 * 00027 * ***** END GPL LICENSE BLOCK ***** 00028 * Sensor for keyboard input 00029 */ 00030 00036 #include <stddef.h> 00037 00038 #include "SCA_KeyboardSensor.h" 00039 #include "SCA_KeyboardManager.h" 00040 #include "SCA_LogicManager.h" 00041 #include "StringValue.h" 00042 #include "SCA_IInputDevice.h" 00043 00044 /* ------------------------------------------------------------------------- */ 00045 /* Native functions */ 00046 /* ------------------------------------------------------------------------- */ 00047 00048 SCA_KeyboardSensor::SCA_KeyboardSensor(SCA_KeyboardManager* keybdmgr, 00049 short int hotkey, 00050 short int qual, 00051 short int qual2, 00052 bool bAllKeys, 00053 const STR_String& targetProp, 00054 const STR_String& toggleProp, 00055 SCA_IObject* gameobj) 00056 :SCA_ISensor(gameobj,keybdmgr), 00057 m_hotkey(hotkey), 00058 m_qual(qual), 00059 m_qual2(qual2), 00060 m_bAllKeys(bAllKeys), 00061 m_targetprop(targetProp), 00062 m_toggleprop(toggleProp) 00063 { 00064 if (hotkey == SCA_IInputDevice::KX_ESCKEY) 00065 keybdmgr->GetInputDevice()->HookEscape(); 00066 // SetDrawColor(0xff0000ff); 00067 Init(); 00068 } 00069 00070 00071 00072 SCA_KeyboardSensor::~SCA_KeyboardSensor() 00073 { 00074 } 00075 00076 void SCA_KeyboardSensor::Init() 00077 { 00078 // this function is used when the sensor is disconnected from all controllers 00079 // by the state engine. It reinitializes the sensor as if it was just created. 00080 // However, if the target key is pressed when the sensor is reactivated, it 00081 // will not generated an event (see remark in Evaluate()). 00082 m_val = (m_invert)?1:0; 00083 m_reset = true; 00084 } 00085 00086 CValue* SCA_KeyboardSensor::GetReplica() 00087 { 00088 SCA_KeyboardSensor* replica = new SCA_KeyboardSensor(*this); 00089 // this will copy properties and so on... 00090 replica->ProcessReplica(); 00091 replica->Init(); 00092 return replica; 00093 } 00094 00095 00096 00097 short int SCA_KeyboardSensor::GetHotkey() 00098 { 00099 return m_hotkey; 00100 } 00101 00102 00103 00104 bool SCA_KeyboardSensor::IsPositiveTrigger() 00105 { 00106 bool result = (m_val != 0); 00107 00108 if (m_invert) 00109 result = !result; 00110 00111 return result; 00112 } 00113 00114 00115 00116 bool SCA_KeyboardSensor::TriggerOnAllKeys() 00117 { 00118 return m_bAllKeys; 00119 } 00120 00121 00122 00123 bool SCA_KeyboardSensor::Evaluate() 00124 { 00125 bool result = false; 00126 bool reset = m_reset && m_level; 00127 bool qual = true; 00128 bool qual_change = false; 00129 short int m_val_orig = m_val; 00130 00131 SCA_IInputDevice* inputdev = ((SCA_KeyboardManager *)m_eventmgr)->GetInputDevice(); 00132 // cerr << "SCA_KeyboardSensor::Eval event, sensing for "<< m_hotkey << " at device " << inputdev << "\n"; 00133 00134 /* See if we need to do logging: togPropState exists and is 00135 * different from 0 */ 00136 CValue* myparent = GetParent(); 00137 CValue* togPropState = myparent->GetProperty(m_toggleprop); 00138 if (togPropState && 00139 (((int)togPropState->GetNumber()) != 0) ) 00140 { 00141 LogKeystrokes(); 00142 } 00143 00144 m_reset = false; 00145 00146 /* Now see whether events must be bounced. */ 00147 if (m_bAllKeys) 00148 { 00149 bool justactivated = false; 00150 bool justreleased = false; 00151 bool active = false; 00152 00153 for (int i=SCA_IInputDevice::KX_BEGINKEY ; i<= SCA_IInputDevice::KX_ENDKEY;i++) 00154 { 00155 const SCA_InputEvent & inevent = inputdev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) i); 00156 switch (inevent.m_status) 00157 { 00158 case SCA_InputEvent::KX_JUSTACTIVATED: 00159 justactivated = true; 00160 break; 00161 case SCA_InputEvent::KX_JUSTRELEASED: 00162 justreleased = true; 00163 break; 00164 case SCA_InputEvent::KX_ACTIVE: 00165 active = true; 00166 break; 00167 case SCA_InputEvent::KX_NO_INPUTSTATUS: 00168 /* do nothing */ 00169 break; 00170 } 00171 } 00172 00173 if (justactivated) 00174 { 00175 m_val=1; 00176 result = true; 00177 } else 00178 { 00179 if (justreleased) 00180 { 00181 m_val=(active)?1:0; 00182 result = true; 00183 } else 00184 { 00185 if (active) 00186 { 00187 if (m_val == 0) 00188 { 00189 m_val = 1; 00190 if (m_level) { 00191 result = true; 00192 } 00193 } 00194 } else 00195 { 00196 if (m_val == 1) 00197 { 00198 m_val = 0; 00199 result = true; 00200 } 00201 } 00202 } 00203 if (m_tap) 00204 // special case for tap mode: only generate event for new activation 00205 result = false; 00206 } 00207 00208 00209 } else 00210 { 00211 00212 // cerr << "======= SCA_KeyboardSensor::Evaluate:: peeking at key status" << endl; 00213 const SCA_InputEvent & inevent = inputdev->GetEventValue( 00214 (SCA_IInputDevice::KX_EnumInputs) m_hotkey); 00215 00216 // cerr << "======= SCA_KeyboardSensor::Evaluate:: status: " << inevent.m_status << endl; 00217 00218 00219 /* Check qualifier keys 00220 * - see if the qualifiers we request are pressed - 'qual' true/false 00221 * - see if the qualifiers we request changed their state - 'qual_change' true/false 00222 */ 00223 if (m_qual > 0) { 00224 const SCA_InputEvent & qualevent = inputdev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) m_qual); 00225 switch(qualevent.m_status) { 00226 case SCA_InputEvent::KX_NO_INPUTSTATUS: 00227 qual = false; 00228 break; 00229 case SCA_InputEvent::KX_JUSTRELEASED: 00230 qual_change = true; 00231 qual = false; 00232 break; 00233 case SCA_InputEvent::KX_JUSTACTIVATED: 00234 qual_change = true; 00235 case SCA_InputEvent::KX_ACTIVE: 00236 /* do nothing */ 00237 break; 00238 } 00239 } 00240 if (m_qual2 > 0 && qual==true) { 00241 const SCA_InputEvent & qualevent = inputdev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) m_qual2); 00242 /* copy of above */ 00243 switch(qualevent.m_status) { 00244 case SCA_InputEvent::KX_NO_INPUTSTATUS: 00245 qual = false; 00246 break; 00247 case SCA_InputEvent::KX_JUSTRELEASED: 00248 qual_change = true; 00249 qual = false; 00250 break; 00251 case SCA_InputEvent::KX_JUSTACTIVATED: 00252 qual_change = true; 00253 case SCA_InputEvent::KX_ACTIVE: 00254 /* do nothing */ 00255 break; 00256 } 00257 } 00258 /* done reading qualifiers */ 00259 00260 if (inevent.m_status == SCA_InputEvent::KX_NO_INPUTSTATUS) 00261 { 00262 if (m_val == 1) 00263 { 00264 // this situation may occur after a scene suspend: the keyboard release 00265 // event was not captured, produce now the event off 00266 m_val = 0; 00267 result = true; 00268 } 00269 } else 00270 { 00271 if (inevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED) 00272 { 00273 m_val=1; 00274 result = true; 00275 } else 00276 { 00277 if (inevent.m_status == SCA_InputEvent::KX_JUSTRELEASED) 00278 { 00279 m_val = 0; 00280 result = true; 00281 } else 00282 { 00283 if (inevent.m_status == SCA_InputEvent::KX_ACTIVE) 00284 { 00285 if (m_val == 0) 00286 { 00287 m_val = 1; 00288 if (m_level) 00289 { 00290 result = true; 00291 } 00292 } 00293 } 00294 } 00295 } 00296 } 00297 00298 /* Modify the key state based on qual(s) 00299 * Tested carefuly. dont touch unless your really sure. 00300 * note, this will only change the results if key modifiers are set. 00301 * 00302 * When all modifiers and keys are positive 00303 * - pulse true 00304 * 00305 * When ANY of the modifiers or main key become inactive, 00306 * - pulse false 00307 */ 00308 if (qual==false) { /* one of the qualifiers are not pressed */ 00309 if (m_val_orig && qual_change) { /* we were originally enabled, but a qualifier changed */ 00310 result = true; 00311 } else { 00312 result = false; 00313 } 00314 m_val = 0; /* since one of the qualifiers is not on, set the state to false */ 00315 } else { /* we done have any qualifiers or they are all pressed */ 00316 if (m_val && qual_change) { /* the main key state is true and our qualifier just changed */ 00317 result = true; 00318 } 00319 } 00320 /* done with key quals */ 00321 00322 } 00323 00324 if (reset) 00325 // force an event 00326 result = true; 00327 return result; 00328 00329 } 00330 00331 void SCA_KeyboardSensor::AddToTargetProp(int keyIndex) 00332 { 00333 if (IsPrintable(keyIndex)) { 00334 CValue* tprop = GetParent()->GetProperty(m_targetprop); 00335 00336 if (tprop) { 00337 /* overwrite the old property */ 00338 if (IsDelete(keyIndex)) { 00339 /* strip one char, if possible */ 00340 STR_String newprop = tprop->GetText(); 00341 int oldlength = newprop.Length(); 00342 if (oldlength >= 1 ) { 00343 newprop.SetLength(oldlength - 1); 00344 CStringValue * newstringprop = new CStringValue(newprop, m_targetprop); 00345 GetParent()->SetProperty(m_targetprop, newstringprop); 00346 newstringprop->Release(); 00347 } 00348 } else { 00349 /* append */ 00350 char pchar = ToCharacter(keyIndex, IsShifted()); 00351 STR_String newprop = tprop->GetText() + pchar; 00352 CStringValue * newstringprop = new CStringValue(newprop, m_targetprop); 00353 GetParent()->SetProperty(m_targetprop, newstringprop); 00354 newstringprop->Release(); 00355 } 00356 } else { 00357 if (!IsDelete(keyIndex)) { 00358 /* Make a new property. Deletes can be ignored. */ 00359 char pchar = ToCharacter(keyIndex, IsShifted()); 00360 STR_String newprop = pchar; 00361 CStringValue * newstringprop = new CStringValue(newprop, m_targetprop); 00362 GetParent()->SetProperty(m_targetprop, newstringprop); 00363 newstringprop->Release(); 00364 } 00365 } 00366 } 00367 00368 } 00369 00373 bool SCA_KeyboardSensor::IsShifted(void) 00374 { 00375 SCA_IInputDevice* inputdev = ((SCA_KeyboardManager *)m_eventmgr)->GetInputDevice(); 00376 00377 if ( (inputdev->GetEventValue(SCA_IInputDevice::KX_RIGHTSHIFTKEY).m_status 00378 == SCA_InputEvent::KX_ACTIVE) 00379 || (inputdev->GetEventValue(SCA_IInputDevice::KX_RIGHTSHIFTKEY).m_status 00380 == SCA_InputEvent::KX_JUSTACTIVATED) 00381 || (inputdev->GetEventValue(SCA_IInputDevice::KX_LEFTSHIFTKEY).m_status 00382 == SCA_InputEvent::KX_ACTIVE) 00383 || (inputdev->GetEventValue(SCA_IInputDevice::KX_LEFTSHIFTKEY).m_status 00384 == SCA_InputEvent::KX_JUSTACTIVATED) 00385 ) { 00386 return true; 00387 } else { 00388 return false; 00389 } 00390 } 00391 00392 void SCA_KeyboardSensor::LogKeystrokes(void) 00393 { 00394 SCA_IInputDevice* inputdev = ((SCA_KeyboardManager *)m_eventmgr)->GetInputDevice(); 00395 int num = inputdev->GetNumActiveEvents(); 00396 00397 /* weird loop, this one... */ 00398 if (num > 0) 00399 { 00400 00401 int index = 0; 00402 /* Check on all keys whether they were pushed. This does not 00403 * untangle the ordering, so don't type too fast :) */ 00404 for (int i=SCA_IInputDevice::KX_BEGINKEY ; i<= SCA_IInputDevice::KX_ENDKEY;i++) 00405 { 00406 const SCA_InputEvent & inevent = inputdev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) i); 00407 if (inevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED) //NO_INPUTSTATUS) 00408 { 00409 if (index < num) 00410 { 00411 AddToTargetProp(i); 00412 index++; 00413 } 00414 } 00415 } 00416 } 00417 } 00418 00419 #ifdef WITH_PYTHON 00420 00421 /* ------------------------------------------------------------------------- */ 00422 /* Python Functions */ 00423 /* ------------------------------------------------------------------------- */ 00424 00425 KX_PYMETHODDEF_DOC_O(SCA_KeyboardSensor, getKeyStatus, 00426 "getKeyStatus(keycode)\n" 00427 "\tGet the given key's status (KX_NO_INPUTSTATUS, KX_JUSTACTIVATED, KX_ACTIVE or KX_JUSTRELEASED).\n") 00428 { 00429 if (!PyLong_Check(value)) { 00430 PyErr_SetString(PyExc_ValueError, "sensor.getKeyStatus(int): Keyboard Sensor, expected an int"); 00431 return NULL; 00432 } 00433 00434 int keycode = PyLong_AsSsize_t(value); 00435 00436 if ((keycode < SCA_IInputDevice::KX_BEGINKEY) 00437 || (keycode > SCA_IInputDevice::KX_ENDKEY)){ 00438 PyErr_SetString(PyExc_AttributeError, "sensor.getKeyStatus(int): Keyboard Sensor, invalid keycode specified!"); 00439 return NULL; 00440 } 00441 00442 SCA_IInputDevice* inputdev = ((SCA_KeyboardManager *)m_eventmgr)->GetInputDevice(); 00443 const SCA_InputEvent & inevent = inputdev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) keycode); 00444 return PyLong_FromSsize_t(inevent.m_status); 00445 } 00446 00447 /* ------------------------------------------------------------------------- */ 00448 /* Python Integration Hooks */ 00449 /* ------------------------------------------------------------------------- */ 00450 00451 PyTypeObject SCA_KeyboardSensor::Type = { 00452 PyVarObject_HEAD_INIT(NULL, 0) 00453 "SCA_KeyboardSensor", 00454 sizeof(PyObjectPlus_Proxy), 00455 0, 00456 py_base_dealloc, 00457 0, 00458 0, 00459 0, 00460 0, 00461 py_base_repr, 00462 0,0,0,0,0,0,0,0,0, 00463 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, 00464 0,0,0,0,0,0,0, 00465 Methods, 00466 0, 00467 0, 00468 &SCA_ISensor::Type, 00469 0,0,0,0,0,0, 00470 py_base_new 00471 }; 00472 00473 PyMethodDef SCA_KeyboardSensor::Methods[] = { 00474 KX_PYMETHODTABLE_O(SCA_KeyboardSensor, getKeyStatus), 00475 {NULL,NULL} //Sentinel 00476 }; 00477 00478 PyAttributeDef SCA_KeyboardSensor::Attributes[] = { 00479 KX_PYATTRIBUTE_RO_FUNCTION("events", SCA_KeyboardSensor, pyattr_get_events), 00480 KX_PYATTRIBUTE_BOOL_RW("useAllKeys",SCA_KeyboardSensor,m_bAllKeys), 00481 KX_PYATTRIBUTE_INT_RW("key",0,SCA_IInputDevice::KX_ENDKEY,true,SCA_KeyboardSensor,m_hotkey), 00482 KX_PYATTRIBUTE_SHORT_RW("hold1",0,SCA_IInputDevice::KX_ENDKEY,true,SCA_KeyboardSensor,m_qual), 00483 KX_PYATTRIBUTE_SHORT_RW("hold2",0,SCA_IInputDevice::KX_ENDKEY,true,SCA_KeyboardSensor,m_qual2), 00484 KX_PYATTRIBUTE_STRING_RW("toggleProperty",0,100,false,SCA_KeyboardSensor,m_toggleprop), 00485 KX_PYATTRIBUTE_STRING_RW("targetProperty",0,100,false,SCA_KeyboardSensor,m_targetprop), 00486 { NULL } //Sentinel 00487 }; 00488 00489 00490 PyObject* SCA_KeyboardSensor::pyattr_get_events(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) 00491 { 00492 SCA_KeyboardSensor* self= static_cast<SCA_KeyboardSensor*>(self_v); 00493 00494 SCA_IInputDevice* inputdev = ((SCA_KeyboardManager *)self->m_eventmgr)->GetInputDevice(); 00495 00496 PyObject* resultlist = PyList_New(0); 00497 00498 for (int i=SCA_IInputDevice::KX_BEGINKEY ; i<= SCA_IInputDevice::KX_ENDKEY;i++) 00499 { 00500 const SCA_InputEvent & inevent = inputdev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) i); 00501 if (inevent.m_status != SCA_InputEvent::KX_NO_INPUTSTATUS) 00502 { 00503 PyObject* keypair = PyList_New(2); 00504 PyList_SET_ITEM(keypair,0,PyLong_FromSsize_t(i)); 00505 PyList_SET_ITEM(keypair,1,PyLong_FromSsize_t(inevent.m_status)); 00506 PyList_Append(resultlist,keypair); 00507 } 00508 } 00509 return resultlist; 00510 } 00511 00512 #endif // WITH_PYTHON 00513 00514 /* Accessed from python */ 00515 00516 // this code looks ugly, please use an ordinary hashtable 00517 00518 char ToCharacter(int keyIndex, bool shifted) 00519 { 00520 /* numerals */ 00521 if ( (keyIndex >= SCA_IInputDevice::KX_ZEROKEY) 00522 && (keyIndex <= SCA_IInputDevice::KX_NINEKEY) ) { 00523 if (shifted) { 00524 char numshift[] = ")!@#$%^&*("; 00525 return numshift[keyIndex - '0']; 00526 } else { 00527 return keyIndex - SCA_IInputDevice::KX_ZEROKEY + '0'; 00528 } 00529 } 00530 00531 /* letters... always lowercase... is that desirable? */ 00532 if ( (keyIndex >= SCA_IInputDevice::KX_AKEY) 00533 && (keyIndex <= SCA_IInputDevice::KX_ZKEY) ) { 00534 if (shifted) { 00535 return keyIndex - SCA_IInputDevice::KX_AKEY + 'A'; 00536 } else { 00537 return keyIndex - SCA_IInputDevice::KX_AKEY + 'a'; 00538 } 00539 } 00540 00541 if (keyIndex == SCA_IInputDevice::KX_SPACEKEY) { 00542 return ' '; 00543 } 00544 if (keyIndex == SCA_IInputDevice::KX_RETKEY || keyIndex == SCA_IInputDevice::KX_PADENTER) { 00545 return '\n'; 00546 } 00547 00548 00549 if (keyIndex == SCA_IInputDevice::KX_PADASTERKEY) { 00550 return '*'; 00551 } 00552 00553 if (keyIndex == SCA_IInputDevice::KX_TABKEY) { 00554 return '\t'; 00555 } 00556 00557 /* comma to period */ 00558 char commatoperiod[] = ",-."; 00559 char commatoperiodshifted[] = "<_>"; 00560 if (keyIndex == SCA_IInputDevice::KX_COMMAKEY) { 00561 if (shifted) { 00562 return commatoperiodshifted[0]; 00563 } else { 00564 return commatoperiod[0]; 00565 } 00566 } 00567 if (keyIndex == SCA_IInputDevice::KX_MINUSKEY) { 00568 if (shifted) { 00569 return commatoperiodshifted[1]; 00570 } else { 00571 return commatoperiod[1]; 00572 } 00573 } 00574 if (keyIndex == SCA_IInputDevice::KX_PERIODKEY) { 00575 if (shifted) { 00576 return commatoperiodshifted[2]; 00577 } else { 00578 return commatoperiod[2]; 00579 } 00580 } 00581 00582 /* semicolon to rightbracket */ 00583 char semicolontorightbracket[] = ";\'`/\\=[]"; 00584 char semicolontorightbracketshifted[] = ":\"~\?|+{}"; 00585 if ((keyIndex >= SCA_IInputDevice::KX_SEMICOLONKEY) 00586 && (keyIndex <= SCA_IInputDevice::KX_RIGHTBRACKETKEY)) { 00587 if (shifted) { 00588 return semicolontorightbracketshifted[keyIndex - SCA_IInputDevice::KX_SEMICOLONKEY]; 00589 } else { 00590 return semicolontorightbracket[keyIndex - SCA_IInputDevice::KX_SEMICOLONKEY]; 00591 } 00592 } 00593 00594 /* keypad2 to padplus */ 00595 char pad2topadplus[] = "246813579. 0- +"; 00596 if ((keyIndex >= SCA_IInputDevice::KX_PAD2) 00597 && (keyIndex <= SCA_IInputDevice::KX_PADPLUSKEY)) { 00598 return pad2topadplus[keyIndex - SCA_IInputDevice::KX_PAD2]; 00599 } 00600 00601 return '!'; 00602 } 00603 00604 00605 00610 bool IsPrintable(int keyIndex) 00611 { 00612 /* only print 00613 * - numerals: KX_ZEROKEY to KX_NINEKEY 00614 * - alphas: KX_AKEY to KX_ZKEY. 00615 * - specials: KX_RETKEY, KX_PADASTERKEY, KX_PADCOMMAKEY to KX_PERIODKEY, 00616 * KX_TABKEY , KX_SEMICOLONKEY to KX_RIGHTBRACKETKEY, 00617 * KX_PAD2 to KX_PADPLUSKEY 00618 * - delete and backspace: also printable in the sense that they modify 00619 * the string 00620 * - retkey: should this be printable? 00621 * - virgule: prints a space... don't know which key that's supposed 00622 * to be... 00623 */ 00624 if ( ((keyIndex >= SCA_IInputDevice::KX_ZEROKEY) 00625 && (keyIndex <= SCA_IInputDevice::KX_NINEKEY)) 00626 || ((keyIndex >= SCA_IInputDevice::KX_AKEY) 00627 && (keyIndex <= SCA_IInputDevice::KX_ZKEY)) 00628 || (keyIndex == SCA_IInputDevice::KX_SPACEKEY) 00629 || (keyIndex == SCA_IInputDevice::KX_RETKEY) 00630 || (keyIndex == SCA_IInputDevice::KX_PADENTER) 00631 || (keyIndex == SCA_IInputDevice::KX_PADASTERKEY) 00632 || (keyIndex == SCA_IInputDevice::KX_TABKEY) 00633 || ((keyIndex >= SCA_IInputDevice::KX_COMMAKEY) 00634 && (keyIndex <= SCA_IInputDevice::KX_PERIODKEY)) 00635 || ((keyIndex >= SCA_IInputDevice::KX_SEMICOLONKEY) 00636 && (keyIndex <= SCA_IInputDevice::KX_RIGHTBRACKETKEY)) 00637 || ((keyIndex >= SCA_IInputDevice::KX_PAD2) 00638 && (keyIndex <= SCA_IInputDevice::KX_PADPLUSKEY)) 00639 || (keyIndex == SCA_IInputDevice::KX_DELKEY) 00640 || (keyIndex == SCA_IInputDevice::KX_BACKSPACEKEY) 00641 ) 00642 { 00643 return true; 00644 } else { 00645 return false; 00646 } 00647 } 00648 00652 bool IsDelete(int keyIndex) 00653 { 00654 if ( (keyIndex == SCA_IInputDevice::KX_DELKEY) 00655 || (keyIndex == SCA_IInputDevice::KX_BACKSPACEKEY) ) { 00656 return true; 00657 } else { 00658 return false; 00659 } 00660 }