Exemple #1
0
    def __init__(self, game, tools, parts):
        self.game = game
        self.tools = tools
        self.parts = parts
        

        Screen.__init__(self, self.buttons, self.actors, (0,128,0))
    def __init__(self,name):
        Screen.__init__(self,name)

        self.screen.fill([0,0,0])             # just black, no graphic background image

        # go ahead and calculate the time display/buttons

        self.buttonHeight = self.height/3
        self.buttonPadding = self.width/25

        self.matchImage, self.autoImage, self.teleopImage, self.endGameImage = self.numberImages(self.buttonHeight)
        self.buttonWidth = self.matchImage.get_width()
        self.matchPos, self.autoPos, self.teleopPos, self.endGamePos = self.numberPositions(self.buttonHeight,
                                                                                            self.buttonWidth,
                                                                                            self.buttonPadding)
        
        self.matchButton = self.buttons((self.buttonWidth,self.buttonHeight),self.matchPos,
                                        graphic=self.matchImage, callback=self.editMatchNumber,gpio=HARDWARE.button.NW)
        self.autoButton = self.buttons((self.buttonWidth,self.buttonHeight),self.autoPos,
                                       graphic=self.autoImage, callback=self.editAutoNumber,gpio=HARDWARE.button.SW)
        self.teleopButton = self.buttons((self.buttonWidth,self.buttonHeight),self.teleopPos,
                                         graphic=self.teleopImage, callback=self.editTeleopNumber,gpio=HARDWARE.button.NE)
        self.endGameButton = self.buttons((self.buttonWidth,self.buttonHeight),self.endGamePos,
                                          graphic=self.endGameImage, callback=self.editEndGameNumber,gpio=HARDWARE.button.SE)

        self.ButtonS = self.buttons(bgcolor = (0,0,255), callback=self.done,
                                     **Button.standardButton("S","Done",self.screen))
Exemple #3
0
    def __init__(self, game, materials, newMaterials, money):
        
        self.money = money
        
        self.game = game

        
        self.materials = materials
        self.newMaterials = newMaterials
        
        self.constantLabels = []
        self.shownItems = []

        self.mixScreenButton = MatSciGame.MixScreenButton("mixScreen","img/MixingButton.png", pygame.Rect(900, 300, 300, 75),MatSciGame.ForceScreenButton.clicked, self.game)
        
        self.constantLabels.append(ScreenText("moneyText", "Money = " + str(self.money), pygame.Rect(900, 0, 300, 75), pygame.font.SysFont("Arial", 40)))               
        
        self.Notificationlabels = []
        self.infoLabels = []
        
        self.actors = self.constantLabels + self.shownItems
        
        self.buttons = [self.mixScreenButton]
        
        Screen.__init__(self, self.buttons, self.actors, "img/bookOpen.png")
Exemple #4
0
    def __init__(self, robot, game):
        self.robot = robot
        self.game = game
        self.startPosition = (400,400)
        start = BuildButton("tobuildscreen", pygame.Rect(scrright-200, scrbottom-100, 200, 100), "img/back_button_big.png", BuildButton.clicked, self)
        buy = BuyButton("buythings", pygame.Rect(500, scrbottom-140, 400,150), "img/buy_button.png", BuyButton.clicked, self)
        font1 = pygame.font.SysFont("Arial", 40)
        self.moneyLabel = ScreenText("moneytext", "Money: "+str(self.robot.money), pygame.Rect(WINDOWWIDTH-225, 0, 200, 50), font1)
        motorLabel = planes.Plane("motorLabel", pygame.Rect(scrleft,scrtop,170,50), draggable=False, grab=False)
        motorLabel.image = pygame.image.load("img/motorupgrade_label.png")
        mu1 = MotorUpgrade("mu1", pygame.Rect(scrleft,scrtop+60,50,50), "img/motorupgrade_1.png", 100, 0.3, 1, self)
        mu2 = MotorUpgrade("mu2", pygame.Rect(scrleft+60,scrtop+60,50,50), "img/motorupgrade_2.png", 200, 0.2, 2, self)
        mu3 = MotorUpgrade("mu3", pygame.Rect(scrleft+120,scrtop+60,50,50), "img/motorupgrade_3.png", 300, 0.1, 3, self)
        self.shoppingcart = ShoppingCart("shoppingcart", pygame.Rect(350,50,800,600), self)
        self.shoppingcart.image = pygame.image.load("img/shoppingcart.png")

        bumperLabel = planes.Plane("bumperLabel", pygame.Rect(scrleft, mu3.rect.bottom + 30, 170, 50), draggable=False, grab=False)
        bumperLabel.image = pygame.image.load("img/bumperupgrade_label.png")
        bu1 = BumperUpgrade("bu1", pygame.Rect(scrleft, bumperLabel.rect.bottom + 10, 50, 50), "img/bumperupgrade_1.png", 100, 7, 1, self)
        bu2 = BumperUpgrade("bu2", pygame.Rect(scrleft+60, bumperLabel.rect.bottom + 10, 50, 50), "img/bumperupgrade_2.png", 200, 5, 2, self)
        bu3 = BumperUpgrade("bu3", pygame.Rect(scrleft+120, bumperLabel.rect.bottom + 10, 50, 50), "img/bumperupgrade_3.png", 300, 3, 3, self)
        self.costInCartlabel = ScreenText("costincart", "Cost in Cart: 0", pygame.Rect(500, 50, 400, 50), font1)

        buttons = [start, buy]
        self.upgrades = [mu1, mu2, mu3, bu1, bu2, bu3]
        self.actorsWithoutDesc = [self.shoppingcart, motorLabel, bumperLabel, self.moneyLabel, self.costInCartlabel] + self.upgrades
        self.actors = self.actorsWithoutDesc
        Screen.__init__(self,buttons,self.actors,BLACK)
