Changeset 294


Ignore:
Timestamp:
05/25/2012 04:38:07 PM (3 years ago)
Author:
andefodahl
Message:

ugh

Location:
traintris
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • traintris/gameboard.py

    r291 r294  
    360360           
    361361    #--------------------------------------------------------------------
    362     # Helper function that displays the info of a particular cell
    363     def displayInfo( self, row, column ):
    364         self.grid[row][column].displayInfo()
    365            
    366     #--------------------------------------------------------------------
    367362    # Notify method responsible for interacting and recieving input from
    368363    # the event manager
  • traintris/gameboardview.py

    r293 r294  
    153153    def addButton(self, text, imageName, size, pos, type):
    154154        self.buttonList.append(Button(text, imageName, size, pos, type))
    155        
    156     def removeButton(self, imageName):
    157         for button in self.buttonList:
    158             if button.imageName == imageName:
    159                 self.buttonList.remove(button)
    160                
    161     def drawCategoryButtons(self):
    162         buttonsize = (self.screen.get_width() / 4)
    163         self.addButton( "Producers", "topbutton", (buttonsize, 65), (0,0), CONSTANTS.CATEGORY)
    164         self.addButton( "Herbivores", "topbutton", (buttonsize, 65), (buttonsize, 0), CONSTANTS.CATEGORY)
    165         self.addButton( "Carnivores", "topbutton", (buttonsize, 65), (2*buttonsize, 0), CONSTANTS.CATEGORY)
    166         self.addButton( "Humans", "topbutton", (buttonsize, 65), (3*buttonsize, 0), CONSTANTS.CATEGORY)
    167        
    168     def drawOrganismBar(self, animalList):
    169         buttonsize = (self.screen.get_width() / 8)+1 # 1 more pixel is needed because of rounding
    170         for x in range(len(animalList)):
    171             self.addButton( animalList[x][0], "tr", (buttonsize, 90), ((x)*buttonsize, 65), CONSTANTS.ORGANISM)
    172            
    173     def removeOrganismBar(self):
    174         for x in range(8):
    175             self.removeButton("tr")
    176          
    177     def drawMenuButtons(self):
    178         boxsize = (self.screen.get_width() / 5)
    179         xstart = self.screen.get_width() - boxsize
    180         ystart = self.screen.get_height() - boxsize
    181         self.addButton( "Remove", "topbutton", (342, 65), (xstart + 10, ystart + 10), CONSTANTS.MENU)
    182 
    183     ############################################################################
    184 
    185     def addOrganism(self):
    186         self.level[self.set][self.y][self.x] = self.setIndex
    187 
    188     def changeTile(self, row, column):
    189         self.level[0][column][row] = self.setIndex
    190        
     155   
    191156    def manageButtons(self, x, y, type):
    192157        self.x = x
     
    233198                    button.mode = CONSTANTS.HOVER
    234199        self.draw()
     200   
     201    def removeButton(self, imageName):
     202        for button in self.buttonList:
     203            if button.imageName == imageName:
     204                self.buttonList.remove(button)
     205               
     206    def drawCategoryButtons(self):
     207        buttonsize = (self.screen.get_width() / 4)
     208        self.addButton( "Producers", "topbutton", (buttonsize, 65), (0,0), CONSTANTS.CATEGORY)
     209        self.addButton( "Herbivores", "topbutton", (buttonsize, 65), (buttonsize, 0), CONSTANTS.CATEGORY)
     210        self.addButton( "Carnivores", "topbutton", (buttonsize, 65), (2*buttonsize, 0), CONSTANTS.CATEGORY)
     211        self.addButton( "Humans", "topbutton", (buttonsize, 65), (3*buttonsize, 0), CONSTANTS.CATEGORY)
     212       
     213    def drawOrganismBar(self, animalList):
     214        buttonsize = (self.screen.get_width() / 8)+1 # 1 more pixel is needed because of rounding
     215        for x in range(len(animalList)):
     216            self.addButton( animalList[x][0], "tr", (buttonsize, 90), ((x)*buttonsize, 65), CONSTANTS.ORGANISM)
     217           
     218    def removeOrganismBar(self):
     219        for x in range(8):
     220            self.removeButton("tr")
     221         
     222    def drawMenuButtons(self):
     223        boxsize = (self.screen.get_width() / 5)
     224        xstart = self.screen.get_width() - boxsize
     225        ystart = self.screen.get_height() - boxsize
     226        self.addButton( "Remove", "topbutton", (342, 65), (xstart + 10, ystart + 10), CONSTANTS.MENU)
     227
     228    ############################################################################
     229
     230    def addOrganism(self):
     231        self.level[self.set][self.y][self.x] = self.setIndex
     232
     233    def changeTile(self, row, column):
     234        self.level[0][column][row] = self.setIndex
    235235       
    236236    def mouseMoveManager(self, x, y):
Note: See TracChangeset for help on using the changeset viewer.