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

Method render

source/src/menus.cpp:535–558  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

533 virtual int width() { return text_width(text) + (isradio ? 0 : menurighttabwidth) + maxvaluewidth + 2*FONTH; }
534
535 virtual void render(int x, int y, int w)
536 {
537 bool sel = isselection();
538 int range = max_-min_;
539 int cval = value-min_;
540
541 int tw = text_width(text), ow = isradio ? text_width(curval) : menurighttabwidth, pos = !isradio || ow < menurighttabwidth ? menurighttabwidth : ow;
542 if(sel)
543 {
544 renderbg(x + w - pos, y, ow, menuselbgcolor);
545 renderbg(x, y, w - pos - FONTH/2, menuseldescbgcolor);
546 if(pos - ow > FONTH/2) renderbg(x + w - pos + ow + FONTH/2, y, pos - ow - FONTH/2, menuseldescbgcolor);
547 }
548 int c = greyedout ? 128 : 255;
549 draw_text(text, x, y, c, c, c);
550 draw_text(curval, x + (isradio ? w - pos : tw), y, c, c, c);
551
552 if(!isradio)
553 {
554 blendbox(x+w-menurighttabwidth, y+FONTH/3, x+w, y+FONTH*2/3, false, -1, &gray);
555 int offset = (int)(cval/((float)range)*menurighttabwidth);
556 blendbox(x+w-menurighttabwidth+offset-FONTH/6, y, x+w-menurighttabwidth+offset+FONTH/6, y+FONTH, false, -1, greyedout ? &gray : (sel ? &whitepulse : &white));
557 }
558 }
559
560 virtual void key(int code, bool isdown)
561 {

Callers

nothing calls this directly

Calls 3

text_widthFunction · 0.85
draw_textFunction · 0.85
blendboxFunction · 0.85

Tested by

no test coverage detected