Exemple #5
0
    def __init__(self, game, materials, newMaterials, money):
        
        self.dropTest = MeltingTestZone('dropTest', pygame.Rect(290, 200, 300, 300), self)
        self.dropMats = HoldZone('holdMats', pygame.Rect(730, 100, 90, 550), game)
        self.dropNewMats = HoldZone('holdsNewMaterials', pygame.Rect(150/2,100, 180, 550), game)
        self.money = money
        
        self.game = game

        
        self.materials = materials
        self.newMaterials = newMaterials

        
        
        self.constantLabels = []
        self.dropZones = [self.dropTest, self.dropMats, self.dropNewMats]
        self.mixScreenButton = MatSciGame.MixScreenButton("mixScreen","img/MixingButton.png", pygame.Rect(900, 300, 300, 75),MatSciGame.ForceScreenButton.clicked, self.game)
        
        self.constantLabels.append(ScreenText("moneyText", "Money = " + str(self.money), pygame.Rect(900, 0, 300, 75), pygame.font.SysFont("Arial", 40)))               
        
        
        
        self.Notificationlabels = []
        self.infoLabels = []
        
        self.actors = self.constantLabels + self.dropZones+ self.materials+self.newMaterials
        self.buttons = [self.mixScreenButton]
        
        Screen.__init__(self, self.buttons, self.actors, "img/kitchenBackground.png")
Exemple #6
0
    def __init__(self, game, materials, newMaterials, money):
        
        self.dropTest = ItemMakeZone('makeItems', pygame.Rect(300, 200, 450, 450), self, game)
        self.dropMats = HoldZone('holdMats', pygame.Rect(730, 100, 90, 550), game)
        self.dropNewMats = HoldZone('holdsNewMaterials', pygame.Rect(150/2,100, 180, 550), game)
        self.dropItems = HoldZone('holdsItems', pygame.Rect(650,625, 300, WINDOWHEIGHT/2), game)
        self.money = money
        
        self.game = game

        
        self.materials = materials
        self.newMaterials = newMaterials
        self.items = []
        
        self.items.append(MatSciGame.Item("cup", pygame.Rect(300, 600, 85, 93), 60, 50, 70, .3, .1, .6, (0,0,0)))
        self.items.append(MatSciGame.Item("hammer", pygame.Rect(400, 600, 90, 90), 100, 60, 40, .6, .3, .1, (0,0,0)))
        self.items.append(MatSciGame.Item("table", pygame.Rect(650, 600, 85, 70), 80, 40, 60, .5, .2, .3, (0,0,0)))
        self.items.append(MatSciGame.Item("poker", pygame.Rect(500, 600, 34, 90), 40, 100, 30, .2, .7, .1, (0,0,0)))
        self.items.append(MatSciGame.Item("decor", pygame.Rect(550, 600, 80, 90), 20, 40, 100, .2, .1, .7, (0,0,0)))
        
        self.constantLabels = []
        self.dropZones = [self.dropTest, self.dropMats, self.dropNewMats]
        self.mixScreenButton = MatSciGame.MixScreenButton("mixScreen","img/MixingButton.png", pygame.Rect(900, 300, 300, 75),MatSciGame.ForceScreenButton.clicked, self.game)
        
        self.constantLabels.append(ScreenText("moneyText", "Money = " + str(self.money), pygame.Rect(900, 0, 300, 75), pygame.font.SysFont("Arial", 40)))               
        
        self.Notificationlabels = []
        self.infoLabels = []
        
        self.actors = self.constantLabels + self.dropZones+ self.materials+self.newMaterials + self.items
        self.buttons = [self.mixScreenButton]
        
        Screen.__init__(self, self.buttons, self.actors, "img/kitchenBackground.png")
Exemple #7
0
	def __init__(self, **args):
		self.choice = self.nextchoice = 0
		self.choices = [i.upper() for i in ['Arcade', 'VS Mode', 'Training', 'Options', 'Exit']]
		self.done = False
		keycond = lambda: not self.done
		Screen.__init__(self, 'system/title', keycond=keycond, **args)
		self.incx = 0
