示例#1
0
    def __init__(self, win, font, frameRate, version):
        self.win = win
        self.font = font
        self.frameRate = frameRate
        self.version = version

        self.width = int(self.win.get_width() * 0.8)
        self.height = int(self.win.get_height() * 0.8)

        self.x = (self.win.get_width() - self.width) / 2.0
        self.y = (self.win.get_height() - self.height) / 2.0

        self.backgroundFade = pygame.Surface(
            (self.win.get_width(), self.win.get_height()), pygame.SRCALPHA)
        self.backgroundFade.fill((255, 255, 255, 156))

        self.aboutBackground = pygame.Rect(
            0 + (self.win.get_width() - self.width) / 2.0,
            0 + (self.win.get_height() - self.height) / 2.0, self.width,
            self.height)

        self.button_back = Button("Back",
                                  (self.x + 20, self.height + self.y - 20),
                                  font=self.font)
        self.button_back.rect.y -= self.button_back.rect.h
        self.buttons = [self.button_back]

        self.aboutTitleText = TextBox('About:', (self.x + 20, self.y + 20),
                                      width=self.width - 40,
                                      backgroundColour=(150, 150, 150),
                                      font=self.font,
                                      fontSize='large')
        self.aboutText_1 = TextBox(
            "ReBel version {}".format(self.version[1:]),
            (self.x + 20, self.aboutTitleText.y + self.aboutTitleText.h + 7),
            width=self.width - 40,
            font=self.font,
            fontSize='small')
        self.aboutText_2 = TextBox("ReBel is a client-server-based multiuser online ringing software. Developed by Samuel M. Senior and " + \
                                   "open-sourced using the BSD-3-Clause license.",
                                   (self.x+20, self.aboutText_1.y+self.aboutText_1.h+10), width=self.width-40, font=self.font, fontSize='tiny')
        self.aboutText_3 = TextBox(
            "Source code can be downloaded from 'https://github.com/samuelsenior/ReBel'.",
            (self.x + 20, self.aboutText_2.y + self.aboutText_2.h + 10),
            width=self.width - 40,
            font=self.font,
            fontSize='tiny')
        self.aboutText_4 = TextBox(
            "The latest release can be downloaded from 'https://github.com/samuelsenior/ReBel/releases'.",
            (self.x + 20, self.aboutText_3.y + self.aboutText_3.h + 10),
            width=self.width - 40,
            font=self.font,
            fontSize='tiny')
        self.aboutText = [
            self.aboutTitleText, self.aboutText_1, self.aboutText_2,
            self.aboutText_3, self.aboutText_4
        ]
    def __init__(self,screen,cursor, clock, padre):
        resource.set_images_path(os.path.join("imagenes", "compartir"))
        self.background = resource.get_image("fondoCompartir.png")
        
        imgBtnEnviar = resource.get_image("botonEnviar.png")
        imgBtnEnviarSelec = resource.get_image("BotonesEnviar_selec.png")
        
        self.btnEnviar = Boton.Boton(imgBtnEnviar, imgBtnEnviarSelec, 700,550)
        
        
        
        self.screen = screen
        self.clock = clock
        self.tablero = padre

        self.mouse = mouse.Mouse()
        self.cursor = cursor
  
        self.inicio = True
        self.juego = False
        self.terminar = False
        self.envio = False
        self.letreroEnvio = False
        self.letreroNoEnvio = False
        self.CamposVacios = False
        

        self.tb1 = TextBox(position=(460,250),size=(400,25),textsize=22,editable=False)
        self.tb2 = TextBox(position=(460,300),size=(400,25),textsize=22,editable=False)
        self.contendora = textBox2.Contenedora()
        rutaFuente = os.path.join("fuentes", "PatrickHand-Regular.ttf")
        self.font = pygame.font.Font(rutaFuente, 22) 
        self.img=self.font.render("Nombre: ",1,(0,0,0))
        self.img2=self.font.render("Colegio: ",1,(0,0,0))
        self.img3=self.font.render("Mensaje: ",1,(0,0,0))
        
        
        resource.set_images_path(os.path.join("imagenes"))
        imgBtnRegresar = resource.get_image("boton_regresar.png")
        imgBtnRegresarSelec = resource.get_image("boton_regresar_selec.png")
        
        self.background2 = resource.get_image("Fondo.jpg", False)
        
        
        
        self.btnRegresar = Boton.Boton(imgBtnRegresar, imgBtnRegresarSelec, (1200 - 214 - 10), 10)
        
        self.msjInicio = MensajeEmergente.MensajeInicial(30, "Compartir")
        self.msjVacios = MensajeEmergente.MensajeInicial(30, "Compartir2")
        self.msjNoEnvio = MensajeEmergente.MensajeInicial(30, "Compartir3")
        self.msjEnvio = MensajeEmergente.MensajeInicial(30, "Compartir4")
