static void DrawTooltips( GraphicsDevice *device, Vec2i pos, int yc, int xc, int mouseYc, int mouseXc) { UNUSED(yc); UNUSED(xc); switch (mouseYc) { case YC_ATTRIBUTES: switch (mouseXc) { case XC_TRACK: DrawTooltip(device, pos, "Looking towards the player\n" "Useless for friendly characters"); break; case XC_DELAY: DrawTooltip(device, pos, "Frames before making another decision"); break; } break; case YC_FLAGS: switch (mouseXc) { case XC_IMMUNITY: DrawTooltip(device, pos, "Immune to poison"); break; case XC_RUNS_AWAY: DrawTooltip(device, pos, "Runs away from player"); break; case XC_SNEAKY: DrawTooltip(device, pos, "Shoots back when player shoots"); break; case XC_SLEEPING: DrawTooltip(device, pos, "Doesn't move unless seen"); break; } break; case YC_FLAGS2: switch (mouseXc) { case XC_PRISONER: DrawTooltip(device, pos, "Doesn't move until touched"); break; case XC_PENALTY: DrawTooltip(device, pos, "Large score penalty when shot"); break; case XC_VICTIM: DrawTooltip(device, pos, "Takes damage from everyone"); break; } default: break; } }
static void SetTooltip (const char* text, POINT* p) { #ifdef _WIN32 static int yOffset = 0; #else static int yOffset = -27; #endif if (text) { if (!g_tooltipBm) g_tooltipBm = new (nothrow) LICE_SysBitmap(); if (g_tooltipBm) { if (!g_tooltipWnd) { g_tooltipWnd = CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_BR_TOOLTIP), g_hwndParent, TooltipWnd); SetWindowLongPtr(g_tooltipWnd,GWL_STYLE,GetWindowLongPtr(g_tooltipWnd,GWL_STYLE)&~WS_CAPTION); EnableWindow(g_tooltipWnd, false); DrawTooltip(g_tooltipBm, text); SetWindowPos(g_tooltipWnd, HWND_TOPMOST, p->x + 30, p->y + yOffset, g_tooltipBm->getWidth(), g_tooltipBm->getHeight(), SWP_NOACTIVATE); ShowWindow(g_tooltipWnd, SW_SHOWNOACTIVATE); } else { DrawTooltip(g_tooltipBm, text); SetWindowPos(g_tooltipWnd, 0, p->x + 30, p->y + yOffset, g_tooltipBm->getWidth(), g_tooltipBm->getHeight(), SWP_NOACTIVATE|SWP_NOZORDER); InvalidateRect(g_tooltipWnd, NULL, TRUE); } } } else { DestroyWindow(g_tooltipWnd); delete g_tooltipBm; g_tooltipWnd = NULL; g_tooltipBm = NULL; } }
void MenuSystem::Draw() { // Get window width/height Vec2 wSize; wSize.x = Context::getWindowWidth(); wSize.y = Context::getWindowHeight(); // Draw debug-text std::string str = toString((GLint)activeDropdown); fontBold->Draw(Vec2((Context::getWindowWidth() - fontBold->GetWidth(str)) / 2, 10), str); // Draw menus for(GLuint i = 0; i < menus.size(); i ++) { menus[i]->Draw(); } // Draw the dropdown-list of the currently active dropdown if (IsDropdownActive()) { activeDropdown->DrawItems(); } // Draw black rectangle to dim background of overlay if (overlayBackgroundAlpha > 0.0f) { GLfloat alpha = overlayBackgroundAlpha * 0.5f; sprUI->Draw(Vec2(0, 0), 0.0f, Vec2(wSize.x, wSize.y), Color(0, 0, 0), alpha, 0, 72, 1, 1); } // Draw the overlay if (overlaySlide > -1.0f) { GLfloat slide, alpha; if (overlayShow) slide = EaseQuadIn(overlaySlide); else slide = EaseQuadIn(overlaySlide * -1); alpha = abs(overlaySlide + 1.0f); overlayRenderTarget->Draw((wSize.x - overlayRenderTarget->GetSize().x) / 2 + slide * 50, (wSize.y - overlayRenderTarget->GetSize().y) / 2, alpha); // Draw the items of the overlay if (overlaySlide == 0) { for (GLint i = 0; i < (GLint)overlayItems.size(); i++) { overlayItems[i]->Draw(); } } else // draw the items-rendertarget { overlayItemsRenderTarget->Draw(overlayItemsRenderTargetPosition.x + slide * 50, overlayItemsRenderTargetPosition.y, alpha); } } // Draw tooltip if (tooltipTimer == 0) DrawTooltip(); // Draw cursor if (cursorOffset > -1) { Vec2 mouse = Input::getMousePos(); sprCursor->Draw(Vec2((GLint)mouse.x, (GLint)mouse.y), 0.0f, Vec2(1.0f, 1.0f), 1.0f, cursorOffset * 32, 0, 32, 32); } }