Exemple #8
0
    def __init__(self,name):
        Screen.__init__(self,name)
        self.titleImage = pygame.image.load("Media/ChapFCS-title.gif").convert()
        self.titlePosition = ((self.screen.get_width()-self.titleImage.get_width())/2,
                              (self.screen.get_height()/4))
        self.tablePosition = (100,175)

        self.screen.fill([0,0,0])             # just black, no graphic background image

        self.ButtonNW = self.buttons(bgcolor = (0,0,255), callback=self.systemOptions,
                                     **Button.standardButton("NW",["System","Options"],self.screen))
        self.ButtonNE = self.buttons(bgcolor = (0,0,255), callback=self.matchOptions,
                                     **Button.standardButton("NE",["Field","Options"],self.screen))
        self.ButtonSE = self.buttons(bgcolor = (0,0,255), callback=self.about,
                                     **Button.standardButton("SE","About",self.screen))
        self.ButtonS = self.buttons(bgcolor = (255,255,255), callback=self.nextMatch, lcolor = (0,0,0),
                                     **Button.standardButton("S",["Next","Match"],self.screen))


        self.dataTable = self.tables(fontsize=20,font="monospace")

        self.dataTable.addData("Field Name: ",align="right")
        self.dataTable.addData(Settings.fieldName, bold=True, name="fieldName",bgcolor=(50,50,50),callback=self.setFieldName)
        self.dataTable.endRow()
        self.dataTable.addData("Next Match: ", align="right")
        self.dataTable.addData(Settings.matchNumber,name="match",callback=self.setMatchNumber,bold=True)
        self.dataTable.endRow()

        # put out the title
        self.screen.blit(self.titleImage,self.titlePosition)
        self.dataTable.position = self.tablePosition
Exemple #9
0
 def __init__(self, shell, filename, **kwds):
     text = get_text(filename)
     text_pages = text.split("\nPAGE\n")
     pages = []
     page_size = (0, 0)
     for text_page in text_pages:
         lines = text_page.strip().split("\n")
         page = Page(self, lines[0], lines[1:])
         pages.append(page)
         page_size = maximum(page_size, page.size)
     self.pages = pages
     bf = self.button_font
     b1 = Button("Prev Page", font=bf, action=self.prev_page)
     b2 = Button("Menu", font=bf, action=self.go_back)
     b3 = Button("Next Page", font=bf, action=self.next_page)
     b = self.margin
     page_rect = Rect((b, b), page_size)
     gap = (0, 18)
     b1.topleft = add(page_rect.bottomleft, gap)
     b2.midtop = add(page_rect.midbottom, gap)
     b3.topright = add(page_rect.bottomright, gap)
     Screen.__init__(self, shell, **kwds)
     self.size = add(b3.bottomright, (b, b))
     self.add(b1)
     self.add(b2)
     self.add(b3)
     self.prev_button = b1
     self.next_button = b3
     self.set_current_page(0)
    def __init__(self):
        Screen.__init__(self,"fieldNumberScreen")

        self.screen.fill([0,0,0])             # just black, no graphic background image

        self.buttonHeight = self.height/3
        self.buttonPadding = self.width/25

        self.matchImage, self.autoImage, self.teleopImage, self.endGameImage = self.numberImages(self.buttonHeight)
        self.buttonWidth = self.matchImage.get_width()
        self.matchPos, self.autoPos, self.teleopPos, self.endGamePos = self.numberPositions(self.buttonHeight,
                                                                                            self.buttonWidth,
                                                                                            self.buttonPadding)
        
        self.matchButton = self.buttons((self.buttonWidth,self.buttonHeight),self.matchPos,
                                        graphic=self.matchImage, callback=self.editMatchNumber)
        self.autoButton = self.buttons((self.buttonWidth,self.buttonHeight),self.autoPos,
                                       graphic=self.autoImage, callback=self.editAutoNumber)
        self.teleopButton = self.buttons((self.buttonWidth,self.buttonHeight),self.teleopPos,
                                         graphic=self.teleopImage, callback=self.editTeleopNumber)
        self.endGameButton = self.buttons((self.buttonWidth,self.buttonHeight),self.endGamePos,
                                          graphic=self.endGameImage, callback=self.editEndGameNumber)

        self.ButtonS = self.buttons(bgcolor = (0,0,255), callback=self.done,
                                     **Button.standardButton("S","Done",self.screen))
Exemple #11
0
 def __init__(self, **args):
     self.choices = ['RETURN', 'P1 CONTROLS', 'P2 CONTROLS', 'MUSIC VOLUME', 'SFX VOLUME', 'AI DIFFICULTY', 
                     'SHOW HITBOXES', 'NUMBER OF ROUNDS', 'TIMER']
     self.extra = {}
     self.extra['MUSIC VOLUME'] = self.extra['SFX VOLUME'] = [0, 25, 50, 75 ,100]
     self.extra['NUMBER OF ROUNDS'] = [1, 3, 5]
     self.extra['SHOW HITBOXES'] = ['YES', 'NO']
     self.extra['AI DIFFICULTY'] = ['GIANCARLO', 'VERY EASY', 'EASY', 'NORMAL', 'HARD', 'VERY HARD']
     self.extra['TIMER'] = [20, 30, 45, 99]
     self.config = {}
     self.config['MUSIC VOLUME'] = 2
     self.config['SHOW HITBOXES'] = 0
     self.config['SFX VOLUME'] = 2
     self.config['NUMBER OF ROUNDS'] = 2
     self.config['AI DIFFICULTY'] = 3
     self.config['TIMER'] = 2
     self.volume = 50
     self.nrounds = 2
     keycond = lambda: not self.done
     Screen.__init__(self, 'system/title', keycond=keycond, **args)
     self.f = self.area.font['metal']
     self.incx = 0
     self.x, self.y = 8, 8
     self.choice = 0
     self.setting = lambda configname: self.extra[configname][self.config[configname]]
Exemple #12
0
    def toolClicked(self,tools,parts):
        self.tools.database = database
        self.screen.Notificationlabels.append(ScreenText("text1", database, pygame.Rect(100, 3*WINDOWHEIGHT/4, 200, 50), font1))
        passn


        Screen.__init__(self, self.buttons, self.actors, (128,0,0))