示例#3
0
 def generate_textBoxs(self):
     group = []
     posx = self.posx + self.s_left + self.s_text_inter + self.text_sizex
     for i in range(0, 2):
         posy = self.posy + self.s_top + (self.items_sizey +
                                          self.s_between) * i
         group.append(
             TextBox(posx,
                     posy,
                     self.items_sizex,
                     self.items_sizey,
                     color=(176, 184, 196),
                     font_size=self.font_size))
     return group[:]
示例#4
0
    def generate_textBoxs(self):
        """
    Genera el arreglo de TextBoxes
    """
        group = []
        posx = self.posx + self.s_left + self.s_text_inter + self.menu_items_sizex
        for i in range(0, 2):
            group.append(
                TextBox(posx,
                        self.posy + self.s_top +
                        (self.items_sizey + self.s_between) * i,
                        self.items_sizex,
                        self.items_sizey,
                        color=(176, 184, 196),
                        font_size=self.font_size))

        return group[:]
示例#5
0
FPS = 50
fpsClock=pygame.time.Clock()

gameTable = (0, 10, 100, 100)

fontObj = pygame.font.Font(None, 32)                  # 현재 디렉토리로부터 myfont.ttf 폰트 파일을 로딩한다. 텍스트 크기를 32로 한다
dieSurface = fontObj.render('YOU DIED', True, RED)

grass = pygame.image.load("youwin.png")
dictimg = pygame.image.load("book.png")
gameover = pygame.image.load("heart.png")
dictimg = pygame.transform.scale(dictimg, (80, 30))
heartimg = pygame.image.load("heart.png")
heartimg = pygame.transform.scale(heartimg, (30, 30))

textBox = TextBox()
shiftDown = False
textBox.rect.center = [310, 400]


def main_window(speed, difficulty):
    word = Word('E')
    width, height = 640, 480
    screen = pygame.display.set_mode((width, height))
    pygame.display.set_caption("Mole Game")
    screen.fill(GREEN)

    running = True

    wordsLst = []  # [word || block_index || timer]
    mainTimer = 100 - speed
