Exemplo n.º 1
0
pygame.init()

# size = width, height = 320, 400
size = width, height = 625, 400
xoffset = 50
yoffset = 50
offset = xoffset/2, yoffset/2
screen = pygame.display.set_mode(size)

black = 0, 0, 0
white = 255, 255, 255
bgcolor = white

## For visual reference, we will also draw a
## coordinate axis.
coords = math3d.wireframe('coords.dat')

## This is where I will be experimenting with movement...
nextscreen = 0
pygame.mouse.set_visible(False)
center_x = width/2; center_y = height/2
inner_r = 50*50; outer_r = 100*100
m_0 = (float(height)/width); m_1 =-(float(height)/width)

clockwise_image = \
         pygame.image.load('../images/arrow_rotate_clockwise.png')
counter_clockwise_image = \
         pygame.image.load('../images/arrow_rotate_anticlockwise.png')
fwd_image = pygame.image.load('../images/add.png')
back_image = pygame.image.load('../images/money_yen.png')
Exemplo n.º 2
0
# what we use to draw things to the screen.
camera = math3d.camera(width-xoffset, height-yoffset)

# We will be rotating eight different cubes.  The
# following vectors will be used to position each
# cube.
vec = math3d.vector
positions = [ vec(50, 50, 50), vec(-50, 50, 50),
              vec(-50, -50, 50), vec(50, -50, 50),
              vec(50, 50, -50), vec(-50, 50, -50),
              vec(-50, -50, -50), vec(50, -50, -50) ]
cube = []
#for i in range(8):
   #cube.append(math3d.wireframe('littlecube.dat',
       #pos = positions[i], axis=positions[(i+1)%8]))
cube.append(math3d.wireframe('worm_middle_segment.dat', pos = vec(0, 0, 0), axis = vec(1, 0, 0)))
cube.append(math3d.wireframe('worm_head_tail.dat', pos = vec(0, 0, 100), axis = vec(1, 0, 0)))
cube.append(math3d.wireframe('worm_ball_type_I.dat', pos = vec(0, 0, 200), axis = vec(1, 0, 0)))
cube.append(math3d.wireframe('worm_elbow.dat', pos = vec(0, 0, -100), axis = vec(1, 0, 0)))

# For visual reference, we will also draw a
# coordinate axis.
coords = math3d.wireframe('coords.dat')

camera.film.fill(bgcolor)

# Rotate cubes around Fwd axis
i = 0
nextscreen = 0
while 1:
   for event in pygame.event.get():
Exemplo n.º 3
0
# We can now create a camera object.  This will be
# what we use to draw things to the screen.
camera = math3d.camera(width-xoffset, height-yoffset)

# We will be rotating eight different cubes.  The
# following vectors will be used to position each
# cube.
vec = math3d.vector
positions = [ vec(50, 50, 50), vec(-50, 50, 50),
              vec(-50, -50, 50), vec(50, -50, 50),
              vec(50, 50, -50), vec(-50, 50, -50),
              vec(-50, -50, -50), vec(50, -50, -50) ]
cube = []
for i in range(8):
   cube.append(math3d.wireframe('littlecube.dat',
       pos = positions[i], axis=positions[(i+1)%8]))

# For visual reference, we will also draw a
# coordinate axis.
coords = math3d.wireframe('coords.dat')

camera.film.fill(bgcolor)

# Rotate cubes around Fwd axis
i = 0
nextscreen = 0
while 1:
   for event in pygame.event.get():
      if event.type == pygame.QUIT:
         sys.exit()
      elif event.type == pygame.KEYDOWN:
Exemplo n.º 4
0
                   pos=math3d.vector(-500, 0, 0))

# We will be rotating eight different cubes.  The
# following vectors will be used to position each
# cube.

# All of the following is used by the "residue"
# from my initial program
vec = math3d.vector
positions = [ vec(50, 50, 50), vec(-50, 50, 50),
              vec(-50, -50, 50), vec(50, -50, 50),
              vec(50, 50, -50), vec(-50, 50, -50),
              vec(-50, -50, -50), vec(50, -50, -50) ]
cube = []

cube.append(math3d.wireframe('worm_middle_segment.dat',
             pos = vec(0, 0, 0), axis = vec(1, 0, 0)))
#cube.append(math3d.wireframe('worm_head_tail.dat',
#            pos = vec(0, 0, 100), axis = vec(1, 0, 0)))
#cube.append(math3d.wireframe('worm_middle_segment.dat',
#            pos = vec(0, 0, -100), axis = vec(1, 0, 0)))
#cube.append(math3d.wireframe('worm_elbow.dat',
#            pos = vec(0, 0, -200), axis = vec(1, 0, 0), beta=64))
#cube.append(math3d.wireframe('worm_middle_segment.dat',
#            pos = vec(0, -100, -200), axis = vec(1, 0, 0), beta=64))
#cube.append(math3d.wireframe('worm_elbow.dat',
#            pos = vec(0, -200, -200), axis = vec(0, 0, 1), beta=128))
#cube.append(math3d.wireframe('worm_head_tail.dat',
#            pos = vec(0, 0, -100), axis = vec(1, 0, 0), beta=128))
#cube.append(math3d.wireframe('worm_ball_type_I.dat',
#            pos = vec(0, 0, 200), axis = vec(1, 0, 0)))