Exemple #13
0
 def __init__(self, shell, filename, **kwds):
     text = get_text(filename)
     text_pages = text.split("\nPAGE\n")
     pages = []
     page_size = (0, 0)
     for text_page in text_pages:
         lines = text_page.strip().split("\n")
         page = Page(self, lines[0], lines[1:])
         pages.append(page)
         page_size = maximum(page_size, page.size)
     self.pages = pages
     bf = self.button_font
     b1 = Button("Prev Page", font=bf, action=self.prev_page)
     b2 = Button("Menu", font=bf, action=self.go_back)
     b3 = Button("Next Page", font=bf, action=self.next_page)
     b = self.margin
     page_rect = Rect((b, b), page_size)
     gap = (0, 18)
     b1.topleft = add(page_rect.bottomleft, gap)
     b2.midtop = add(page_rect.midbottom, gap)
     b3.topright = add(page_rect.bottomright, gap)
     Screen.__init__(self, shell, **kwds)
     self.size = add(b3.bottomright, (b, b))
     self.add(b1)
     self.add(b2)
     self.add(b3)
     self.prev_button = b1
     self.next_button = b3
     self.set_current_page(0)
    def __init__(self,name,globalName,mode,title,color):
        Screen.__init__(self,name)

        self.ButtonS = self.buttons(bgcolor = (0,0,255), callback=self.done,
                                     **Button.standardButton("S","Done",self.screen))
        self.ButtonNW = self.buttons(bgcolor = (0,0,255), callback=self.cancel,
                                     **Button.standardButton("NW","Cancel",self.screen))

        self.ButtonNE = self.buttons(bgcolor = (0,0,255), callback=self.up, upCallback=self.release,
                                     holdCallback = self.holdCountUp, rotation = 180,
                                     **removeKey(Button.standardButton("NE","V",self.screen),'rotation'))

        self.ButtonSE = self.buttons(bgcolor = (0,0,255), callback=self.down, upCallback=self.release,
                                     holdCallback = self.holdCountDown,
                                     **Button.standardButton("SE","V",self.screen))
        self.ButtonSW = self.buttons(bgcolor = (255,0,0), callback=self.permenance,
                                     **Button.standardButton("SW","Permenance",self.screen))

        self.globalName = globalName
        self.mode = mode
        self.color = color
        self.title = title
        self.heldCountUp = False
        self.heldCountDown = False
        self.heldLastTime = datetime.datetime.now()
        self.needsUpdate = True
        self.PT = True
Exemple #15
0
    def __init__(self,gamemodel):

        self.win = 0
        self.gamemodel = gamemodel
        self.buttons = []
        self.actors = []
        self.howManyRays = 0
        self.howManySharks = 0
        self.howManyScallops = 0



        self.rayOffset = 0
        self.sharkOffset = 0
        self.scallopOffset = 0

        self.rayX = 0
        self.sharkX = 0
        self.scallopX = 0

        self.timesteps = 0

        font1 = pygame.font.SysFont("Arial", 20)
        font2 = pygame.font.SysFont("Arial", 70)
        self.timeLabel = ScreenText("timetext", "Timestep: "+str(self.timesteps), pygame.Rect(WINDOWWIDTH-270,0,250,40), font1)
        self.numrayLabel = ScreenText("raytext", "Rays: "+str(self.howManyRays), pygame.Rect(70,0,150,30), font1)
        self.changerayLabel = ScreenText("changeraytext", "Change: "+str(self.howManyRays), pygame.Rect(70,40,150,30), font1)
        self.numsharkLabel = ScreenText("sharktext", "Sharks: "+str(self.howManySharks), pygame.Rect(300,0,150,30), font1)
        self.changesharkLabel = ScreenText("changesharktext", "Change: "+str(self.howManySharks), pygame.Rect(300,40,150,30), font1)
        self.numscallopLabel = ScreenText("scalloptext", "Scallops: "+str(self.howManyScallops), pygame.Rect(530,0,150,30), font1)
        self.changescallopLabel = ScreenText("changescalloptext", "Change: "+str(self.howManyScallops), pygame.Rect(530,40,150,30), font1)

        self.winLabel = ScreenText("wintext", "YOU WIN!", pygame.Rect(0,0,1200,750), font2)
        buttonReset = ResetButton("reset", "img/reset_button.png", pygame.Rect(8*WINDOWWIDTH/10-40,8*WINDOWHEIGHT/10-30, 2*WINDOWWIDTH/10, WINDOWHEIGHT/10), ResetButton.clicked, self)
        button0 = TimeStepButton("time", "img/timestep_button.png", pygame.Rect(8*WINDOWWIDTH/10-40,7*WINDOWHEIGHT/10-40, 2*WINDOWWIDTH/10, WINDOWHEIGHT/10), TimeStepButton.clicked, self)
        button1 = RayButton("ray","img/ray.png",pygame.Rect(8.5*WINDOWWIDTH/10-30,WINDOWHEIGHT/10,WINDOWWIDTH/10,WINDOWHEIGHT/10),RayButton.clicked, self)
        button2 = SharkButton("shark","img/shark.png",pygame.Rect(8.5*WINDOWWIDTH/10-30,2*WINDOWHEIGHT/10 + 10,WINDOWWIDTH/10,WINDOWHEIGHT/10),SharkButton.clicked, self)
        button3 = ScallopButton("scallop", "img/scallop.png", pygame.Rect(8.5*WINDOWWIDTH/10-30,3*WINDOWHEIGHT/10 + 20, WINDOWWIDTH/10, WINDOWHEIGHT/10), ScallopButton.clicked, self)
        
        ###########
        buttonback = GBackButton("back", "img/back_button_ingame.png", pygame.Rect(8*WINDOWWIDTH/10-40, 9*WINDOWHEIGHT/10-20, 2*WINDOWWIDTH/10, WINDOWHEIGHT/10), BackButton.clicked, self)
        self.buttons.append(buttonback)
        ##########
        self.buttons.append(buttonReset)
        self.buttons.append(button0)
        self.buttons.append(button1)
        self.buttons.append(button2)
        self.buttons.append(button3)
        #self.buttons.append(button4)

        self.actors.append(self.timeLabel)
        self.actors.append(self.numrayLabel)
        self.actors.append(self.changerayLabel)
        self.actors.append(self.numsharkLabel)
        self.actors.append(self.changesharkLabel)
        self.actors.append(self.numscallopLabel)
        self.actors.append(self.changescallopLabel)

        Screen.__init__(self, self.buttons, self.actors, "img/Background_modsim.png")
