+++ /dev/null
-'''\r
-Created on 28 aout 2009\r
-\r
-@author: Samuel Benveniste\r
-'''\r
-\r
-import os\r
-import sys\r
-import subprocess\r
-import re\r
-\r
-import pygame\r
-import pygame.midi\r
-import pickle\r
-\r
-from gui.constants import *\r
-\r
-from gui.PlayingScreen import PlayingScreen\r
-from gui.InstrumentChoice import InstrumentChoice\r
-from instruments.Instrument import Instrument\r
-from cursor.WarpingCursor import *\r
-from controllers.Wiimote import Wiimote\r
-from songs.Song import Song\r
-from gui.StaticFamiliarizer import StaticFamiliarizer\r
-from gui.SongFamiliarizer import SongFamiliarizer\r
-from gui.SongPlayingScreen import SongPlayingScreen\r
-from gui.DummyInstrumentChoice import DummyInstrumentChoice\r
-\r
-class FamiliarizerLog():\r
- '''\r
- classdocs\r
- '''\r
-\r
- def __init__(self,eventLog,level,activeWiimotes):\r
- '''\r
- Constructor\r
- '''\r
- self.eventLog = eventLog\r
- self.level = level\r
- self.activeWiimotes = activeWiimotes\r
- self.scale = scaleDict["majorScale"] \r
- \r
-if __name__ == '__main__':\r
- \r
- f = file('../../../saves/19-01-2009-testcoll1-v65-1.fmwi', 'r')\r
- unpickler = pickle.Unpickler(f)\r
- log = unpickler.load()\r
- f.close()\r
- \r
- pygame.init()\r
- modeResolution = (1024,768)\r
- window = pygame.display.set_mode(modeResolution,pygame.FULLSCREEN)\r
- pygame.midi.init()\r
- instruments = [Instrument(log.scale, i + 1, "".join(["../instruments/instrumentImages/", instrumentImagePathList[i], ".jpg"]), octaves[i]) for i in range(9)]\r
- \r
- joys = [[id,pygame.joystick.Joystick(id).get_name()] for id in range(pygame.joystick.get_count())]\r
- for joy in joys:\r
- if joy[1] in joyNames:\r
- pygame.joystick.Joystick(joy[0]).init() \r
- \r
- ports = [pygame.midi.get_device_info(id)[1] for id in range(pygame.midi.get_count())]\r
- portOffset = ports.index(portNames[0])\r
- print(portOffset)\r
- \r
- screen = pygame.display.get_surface()\r
- clock = pygame.time.Clock() \r
- cursorImages=[['../cursor/cursorImages/black/10.png'],['../cursor/cursorImages/red/10.png'],['../cursor/cursorImages/blue/10.png'],['../cursor/cursorImages/green/10.png']]\r
- durations = [75 for i in range(len(cursorImages))]\r
- \r
- extsc = True\r
- casc = False\r
- easyMode = True\r
- \r
- song = Song(scaleDict["majorScale"],[3,9,6,4,1,8,5,7,2,10],True)\r
-\r
- wiimoteCount = 4\r
- \r
- cursors = [WarpingCursor(None, cursorImages[i], durations, (300 * i, 300 * i),'../cursor/cursorImages/black/flash.png') for i in range(wiimoteCount)]\r
- wiimotes = [Wiimote(i, i + portOffset, None, instruments[0], cursors[i]) for i in range(wiimoteCount)]\r
- dummyInstrumentChoice = DummyInstrumentChoice(wiimotes, window, screen, clock, joys, portOffset, log.activeWiimotes)\r
- if log.level < 2 :\r
- familiarize = StaticFamiliarizer(wiimotes, window, screen, clock, joys, portOffset,log.activeWiimotes,level = log.level,eventLog = log.eventLog,replay = True)\r
- elif log.level == 2 :\r
- familiarize = SongFamiliarizer(wiimotes, window, screen, clock, joys, portOffset,song,log.activeWiimotes,casc,extsc,easyMode,eventLog = log.eventLog,replay = True)\r
- else :\r
- familiarize = SongPlayingScreen(dummyInstrumentChoice,songDict["clairdelalune"],easyMode = True,eventLog = log.eventLog,replay = True)\r
- \r
- while familiarize.nextLevel != None :\r
- if familiarize.nextLevel < 2 :\r
- familiarize = StaticFamiliarizer(wiimotes, window, screen, clock, joys, portOffset,log.activeWiimotes,level = familiarize.nextLevel,eventLog = familiarize.eventLog,replay = True)\r
- elif familiarize.nextLevel == 2 :\r
- familiarize = SongFamiliarizer(wiimotes, window, screen, clock, joys, portOffset,song,log.activeWiimotes,casc,extsc,easyMode,eventLog = familiarize.eventLog,replay = True)\r
- else :\r
- familiarize = SongPlayingScreen(dummyInstrumentChoice,songDict["clairdelalune"],easyMode = True,eventLog = familiarize.eventLog,replay = True)\r
- \r
- for wiimote in wiimotes:\r
- del wiimote.port \r
- \r
- pygame.midi.quit()\r
- pygame.quit()
\ No newline at end of file