Changeset 54:fb6a875ea5d2 in xplra for src/client/c/hu/varadiistvan/xplra/XPlane.cc
- Timestamp:
- 02/16/13 18:04:17 (11 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/client/c/hu/varadiistvan/xplra/XPlane.cc
r40 r54 59 59 using std::auto_ptr; 60 60 using std::string; 61 using std::min; 61 62 62 63 //------------------------------------------------------------------------------ … … 500 501 //------------------------------------------------------------------------------ 501 502 503 void XPlane::registerHotkeys(const uint16_t* codes, size_t length) 504 throw(Exception) 505 { 506 stream->writeU8(Protocol::COMMAND_REGISTER_HOTKEYS); 507 stream->writeU32(length); 508 stream->write(codes, sizeof(uint16_t)*length); 509 stream->flush(); 510 checkResult(); 511 } 512 513 //------------------------------------------------------------------------------ 514 515 void XPlane::queryHotkeys(uint8_t* states, size_t length) throw(Exception) 516 { 517 stream->writeU8(Protocol::COMMAND_QUERY_HOTKEYS); 518 stream->flush(); 519 checkResult(); 520 521 size_t count = stream->readU32(); 522 checkStream(); 523 stream->read(states, min(length, count)); 524 if (length<count) { 525 while(length<count) { 526 stream->readU8(); 527 ++length; 528 } 529 } else if (length>count) { 530 memset(states + count, 0, length - count); 531 } 532 checkStream(); 533 } 534 535 //------------------------------------------------------------------------------ 536 537 void XPlane::unregisterHotkeys() 538 { 539 stream->writeU8(Protocol::COMMAND_UNREGISTER_HOTKEYS); 540 stream->flush(); 541 checkResult(); 542 } 543 544 //------------------------------------------------------------------------------ 545 502 546 // Local Variables: 503 547 // mode: C++
Note:
See TracChangeset
for help on using the changeset viewer.