Exemple #16
0
	def __init__(self, p1, p2, **args):
		cond = lambda: not self.done
		Screen.__init__(self, 'system/vs', keycond=cond, **args)
		self.p1, self.p2 = p1, p2
		self.c = [RGB(255,0,0,32), RGB(0,255,0,32), RGB(0,0,255,32)]
		self.f = self.area.font['menuwhite']
		self.barmax = p1.totalframes + p2.totalframes
		self.bar = 0
Exemple #17
0
 def __init__(self, main):
     Screen.__init__(self, main)
     self.introtheme = pygame.mixer.music.load("../sound/lifdoff.ogg")
     self.logo = pygame.image.load("../img/lifdofflogo.png")
     self.overlay = pygame.Surface((1280, 800), pygame.SRCALPHA)
     self.overlay.fill((0xFF, 0xFF, 0xFF, 192))
     self.yloc = 500-62
     self.playing = 0
Exemple #18
0
    def __init__(self, main):
        Screen.__init__(self, main)
        self.waves = Waves()
        self.smallerfont = pygame.font.Font(None, 50)  # font for menu items

        def go_back(mpos):
            self.main.change_screen("main")
        self.clickbox.append((30, 650, 102, 50), go_back)
Exemple #19
0
    def __init__(self, display, profile1, profile2):
        Screen.__init__(self, display)

        self.profile1 = profile1
        self.profile2 = profile2

        self.initComponents()
        self.attachComponents()
Exemple #20
0
 def __init__(self):
     dropBig = DropZone('bigDrop', pygame.Rect(200, 300, 200, 200))
     self.materials = []
     for i in range(0,3):
         self.materials.append(Material("mat"+str(i), pygame.Rect((400, 600/(len(self.materials)+1) * i, 20, 20))))
     self.dropZones = [dropBig]
     self.actors = self.dropZones + self.materials
     Screen.__init__(self, [], self.actors, (0,128,0))
Exemple #21
0
 def __init__(self, screen):
     Screen.__init__(self, screen)
     self.font = pygame.font.Font("assets/fonts/blogger-sans.ttf", 32)
     self.text = self.font.render("Pygame Snake", True, (0, 0, 0))
     self.fontbtn = pygame.font.Font("assets/fonts/blogger-sans.ttf", 22)
     self.textnew = self.fontbtn.render("New Game", True, (0, 0, 0))
     self.textquit = self.fontbtn.render("Quit", True, (0, 0, 0))
     self.choice = 0
