Ejemplo n.º 1
0
# (this can be changed later to 'False' with 'cloudimg.blend = False')
myplane = pi3d.createPlane(300, 300, 'box', 100, 100, 0)

starsimg = pi3d.loadTexture("textures/stars2.jpg")

arialFont = pi3d.font("MicrosoftSansSerif","#dd00aa")   #load AR_CENA font and set the font colour to 'raspberry'
destineFont = pi3d.font("Tahoma", "#0055ff")

# Fetch key presses
mykeys = pi3d.key()

rot=0.0

# Display scene
while 1:
    display.clear()

    rot=rot+0.2
    
    pi3d.identity()

#    pi3d.sprite(starsimg, 0,0,-20, 20,20,rot)
#    pi3d.rectangle(starsimg, 0,0,-20, 20,20,rot)

#    myplane.draw(starsimg)
    #                                           x oof, y off, z off, angle, x scale, y scale
    pi3d.drawString(arialFont, "`Test arial font!" ,    math.sin(rot/100), math.cos(rot/100), -2.2, rot, 0.003, 0.003)
#    pi3d.drawString(destineFont, ".Test destine font!", math.cos(rot/100), math.sin(rot/100) - 0.3, -2.2, -rot, 0.001, 0.001)
    
    display.swapBuffers()
Ejemplo n.º 2
0
rot = 0.0

# Display scene
while 1:
    display.clear()

    pi3d.sprite(starsimg, 0, 0, -20, 20, 20, rot)
    rot = rot + 0.02

    pi3d.identity()
    mysphere.draw(earthimg)
    mysphere.rotateIncY(0.1)

    mysphere2.draw(cloudimg)
    mysphere2.rotateIncY(0.2)

    pi3d.drawString(arialFont, "The Raspberry Pi ROCKS!", -1.0, 0.0, -2.2, 10.0, 0.003, 0.003)
    pi3d.drawString(destineFont, "Some nice OpenGL bitmap fonts to play with!", -1.3, -0.3, -2.2, 10.0, 0.002, 0.002)

    k = mykeys.read()
    if k > -1:
        if k == 112:
            display.screenshot("earthPic.jpg")
        elif k == 27:
            display.destroy()
            break
        else:
            print k

    display.swapBuffers()
Ejemplo n.º 3
0
    mycylinder.draw(patimg)
    mycylinder.rotateIncY(2)
    mycylinder.rotateIncZ(1)

    mytcone.draw(coffimg)
    mytcone.rotateIncY(2)
    mytcone.rotateIncZ(-1)

    mytorus.draw(patimg)
    mytorus.rotateIncY(3)
    mytorus.rotateIncZ(1)

    mylathe.draw(patimg)
    mylathe.rotateIncY(2)
    mylathe.rotateIncZ(1)
    
    pi3d.drawString(arialFont,"Raspberry Pi ROCKS!",-0.8,-0.7,-2.2, 10.0, 0.003,0.003)
    #pi3d.drawString(destineFont,"Some nice OpenGL bitmap fonts to play with",-1.3,-0.3,-2.2, 10.0, 0.002,0.002)
    
    k = mykeys.read()
    if k >-1:
	if k==112: display.screenshot("shapesPic.jpg")
	elif k==27:
	    display.destroy()
	    mykeys.close()
	    break
	else:
	    print k

    display.swapBuffers()
Ejemplo n.º 4
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()