Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslm <slm@slm-laptop.(none)>2010-06-30 19:25:34 (GMT)
committer slm <slm@slm-laptop.(none)>2010-06-30 19:25:34 (GMT)
commit05ea6a12ff135d468d8a52a67581dc47bfd5b140 (patch)
tree4a7a6a141d4f70392d3a99ddbfc4358791a4f936
parent0e56fe4b7dc23a2e51e670667aad7d497b909c18 (diff)
Made corrections to scalability test; still not pep-8 compliant, however functional. If complete test is erroneous, it is because I have been making continuous and exhausting changes to the program; complete test is definately in development.
-rwxr-xr-xdevtools/CompleteTestKit/fileTypeTests.py254
-rw-r--r--devtools/CompleteTestKit/fileTypeTests.py~256
-rwxr-xr-xdevtools/ScaleTypeTest/scaleTest.py39
3 files changed, 441 insertions, 108 deletions
diff --git a/devtools/CompleteTestKit/fileTypeTests.py b/devtools/CompleteTestKit/fileTypeTests.py
index 5d64452..b97ddb6 100755
--- a/devtools/CompleteTestKit/fileTypeTests.py
+++ b/devtools/CompleteTestKit/fileTypeTests.py
@@ -6,27 +6,53 @@ pygame.init()
# Scroll below the def () for the initial code for this program
-#= .image() Animation Test ================================================================================
+'''
+The file type array will be iterated through as the test progresses to tell the program what extension and path to use for the images
+'''
+
+ftArr=[ [".bmp","./art/BMP16/"] , [".bmp","./art/BMP24/"] , [".bmp","./art/BMP32/"] , [".gif","./art/GIF/"] , [".gif","./art/GIFT/"] , [".jpg","./art/JPG1/"] , [".jpg","./art/JPG2/"] , [".jpg","./art/JPG3/"] , [".jpg","./art/JPG4/"] , [".png","./art/PNGI/"] , [".png","./art/PNGT/"] ]
+
+
+'''
+Image() Animation Test
+'''
def imgTest():
- sizeIn=make=maxTrial=''
+ screenSize=numImages=maxTrial=''
+ def change():
+ cnt=numImages
+ while cnt>0:
+ img[cnt,0]=imgSwitch.get(i,pygame.image.load("%s1%s"%(ft[1],ft[0])))
+ cnt=cnt-1
+ def collision():
+ cnt=numImages
+ while cnt>0:
+ if img[cnt,1].left < 0 or img[cnt,1].right > screenWidth:
+ img[cnt,2]=[ -img[cnt,2][0], img[cnt,2][1] ]
+ if img[cnt,1].top < 0 or img[cnt,1].bottom > screenHeight:
+ img[cnt,2]=[ img[cnt,2][0], -img[cnt,2][1] ]
+ img[cnt,1] = img[cnt,1].move(img[cnt,2])
+ screen.blit(img[cnt,0],img[cnt,1])
+ cnt=cnt-1
+ pygame.display.flip()
while 1:
print "\nImage Load Test Details\nFor default values, please leave the field blank"
try:
- print "\nSet size, formatted as '>height,width':"
- sizeIn=str(raw_input('>'))
- sizeIn.split(',')
- height=int(sizeIn[0])
- width=int(sizeIn[1])
+ print "\nSet size, formatted as '>width,height':"
+ screenSize=str(raw_input('>'))
+ screenSize.split(',')
+ screenWidth=int(screenSize[0])
+ screenHeight=int(screenSize[1])
+
except:
- width=600
- height=400
+ screenWidth=600
+ screenHeight=400
try:
print "How many images would you like to draw?"
- make=int(raw_input('>'))
+ numImages=int(raw_input('>'))
except:
- make=5
+ numImages=5
try:
print "How many trials would you like to run?"
maxTrial=int(raw_input('>'))
@@ -34,45 +60,22 @@ def imgTest():
except:
maxTrial=5
break
- dateTime=str(datetime.now())
- f=open('./logs/Test Result - Image Animation - %s.csv'%dateTime,'a')
- f.write("Height (pixels)"+','+"Width (pixels)"+','+"Trial Runs"+','+"Image Objects Drawn")
- f.write("\n"+str(height)+','+str(width)+','+str(maxTrial)+','+str(make))
+
+ f=open('./logs/Test Result - Image Test - %s.csv'%str(datetime.now()),'a')
+ f.write("Width (pixels)"+','+"Height (pixels)"+','+"Trial Runs"+','+"Image Objects Drawn")
+ f.write("\n"+str(screenWidth)+','+str(screenHeight)+','+str(maxTrial)+','+str(numImages))
f.write("\nFile Type"+','+"Time taken to load images to memory"+','+"Trials")
ft="" #filetype
img={}
r=0 #frame refreshes
i=1 #cycles images
- size = width, height
t=0 #trial number n
- colorkey=(255, 152, 0)
-
- #the file type array will be iterated through as the test progresses to tell the program what extension and path to use for the images
- ftArr=[ [".bmp","./art/BMP16/"] , [".bmp","./art/BMP24/"] , [".bmp","./art/BMP32/"] , [".gif","./art/GIF/"] , [".gif","./art/GIFT/"] , [".jpg","./art/JPG1/"] , [".jpg","./art/JPG2/"] , [".jpg","./art/JPG3/"] , [".jpg","./art/JPG4/"] , [".png","./art/PNGI/"] , [".png","./art/PNGT/"] ]
- screen = pygame.display.set_mode(size) #Screen Set 600x400
+ screen = pygame.display.set_mode(screenWidth, screenHeight) #Screen Set 600x400
background = 152, 251, 152 # pale green
- def chngImg():
- cnt=make
- while cnt>0:
- img[cnt,0]=imgSwitch.get(i,pygame.image.load("%s1%s"%(ft[1],ft[0])))
- cnt=cnt-1
-
- def collision():
- cnt=make
- while cnt>0:
- if img[cnt,1].left < 0 or img[cnt,1].right > width:
- img[cnt,2]=[ -img[cnt,2][0], img[cnt,2][1] ]
- if img[cnt,1].top < 0 or img[cnt,1].bottom > height:
- img[cnt,2]=[ img[cnt,2][0], -img[cnt,2][1] ]
- img[cnt,1] = img[cnt,1].move(img[cnt,2])
- screen.blit(img[cnt,0],img[cnt,1])
- cnt=cnt-1
- pygame.display.flip()
-
while 1:
- cnt=make
+ cnt=numImages
try:ft=ftArr[t]
except:sys.exit("Test Complete")
f.seek(0,2)
@@ -88,9 +91,9 @@ def imgTest():
6: pygame.image.load("%s7%s"%(ft[1],ft[0])),
7: pygame.image.load("%s8%s"%(ft[1],ft[0])),
8: pygame.image.load("%s9%s"%(ft[1],ft[0])),
- }
+ }
f.write(','+str(time.time()-start))
-
+
print "Testing "+ft[1]
trial=maxTrial
@@ -106,7 +109,7 @@ def imgTest():
r=0
start=time.time()
while 1:
- chngImg()
+ change()
i=i+1
if i>9: i=1
collision()
@@ -127,12 +130,168 @@ def spriteTest():
print "spriteTest called"
dateTime=str(datetime.now())
file=open('./logs/testresult - %s.csv'%dateTime,'a')
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-#= Scalability Test =======================================================================================
+'''
+ Scalability Test
+'''
def scaleTest():
- dateTime=str(datetime.now())
- print "scaleTest called"
- file=open('./logs/testresult - %s.csv'%dateTime,'a')
+ screenSize=maxTrial=''
+ trialSize=[]
+ def collision():
+ cnt=numImages
+ while cnt>0:
+ if img[cnt,1].left < 0 or img[cnt,1].right > screenWidth:
+ img[cnt,2]=[ -img[cnt,2][0], img[cnt,2][1] ]
+ if img[cnt,1].top < 0 or img[cnt,1].bottom > screenHeight:
+ img[cnt,2]=[ img[cnt,2][0], -img[cnt,2][1] ]
+ img[cnt,1] = img[cnt,1].move(img[cnt,2])
+ screen.blit(img[cnt,0],img[cnt,1])
+ cnt=cnt-1
+ pygame.display.flip()
+ while 1:
+ print "\nImage Load Test Details\nFor default values, please leave the field blank"
+ try:
+ print "\nSet size, formatted as '>height,width':"
+ screenSize=str(raw_input('>'))
+ screenSize.split(',')
+ screenHeight=int(screenSize[0])
+ screenWidth=int(screenSize[1])
+ break
+ except:
+ screenWidth=600
+ screenHeight=400
+ break
+ while 1:
+ try:
+ maxTrial=input('How many trials would you like to run?\n>')
+ maxTrial=int(maxTrial)
+ print 'ok...'
+ t=1
+ while t<=maxTrial:
+ try:
+ sizeIn=raw_input('Please enter the size of the image for trial '+str(t)+' as \'>width,height\'\n>')
+ sizeIn=sizeIn.split(',')
+ print sizeIn[0]
+ print sizeIn[1]
+ if isInstance(sizeIn[0],int) and isInstance(sizeIn[1],int):
+ trialSize.append(sizeIn)
+ print trialSize[t]
+ t=t+1
+ else:
+ print "Error, please reenter..."
+ except: pass
+ break
+ except:
+ print "Error, please reenter..."
+ pass
+ print 'made it out'
+ f=open('./logs/Test Result - Image Test - %s.csv'%str(datetime.now()),'a')
+ f.write("Height (pixels)"+','+"Width (pixels)"+','+"Trial Runs"+','+"Image Objects Drawn")
+ f.write("\n"+str(screenHeight)+','+str(screenWidth)+','+str(maxTrial)+','+str(numImages))
+ f.write("\nFile Type"+','+"Time taken to load images to memory"+','+"Trials")
+ ft="" #filetype
+ img={}
+ r=0 #frame refreshes
+ i=1 #cycles images
+ size = screenWidth, screenHeight
+ t=0 #trial number n
+
+ screen = pygame.display.set_mode(size) #Screen Set 600x400
+ background = 152, 251, 152 # pale green
+
+ while 1:
+ try:ft=ftArr[t]
+ except:sys.exit("Test Complete")
+ f.seek(0,2)
+ f.write(str('\n'+ft[1]+' Test'))
+ f.seek(0,2)
+ start=time.time()
+ imgSwitch={
+ 1: pygame.image.load("%s2%s"%(ft[1],ft[0])),
+ 2: pygame.image.load("%s3%s"%(ft[1],ft[0])),
+ 3: pygame.image.load("%s4%s"%(ft[1],ft[0])),
+ 4: pygame.image.load("%s5%s"%(ft[1],ft[0])),
+ 5: pygame.image.load("%s6%s"%(ft[1],ft[0])),
+ 6: pygame.image.load("%s7%s"%(ft[1],ft[0])),
+ 7: pygame.image.load("%s8%s"%(ft[1],ft[0])),
+ 8: pygame.image.load("%s9%s"%(ft[1],ft[0])),
+ }
+ f.write(','+str(time.time()-start))
+
+ print "Testing "+ft[1]
+ trial=maxTrial
+
+ while trial>0:
+ img[1,0]= pygame.image.load("%s1%s"%(ft[1],ft[0]))
+ img[1,1]= img[1,0].get_rect()
+ img[1,2]= [2,2] #speed
+ r=0
+ start=time.time()
+ while 1:
+ change()
+ i=i+1
+ if i>9: i=1
+ img[cnt,0]=imgSwitch.get(i,pygame.image.load("%s1%s"%(ft[1],ft[0])))
+ screen.fill(background)
+ r=r+1
+ if r>500: break
+
+ print 1/((time.time()-start)/r)
+ f.seek(0,2)
+ f.write(','+str(1/((time.time()-start)/r)))
+ trial=trial-1
+
+ t=t+1
+ f.close()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
while 1:
print "\n\nWelcome to the master File Type Tester Interface"
@@ -143,7 +302,6 @@ while 1:
print "2. Simple File Type variety Test, as sprites (NOTE: not working yet)"
print "3. Selected Scalability Test (NOTE: not working yet)"
- dateTime=str(datetime.now())
acceptible='^[1-3]$'
list={ 1:imgTest,
2:spriteTest,
diff --git a/devtools/CompleteTestKit/fileTypeTests.py~ b/devtools/CompleteTestKit/fileTypeTests.py~
index f0d751b..b97ddb6 100644
--- a/devtools/CompleteTestKit/fileTypeTests.py~
+++ b/devtools/CompleteTestKit/fileTypeTests.py~
@@ -6,27 +6,53 @@ pygame.init()
# Scroll below the def () for the initial code for this program
-#= .image() Animation Test ================================================================================
+'''
+The file type array will be iterated through as the test progresses to tell the program what extension and path to use for the images
+'''
+
+ftArr=[ [".bmp","./art/BMP16/"] , [".bmp","./art/BMP24/"] , [".bmp","./art/BMP32/"] , [".gif","./art/GIF/"] , [".gif","./art/GIFT/"] , [".jpg","./art/JPG1/"] , [".jpg","./art/JPG2/"] , [".jpg","./art/JPG3/"] , [".jpg","./art/JPG4/"] , [".png","./art/PNGI/"] , [".png","./art/PNGT/"] ]
+
+
+'''
+Image() Animation Test
+'''
def imgTest():
- sizeIn=make=maxTrial=''
+ screenSize=numImages=maxTrial=''
+ def change():
+ cnt=numImages
+ while cnt>0:
+ img[cnt,0]=imgSwitch.get(i,pygame.image.load("%s1%s"%(ft[1],ft[0])))
+ cnt=cnt-1
+ def collision():
+ cnt=numImages
+ while cnt>0:
+ if img[cnt,1].left < 0 or img[cnt,1].right > screenWidth:
+ img[cnt,2]=[ -img[cnt,2][0], img[cnt,2][1] ]
+ if img[cnt,1].top < 0 or img[cnt,1].bottom > screenHeight:
+ img[cnt,2]=[ img[cnt,2][0], -img[cnt,2][1] ]
+ img[cnt,1] = img[cnt,1].move(img[cnt,2])
+ screen.blit(img[cnt,0],img[cnt,1])
+ cnt=cnt-1
+ pygame.display.flip()
while 1:
print "\nImage Load Test Details\nFor default values, please leave the field blank"
try:
- print "\nSet size, formatted as '>height,width':"
- sizeIn=str(raw_input('>'))
- sizeIn.split(',')
- height=int(sizeIn[0])
- width=int(sizeIn[1])
+ print "\nSet size, formatted as '>width,height':"
+ screenSize=str(raw_input('>'))
+ screenSize.split(',')
+ screenWidth=int(screenSize[0])
+ screenHeight=int(screenSize[1])
+
except:
- width=600
- height=400
+ screenWidth=600
+ screenHeight=400
try:
print "How many images would you like to draw?"
- make=int(raw_input('>'))
+ numImages=int(raw_input('>'))
except:
- make=5
+ numImages=5
try:
print "How many trials would you like to run?"
maxTrial=int(raw_input('>'))
@@ -34,45 +60,22 @@ def imgTest():
except:
maxTrial=5
break
- dateTime=str(datetime.now())
- f=open('./logs/Test Result - Image Animation - %s.csv'%dateTime,'a')
- f.write("Height (pixels)"+','+"Width (pixels)"+','+"Trial Runs"+','+"Image Objects Drawn")
- f.write("\n"+str(height)+','+str(width)+','+str(maxTrial)+','+str(make))
- f.write("\nFile Type"+','+"Trials")
+
+ f=open('./logs/Test Result - Image Test - %s.csv'%str(datetime.now()),'a')
+ f.write("Width (pixels)"+','+"Height (pixels)"+','+"Trial Runs"+','+"Image Objects Drawn")
+ f.write("\n"+str(screenWidth)+','+str(screenHeight)+','+str(maxTrial)+','+str(numImages))
+ f.write("\nFile Type"+','+"Time taken to load images to memory"+','+"Trials")
ft="" #filetype
img={}
r=0 #frame refreshes
i=1 #cycles images
- size = width, height
t=0 #trial number n
- colorkey=(255, 152, 0)
-
- #the file type array will be iterated through as the test progresses to tell the program what extension and path to use for the images
- ftArr=[ [".bmp","./art/BMP16/"] , [".bmp","./art/BMP24/"] , [".bmp","./art/BMP32/"] , [".gif","./art/GIF/"] , [".gif","./art/GIFT/"] , [".jpg","./art/JPG1/"] , [".jpg","./art/JPG2/"] , [".jpg","./art/JPG3/"] , [".jpg","./art/JPG4/"] , [".png","./art/PNGI/"] , [".png","./art/PNGT/"] ]
- screen = pygame.display.set_mode(size) #Screen Set 600x400
+ screen = pygame.display.set_mode(screenWidth, screenHeight) #Screen Set 600x400
background = 152, 251, 152 # pale green
- def chngImg():
- cnt=make
- while cnt>0:
- img[cnt,0]=imgSwitch.get(i,pygame.image.load("%s1%s"%(ft[1],ft[0])))
- cnt=cnt-1
-
- def collision():
- cnt=make
- while cnt>0:
- if img[cnt,1].left < 0 or img[cnt,1].right > width:
- img[cnt,2]=[ -img[cnt,2][0], img[cnt,2][1] ]
- if img[cnt,1].top < 0 or img[cnt,1].bottom > height:
- img[cnt,2]=[ img[cnt,2][0], -img[cnt,2][1] ]
- img[cnt,1] = img[cnt,1].move(img[cnt,2])
- screen.blit(img[cnt,0],img[cnt,1])
- cnt=cnt-1
- pygame.display.flip()
-
while 1:
- cnt=make
+ cnt=numImages
try:ft=ftArr[t]
except:sys.exit("Test Complete")
f.seek(0,2)
@@ -88,9 +91,9 @@ def imgTest():
6: pygame.image.load("%s7%s"%(ft[1],ft[0])),
7: pygame.image.load("%s8%s"%(ft[1],ft[0])),
8: pygame.image.load("%s9%s"%(ft[1],ft[0])),
- }
+ }
f.write(','+str(time.time()-start))
-
+
print "Testing "+ft[1]
trial=maxTrial
@@ -106,7 +109,7 @@ def imgTest():
r=0
start=time.time()
while 1:
- chngImg()
+ change()
i=i+1
if i>9: i=1
collision()
@@ -127,12 +130,168 @@ def spriteTest():
print "spriteTest called"
dateTime=str(datetime.now())
file=open('./logs/testresult - %s.csv'%dateTime,'a')
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-#= Scalability Test =======================================================================================
+
+'''
+ Scalability Test
+'''
def scaleTest():
- dateTime=str(datetime.now())
- print "scaleTest called"
- file=open('./logs/testresult - %s.csv'%dateTime,'a')
+ screenSize=maxTrial=''
+ trialSize=[]
+ def collision():
+ cnt=numImages
+ while cnt>0:
+ if img[cnt,1].left < 0 or img[cnt,1].right > screenWidth:
+ img[cnt,2]=[ -img[cnt,2][0], img[cnt,2][1] ]
+ if img[cnt,1].top < 0 or img[cnt,1].bottom > screenHeight:
+ img[cnt,2]=[ img[cnt,2][0], -img[cnt,2][1] ]
+ img[cnt,1] = img[cnt,1].move(img[cnt,2])
+ screen.blit(img[cnt,0],img[cnt,1])
+ cnt=cnt-1
+ pygame.display.flip()
+ while 1:
+ print "\nImage Load Test Details\nFor default values, please leave the field blank"
+ try:
+ print "\nSet size, formatted as '>height,width':"
+ screenSize=str(raw_input('>'))
+ screenSize.split(',')
+ screenHeight=int(screenSize[0])
+ screenWidth=int(screenSize[1])
+ break
+ except:
+ screenWidth=600
+ screenHeight=400
+ break
+ while 1:
+ try:
+ maxTrial=input('How many trials would you like to run?\n>')
+ maxTrial=int(maxTrial)
+ print 'ok...'
+ t=1
+ while t<=maxTrial:
+ try:
+ sizeIn=raw_input('Please enter the size of the image for trial '+str(t)+' as \'>width,height\'\n>')
+ sizeIn=sizeIn.split(',')
+ print sizeIn[0]
+ print sizeIn[1]
+ if isInstance(sizeIn[0],int) and isInstance(sizeIn[1],int):
+ trialSize.append(sizeIn)
+ print trialSize[t]
+ t=t+1
+ else:
+ print "Error, please reenter..."
+ except: pass
+ break
+ except:
+ print "Error, please reenter..."
+ pass
+ print 'made it out'
+ f=open('./logs/Test Result - Image Test - %s.csv'%str(datetime.now()),'a')
+ f.write("Height (pixels)"+','+"Width (pixels)"+','+"Trial Runs"+','+"Image Objects Drawn")
+ f.write("\n"+str(screenHeight)+','+str(screenWidth)+','+str(maxTrial)+','+str(numImages))
+ f.write("\nFile Type"+','+"Time taken to load images to memory"+','+"Trials")
+ ft="" #filetype
+ img={}
+ r=0 #frame refreshes
+ i=1 #cycles images
+ size = screenWidth, screenHeight
+ t=0 #trial number n
+
+ screen = pygame.display.set_mode(size) #Screen Set 600x400
+ background = 152, 251, 152 # pale green
+
+ while 1:
+ try:ft=ftArr[t]
+ except:sys.exit("Test Complete")
+ f.seek(0,2)
+ f.write(str('\n'+ft[1]+' Test'))
+ f.seek(0,2)
+ start=time.time()
+ imgSwitch={
+ 1: pygame.image.load("%s2%s"%(ft[1],ft[0])),
+ 2: pygame.image.load("%s3%s"%(ft[1],ft[0])),
+ 3: pygame.image.load("%s4%s"%(ft[1],ft[0])),
+ 4: pygame.image.load("%s5%s"%(ft[1],ft[0])),
+ 5: pygame.image.load("%s6%s"%(ft[1],ft[0])),
+ 6: pygame.image.load("%s7%s"%(ft[1],ft[0])),
+ 7: pygame.image.load("%s8%s"%(ft[1],ft[0])),
+ 8: pygame.image.load("%s9%s"%(ft[1],ft[0])),
+ }
+ f.write(','+str(time.time()-start))
+
+ print "Testing "+ft[1]
+ trial=maxTrial
+
+ while trial>0:
+ img[1,0]= pygame.image.load("%s1%s"%(ft[1],ft[0]))
+ img[1,1]= img[1,0].get_rect()
+ img[1,2]= [2,2] #speed
+ r=0
+ start=time.time()
+ while 1:
+ change()
+ i=i+1
+ if i>9: i=1
+ img[cnt,0]=imgSwitch.get(i,pygame.image.load("%s1%s"%(ft[1],ft[0])))
+ screen.fill(background)
+ r=r+1
+ if r>500: break
+
+ print 1/((time.time()-start)/r)
+ f.seek(0,2)
+ f.write(','+str(1/((time.time()-start)/r)))
+ trial=trial-1
+
+ t=t+1
+ f.close()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
while 1:
print "\n\nWelcome to the master File Type Tester Interface"
@@ -143,7 +302,6 @@ while 1:
print "2. Simple File Type variety Test, as sprites (NOTE: not working yet)"
print "3. Selected Scalability Test (NOTE: not working yet)"
- dateTime=str(datetime.now())
acceptible='^[1-3]$'
list={ 1:imgTest,
2:spriteTest,
diff --git a/devtools/ScaleTypeTest/scaleTest.py b/devtools/ScaleTypeTest/scaleTest.py
index cbaaf2a..76e87e0 100755
--- a/devtools/ScaleTypeTest/scaleTest.py
+++ b/devtools/ScaleTypeTest/scaleTest.py
@@ -35,19 +35,20 @@ background = 152, 251, 152 # pale green
def chngImg():
cnt=make
while cnt>0:
- switcher = {
- 1: pygame.image.load("%s2.%s"%(ft[1],ft[0])),
- 2: pygame.image.load("%s3.%s"%(ft[1],ft[0])),
- 3: pygame.image.load("%s4.%s"%(ft[1],ft[0])),
- 4: pygame.image.load("%s5.%s"%(ft[1],ft[0])),
- 5: pygame.image.load("%s6.%s"%(ft[1],ft[0])),
- 6: pygame.image.load("%s7.%s"%(ft[1],ft[0])),
- 7: pygame.image.load("%s8.%s"%(ft[1],ft[0])),
- 8: pygame.image.load("%s9.%s"%(ft[1],ft[0])),
- 9: pygame.image.load("%s1.%s"%(ft[1],ft[0]))
+ """switcher = {
+ 1: pygame.transform.scale( pygame.image.load( "%s2.%s"%( ft[1],ft[0] ) ) ,(sizeTo[0],sizeTo[1] ),
+ 2: pygame.transform.scale( pygame.image.load("%s3.%s"%(ft[1],ft[0])),(sizeTo[0],sizeTo[1] ),
+ 3: pygame.transform.scale( pygame.image.load("%s4.%s"%(ft[1],ft[0])),(sizeTo[0],sizeTo[1] ),
+ 4: pygame.transform.scale( pygame.image.load("%s5.%s"%(ft[1],ft[0])),(sizeTo[0],sizeTo[1] ),
+ 5: pygame.transform.scale( pygame.image.load("%s6.%s"%(ft[1],ft[0])),(sizeTo[0],sizeTo[1] ),
+ 6: pygame.transform.scale( pygame.image.load("%s7.%s"%(ft[1],ft[0])),(sizeTo[0],sizeTo[1] ),
+ 7: pygame.transform.scale( pygame.image.load("%s8.%s"%(ft[1],ft[0])),(sizeTo[0],sizeTo[1] ),
+ 8: pygame.transform.scale( pygame.image.load("%s9.%s"%(ft[1],ft[0])),(sizeTo[0],sizeTo[1] ),
+ 9: pygame.transform.scale( pygame.image.load("%s1.%s"%(ft[1],ft[0])),(sizeTo[0],sizeTo[1] )
}
+ """
img[cnt,0]=switcher.get(i,pygame.image.load("%s1.%s"%(ft[1],ft[0])))
- img[cnt,0] = pygame.transform.scale(img[cnt,0],(sizeTo[0], sizeTo[1]))
+# img[cnt,0] = pygame.transform.scale(img[cnt,0],(sizeTo[0], sizeTo[1]))
cnt=cnt-1
#-----------------------------------------------------------------
@@ -74,6 +75,22 @@ while 1:
ft=ftArr[t]
print "Testing: "+ft[1]+" extension "+ft[0]
trialthis=trial
+ start=time.time()
+ switcher = {
+ 1: pygame.transform.scale( pygame.image.load( "%s2.%s"%( ft[1],ft[0] ) ),(sizeTo[0],sizeTo[1] )),
+ 2: pygame.transform.scale( pygame.image.load("%s3.%s"%(ft[1],ft[0])),(sizeTo[0],sizeTo[1] )),
+ 3: pygame.transform.scale( pygame.image.load("%s4.%s"%(ft[1],ft[0])),(sizeTo[0],sizeTo[1] )),
+ 4: pygame.transform.scale( pygame.image.load("%s5.%s"%(ft[1],ft[0])),(sizeTo[0],sizeTo[1] )),
+ 5: pygame.transform.scale( pygame.image.load("%s6.%s"%(ft[1],ft[0])),(sizeTo[0],sizeTo[1] )),
+ 6: pygame.transform.scale( pygame.image.load("%s7.%s"%(ft[1],ft[0])),(sizeTo[0],sizeTo[1] )),
+ 7: pygame.transform.scale( pygame.image.load("%s8.%s"%(ft[1],ft[0])),(sizeTo[0],sizeTo[1] )),
+ 8: pygame.transform.scale( pygame.image.load("%s9.%s"%(ft[1],ft[0])),(sizeTo[0],sizeTo[1] )),
+ 9: pygame.transform.scale( pygame.image.load("%s1.%s"%(ft[1],ft[0])),(sizeTo[0],sizeTo[1] ))
+ }
+ print "Time taken to load this test at ",
+ print sizeTo
+ print " pixels was "
+ print time.time()-start
#-----------------------------------------------------------------
while trialthis>0: