void vcprintf(const char *fmt, va_list ap) { char buf[CONSOLE_BUF_MAX]; uval len = printfBuf(fmt, ap, buf, CONSOLE_BUF_MAX); consoleWrite(buf, len); }
Windows7Multitouch::Windows7Multitouch() : waitingForMatchingMouseDown(false), waitingForMatchingMouseUp(false), alreadySimulatedMouseUp(false), _pIManipulationProcessor(NULL), _pManipulationEventSink(NULL), _gestureManager(), pRegisterTouchWindow(NULL), pUnregisterTouchWindow(NULL), pCloseTouchInputHandle(NULL), pGetTouchInputInfo(NULL), pTKGetGestureMetrics(NULL), _hMod(NULL), _supportsMultiTouch(false), _logFile(NULL), _logFileStream(NULL) { _hMod = LoadLibrary(_T("User32.dll")); if (_hMod) { pRegisterTouchWindow = (RegisterTouchWindowSignature) GetProcAddress(_hMod, "RegisterTouchWindow"); pUnregisterTouchWindow = (UnregisterTouchWindowSignature) GetProcAddress(_hMod, "UnregisterTouchWindow"); pCloseTouchInputHandle = (CloseTouchInputHandleSignature) GetProcAddress(_hMod, "CloseTouchInputHandle"); pGetTouchInputInfo = (GetTouchInputInfoSignature) GetProcAddress(_hMod, "GetTouchInputInfo"); pTKGetGestureMetrics = (TKGetGestureMetricsSignature) GetProcAddress(_hMod, "TKGetGestureMetrics"); if (pRegisterTouchWindow && pUnregisterTouchWindow && pCloseTouchInputHandle && pGetTouchInputInfo) { // We must call this to start receiving the WM_TOUCH* events if (!pRegisterTouchWindow(winOS->GetWindowsHandle(), TWF_WANTPALM)) { consoleWrite(QString("RegisterTouchWindow failed, GetLastError() = %1").arg(GetLastError())); } else { initializeLogFile(); // Do this now so we can record any errors _supportsMultiTouch = true; HRESULT hr = CoInitialize(0); hr = CoCreateInstance( CLSID_ManipulationProcessor, NULL, CLSCTX_ALL, IID_IManipulationProcessor, (void **)&_pIManipulationProcessor); if (hr == S_OK) _pManipulationEventSink = new ManipulationEventSink(_pIManipulationProcessor); else logError(QString("\nFailed to initialize Manipulation Processor, HRESULT = %1").arg(hr)); } } } }
DXRender::~DXRender() { LOG(QString_NT("Destroying DirectX")); releaseResources(); ULONG refs = 0; if (device) { refs = device->Release(); LOG(QString_NT("Released d3d device references = %1").arg(refs)); if (refs != 0) { printf(QT_NT("Released d3d device references = %u\n"), refs); consoleWrite(QString(QT_NT("WARNING: Direct3D device has %1 remaining references\n")).arg(refs)); } device = NULL; } SAFE_RELEASE(d3d); }
void Windows7Multitouch::logError( QString message ) { if (_logFileStream) *_logFileStream << message; consoleWrite(message); }
void datagramInterpreter(uint8_t t, const uint8_t *data, int size) { switch(t) { case DG_HEARTBEAT: // Heartbeat if(heartbeatReset) { memcpy((void*) &heartbeatCount, data, sizeof(heartbeatCount)); heartbeatTime = time(NULL); } break; case DG_CONSOLE: // Console output consoleWrite(data, size); break; case DG_INITIALIZED: initDone = true; break; case DG_READY: // Initialization done // consoleNotef("ready\n"); logReady = true; break; case DG_LOGDATA: // Log data if(size > 0) logStore((const uint16_t*) data, size/2); else if(receivingLog) { logDisplay(); logClose(); // Auto clear if(!autoClearDone) sendCommand("clear"); autoClearDone = true; } break; case DG_LOGINFO: // Log stamp memcpy(&logInfo, data, sizeof(logInfo)); consoleNotef("LOG %d OF MODEL %s\n", logInfo.stamp, logInfo.name); receivingLog = logOpen(&logInfo); break; case DG_PARAMS: // Param backup if(size > 0) { memset(modelName, '\0', NAME_LEN); memcpy(modelName, (char*) data, size); consoleNotef("BACKUP %s START\n", modelName); backupOpen(modelName);; } else { consoleNotef("BACKUP END\n"); backupClose(); } break; case DG_SIMLINK: // Simulator link control record udpClient(data, size); break; default: consoleNotef("FUNNY DATAGRAM TYPE = %d SIZE = %d\n", t, size); } }