示例#1
0
    def Draw(self, gameDisplay):
        '''
        On dessine le fond d'ecran
        '''
        Helpers.blit_alpha(gameDisplay, self.bg_img, (0, 0), 180)
        '''
        On cree les textes
        '''
        titleSurface = self.TitleFont.render("Bonjour !", True,
                                             (255, 255, 255))
        swipeSurface = self.SwipeFont.render(
            "Balayez vers le haut pour continuer", True, (255, 255, 255))
        timeSurface = self.TimeFont.render(strftime("%H:%M:%S"), True,
                                           (255, 255, 255))
        '''
        Calculs de positions pour simplifier les blit() en bas
        '''
        secondsWidth = self.TimeFont.render(strftime("00:00:00"), True,
                                            (250, 250, 250)).get_rect().width
        '''
        On dessine tout, avec transparence pour les animations
        '''
        # on dessine l'heure situee en bas
        Helpers.blit_alpha(
            gameDisplay, timeSurface,
            (self.WindowRes[0] / 2 - secondsWidth / 2,
             self.WindowRes[1] * 6.4 / 8 - timeSurface.get_rect().height / 2 +
             self.time_offset), self.time_color)

        # on dessine la ligne qui demande de glisser vers le haut
        Helpers.blit_alpha(
            gameDisplay, swipeSurface,
            (self.WindowRes[0] / 2 - swipeSurface.get_rect().width / 2,
             self.WindowRes[1] / 2 - swipeSurface.get_rect().height / 2 + 50 +
             self.swipe_offset), self.swipe_color)

        # on dessine le Bonjour au centre
        Helpers.blit_alpha(
            gameDisplay, titleSurface,
            (self.WindowRes[0] / 2 - titleSurface.get_rect().width / 2,
             self.WindowRes[1] / 2 - titleSurface.get_rect().height / 2 - 25 +
             self.bonjour_offset), self.bonjour_color)