Exemple #22
0
    def __init__(self,gamemodel):

        self.gamemodel = gamemodel
        self.buttons = []
        self.actors = []
        self.howManyRays = 0
        self.howManySharks = 0
        self.howManyScallops = 0
        self.howManyPlankton = 0


        self.rayOffset = 0
        self.sharkOffset = 0
        self.scallopOffset = 0
        self.planktonOffset = 0

        self.timesteps = 0

        font1 = pygame.font.SysFont("Arial", 20)
        self.timeLabel = ScreenText("timetext", "Timestep: "+str(self.timesteps), pygame.Rect(WINDOWWIDTH-270,0,250,40), font1)
        self.numrayLabel = ScreenText("raytext", "Rays: "+str(self.howManyRays), pygame.Rect(50,0,100,40), font1)
        self.changerayLabel = ScreenText("changeraytext", "Change: "+str(self.howManyRays), pygame.Rect(50,40,100,40), font1)
        self.numsharkLabel = ScreenText("sharktext", "Sharks: "+str(self.howManySharks), pygame.Rect(170,0,100,40), font1)
        self.changesharkLabel = ScreenText("changesharktext", "Change: "+str(self.howManySharks), pygame.Rect(170,40,100,40), font1)
        self.numscallopLabel = ScreenText("scalloptext", "Scallops: "+str(self.howManyScallops), pygame.Rect(290,0,100,40), font1)
        self.changescallopLabel = ScreenText("changescalloptext", "Change: "+str(self.howManyScallops), pygame.Rect(290,40,100,40), font1)
        self.numplanktonLabel = ScreenText("planktontext", "Plankton: "+str(self.howManyPlankton), pygame.Rect(410,0,100,40), font1)
        self.changeplanktonLabel = ScreenText("changeplanktontext", "Change: "+str(self.howManyPlankton), pygame.Rect(410,40,100,40), font1)

        buttonReset = ResetButton("reset", "reset_button.png", pygame.Rect(8*WINDOWWIDTH/10-40,8*WINDOWHEIGHT/10-30, 2*WINDOWWIDTH/10, WINDOWHEIGHT/10), ResetButton.clicked, self)
        button0 = TimeStepButton("time", "timestep_button.png", pygame.Rect(8*WINDOWWIDTH/10-40,7*WINDOWHEIGHT/10-40, 2*WINDOWWIDTH/10, WINDOWHEIGHT/10), TimeStepButton.clicked, self)
        button1 = RayButton("ray","ray.jpg",pygame.Rect(8*WINDOWWIDTH/10-30,WINDOWHEIGHT/10,WINDOWWIDTH/10,WINDOWHEIGHT/10),RayButton.clicked, self)
        button2 = SharkButton("shark","shark.jpg",pygame.Rect(9*WINDOWWIDTH/10-20,WINDOWHEIGHT/10,WINDOWWIDTH/10,WINDOWHEIGHT/10),SharkButton.clicked, self)
        button3 = ScallopButton("scallop", "scallop.jpg", pygame.Rect(8*WINDOWWIDTH/10-30,2*WINDOWHEIGHT/10, WINDOWWIDTH/10, WINDOWHEIGHT/10), ScallopButton.clicked, self)
        button4 = PlanktonButton("plankton", "plankton.jpeg", pygame.Rect(9*WINDOWWIDTH/10-20, 2*WINDOWHEIGHT/10, WINDOWWIDTH/10, WINDOWHEIGHT/10), PlanktonButton.clicked, self)
        
        ###########
        buttonback = GBackButton("back", "back_button_ingame.png", pygame.Rect(8*WINDOWWIDTH/10-40, 9*WINDOWHEIGHT/10-20, 2*WINDOWWIDTH/10, WINDOWHEIGHT/10), BackButton.clicked, self)
        self.buttons.append(buttonback)
        ##########
        self.buttons.append(buttonReset)
        self.buttons.append(button0)
        self.buttons.append(button1)
        self.buttons.append(button2)
        self.buttons.append(button3)
        self.buttons.append(button4)

        self.actors.append(self.timeLabel)
        self.actors.append(self.numrayLabel)
        self.actors.append(self.changerayLabel)
        self.actors.append(self.numsharkLabel)
        self.actors.append(self.changesharkLabel)
        self.actors.append(self.numscallopLabel)
        self.actors.append(self.changescallopLabel)
        self.actors.append(self.numplanktonLabel)
        self.actors.append(self.changeplanktonLabel)
        Screen.__init__(self, self.buttons, self.actors, "Background_modsim.png")
Exemple #23
0
 def __init__(self):
     left = LeftButton("left",pygame.Rect(0,MOVEBUTTON_HEIGHT+5,MOVEBUTTON_WIDTH,MOVEBUTTON_HEIGHT),LeftButton.clicked, self)
     right = RightButton("right",pygame.Rect(MOVEBUTTON_WIDTH+5,MOVEBUTTON_HEIGHT+5,MOVEBUTTON_WIDTH,MOVEBUTTON_HEIGHT),RightButton.clicked, self)
     up = UpButton("up",pygame.Rect(0,0,MOVEBUTTON_WIDTH,MOVEBUTTON_HEIGHT),UpButton.clicked, self)
     down = DownButton("down",pygame.Rect(MOVEBUTTON_WIDTH+5,0,MOVEBUTTON_WIDTH,MOVEBUTTON_HEIGHT),DownButton.clicked, self)
     self.commands = []
     buttons = [up,down,left,right]
     self.robot = Robot(200,200,100,100, "Robot", GREEN)
     self.actors = [self.robot]
     Screen.__init__(self,buttons,self.actors,BLACK)
Exemple #24
0
 def __init__(self):
     Screen.__init__(self,"TeamAssign")
     self.ButtonNW = self.buttons(bgcolor = (100,100,0), callback=self.reboot,
                                  **Button.standardButton("NW","Reboot",self.screen))
     self.ButtonSW = self.buttons(bgcolor = (0,0,255), callback=self.setup,
                                  **Button.standardButton("SW","Yes",self.screen))
     self.ButtonNE = self.buttons(bgcolor = (0,0,255), callback=self.matchSetup,
                                  **Button.standardButton("NE",["Match","Setup"],self.screen))
     self.ButtonSE = self.buttons(bgcolor = (0,0,255), callback=self.quit,
                                  **Button.standardButton("SE","Quit",self.screen))
