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

Method draw

code/main/QuestEntity.ts:180–207  ·  view source on GitHub ↗
(renderArea: RenderArea)

Source from the content-addressed store, hash-verified

178 }
179
180 public draw(renderArea: RenderArea): void{
181 if(this.renderArea != null){
182 // On some conditions, we exit now and don't draw anything (it allows no drawing outside of the quest panel when realQuestSize and realQuestDrawingSize are different (in the hole for example)
183 if(this.globalPosition.x + this.renderAreaPosition.x + this.quest.getGlobalDrawingOffset().x > this.quest.getRealQuestDrawingSize().x)
184 return;
185 if(this.globalPosition.y + this.renderAreaPosition.y + this.quest.getGlobalDrawingOffset().y > this.quest.getRealQuestDrawingSize().y)
186 return;
187 if(this.globalPosition.x + this.renderAreaPosition.x + this.renderArea.getWidth() + this.quest.getGlobalDrawingOffset().x < 0)
188 return;
189 if(this.globalPosition.y + this.renderAreaPosition.y + this.renderArea.getHeight() + this.quest.getGlobalDrawingOffset().y < 0)
190 return;
191
192 renderArea.drawArea(this.renderArea, this.quest.getRealQuestPosition().x + this.quest.getGlobalDrawingOffset().x + this.globalPosition.x + this.renderAreaPosition.x, this.quest.getRealQuestPosition().y + this.quest.getGlobalDrawingOffset().y + this.globalPosition.y + this.renderAreaPosition.y, this.transparency);
193 }
194
195 // If the debug mode is on
196 if(Saving.loadBool("gameDebug")){
197 if(this.cbc != null){
198 for(var i = 0; i < this.cbc.getBoxes().length; i++){
199 for(var k = 0; k < this.cbc.getBoxes()[i].getSize().x; k++){
200 for(var j = 0; j < this.cbc.getBoxes()[i].getSize().y; j++){
201 renderArea.drawString("D", this.quest.getRealQuestPosition().x + this.quest.getGlobalDrawingOffset().x + this.globalPosition.x + this.cbc.getBoxes()[i].getPosition().x + k, this.quest.getRealQuestPosition().y + this.quest.getGlobalDrawingOffset().y + this.globalPosition.y + this.cbc.getBoxes()[i].getPosition().y + j);
202 }
203 }
204 }
205 }
206 }
207 }
208
209 public forceMoving(movement: Pos): void{
210 if(this.canBeForcedToMove)

Callers 2

handleAnimationMethod · 0.45

Calls 10

drawAreaMethod · 0.80
getRealQuestPositionMethod · 0.80
getBoxesMethod · 0.80
getSizeMethod · 0.80
drawStringMethod · 0.80
getWidthMethod · 0.45
getHeightMethod · 0.45
getPositionMethod · 0.45

Tested by

no test coverage detected