示例#2
0
    def Draw(self, gameDisplay):
        '''
        On affiche le fond d'ecran en fond (cad en premiere position dans le Draw())
        '''
        affine = -0.229166667 * self.ancrage + 180
        if self.ScreenStatus == "RUNNING":
            Helpers.blit_alpha(gameDisplay, self.bg_img, (0, 0), affine)
        if "FADING" in self.ScreenStatus:
            Helpers.blit_alpha(gameDisplay, self.bg_img, (0, 0), affine)
        '''-------------------------------------------------------------------------------------------------------------
        -------------------------------------------------PANEL HOME-----------------------------------------------------
        -------------------------------------------------------------------------------------------------------------'''
        '''
        Renders the Date and Time (date, Hours+Minutes, Seconds)
        '''
        timeSurface = self.TimeFont.render(strftime("%H:%M"), True,
                                           (255, 255, 255))
        secondsSurface = self.SecondsFont.render(strftime(":%S"), True,
                                                 (255, 255, 255))
        dateSurface = self.DateFont.render(
            "Today is " + strftime("%A %d, %B %Y"), True, (255, 255, 255))
        '''
        Calculs de positions pour simplifier les blit() en bas
        '''
        secondsWidth = self.SecondsFont.render(
            strftime(":00"), True, (255, 255, 255)).get_rect().width
        timePos = self.WindowRes[0] / 2 - (timeSurface.get_rect().width +
                                           secondsWidth) / 2
        '''
        On dessine tout, avec transparence
        '''
        # on dessine l'heure
        Helpers.blit_alpha(
            gameDisplay, timeSurface,
            (timePos, self.WindowRes[1] * 2 / 5 -
             timeSurface.get_rect().height / 2 - 60 + self.ancrage),
            self.time_color)

        # on dessine les secondes
        Helpers.blit_alpha(
            gameDisplay, secondsSurface,
            (timePos + timeSurface.get_rect().width,
             timeSurface.get_rect().bottom -
             timeSurface.get_rect().height * 1 / 5 - 45 + self.ancrage),
            self.time_color)

        # on dessine la date situee sous l'heure
        Helpers.blit_alpha(
            gameDisplay, dateSurface,
            (self.WindowRes[0] / 2 - dateSurface.get_rect().width / 2,
             self.WindowRes[1] * 3 / 5 - dateSurface.get_rect().height / 2 -
             60 + self.ancrage), self.date_color)
        '''
        On affiche la ligne separatrice au milieu des deux panels.
        De plus on la decale un petit peu en fonction de quel ecran on regarde pour constamment la cacher,
        sauf pendant qu'on scroll.
        '''
        self.off = -1
        if self.ancrage == self.WindowRes[1]:
            self.off = 0
        gameDisplay.blit(self.horizontal_line, (35, self.off + self.ancrage))
        '''
        Indication d'ou sont les applications
        '''
        appshint = self.AppsHintFont.render("APPLICATIONS", True,
                                            (255, 255, 255))
        Helpers.blit_alpha(gameDisplay, appshint,
                           (self.WindowRes[0] / 2 -
                            appshint.get_rect().width / 2, 10 + self.ancrage),
                           self.widget_opacity)

        self.arrow.Draw(
            gameDisplay,
            (self.WindowRes[0] / 2 - appshint.get_rect().width / 2 - 26,
             13 + self.ancrage), "DOWN", self.widget_opacity - 60)
        self.arrow.Draw(
            gameDisplay,
            (self.WindowRes[0] / 2 + appshint.get_rect().width / 2 + 10,
             13 + self.ancrage), "DOWN", self.widget_opacity - 60)

        self.widget_manager.Draw(gameDisplay, self.ancrage,
                                 self.widget_opacity)
        '''-------------------------------------------------------------------------------------------------------------
        ---------------------------------------------PANEL APPLICATIONS-------------------------------------------------
        -------------------------------------------------------------------------------------------------------------'''
        '''
        On genere et dessine le titre "applications" en haut du panel
        '''
        AppsTitleSurface = self.AppsTitleFont.render("Applications", True,
                                                     (255, 255, 255))
        gameDisplay.blit(
            AppsTitleSurface,
            (self.WindowRes[0] / 2 - AppsTitleSurface.get_rect().width / 2,
             7 + self.ancrage - self.WindowRes[1]))
        '''
        On dessine la ligne horizontale separatrice sous le titre "Applications"
        '''
        gameDisplay.blit(self.horizontal_line,
                         (35, 43 + self.ancrage - self.WindowRes[1]))
        '''
        TEMPORAIRE On dessine une petite description sympa
        '''
        #AppsTitleSurface    = self.DateFont.render("No apps here yet. Download them in the store !", True, (255, 255, 255))
        #gameDisplay.blit(AppsTitleSurface, (self.WindowRes[0] / 2 - AppsTitleSurface.get_rect().width / 2, 230 + self.ancrage - self.WindowRes[1]))
        '''
        On dessine les icones d'applications et les descriptions.
        '''
        prochainement = self.DisponibleFont.render("Prochainement", True,
                                                   (255, 255, 255))
        disponible = self.DisponibleFont.render("disponible", True,
                                                (255, 255, 255))
        for line in range(0, 2):
            for app in range(0, 4):
                gameDisplay.blit(self.app_icons[app + line * 4],
                                 (50 + (app + 1) * 700 / 4 - 700 / 8 -
                                  self.app_icons[app].get_rect().width / 2,
                                  45 + line * 180 - 450 + self.ancrage))

                description = self.DescriptionFont.render(
                    self.app_descriptions[app + line * 4], True,
                    (255, 255, 255))
                gameDisplay.blit(description,
                                 (50 + (app + 1) * 700 / 4 - 700 / 8 -
                                  description.get_rect().width / 2,
                                  45 + self.app_icons[app].get_rect().height -
                                  5 + line * 180 - 450 + self.ancrage))

                if line == 1:
                    Helpers.blit_alpha(
                        gameDisplay, self.blackicons[app + line * 4],
                        (50 + (app + 1) * 700 / 4 - 700 / 8 -
                         self.app_icons[app].get_rect().width / 2,
                         45 + line * 180 - 450 + self.ancrage), 190)
                    gameDisplay.blit(
                        prochainement,
                        (50 + (app + 1) * 700 / 4 - 700 / 8 -
                         prochainement.get_rect().width / 2,
                         70 + line * 180 - 450 + self.ancrage +
                         self.app_icons[app].get_rect().width / 2 -
                         prochainement.get_rect().width / 2))
                    gameDisplay.blit(
                        disponible,
                        (50 + (app + 1) * 700 / 4 - 700 / 8 -
                         disponible.get_rect().width / 2,
                         77 + line * 180 - 450 + self.ancrage +
                         self.app_icons[app].get_rect().height / 2 -
                         disponible.get_rect().width / 2))