Changeset 51:bc776d590040 in xplra for src
- Timestamp:
- 02/16/13 10:31:37 (12 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/plugin/src/xplra
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/plugin/src/xplra/MessageWindow.cc
r50 r51 79 79 maxMessageLength(0), 80 80 showForced(false), 81 showTime(0.0), 81 82 hideTime(0.0), 82 83 clickedX(-1), … … 146 147 float d = getNewMessage(displayedMessage); 147 148 if (d>0.0) { 149 showTime = now; 148 150 hideTime = now + d; 149 151 } … … 156 158 XPLMDrawTranslucentDarkBox(left, top, right, bottom); 157 159 if (hideTime!=0.0) { 158 159 string dm(displayedMessage, 0, maxMessageLength); 160 size_t offset = 0; 161 if (displayedMessage.size()>maxMessageLength && 162 now > (showTime + scrollTimeout) ) 163 { 164 offset = (now - showTime - scrollTimeout) / 165 scrollInterval; 166 offset = min(offset, 167 displayedMessage.size() - maxMessageLength); 168 } 169 170 string dm(displayedMessage, offset, maxMessageLength); 160 171 161 172 XPLMDrawString(colour, -
src/plugin/src/xplra/MessageWindow.h
r50 r51 94 94 static const int baseLineSize = 2; 95 95 96 /** 97 * The amount of time in seconds after which the message is 98 * started to be scrolled, if it should be scrolled. 99 */ 100 static const float scrollTimeout = 1.0; 101 102 /** 103 * The amount of time in seconds between each character step. 104 */ 105 static const float scrollInterval = 0.1; 106 96 107 private: 97 108 /** … … 143 154 * The maximal message length. 144 155 */ 145 int maxMessageLength;156 size_t maxMessageLength; 146 157 147 158 /** … … 154 165 */ 155 166 std::string displayedMessage; 167 168 /** 169 * The time the current message was shown. 170 */ 171 float showTime; 156 172 157 173 /**
Note:
See TracChangeset
for help on using the changeset viewer.