Exemple #25
0
	def __init__(self,tools,parts,game):
		self.game = game

		start = StartButton("movescreen", pygame.Rect(WINDOWHEIGHT -50, 75, 50))

		Screen.__init__(self,buttons,self.actors,BLACK)

		if model.inGame:
			model.currentGame.currentscreen.update()
			model.currentScreen = model.currentGame.currentScreen
 def __init__(self,name):
     Screen.__init__(self,name)
     self.ButtonNW = self.buttons(bgcolor = (0,0,255), callback=self.systemOptions,
                                  **Button.standardButton("NW",["System","Options"],self.screen))
     self.ButtonSW = self.buttons(bgcolor = (0,0,255), callback=self.setup,
                                  **Button.standardButton("SW","Setup",self.screen))
     self.ButtonNE = self.buttons(bgcolor = (0,0,255), callback=self.matchSetup,
                                  **Button.standardButton("NE",["Match","Options"],self.screen))
     self.ButtonSE = self.buttons(bgcolor = (0,0,255), callback=self.quit,
                                  **Button.standardButton("SE","Quit",self.screen))
    def __init__(self, display, profile, x, y):
        Screen.__init__(self, display)

        # Give screen access to gems and upgrades
        self.profile = profile
        self.x = x
        self.y = y

        self.initComponents()
        self.attachComponents()
Exemple #28
0
    def __init__(self,name):
        Screen.__init__(self,name)

        self.ButtonS = self.buttons(bgcolor = (255,0,0), callback=self.quit,
                                     **Button.standardButton("S","Quit",self.screen))

        self.str = "The Chap FCS is a project created by Chap Research,\nat Westlake High School, in Austin, Texas. The project was created by Arnhav Iyengar, Jacob Rothfus, Lewis Jones, and Eric Rothfus, in association with FRC Team 2468, Team Appreciate. This system was made to promote fariness and safety in the FTC competition, by creating a consistant, and easy way to start and stop all the robots in a match."
        self.target = 1
        self.str2 = ""
        self.x = 10
        self.y = 75
Exemple #29
0
	def __init__(self, p, frame = 'stand', **args):
		cond = lambda: not Input.keyboard['ESCAPE'].Pressed()
		self.c = [RGB(255,0,0), RGB(0,255,0), RGB(0,0,255)]
		self.text = {'A':'hitbox(x1, y1)', 'S':'Set hitbox', 'D':'center', 'F':'frame'}
		self.mode = 'D'
		self.config = dict((i,(0,0)) for i in self.text)
		self.p = p
		self.frame = frame
		Screen.__init__(self, keycond=cond, mouse=True, **args)
		self.config['D'] = self.p.center[self.frame]
		self.frames = [k for k in p.pic.keys()]
    def __init__(self,name,match):
        Screen.__init__(self,name)

        self.match = match        
        self.match.fakeTeams()
        
        self.tablePosition = (130,10)
        self.trashcanpic = pygame.image.load("Media/trashCan2.png").convert()
        self.trashcanpic = pygame.transform.scale(self.trashcanpic, (37,50))
        self.refreshpic = pygame.image.load("Media/refresh.png").convert()
        self.refreshpic = pygame.transform.scale(self.refreshpic, (50,50))

        self.cb1 = (150,150,150)
        self.cb2 = (50,50,50)
        self.sideBlue = (150,150,255)
        self.sideRed = (255,150,150)

        self.roboSel = None                   #  the index into the Table of robots
#        self.trashList = []
        self.AssignButtonPressed = None        #This is set to one of NW NE SW SE or NOne
        self.assignedTeams = { "NW":None, "NE":None, "SW":None, "SE":None }

        self.screen.fill([0,0,0])             # just black, no graphic background image
        self.Button = dict()
        self.Button["NW"] = self.buttons(bgcolor = (0,0,255), callback=self.teamAssign,rock = "NW",fontsize = 25,
                                     **Button.standardButton("NW",self.assignedTeams["NW"],self.screen))
        self.Button["NE"] = self.buttons(bgcolor = (255,0,0), callback=self.teamAssign,rock = "NE",fontsize = 25,
                                     **Button.standardButton("NE",self.assignedTeams["NE"],self.screen))
        self.Button["SW"] = self.buttons(bgcolor = (0,0,255), callback=self.teamAssign,rock = "SW",fontsize = 25,
                                     **Button.standardButton("SW",self.assignedTeams["SW"],self.screen))
        self.Button["SE"] = self.buttons(bgcolor = (255,0,0), callback=self.teamAssign,rock = "SE",fontsize = 25,
                                     **Button.standardButton("SE",self.assignedTeams["SE"],self.screen))
        self.ButtonS = self.buttons(bgcolor = (255,255,255), callback=self.done, lcolor = (0,0,0),
                                     **Button.standardButton("S","Done",self.screen))
        self.ButtonDel = self.buttons(graphic = self.trashcanpic, callback = self.trashButton,rock = "DelButton",
                                      size=(37,50), position=(130,270), rotation=0,labels=["",""])
        self.ButtonRef = self.buttons(graphic = self.refreshpic, callback = self.refresh,rock = "RefreshButton",
                                      size=(50,50), position=(300,270), rotation=0,labels=["",""])
        self.createSides()

        self.sWidth = self.screen.get_width()
        self.sHeight = self.screen.get_height()
        self.boxHeight = self.sWidth/9
        self.boxWidth = self.sHeight/3
        self.one = "1"
        self.two = "2"
        self.myfont = pygame.font.SysFont("monospace", 30)
        self.myfont.set_bold(True)
        self.N1 = self.myfont.render(self.one,1,(255,255,255))
        self.N2 = self.myfont.render(self.two,1,(255,255,255))
        self.screen.blit(self.N1,(self.boxWidth/2-10,self.boxHeight+10))
        self.screen.blit(self.N2,(self.boxWidth/2-10,self.sHeight-(self.boxHeight+40)))        
        self.screen.blit(self.N1,(self.sWidth-(self.boxWidth/2)-10,self.boxHeight+10))
        self.screen.blit(self.N2,(self.sWidth-(self.boxWidth/2)-10,self.sHeight-(self.boxHeight+40)))        
