Ejemplo n.º 1
0
    def __init__(self, song, speed):

        self.input = Input()
        self.resource = Resource()
        self.audio = Audio()
        self.audio.pre_open()
        pygame.init()
        self.audio.open()
        if song != None:
            self.song = loadSong(self.resource, song)
        else:
            self.song = loadSong(self.resource, "gangnam")
        self.clock = pygame.time.Clock()
        pygame.display.set_mode((Constants.SCREEN_WIDTH, Constants.SCREEN_HEIGHT))
        pygame.display.set_caption("DanceCV")
        screen = pygame.display.get_surface()
        if speed != None:
            self.scene = Scene(self.resource, self.song, screen, self.input, speed)
        else:
            self.scene = Scene(self.resource, self.song, screen, self.input, 2)
Ejemplo n.º 2
0
  def shown(self):
    self.engine.input.addKeyListener(self)

    if not self.songName:
      self.libraryName, self.songName = Dialogs.chooseSong(self.engine)

    if not self.songName:
      self.engine.view.popLayer(self)
      return

    self.engine.resource.load(self, "song", lambda: loadSong(self.engine, self.songName, seekable = True, library = self.libraryName))
    Dialogs.showLoadingScreen(self.engine, lambda: self.song, text = _("Loading song..."))
Ejemplo n.º 3
0
  def shown(self):
    self.engine.input.addKeyListener(self)

    if not self.songName:
      self.libraryName, self.songName = Dialogs.chooseSong(self.engine)

    if not self.songName:
      self.engine.view.popLayer(self)
      return

    self.engine.resource.load(self, "song", lambda: loadSong(self.engine, self.songName, seekable = True, library = self.libraryName))
    Dialogs.showLoadingScreen(self.engine, lambda: self.song, text = str("Loading song..."))
Ejemplo n.º 4
0
    def __init__(self, song, speed):

        self.input = Input()
        self.resource = Resource()
        self.audio = Audio()
        self.audio.pre_open()
        pygame.init()
        self.audio.open()
        if song != None:
            self.song = loadSong(self.resource, song)
        else:
            self.song = loadSong(self.resource, "gangnam")
        self.clock = pygame.time.Clock()
        pygame.display.set_mode(
            (Constants.SCREEN_WIDTH, Constants.SCREEN_HEIGHT))
        pygame.display.set_caption("DanceCV")
        screen = pygame.display.get_surface()
        if speed != None:
            self.scene = Scene(self.resource, self.song, screen, self.input,
                               speed)
        else:
            self.scene = Scene(self.resource, self.song, screen, self.input, 2)
Ejemplo n.º 5
0
    def __init__(self, engine, libraryName, songName):
        super(GuitarScene, self).__init__(engine)

        self.guitar           = Guitar(self.engine)
        self.visibility       = 0.0
        self.libraryName      = libraryName
        self.songName         = songName
        self.done             = False
        self.sfxChannel       = self.engine.audio.getChannel(self.engine.audio.getChannelCount() - 1)
        self.lastMultTime     = None
        self.cheatCodes       = [
            ([117, 112, 116, 111, 109, 121, 116, 101, 109, 112, 111], self.toggleAutoPlay),
            ([102, 97, 115, 116, 102, 111, 114, 119, 97, 114, 100],   self.goToResults)
        ]
        self.enteredCode      = []
        self.song             = None
        self.autoPlay         = False
        self.lastPickPos      = None
        self.lastSongPos      = 0.0
        self.keyBurstTimeout  = None
        self.keyBurstPeriod   = 30
        self.camera.target    = (0, 0, 4)
        self.camera.origin    = (0, 3, -3)

        self.loadSettings()
        self.engine.resource.load(self, "song",          lambda: loadSong(self.engine, songName, library = libraryName), onLoad = self.songLoaded)

        self.stage            = Stage.Stage(self, self.engine.resource.fileName("stage.ini"))

        self.engine.loadImgDrawing(self, "fx2x",   "2x.png", textureSize = (256, 256))
        self.engine.loadImgDrawing(self, "fx3x",   "3x.png", textureSize = (256, 256))
        self.engine.loadImgDrawing(self, "fx4x",   "4x.png", textureSize = (256, 256))

        Dialogs.showLoadingScreen(self.engine, lambda: self.song, text = _("Tuning Guitar..."))

        settingsMenu = Settings.GameSettingsMenu(self.engine)
        settingsMenu.fadeScreen = True

        self.menu = Menu(self.engine, [
            (_("Return to Song"),    self.resumeHideMenu),
            (_("Restart Song"),      self.restartSong),
            (_("Change Song"),       self.changeSong),
            (_("Settings"),          settingsMenu),
            (_("Quit to Main Menu"), self.quit),
        ], fadeScreen = True, onClose = self.resumeGame)

        self.restartSong()
Ejemplo n.º 6
0
  def createClient(self, libraryName, songName):
    self.guitar           = Guitar(self.engine)
    self.visibility       = 0.0
    self.libraryName      = libraryName
    self.songName         = songName
    self.done             = False
    self.sfxChannel       = self.engine.audio.getChannel(self.engine.audio.getChannelCount() - 1)
    self.lastMultTime     = None
    self.cheatCodes       = [
      ([117, 112, 116, 111, 109, 121, 116, 101, 109, 112, 111], self.toggleAutoPlay),
      ([102, 97, 115, 116, 102, 111, 114, 119, 97, 114, 100],   self.goToResults)
    ]
    self.enteredCode      = []
    self.song             = None
    self.autoPlay         = False
    self.lastPickPos      = None
    self.lastSongPos      = 0.0
    self.keyBurstTimeout  = None
    self.keyBurstPeriod   = 30
    self.camera.target    = (0, 0, 4)
    self.camera.origin    = (0, 3, -3)

    self.loadSettings()
    self.engine.resource.load(self, "song",          lambda: loadSong(self.engine, songName, library = libraryName), onLoad = self.songLoaded)

    self.stage            = Stage.Stage(self, self.engine.resource.fileName("stage.ini"))

    self.engine.loadSvgDrawing(self, "fx2x",   "2x.svg", textureSize = (256, 256))
    self.engine.loadSvgDrawing(self, "fx3x",   "3x.svg", textureSize = (256, 256))
    self.engine.loadSvgDrawing(self, "fx4x",   "4x.svg", textureSize = (256, 256))

    Dialogs.showLoadingScreen(self.engine, lambda: self.song, text = _("Tuning Guitar..."))

    settingsMenu = Settings.GameSettingsMenu(self.engine)
    settingsMenu.fadeScreen = True

    self.menu = Menu(self.engine, [
      (_("Return to Song"),    lambda: None),
      (_("Restart Song"),      self.restartSong),
      (_("Change Song"),       self.changeSong),
      (_("Settings"),          settingsMenu),
      (_("Quit to Main Menu"), self.quit),
    ], fadeScreen = True, onClose = self.resumeGame)

    self.restartSong()