MCPcopy Create free account
hub / github.com/candybox2/candybox2.github.io / render

Method render

code/main/StatusBarTab.ts:48–70  ·  view source on GitHub ↗
(renderArea: RenderArea, x: number, y: number, selected: boolean)

Source from the content-addressed store, hash-verified

46 }
47
48 public render(renderArea: RenderArea, x: number, y: number, selected: boolean): void{
49 // We draw the borders
50 renderArea.drawVerticalLine("|", x + this.xPos - 1, y, 3);
51 renderArea.drawVerticalLine("|", x + this.xPos + this.width, y, 3);
52
53 // We draw the text
54 for(var i = 0; i < 3; i++){
55 // We draw the string
56 renderArea.drawString(this.text[i], x + this.xPos + 1, y+i);
57 // If the tab is selected, we add a special color
58 if(selected)
59 renderArea.addBackgroundColor(x + this.xPos, x + this.xPos + this.width, y+i, new Color(ColorType.STATUS_BAR_SELECTED_TAB, true));
60 }
61
62 // If the tab isn't selected, we add a button to click it !
63 if(selected == false){
64 renderArea.addMultipleAsciiButtons("statusBarTabButton" + this.tabIndexWhenSelected,
65 x + this.xPos, x + this.xPos + this.width, y,
66 x + this.xPos, x + this.xPos + this.width, y+1,
67 x + this.xPos, x + this.xPos + this.width, y+2);
68 renderArea.addLinkCall(".statusBarTabButton" + this.tabIndexWhenSelected, new CallbackCollection(this.clicked.bind(this)));
69 }
70 }
71
72 // Public getters
73 public getType(): StatusBarTabType{

Callers 3

drawTabsMethod · 0.45
updateStatusBarMethod · 0.45
displayAreaMethod · 0.45

Calls 6

drawVerticalLineMethod · 0.80
drawStringMethod · 0.80
addBackgroundColorMethod · 0.80
addLinkCallMethod · 0.80
bindMethod · 0.80

Tested by

no test coverage detected