def build_parts(self): view = viewpoint.OrthoView( "view",[], geom=dict(left=0, right=40, top=40, bottom=0, near=-1.6, vport=(0,0,WIDTH,HEIGHT)), style={"ClearColor":(0.2,0.2,0.2,0)}) self.hexfield = graphics.HexagonField( "field",self.level) view.append(self.hexfield) with view.compile_style(): glEnable(GL_LIGHTING) self.light = lighting.claim_light() lighting.light_position(self.light,(10,10,10,0)) lighting.light_colour(self.light,(1,1,1,1)) lighting.light_switch(self.light,True) lighting.setup() tools = viewpoint.OrthoView( "tools",[], geom=dict(left=0,right=100,top=300,bottom=0, vport=(WIDTH,0,TOOLW,HEIGHT)), style={"ClearColor":(0,0,0,0)}) tools.append( ColourBar("red",0, geom=dict(scale=10,pos=(10,10,0)))) tools.append( ColourBar("green",1, geom=dict(scale=10,pos=(25,10,0)))) tools.append( ColourBar("blue",2, geom=dict(scale=10,pos=(40,10,0)))) tools.append( ColourBar("alpha",3,intensity=15, geom=dict(scale=10,pos=(55,10,0)))) tools.append( panel.LabelPanel("cellcode", text=self.cellcode, style={"font_size":10}, geom={"pos":(50,250,0)})) tools.append( MiniBorder("border",bg=self.level.bg, bd=self.level.bd,fg=self.level.fg, geom=dict(scale=40,pos=(10,200,0)))) self.parts = part.Group("parts",[view,tools]) for coords,mname in self.level.monsters.items(): self.add_thing_to_view(coords,monsters,mname) for coords,pname in self.level.powerups.items(): self.add_thing_to_view(coords,graphics,pname) self.parts.restyle(True)
def setup_style(self): lighting.setup()