e84d1c27d94a3204d2cf22d4c82400e4122d6784
2 Created on 28 aout 2009
4 @author: Samuel Benveniste
16 from gui
.constants
import *
18 from gui
.PlayingScreen
import PlayingScreen
19 from gui
.InstrumentChoice
import InstrumentChoice
20 from instruments
.Instrument
import Instrument
21 from cursor
.WarpingCursor
import *
22 from controllers
.Wiimote
import Wiimote
23 from songs
.Song
import Song
24 from gui
.StaticFamiliarizer
import StaticFamiliarizer
25 from gui
.SongFamiliarizer
import SongFamiliarizer
26 from gui
.SongPlayingScreen
import SongPlayingScreen
27 from gui
.DummyInstrumentChoice
import DummyInstrumentChoice
29 class FamiliarizerLog():
34 def __init__(self
,eventLog
,level
,activeWiimotes
):
38 self
.eventLog
= eventLog
40 self
.activeWiimotes
= activeWiimotes
41 self
.scale
= scaleDict
["majorScale"]
43 if __name__
== '__main__':
45 f
= file('../../../saves/19-01-2009-testcoll1-v65-1.fmwi', 'r')
46 unpickler
= pickle
.Unpickler(f
)
47 log
= unpickler
.load()
51 modeResolution
= (1024,768)
52 window
= pygame
.display
.set_mode(modeResolution
,pygame
.FULLSCREEN
)
54 instruments
= [Instrument(log
.scale
, i
+ 1, "".join(["../instruments/instrumentImages/", instrumentImagePathList
[i
], ".jpg"]), octaves
[i
]) for i
in range(9)]
56 joys
= [[id,pygame
.joystick
.Joystick(id).get_name()] for id in range(pygame
.joystick
.get_count())]
58 if joy
[1] in joyNames
:
59 pygame
.joystick
.Joystick(joy
[0]).init()
61 ports
= [pygame
.midi
.get_device_info(id)[1] for id in range(pygame
.midi
.get_count())]
62 portOffset
= ports
.index(portNames
[0])
65 screen
= pygame
.display
.get_surface()
66 clock
= pygame
.time
.Clock()
67 cursorImages
=[['../cursor/cursorImages/black/10.png'],['../cursor/cursorImages/red/10.png'],['../cursor/cursorImages/blue/10.png'],['../cursor/cursorImages/green/10.png']]
68 durations
= [75 for i
in range(len(cursorImages
))]
74 song
= Song(scaleDict
["majorScale"],[3,9,6,4,1,8,5,7,2,10],True)
78 cursors
= [WarpingCursor(None, cursorImages
[i
], durations
, (300 * i
, 300 * i
),'../cursor/cursorImages/black/flash.png') for i
in range(wiimoteCount
)]
79 wiimotes
= [Wiimote(i
, i
+ portOffset
, None, instruments
[0], cursors
[i
]) for i
in range(wiimoteCount
)]
80 dummyInstrumentChoice
= DummyInstrumentChoice(wiimotes
, window
, screen
, clock
, joys
, portOffset
, log
.activeWiimotes
)
82 familiarize
= StaticFamiliarizer(wiimotes
, window
, screen
, clock
, joys
, portOffset
,log
.activeWiimotes
,level
= log
.level
,eventLog
= log
.eventLog
,replay
= True)
84 familiarize
= SongFamiliarizer(wiimotes
, window
, screen
, clock
, joys
, portOffset
,song
,log
.activeWiimotes
,casc
,extsc
,easyMode
,eventLog
= log
.eventLog
,replay
= True)
86 familiarize
= SongPlayingScreen(dummyInstrumentChoice
,songDict
["clairdelalune"],easyMode
= True,eventLog
= log
.eventLog
,replay
= True)
88 while familiarize
.nextLevel
!= None :
89 if familiarize
.nextLevel
< 2 :
90 familiarize
= StaticFamiliarizer(wiimotes
, window
, screen
, clock
, joys
, portOffset
,log
.activeWiimotes
,level
= familiarize
.nextLevel
,eventLog
= familiarize
.eventLog
,replay
= True)
91 elif familiarize
.nextLevel
== 2 :
92 familiarize
= SongFamiliarizer(wiimotes
, window
, screen
, clock
, joys
, portOffset
,song
,log
.activeWiimotes
,casc
,extsc
,easyMode
,eventLog
= familiarize
.eventLog
,replay
= True)
94 familiarize
= SongPlayingScreen(dummyInstrumentChoice
,songDict
["clairdelalune"],easyMode
= True,eventLog
= familiarize
.eventLog
,replay
= True)
96 for wiimote
in wiimotes
: