Ejemplo n.º 1
0
camera = pi3d.camera()
camera.orthographic(0, scnx, 0, scny)

while True:
	
    display.clear()
	
    for b in range (0, maxballs):
			    
	# Draw ball (tex,x,y,z,width,height,rotation)
	pi3d.sprite(ball[bi[b]],bx[b],by[b],-1,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]
    
    #draw a bar at the top of the screen
    pi3d.rectangle(bar,0,scny-32,scnx,32)
    pi3d.rectangle(bbtitle,5,scny-32,256,32)
    
    display.swap_buffers()
Ejemplo n.º 2
0
	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()
	
	# Handle window events
	# Press ESCAPE to terminate
	win.update()
Ejemplo n.º 3
0
        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]

    #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

    display.swapBuffers()
Ejemplo n.º 4
0
camera = pi3d.camera()
camera.orthographic(0, scnx, 0, scny)

while True:

    display.clear()

    for b in range(0, maxballs):

        # Draw ball (tex,x,y,z,width,height,rotation)
        pi3d.sprite(ball[bi[b]], bx[b], by[b], -1, 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]

    #draw a bar at the top of the screen
    pi3d.rectangle(bar, 0, scny - 32, scnx, 32)
    pi3d.rectangle(bbtitle, 5, scny - 32, 256, 32)

    display.swap_buffers()
Ejemplo n.º 5
0
	# 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
	

    display.swapBuffers()
Ejemplo n.º 6
0
scny=1024
display = pi3d.display()
display.create2D(0,0,scnx,scny,0)

# Set last value (alpha) to zero for a transparent background!
display.setBackColour(0,0.2,0.6,0.8)    	
    
# Ball parameters

arialFont = pi3d.font("MicrosoftSansSerif","#ffffff")   #load AR_CENA font and set the font colour to 'raspberry'

bar = pi3d.loadTexture("textures/bar.png")
bbtitle = pi3d.loadTextureAlpha("textures/pi3dbbd.png",True)
coffee = pi3d.loadTexture("textures/COFFEE.PNG")

# Fetch key presses
mykeys = pi3d.key()
scshots = 1

while True:
	
    display.clear()
   
    #draw a bar at the top of the screen
    pi3d.rectangle(bar,0,scny,scnx,32)
    pi3d.rectangle(bbtitle,5,scny,256+5,32)
    pi3d.rectangle(coffee,200,600,400,400)
    pi3d.drawString(arialFont, "`Test arial font!", 300, 300, 0, 0.0, 1.0,1.0)

    display.swapBuffers()