MCPcopy Create free account
hub / github.com/assaultcube/AC / render

Method render

source/src/menus.cpp:349–381  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

347 }
348
349 virtual void render(int x, int y, int w)
350 {
351 int c = greyedout ? 128 : 255;
352 mitem::render(x, y, w);
353 draw_text(text, x, y, c, c, c);
354 if(isselection())
355 {
356 if(!image && !mapmessage)
357 { // load map description and preview picture
358 silent_texture_load = true;
359 const char *cgzpath = "packages" PATHDIVS "maps";
360 if(browsefiledesc)
361 { // checking map messages is slow and may be disabled
362 mapmessage = getfiledesc(cgzpath, behindpath(filename), "cgz"); // check for regular map
363 if(!mapmessage) mapmessage = getfiledesc((cgzpath = "packages" PATHDIVS "maps" PATHDIVS "official"), behindpath(filename), "cgz"); // check for official map
364 }
365 defformatstring(p2p)("%s/preview/%s.jpg", cgzpath, filename);
366 if(!hidebigmenuimages) image = textureload(p2p, 3);
367 if(!image || image == notexture) image = textureload("packages/misc/nopreview.jpg", 3);
368 silent_texture_load = false;
369 }
370 w += FONTH;
371 int xs = (2 * VIRTW - w - x) / 2, xp = x + w + xs / 2, ym = VIRTH - FONTH/2;
372 if(image && !hidebigmenuimages && image->ys > FONTH)
373 {
374 int ys = (xs * image->ys) / image->xs, yp = VIRTH - ys / 2;
375 ym = yp + ys + 2 * FONTH;
376 framedquadtexture(image->id, xp, yp, xs, ys, FONTH);
377 draw_text(text, xp + xs/2 - text_width(text)/2, yp + ys);
378 }
379 if(mapmessage && *mapmessage) draw_text(mapmessage, xp - FONTH, ym, 0xFF, 0xFF, 0xFF, 0xFF, -1, 2 * VIRTW - (xp - FONTH) - FONTH/2);
380 }
381 }
382};
383
384// text input item

Callers

nothing calls this directly

Calls 6

draw_textFunction · 0.85
getfiledescFunction · 0.85
behindpathFunction · 0.85
textureloadFunction · 0.85
framedquadtextureFunction · 0.85
text_widthFunction · 0.85

Tested by

no test coverage detected