示例#6
0
文件: helpScreen.py 项目: sw104/ReBel
    def __init__(self, win, font, frameRate):
        self.win = win
        self.font = font
        self.frameRate = frameRate

        self.width = int(self.win.get_width() * 0.8)
        self.height = int(self.win.get_height() * 0.8)

        self.x = (self.win.get_width() - self.width) / 2.0
        self.y = (self.win.get_height() - self.height) / 2.0

        self.backgroundFade = pygame.Surface((self.win.get_width(), self.win.get_height()), pygame.SRCALPHA)
        self.backgroundFade.fill((255, 255, 255, 156))

        self.helpBackground = pygame.Rect(0 + (self.win.get_width() - self.width) / 2.0, 0 + (self.win.get_height() - self.height) / 2.0, self.width, self.height)

        self.button_back = Button("Back", (self.x + 20, self.height + self.y - 20), font=self.font)
        self.button_back.rect.y -= self.button_back.rect.h
        #
        self.button_serverPage = Button("Server", (self.x + self.width - 20, self.y + 20), font=self.font)
        self.button_serverPage.rect.x -= self.button_serverPage.rect.w
        #
        self.button_ringingPage = Button("Ringing", (self.button_serverPage.x - self.button_serverPage.rect.w - 10, self.y + 20), font=self.font)
        self.button_ringingPage.rect.x -= self.button_ringingPage.rect.w
        #
        self.buttons = [self.button_back, self.button_ringingPage, self.button_serverPage]

        self.serverTitleText = TextBox('Server Help:',
                                       (self.x+20, self.y+self.button_serverPage.rect.h+20), width=self.width-40, backgroundColour=(150, 150, 150), font=self.font, fontSize='large')
        self.serverSubTitleText = TextBox('Connecting to a server:',
                                          (self.x+20, self.serverTitleText.y+self.serverTitleText.h+10), width=self.width-40, font=self.font, fontSize='small')
        self.serverText_1 = TextBox("In 'Your Name' enter your name.",
                                    (self.x+20, self.serverSubTitleText.y+self.serverSubTitleText.h+7), width=self.width-40, font=self.font, fontSize='tiny')
        self.serverText_2 = TextBox("In 'Server IP' enter the public IP of the server as told by the person running the server, or the local IP of the " + \
                                    "server if on the same network, or leave it blank if you are on the same machine as the one runnning the server.",
                                    (self.x+20, self.serverText_1.y+self.serverText_1.h+10), width=self.width-40, font=self.font, fontSize='tiny')
        self.serverText_3 = TextBox("Leave 'Server Port' as the default value if the person running the server hasn't changed it, " + \
                                    "otherwise change it to the number they give.",
                                    (self.x+20, self.serverText_2.y+self.serverText_2.h+10), width=self.width-40, font=self.font, fontSize='tiny')
        self.serverText_4 = TextBox("Once these details have been entered click 'Connect to Server'. If you are able to connect to the " + \
                                    "server successfully a 'Connected' message will appear, if not a 'Server Offline' message will appear. " +
                                    "If you can't connect make sure to check your internet connection, the server IP, and the server port.",
                                    (self.x+20, self.serverText_3.y+self.serverText_3.h+10), width=self.width-40, font=self.font, fontSize='tiny')
        self.serverText_5 = TextBox("To reconnect to a server or to connect to a new one go back to the home screen, enter in the " + \
                                    "details of the new server (or leave the original details in if reconnecting), then click 'Connect " +
                                    "to Server' and then click 'Start Ringing' like normal.",
                                    (self.x+20, self.serverText_4.y+self.serverText_4.h+10), width=self.width-40, font=self.font, fontSize='tiny')
        self.serverText = [self.serverTitleText, self.serverSubTitleText, self.serverText_1, self.serverText_2, self.serverText_3, self.serverText_4, self.serverText_5]

        self.ringingTitleText = TextBox('Ringing Help:',
                                        (self.x+20, self.y+self.button_serverPage.rect.h+20), width=self.width-40, backgroundColour=(150, 150, 150), font=self.font, fontSize='large')
        self.ringingSubTitleText_1 = TextBox('Ringing Keys:',
                                             (self.x+20, self.ringingTitleText.y+self.ringingTitleText.h+10), width=self.width-40, font=self.font, fontSize='small')
        self.ringingText_1 = TextBox("By default bells 1 and 2 are set as the ringable and are rung with the 'j' and 'f' keys.",
                                     (self.x+20, self.ringingSubTitleText_1.y+self.ringingSubTitleText_1.h+7), width=self.width-40, font=self.font, fontSize='tiny')
        self.ringingText_2 = TextBox("All the bells can be configured to be rung and can be set to use any letter or number key. The key bindings are " + \
                                     "set in the 'Options' menu found in the ringing screen.",
                                     (self.x+20, self.ringingText_1.y+self.ringingText_1.h+10), width=self.width-40, font=self.font, fontSize='tiny')
        self.ringingText_3 = TextBox("The bell you set as your first bell will be placed at the bottom of the ringing circle, just to the right of the " + \
                                     "center.",
                                     (self.x+20, self.ringingText_2.y+self.ringingText_2.h+10), width=self.width-40, font=self.font, fontSize='tiny')
        self.ringingSubTitleText_2 = TextBox('Bell Tunings and Scales:',
                                             (self.x+20, self.ringingText_3.y+self.ringingText_3.h+16), width=self.width-40, font=self.font, fontSize='small')
        self.ringingText_4 = TextBox("By default the bells are in the key of C and are generated from a size 15 handbell in C. The key of the bells can " + \
                                     "changed by shifting them by both an integer number of semitones and an integer number of octaves. Currently this " + \
                                     "can only be done by manually changing the config file.",
                                     (self.x+20, self.ringingSubTitleText_2.y+self.ringingSubTitleText_2.h+10), width=self.width-40, font=self.font, fontSize='tiny')
        self.ringingText_5 = TextBox("The bells are tuned to a major scale by default though they can also be changed to natural, harmonic, and melodic " + \
                                     "minor scales. Currently this can only be done manually changing the config file.",
                                     (self.x+20, self.ringingText_4.y+self.ringingText_4.h+10), width=self.width-40, font=self.font, fontSize='tiny')
        
        self.ringingText = [self.ringingTitleText, self.ringingSubTitleText_1, self.ringingText_1, self.ringingText_2, self.ringingText_3]#,
