void GraphicLSystem::interpretSymbol(char symbol) { switch (symbol) { case '[': pushCursor(); break; case ']': popCursor(); break; default: /* do nothing */ break; } }
void CursorManager::replaceCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int targetScale, const Graphics::PixelFormat *format) { if (_cursorStack.empty()) { pushCursor(buf, w, h, hotspotX, hotspotY, keycolor, targetScale, format); return; } Cursor *cur = _cursorStack.top(); #ifdef USE_RGB_COLOR uint size; if (!format) size = w * h; else size = w * h * format->bytesPerPixel; #else uint size = w * h; #endif if (cur->_size < size) { delete[] cur->_data; cur->_data = new byte[size]; cur->_size = size; } if (buf && cur->_data) memcpy(cur->_data, buf, size); cur->_width = w; cur->_height = h; cur->_hotspotX = hotspotX; cur->_hotspotY = hotspotY; cur->_keycolor = keycolor; cur->_targetScale = targetScale; #ifdef USE_RGB_COLOR if (format) cur->_format = *format; else cur->_format = Graphics::PixelFormat::createFormatCLUT8(); #endif g_system->setMouseCursor(cur->_data, w, h, hotspotX, hotspotY, keycolor, targetScale, format); }
X11CursorController::X11CursorController( PlatformWindow *owner ) : PlatformCursorController( owner ) { AssertFatal(dynamic_cast<X11Window*>(mOwner), "X11CursorController::X11CursorController window owner not X11Window."); if(x86UNIXState->isXWindowsRunning()) { Display* display = x86UNIXState->getDisplayPointer(); // Setup a blank cursor so we can hide the cursor static char data[1] = {0}; Cursor cursor; XColor dummy; dummy.red = dummy.green = dummy.blue = 0; Pixmap blank = XCreateBitmapFromData(display, DefaultRootWindow(display), data, 1, 1); mBlankCursor = XCreatePixmapCursor(display, blank, blank, &dummy, &dummy, 0, 0); XFreePixmap(display, blank); pushCursor( PlatformCursorController::curArrow ); } mVisible = true; };