# generate instances for all instruments # input parameters: surface name, image, mid point, instrument index, speed firstInstrument = Instrument(screen, '../pic/small_red_needle.png', FIRST_INSTRUMENT_MID_POINT, 1, TEST_ROT_SPEED) secondInstrument = Instrument(screen, '../pic/small_red_needle.png', SECOND_INSTRUMENT_MID_POINT, 2, 2) thirdInstrument = Instrument(screen, '../pic/small_red_needle.png', THIRD_INSTRUMENT_MID_POINT, 3, 1) fourthInstrument = Instrument(screen, '../pic/small_red_needle.png', FOURTH_INSTRUMENT_MID_POINT, 4, 1) # initalize variables firstInstrumentdegAngle = 0 secondInstrumentdegAngle = 0.0 thirdInstrumentdegAngle = 0.0 fourthInstrumentdegAngle = 0.0 # set instrument at start position degAngle = -20.0 firstInstrument.set_needle_position(degAngle) secondInstrument.set_needle_position(degAngle) thirdInstrument.set_needle_position(degAngle) fourthInstrument.set_needle_position(degAngle) # input data that will set the final position of needle inputData = 0.0 mouseDataX = 0.0 mouseDataY = 0.0 while 1: # update each instrument screen.blit(background, bgRect) firstInstrument.instrument_update(firstInstrumentdegAngle) secondInstrument.instrument_update(secondInstrumentdegAngle)
# load instrument image and get rectangle size background = pygame.image.load("../pic/tripple.png") bgRect = background.get_rect() # generate instances for all instruments # input parameters: surface name, image, mid point, instrument index, speed firstInstrument = Instrument(screen, '../pic/small_red_needle.png', FIRST_INSTRUMENT_MID_POINT, 1, TEST_ROT_SPEED) #secondInstrument = Instrument(screen, '../pic/small_red_needle.png', SECOND_INSTRUMENT_MID_POINT, 2, 2) # initalize variables firstInstrumentdegAngle = 0 secondInstrumentdegAngle = 0.0 # set instrument at start position degAngle = -20.0 firstInstrument.set_needle_position(degAngle) #secondInstrument.set_needle_position(degAngle) # input data that will set the final position of needle inputData = 0.0 mouseDataX = 0.0 mouseDataY = 0.0 while 1: # update each instrument screen.blit(background, bgRect) firstInstrument.instrument_update(firstInstrumentdegAngle) #secondInstrument.instrument_update(secondInstrumentdegAngle) # draw center circle and blit index number in instrument pygame.draw.circle(screen, RED1, (250,150), 15, 0)