/* * ============= * UI_AddMainButton * From Q2max * ============= */ void UI_AddMainButton(mainmenuobject_t *thisObj, int index, int x, int y, char *name) { int w, h; float x1, y1, w1, h1; R_DrawGetPicSize(&w, &h, name); x1 = x; y1 = y; w1 = w; h1 = h; SCR_AdjustFrom640(&x1, &y1, &w1, &h1, ALIGN_CENTER); thisObj->min[0] = x1; thisObj->max[0] = x1 + w1; thisObj->min[1] = y1; thisObj->max[1] = y1 + h1; switch (index) { case 0: thisObj->OpenMenu = M_Menu_Game_f; case 1: thisObj->OpenMenu = M_Menu_Multiplayer_f; case 2: thisObj->OpenMenu = M_Menu_Options_f; case 3: thisObj->OpenMenu = M_Menu_Video_f; case 4: thisObj->OpenMenu = M_Menu_Quit_f; } }
/* ================= Menu_DrawBanner ================= */ void Menu_DrawBanner (char *name) { int w, h; R_DrawGetPicSize (&w, &h, name ); SCR_DrawPic (SCREEN_WIDTH/2-w/2, SCREEN_HEIGHT/2-150, w, h, ALIGN_CENTER, name, 1.0); }
void M_Quit_Draw (void) { #ifdef QUITMENU_NOKEY Menu_AdjustCursor( &s_quit_menu, 1 ); Menu_Draw( &s_quit_menu ); #else // QUITMENU_NOKEY int w, h; R_DrawGetPicSize (&w, &h, "quit"); SCR_DrawPic (SCREEN_WIDTH/2-w/2, SCREEN_HEIGHT/2-h/2, w, h, ALIGN_CENTER, "quit", 1.0); #endif // QUITMENU_NOKEY }
void UI_Draw_Cursor (void) { int w, h; float ofs_x, ofs_y; float scale = SCR_ScaledVideo(ui_cursor_scale->value); // 0.4 char *cur_img = UI_MOUSECURSOR_PIC; //get sizing vars R_DrawGetPicSize( &w, &h, UI_MOUSECURSOR_PIC ); ofs_x = SCR_ScaledVideo(w) * ui_cursor_scale->value * 0.5; ofs_y = SCR_ScaledVideo(h) * ui_cursor_scale->value * 0.5; R_DrawScaledPic (cursor.x - ofs_x, cursor.y - ofs_y, scale, 1.0f, cur_img); }
/* ============= M_Main_Draw ============= */ void M_Main_Draw (void) { int32_t i; int32_t w, h, last_h; int32_t ystart; int32_t xoffset; int32_t widest = -1; int32_t totalheight = 0; char litname[80]; FindMenuCoords (&xoffset, &ystart, &totalheight, &widest); for (i = 0; main_names[i] != 0; i++) if (i != m_main_cursor) { R_DrawGetPicSize (&w, &h, main_names[i]); SCR_DrawPic (xoffset, (ystart + i*40+3), w, h, ALIGN_CENTER, main_names[i], 1.0); } strcpy (litname, main_names[m_main_cursor]); strcat (litname, "_sel"); R_DrawGetPicSize (&w, &h, litname); SCR_DrawPic (xoffset-1, (ystart + m_main_cursor*40+2), w+2, h+2, ALIGN_CENTER, litname, 1.0); // Draw our nifty quad damage model as a cursor if it's loaded. if (quadModel_loaded) UI_DrawMainCursor3D (xoffset-27, ystart+(m_main_cursor*40+1)); else UI_DrawMainCursor (xoffset-25, ystart+(m_main_cursor*40+1), (int32_t)(cls.realtime/100)%NUM_MAINMENU_CURSOR_FRAMES); R_DrawGetPicSize (&w, &h, "m_main_plaque"); SCR_DrawPic (xoffset-(w/2+50), ystart, w, h, ALIGN_CENTER, "m_main_plaque", 1.0); last_h = h; R_DrawGetPicSize (&w, &h, "m_main_logo"); SCR_DrawPic (xoffset-(w/2+50), ystart+last_h+20, w, h, ALIGN_CENTER, "m_main_logo", 1.0); }
/* ============= FindMenuCoords ============= */ void FindMenuCoords (int32_t *xoffset, int32_t *ystart, int32_t *totalheight, int32_t *widest) { int32_t w, h, i; *totalheight = 0; *widest = -1; for (i = 0; main_names[i] != 0; i++) { R_DrawGetPicSize (&w, &h, main_names[i]); if (w > *widest) *widest = w; *totalheight += (h + 12); } *xoffset = (SCREEN_WIDTH - *widest + 70) * 0.5; *ystart = SCREEN_HEIGHT*0.5 - 100; }
/* ============= UI_DrawMainCursor Draws an animating cursor with the point at x,y. The pic will extend to the left of x, and both above and below y. ============= */ void UI_DrawMainCursor (int32_t x, int32_t y, int32_t f) { char cursorname[80]; static qboolean cached; int32_t w,h; if (!cached) { int32_t i; for (i = 0; i < NUM_MAINMENU_CURSOR_FRAMES; i++) { Com_sprintf (cursorname, sizeof(cursorname), "m_cursor%d", i); R_DrawFindPic (cursorname); } cached = true; } Com_sprintf (cursorname, sizeof(cursorname), "m_cursor%d", f); R_DrawGetPicSize (&w, &h, cursorname); SCR_DrawPic (x, y, w, h, ALIGN_CENTER, cursorname, 1.0); }
void UI_Draw_Cursor (void) { float alpha = 1, scale = SCR_ScaledVideo(0.66); int w, h; char *overlay = NULL; char *cur_img = NULL; if (m_drawfunc == M_Main_Draw) { if (MainMenuMouseHover) { if ((cursor.buttonused[0] && cursor.buttonclicks[0]) || (cursor.buttonused[1] && cursor.buttonclicks[1])) { cur_img = "/gfx/ui/cursors/m_cur_click.pcx"; alpha = 0.85 + 0.15*sin(anglemod(cl.time*0.005)); } else { cur_img = "/gfx/ui/cursors/m_cur_hover.pcx"; alpha = 0.85 + 0.15*sin(anglemod(cl.time*0.005)); } } else cur_img = "/gfx/ui/cursors/m_cur_main.pcx"; overlay = "/gfx/ui/cursors/m_cur_over.pcx"; } else { if (cursor.menuitem) { if (cursor.menuitemtype == MENUITEM_TEXT) { cur_img = "/gfx/ui/cursors/m_cur_text.pcx"; } else { if ((cursor.buttonused[0] && cursor.buttonclicks[0]) || (cursor.buttonused[1] && cursor.buttonclicks[1])) { cur_img = "/gfx/ui/cursors/m_cur_click.pcx"; alpha = 0.85 + 0.15*sin(anglemod(cl.time*0.005)); } else { cur_img = "/gfx/ui/cursors/m_cur_hover.pcx"; alpha = 0.85 + 0.15*sin(anglemod(cl.time*0.005)); } overlay = "/gfx/ui/cursors/m_cur_over.pcx"; } } else { cur_img = "/gfx/ui/cursors/m_cur_main.pcx"; overlay = "/gfx/ui/cursors/m_cur_over.pcx"; } } if (cur_img) { R_DrawGetPicSize( &w, &h, cur_img ); R_DrawScaledPic( cursor.x - scale*w/2, cursor.y - scale*h/2, scale, alpha, cur_img); if (overlay) { R_DrawGetPicSize( &w, &h, overlay ); R_DrawScaledPic( cursor.x - scale*w/2, cursor.y - scale*h/2, scale, 1, overlay); } } }