Example #1
0
 def __init__(self, x, y, width, height):
     Layer.__init__(self, x, y, width, height, [255.0, 0.0, 0.0])
     Hotspot.__init__(self, x, y, width, height, columns=len(CommandBar.BUTTONS), hover_type=Hotspot.HOVER_CLICK)
     
     self.batches = graphics.Batch()
     self.commands = []
     for text in CommandBar.BUTTONS:
         self.create_label(text)
     
     self.redistribute_labels()
Example #2
0
 def __init__(self, x, y, width, height):
     Layer.__init__(self, x, y, width, height, [255.0, 0.0, 255.0])
     
     self.batches = graphics.Batch()
     self.items = []
     
     self.line_quantity = height / GameView.EFFECTS_LINE_HEIGHT
     for i in range(self.line_quantity):
         self.items.append(text.Label(font_name=GameView.FONT_NAME, font_size=GameView.EFFECTS_FONT_SIZE, x=x, y=y+i*GameView.EFFECTS_LINE_HEIGHT, batch=self.batches))
     
     Hotspot.__init__(self, x, y, width, height, rows=self.line_quantity)
Example #3
0
 def __init__(self, x, y, width, height):
     Layer.__init__(self, x, y, width, height, [0.0, 255.0, 255.0])
     
     self.batches = graphics.Batch()
     self.log = []
     self.max_chars = int(width / GameView.LOG_FONT_SIZE * GameView.FONT_RATIO)
     
     for i in range(GameView.LOG_LINE_QUANTITY):
         self.log.append(text.Label(font_name=GameView.FONT_NAME, font_size=GameView.LOG_FONT_SIZE, x=x, y=y+i*GameView.LOG_LINE_HEIGHT, batch=self.batches))
     
     self.info = text.HTMLLabel(x=x, y=height, width=width, height=height, multiline=True, batch=self.batches)
Example #4
0
    def __init__(self, x, y, width, height, tile_width, tile_height, color):
        Layer.__init__(self, x, y, width, height, color)
        self.cursor = sprite.Sprite(visual.Cursor.get(visual.Cursor.SELECT), x=-50)
        self.show_cursor = False
        
        self.tile_width = tile_width
        self.tile_height = tile_height
        self.grid_width = self.width / self.tile_width
        self.grid_height = self.height / self.tile_height

        self.cursor.scale = float(self.tile_width / 32.0)
        
        GameHotspot.__init__(self, x, y, width, height, self.grid_height, self.grid_width, hover_type=Hotspot.HOVER_HIDDEN)
Example #5
0
 def update(self, components = None):
     world = State.model().game
     Layer.update(self, components)
     
     Hotspot.__init__(self, self.x, self.y, self.width, self.height, world.rows, world.columns)
     
     if components is None or 'cursor' in components:
         self.update_cursor();
     elif components == None:
         y = 0
         for depth in xrange(-world.depth, world.height):
             floor = World.FLOORS[depth]
             self.items[0][y].text = floor['name']
             self.items[0][y].depth = depth
             y += 1
Example #6
0
 def __init__(self, x, y, width, height):
     Layer.__init__(self, x, y, width, height, [0.0, 255.0, 0.0])
     
     self.batches = graphics.Batch()
     self.portrait = sprite.Sprite(visual.Character.HELENA, x+0, y+height-240, batch=self.batches)
     self.portrait.scale = 0.8
     
     self.name = self.create_label(5, 250, 4)
     self.hp = self.create_label(5, 270, 4)
     self.hp.color = (255, 215, 0, 255)
     self.mana = self.create_label(5, 285, 4)
     self.mana.color = (135, 206, 235, 255)
     self.attributes = self.create_label(5, 310, 2, multiline=True)
     
     self.effects = self.create_label(5, 415, multiline=True)
Example #7
0
 def draw(self):
     Layer.draw(self)
     game = State.model()
     world = game.world
     
     cell_width = self.width / world.columns
     cell_height = self.height / world.rows
     
     depth = 0
     
     x = self.x
     for col in xrange(world.columns):
         y = self.y
         for row in xrange(world.rows):
             floor = world.get_floor(col, row, depth)
             
             color = (1.0, 1.0, 1.0)
             
             if game.current_floor_coords == (col, row, depth):
                 color = (0.7, 0.7, 1.0)
             
             if floor is None:
                 opacity = 0
             elif floor.known:
                 opacity = 0.5
             elif floor.explored:
                 opacity = 1.0
             else:
                 opacity = 0
             
             if opacity > 0:
                 self.set_color(*color, opacity=opacity)
                 
                 gl.glRectf(x, y, x + cell_width, y + cell_height)
             
             y += cell_height
         x += cell_width
Example #8
0
 def __init__(self, x, y, width, height):
     Layer.__init__(self, x, y, width, height)
Example #9
0
 def draw(self):
     Layer.draw(self)
     
     '''
Example #10
0
 def draw(self):
     Layer.draw(self);
     if self.show_cursor:
         self.cursor.draw()