Esempio n. 1
0
	mx,my=mymouse.x,mymouse.y
	mouserot += (mx-omx)*0.2
	tilt -= (my-omy)*0.2
	omx,omy=mx,my
	    
	# turns player tank turret towards center of screen which will have a crosshairs
	if turrot+2.0 < mouserot:
		turrot+=2.0
	if turrot-2.0 > mouserot:
		turrot-=2.0
	
	# switch to 2D orthographic rendering
	display.setOrthographic()
	
	# Draw Frames Per Second info
	pi3d.drawString2D(arialFont,"FPS:"+str(fps.count()),10,50,20)
	    
	# Draw targetting cross
	pi3d.rectangle(target,display.win_width*.5-64,display.win_height*.5+64,128,128)
	
	# Draw map and tank positions
	mx = display.win_width-smaps
	pi3d.rectangle(grndot,mx+(xm/mapwidth)*smaps+smph-doth,smph+doth-(zm/mapdepth)*smaps,dotsize,dotsize)
	pi3d.rectangle(reddot,mx+(-etx/mapwidth)*smaps+smph-doth,smph+doth-(-etz/mapdepth)*smaps,dotsize,dotsize)
	pi3d.rectangle(mountimg1,mx,smaps,smaps,smaps)
	
	# If in sniper mode, then display sniper overlay
	if smode==True: pi3d.rectangle(sniper,0,display.win_height,display.win_width,display.win_height)
	
	display.swapBuffers()
	
Esempio n. 2
0
	# Draw ball (tex,x,y,z,width,height,rotation)
	pi3d.sprite(ball[bi[b]],bx[b],by[b],-2.0,bs[b],bs[b])
	
	# Increment ball positions
	bx[b]=bx[b]+dx[b]
	by[b]=by[b]+dy[b]
	
	# X coords outside of drawing area?  Then invert X direction
	if bx[b]>scnx or bx[b]<0:
		dx[b]=-dx[b]
	
	# Y coords outside of drawing area?  Then invert Y direction
	if by[b]>scny or by[b]<0:
		dy[b]=-dy[b]
    
    pi3d.drawString2D(arialFont,"Raspberry Pi ROCKS!",100,300,80)
	
    #draw a bar at the top of the screen
    pi3d.rectangle(bar,0,scny,scnx,32)
    pi3d.rectangle(bbtitle,5,scny,256+5,32)

    k = mykeys.read()
    if k >-1:
	if k==112:
	    display.screenshot("screen3D"+str(scshots)+".jpg")
	    scshots += 1
	if k==27:
		mykeys.close()
		texs.deleteAll()
		display.destroy()
		break