DWORD wrapXdevLByteSizeToFTDI(XdevLSerialByteSize byteSize) { switch(byteSize) { case SERIAL_BSIZE_5: XDEVL_ASSERT(nullptr, "SERIAL_BSIZE_5 is not supported by this device."); break; case SERIAL_BSIZE_6: XDEVL_ASSERT(nullptr, "SERIAL_BSIZE_6 is not supported by this device."); break; case SERIAL_BSIZE_7: return FT_BITS_7; break; case SERIAL_BSIZE_8: default: break; } return SERIAL_BSIZE_8; }
xdl_int XdevLKeyboardImpl::getButton(const xdl_uint idx, XdevLButton** button) { XDEVL_ASSERT(m_attached, "Keyboard device not attached!"); // If the key mapping does not exists, just create one. XdevLButtonImpl* tmp = m_Buttons[idx]; if(tmp == nullptr) { m_Buttons[idx] = new XdevLButtonImpl(&m_mutex); tmp = m_Buttons[idx]; } *button = tmp; return ERR_OK; }
xdl_int XdevLAudioBufferAL::upload(xdl_int8* src, xdl_uint size) { XDEVL_ASSERT( (m_locked == xdl_true), "You must use lock() before you can upload data into the buffer"); // Initialize AL buffer and upload data. alBufferData(m_id, m_format, (ALvoid*)src, size, m_freq); ALenum error = alGetError(); if(error != AL_NO_ERROR) { std::cerr << getALErrorString(error) << std::endl; return RET_FAILED; } m_size = size; return RET_SUCCESS; }
xdl_int destroyCore(XdevLCore* core) { XDEVL_ASSERT(core, "## Invalid argument!"); // Create the message. xdl::XdevLEvent moduleShutdown; moduleShutdown.type = XDEVL_MODULE_EVENT; moduleShutdown.module.sender = 0; // Send the message to the core. core->sendEventTo(core->getID().getHashCode(), moduleShutdown); delete_xdevL_core(core); return RET_SUCCESS; }
int XdevLOpenGLContextGLX::create(XdevLWindow* window, XdevLOpenGLContext* shareContext) { XDEVL_ASSERT(m_display == nullptr, "XdevLOpenGLContextGLX already created."); if(nullptr != shareContext) { m_shareContext = static_cast<XdevLOpenGLContextGLX*>(shareContext); } window->getDescriptor().registerDependency(this); m_display = static_cast<Display*>(window->getInternal(XdevLInternalName("X11_DISPLAY"))); if(nullptr == m_display) { XDEVL_MODULE_ERROR("Could not get native X11 display information.\n"); return RET_FAILED; } m_window = (Window)(window->getInternal(XdevLInternalName("X11_WINDOW"))); if(None == m_window) { XDEVL_MODULE_ERROR("Could not get native X11 window information.\n"); return RET_FAILED; } if(glXQueryVersion(m_display, &m_glxMajorVersion, &m_glxMinorVersion) == False) { XDEVL_MODULE_ERROR("glXQueryVersion failed.\n"); return RET_FAILED; } if(initOpenGL(m_display, m_window) == RET_FAILED) { XDEVL_MODULE_ERROR("Failed to initialize OpenGL.\n"); return RET_FAILED; } if(glXIsDirect(m_display, m_glxContext)) { XDEVL_MODULE_INFO("Direct Rendering supported.\n"); } else { XDEVL_MODULE_WARNING("Direct Rendering not supported.\n"); } setVSync(getVSync()); return RET_SUCCESS; }
void XdevLCursorAndroid::releaseClip() { XDEVL_ASSERT(0, "Not supported by Android"); }
xdl_int XdevLCursorAndroid::clip(xdl_uint x, xdl_uint y, xdl_uint width, xdl_uint height) { XDEVL_ASSERT(0, "Not supported by Android"); return RET_FAILED; }
void XdevLCursorAndroid::setPosition(xdl_uint x, xdl_uint y) { XDEVL_ASSERT(m_window, "Cursor not attached to a window."); }
xdl_int XdevLCursorAndroid::attach(XdevLWindow* window) { XDEVL_ASSERT(window, "Invalid window parameter"); m_window = static_cast<XdevLWindowAndroid*>(window); return RET_SUCCESS; }
xdl_float XdevLKeyboardImpl::getAxisRangeMax(const xdl_uint axis) const { XDEVL_ASSERT(m_attached, "Keyboard device not attached!"); return 0.0f; }
void XdevLKeyboardImpl::getAxisRangeMinMax(const xdl_uint axis, xdl_float* min, xdl_float* max) { XDEVL_ASSERT(m_attached, "Keyboard device not attached!"); }
void XdevLKeyboardImpl::setAxisRangeMin(const xdl_uint axis, xdl_float min) { XDEVL_ASSERT(m_attached, "Keyboard device not attached!"); }
xdl_double XdevLKeyboardImpl::getClickResponseTime(const xdl_uint key) { XDEVL_ASSERT(m_attached, "Keyboard device not attached!"); return m_Buttons[key]->getClickResponseTime(); }
void XdevLKeyboardImpl::setClickResponseTime(const xdl_uint key, xdl_double crt) { XDEVL_ASSERT(m_attached, "Keyboard device not attached!"); m_Buttons[key]->setClickResponseTime(crt); }
void XdevLKeyboardImpl::setClickResponseTimeForAll(xdl_double crt) { XDEVL_ASSERT(m_attached, "Keyboard device not attached!"); for(auto button : m_Buttons) { button.second->setClickResponseTime(crt); } }
xdl_bool XdevLKeyboardImpl::getClicked(const xdl_uint key) { XDEVL_ASSERT(m_attached, "Keyboard device not attached!"); return m_Buttons[key]->getClicked(); }