Blocking Info Renderer

From FIFE development wiki
Jump to: navigation, search

Introduction

The BlockingInfoRenderer is a debuger or helper renderer. It can be used to show you which instances on the map have their blocking property set to True. You can only changed the color that is used.


Usage

Like all other renderers, you can enable specific layers for this one. Instances on these activated layers are then checked for their blocking property and if it is set to True, the corresponding cells are colored with the default color (green, rgb values: 0,255,0) which you can by using setColor().

Options

getName()

string; gets the name of the renderer


setColor(r, g, b)

changes the used color

r,g,b
integer; color values, range 0-255


Example

Here we active a Layer (agentlayer) and change the color to red (255,0,0)

 # "agentlayer" is the Layer Id to get an instance of fife.Layer()
 # self.map is an instance of fife.Map()
 # self.camera is an instance of fife.Camera()
 
 #get renderer
 renderer = fife.BlockingInfoRenderer.getInstance(self.camera)
 
 #fetch layer
 layer = self.map.getLayer("agentlayer")
 
 #activate a layer
 renderer.addActiveLayer(layer)
 
 #enable renderer
 renderer.setEnabled(True)
 
 #change color to red
 renderer.setColor(255, 0, 0)