From eacf5b5d6d406492ba79b44f9319867230585e9b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 9 Apr 2009 09:50:17 +0000 Subject: BGE Text - multi-line strings for bitmap text - keyboard sensor now logs return and pad enter as "\n" BGE std::vector use in Value.cpp and RAS_MaterialBucket.cpp The size of a new list is known before making them, reduce re-allocs, though probably not a noticeable speedup. --- source/gameengine/GameLogic/SCA_KeyboardSensor.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'source/gameengine/GameLogic/SCA_KeyboardSensor.cpp') diff --git a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp index 3749bf2eda0..9a8b68d8db3 100644 --- a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp +++ b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp @@ -376,7 +376,8 @@ bool SCA_KeyboardSensor::IsPrintable(int keyIndex) || ((keyIndex >= SCA_IInputDevice::KX_AKEY) && (keyIndex <= SCA_IInputDevice::KX_ZKEY)) || (keyIndex == SCA_IInputDevice::KX_SPACEKEY) -/* || (keyIndex == KX_RETKEY) */ + || (keyIndex == SCA_IInputDevice::KX_RETKEY) + || (keyIndex == SCA_IInputDevice::KX_PADENTER) || (keyIndex == SCA_IInputDevice::KX_PADASTERKEY) || (keyIndex == SCA_IInputDevice::KX_TABKEY) || ((keyIndex >= SCA_IInputDevice::KX_COMMAKEY) @@ -386,7 +387,7 @@ bool SCA_KeyboardSensor::IsPrintable(int keyIndex) || ((keyIndex >= SCA_IInputDevice::KX_PAD2) && (keyIndex <= SCA_IInputDevice::KX_PADPLUSKEY)) || (keyIndex == SCA_IInputDevice::KX_DELKEY) - || (keyIndex == SCA_IInputDevice::KX_BACKSPACEKEY) + || (keyIndex == SCA_IInputDevice::KX_BACKSPACEKEY) ) { return true; @@ -423,8 +424,10 @@ char SCA_KeyboardSensor::ToCharacter(int keyIndex, bool shifted) if (keyIndex == SCA_IInputDevice::KX_SPACEKEY) { return ' '; } + if (keyIndex == SCA_IInputDevice::KX_RETKEY || keyIndex == SCA_IInputDevice::KX_PADENTER) { + return '\n'; + } -/* || (keyIndex == SCA_IInputDevice::KX_RETKEY) */ if (keyIndex == SCA_IInputDevice::KX_PADASTERKEY) { return '*'; -- cgit v1.2.3