Exemple #31
0
 def __init__(self,name):
     Screen.__init__(self,name)
     self.ButtonNW = self.buttons(bgcolor = (255,0,0), callback=self.button1,
                                  **Button.standardButton("NW",["Button","1"],self.screen))
     self.ButtonSW = self.buttons(bgcolor = (255,0,0), callback=self.button2,
                                  **Button.standardButton("SW",["Button","2"],self.screen))
     self.ButtonNE = self.buttons(bgcolor = (255,0,0), callback=self.button3,
                                  **Button.standardButton("NE",["Button","3"],self.screen))
     self.ButtonSE = self.buttons(bgcolor = (255,0,0), callback=self.button4,
                                  **Button.standardButton("SE",["Button","4"],self.screen))
     self.ButtonS = self.buttons(bgcolor = (255,0,0), callback=self.quit,
                                  **Button.standardButton("S","Quit",self.screen))
Exemple #32
0
 def __init__(self,name):
     Screen.__init__(self,name)
     self.ButtonNW = self.buttons(bgcolor = (255,0,0), callback=self.buttontest,
                                  **Button.standardButton("NW",["Button","Test"],self.screen))
     self.ButtonSW = self.buttons(bgcolor = (255,0,0), callback=self.networktest,
                                  **Button.standardButton("SW",["Network","Test"],self.screen))
     self.ButtonNE = self.buttons(bgcolor = (255,0,0), callback=self.audiotest,
                                  **Button.standardButton("NE",["Audio","Test"],self.screen))
     self.ButtonSE = self.buttons(bgcolor = (255,0,0), callback=self.bletests,
                                  **Button.standardButton("SE",["Bluetooth","Tests"],self.screen))
     self.ButtonS = self.buttons(bgcolor = (255,255,255), callback=self.quit,lcolor=(0,0,0),
                                  **Button.standardButton("S","Done",self.screen))
Exemple #33
0
	def __init__(self, p1, p2, **args):
		self.p1, self.p2 = p1, p2
		cond = lambda: '' in [p1.selected, p2.selected]
		Screen.__init__(self, 'system/select', keycond=cond, **args)
		p1.px, p1.py, p2.px, p2.py = 0, 0, 3, 0
		#p1.cursor, p2.cursor = self.im['1player-cursor'], self.im['2player-cursor']
		p1.c, p2.c = RGB(0, 255, 0), RGB(0, 0, 255)
		p1.tagx, p2.tagx = 8, 38
		p1.namex, p2.namex = 10, 520
		p1.selected, p2.selected = '', ''
		self.characters = [['genjuro', '', '', ''], ['', 'kyo', '', '']]
		self.xmul, self.ymul = 96, 66	
		self.flashcols = [RGB(255, 0, 0, 64), RGB(0, 255, 0, 64), RGB(0, 0, 255, 64)]
Exemple #34
0
    def __init__(self):
        Screen.__init__(self)
        self.background = empty()

        self.level = Linkage.from_xml('data/prototyp_1.xml')
        self.bodies = FlipThroughList(self.level.bodies)
        self.focus = None

        self.gui = gui.GUI()

        self.camera = cam.Camera(Pt(320, 240))

        # sophia = soph.sophia()
        # sophia.pos = Position(10, 10)

        # self.player = sophia
        # self.sprites = [sophia]
        self.sprites = []
    def __init__(self,
                 server,
                 ref,
                 backup_name,
                 width=20,
                 height=4,
                 heartbeat="off"):
        Screen.__init__(self, server, ref)
        self.backup_name = backup_name

        self.set_heartbeat(heartbeat)
        self.set_width(width)
        self.set_height(height)
        self.set_duration(3)

        ## Add title
        self.add_widget(
            TitleWidget(screen=self,
                        ref="title_" + self.ref,
                        text=self.backup_name))
        ## Create job widget
        self.add_widget(
            ShutdownWidget(screen=self, ref="shutdown_" + self.ref, y=2))

        ## Create job status widget
        self.add_widget(
            JobStatusWidget(screen=self,
                            ref="status_" + self.ref,
                            job_name=self.backup_name,
                            y=3))

        ## Create job usage widget
        self.add_widget(
            UsageWidget(screen=self,
                        ref="usage_" + self.ref,
                        job_name=self.backup_name,
                        y=4))
    def __init__(self,
                 server,
                 ref,
                 width=20,
                 height=4,
                 heartbeat="off",
                 debug=False):
        Screen.__init__(self, server, ref)
        self.set_heartbeat(heartbeat)
        self.set_width(width)
        self.set_height(height)
        self.set_duration(8)

        self.add_widget(
            TitleWidget(screen=self,
                        ref="title_" + self.ref,
                        text="steilerGroup-HS"))
        self.add_widget(
            ShutdownWidget(screen=self, ref="shutdown_" + self.ref, y=2))
        self.add_widget(
            UsageWidget(screen=self, ref="usage_" + self.ref, job_name="",
                        y=3))
        self.add_widget(
            RunningJobsWidget(screen=self, ref="jobs_" + self.ref, y=4))
Exemple #37
0
 def __init__(self, size):
     Screen.__init__(self)
     self.size = size