示例#7
0
    def __init__(self, win, font, config, frameRate):
        self.win = win
        self.font = font
        self.config = config
        self.frameRate = frameRate

        self.bellKeysUpdated = False

        self.width = int(self.win.get_width() * 0.8)
        self.height = int(self.win.get_height() * 0.8)

        self.x = (self.win.get_width() - self.width) / 2.0
        self.y = (self.win.get_height() - self.height) / 2.0

        self.backgroundFade = pygame.Surface(
            (self.win.get_width(), self.win.get_height()), pygame.SRCALPHA)
        self.backgroundFade.fill((255, 255, 255, 156))

        self.optionsBackground = pygame.Rect(
            0 + (self.win.get_width() - self.width) / 2.0,
            0 + (self.win.get_height() - self.height) / 2.0, self.width,
            self.height)

        self.button_back = Button("Cancel",
                                  (self.x + 20, self.height + self.y - 20),
                                  font=self.font)
        self.button_back.rect.y -= self.button_back.rect.h
        #
        self.button_save = Button(
            "Save", (self.x + self.width - 20, self.height + self.y - 20),
            font=self.font)
        self.button_save.rect.x -= self.button_save.rect.w
        self.button_save.rect.y -= self.button_save.rect.h
        #
        self.button_other = Button("Other",
                                   (self.x + self.width - 20, self.y + 20),
                                   font=self.font)
        self.button_other.rect.x -= self.button_other.rect.w
        #
        self.button_tuning = Button(
            "Tuning",
            (self.button_other.x - self.button_other.rect.w - 10, self.y + 20),
            font=self.font)
        self.button_tuning.rect.x -= self.button_tuning.rect.w
        #
        self.button_keys = Button(
            "keys", (self.button_tuning.x - self.button_tuning.rect.w - 10,
                     self.y + 20),
            font=self.font)
        self.button_keys.rect.x -= self.button_keys.rect.w
        #
        self.buttons = [
            self.button_back, self.button_save
        ]  #, self.button_keys, self.button_tuning, self.button_other]

        self.keysTitleText = TextBox(
            'Keys Options:',
            (self.x + 20, self.y + self.button_keys.rect.h + 20),
            width=self.width - 40,
            backgroundColour=(150, 150, 150),
            font=self.font,
            fontSize='large')
        self.keysSubTitleText_1 = TextBox(
            'Bell Keys:',
            (self.x + 20, self.keysTitleText.y + self.keysTitleText.h + 10),
            width=self.width - 40,
            font=self.font,
            fontSize='small')
        self.keysText_1 = TextBox(
            "In the 'Ringable Bells' row of boxes enter in the bell numbers of the bells that you want to ring.",
            (self.x + 20,
             self.keysSubTitleText_1.y + self.keysSubTitleText_1.h + 7),
            width=self.width - 40,
            font=self.font,
            fontSize='tiny')
        self.keysText_2 = TextBox(
            "In the 'Key Press' row of boxes enter in the keys you want to press to ring each bell.",
            (self.x + 20, self.keysText_1.y + self.keysText_1.h + 10),
            width=self.width - 40,
            font=self.font,
            fontSize='tiny')
        self.keysText_3 = TextBox(
            "Each 'Key Press' box corresponds to the 'Ringable Bell' box above it.",
            (self.x + 20, self.keysText_2.y + self.keysText_2.h + 10),
            width=self.width - 40,
            font=self.font,
            fontSize='tiny')
        self.keysText_4 = TextBox("Only numbers can be entered into the 'Ringable Bell' boxes and only letters and numbers can be entered " + \
                                  "into the 'Key Press' boxes.",
                                  (self.x+20, self.keysText_3.y+self.keysText_3.h+10), width=self.width-40, font=self.font, fontSize='tiny')
        self.keysText = [
            self.keysTitleText, self.keysSubTitleText_1, self.keysText_1,
            self.keysText_2, self.keysText_3, self.keysText_4
        ]

        self.tuningTitleText = TextBox(
            'Tuning Options:',
            (self.x + 20, self.y + self.button_tuning.rect.h + 20),
            width=self.width - 40,
            backgroundColour=(150, 150, 150),
            font=self.font,
            fontSize='large')
        self.tuningSubTitleText_1 = TextBox(
            'Octave and Semitone Shift:',
            (self.x + 20,
             self.tuningTitleText.y + self.tuningTitleText.h + 10),
            width=self.width - 40,
            font=self.font,
            fontSize='small')
        self.tuningText_1 = TextBox("... still to do...",
                                    (self.x + 20, self.tuningSubTitleText_1.y +
                                     self.tuningSubTitleText_1.h + 7),
                                    width=self.width - 40,
                                    font=self.font,
                                    fontSize='tiny')
        self.tuningText = [
            self.tuningTitleText, self.tuningSubTitleText_1, self.tuningText_1
        ]

        self.otherTitleText = TextBox(
            'Other Options:',
            (self.x + 20, self.y + self.button_other.rect.h + 20),
            width=self.width - 40,
            backgroundColour=(150, 150, 150),
            font=self.font,
            fontSize='large')
        self.otherSubTitleText_1 = TextBox(
            '...:',
            (self.x + 20, self.otherTitleText.y + self.otherTitleText.h + 10),
            width=self.width - 40,
            font=self.font,
            fontSize='small')
        self.otherText_1 = TextBox("... still to do...",
                                   (self.x + 20, self.otherSubTitleText_1.y +
                                    self.otherSubTitleText_1.h + 7),
                                   width=self.width - 40,
                                   font=self.font,
                                   fontSize='tiny')
        self.otherText = [
            self.otherTitleText, self.otherSubTitleText_1, self.otherText_1
        ]