Ejemplo n.º 1
0
 def on_tick(self):
     bacon.clear(0, 0, 0, 1)
     bacon.draw_string(font, 'Mouse is at %d, %d' % (bacon.mouse.x, bacon.mouse.y), 5, 15)
     if bacon.mouse.left:
         bacon.draw_string(font, 'Left button down', 5, 35)
     if bacon.mouse.right:
         bacon.draw_string(font, 'Right button down', 5, 55)
Ejemplo n.º 2
0
 def on_tick(self):
     bacon.clear(0.2, 0.2, 0.2, 1.0)
     bacon.draw_string(font, 
         'Window target dimensions are fixed to 512x512 but window is resizable; press "f" for fullscreen', 
         x=0, y=0,
         width=512, height=512,
         align=bacon.Alignment.center,
         vertical_align=bacon.VerticalAlignment.center)
Ejemplo n.º 3
0
 def on_tick(self):
     bacon.clear(0, 0, 0, 1)
     bacon.set_color(1, 0.5, 0.5, 1)
     bacon.draw_image(kitten, 0, 0)
     bacon.set_color(0.5, 1, 0.5, 1)
     bacon.draw_image(kitten2, 50, 256)
     bacon.set_color(0.5, 0.5, 1, 1)
     bacon.draw_image(kitten3, 100, 356)
Ejemplo n.º 4
0
 def on_tick(self):
     bacon.clear(0, 0.2, 0, 1)
     bacon.draw_string(font,
                       'This is the menu; click to start game',
                       bacon.window.width / 2,
                       bacon.window.height / 2,
                       align=bacon.Alignment.center,
                       vertical_align=bacon.VerticalAlignment.center)
Ejemplo n.º 5
0
 def on_tick(self):
     bacon.clear(0, 0, 0, 1)
     bacon.set_color(1, 0.5, 0.5, 1)
     bacon.draw_image(kitten, 0, 0)
     bacon.set_color(0.5, 1, 0.5, 1)
     bacon.draw_image(kitten2, 50, 256)
     bacon.set_color(0.5, 0.5, 1, 1)
     bacon.draw_image(kitten3, 100, 356)
Ejemplo n.º 6
0
 def on_tick(self):
     bacon.clear(0, 0, 0, 1)
     if self.controller:
         bacon.translate(bacon.window.width / 2, bacon.window.height / 2)
         bacon.translate(self.controller.left_thumb_x * 100, self.controller.left_thumb_y * 100)
         bacon.rotate(self.controller.right_thumb_x)
         bacon.scale(self.controller.right_thumb_y + 1, self.controller.right_thumb_y + 1)
         bacon.draw_image(kitten, -kitten.width / 2, -kitten.height / 2)
Ejemplo n.º 7
0
 def on_tick(self):
     bacon.clear(0, 0, 0, 0)
     bacon.set_color(1, 1, 1, 1)
     if player_controller and player_controller.get_button_state(1 << 17):
         bacon.draw_string(font, player_controller.manufacturer, (player_controller.left_thumb_x + 1) * bacon.window.width / 2, (player_controller.left_thumb_y + 1) * bacon.window.height / 2)
     for ball in balls:
         ball.update(bacon.timestep)
         bacon.draw_image(ball_image, ball.x, ball.y)
Ejemplo n.º 8
0
    def on_tick(self):
    	bacon.clear(0, 0, 0, 1)
    	
    	bacon.push_transform()
    	bacon.translate(kitten.width / 2, kitten.height / 2)
    	bacon.rotate(math.pi / 4)
        bacon.draw_image(kitten, -kitten.width / 2, -kitten.height / 2)
        bacon.pop_transform()

        bacon.draw_string(font, 'Hello', 20, 30)
Ejemplo n.º 9
0
	def on_tick(self):
		bacon.set_blending(bacon.BlendFlags.src_alpha , bacon.BlendFlags.one_minus_src_alpha )
		bacon.clear(0, 0, 0, 1)
		bacon.translate(0,0)

		for layer in self.stars:
			for star in layer:
				star.draw()

		bacon.draw_string(font, "star count: " + str(self.star_count), 10, 25	)
Ejemplo n.º 10
0
 def on_tick(self):
     bacon.clear(0, 0, 0, 1)
     if self.controller:
         bacon.translate(bacon.window.width / 2, bacon.window.height / 2)
         bacon.translate(self.controller.left_thumb_x * 100,
                         self.controller.left_thumb_y * 100)
         bacon.rotate(self.controller.right_thumb_x)
         bacon.scale(self.controller.right_thumb_y + 1,
                     self.controller.right_thumb_y + 1)
         bacon.draw_image(kitten, -kitten.width / 2, -kitten.height / 2)
Ejemplo n.º 11
0
    def on_tick(self):
        bacon.clear(0, 0, 0, 1)

        bacon.push_transform()
        bacon.translate(kitten.width / 2, kitten.height / 2)
        bacon.rotate(math.pi / 4)
        bacon.draw_image(kitten, -kitten.width / 2, -kitten.height / 2)
        bacon.pop_transform()

        bacon.draw_string(font, 'Hello', 20, 30)
Ejemplo n.º 12
0
 def on_tick(self):
     bacon.clear(0, 0, 0, 0)
     bacon.set_color(1, 1, 1, 1)
     if player_controller and player_controller.get_button_state(1 << 17):
         bacon.draw_string(
             font, player_controller.manufacturer,
             (player_controller.left_thumb_x + 1) * bacon.window.width / 2,
             (player_controller.left_thumb_y + 1) * bacon.window.height / 2)
     for ball in balls:
         ball.update(bacon.timestep)
         bacon.draw_image(ball_image, ball.x, ball.y)
Ejemplo n.º 13
0
 def on_tick(self):
     bacon.clear(0.2, 0.2, 0.2, 1.0)
     bacon.draw_string(
         font,
         'Window target dimensions are fixed to 512x512 but window is resizable; press "f" for fullscreen',
         x=0,
         y=0,
         width=512,
         height=512,
         align=bacon.Alignment.center,
         vertical_align=bacon.VerticalAlignment.center)
Ejemplo n.º 14
0
    def on_tick(self):
        bacon.clear(0, 0, 0, 1)
        bacon.set_blending(bacon.BlendFlags.one, bacon.BlendFlags.one)

        bacon.set_color(1, 0, 0, 1)
        bacon.draw_string(font, 'Bacon', 0, 50)

        bacon.set_color(0, 1, 0, 1)
        bacon.draw_string(font, 'Bacon', 10, 50)
        
        bacon.set_color(0, 0, 1, 1)
        bacon.draw_string(font, 'Bacon', 20, 50)
Ejemplo n.º 15
0
    def on_tick(self):
        bacon.clear(0, 0, 0, 1)
        bacon.set_blending(bacon.BlendFlags.one, bacon.BlendFlags.one)

        bacon.set_color(1, 0, 0, 1)
        bacon.draw_string(font, 'Bacon', 0, 50)

        bacon.set_color(0, 1, 0, 1)
        bacon.draw_string(font, 'Bacon', 10, 50)

        bacon.set_color(0, 0, 1, 1)
        bacon.draw_string(font, 'Bacon', 20, 50)
Ejemplo n.º 16
0
    def on_tick(self):
        bacon.clear(0.3, 0.3, 0.3, 1)

        # Here the scene is drawn directly to the window,
        # and where the letters overlap there is double-blending.
        bacon.set_color(0.5, 0.5, 0.5, 0.5)
        self.draw_scene()

        # This time we render the scene to an image first
        bacon.push_target(offscreen)
        bacon.clear(0, 0, 0, 0)
        bacon.set_color(1, 1, 1, 1)
        self.draw_scene()
        bacon.pop_target()

        # Then render the offscreen image back to the windoww,
        # There is no double-blending this time because we precomposited
        # the image.
        bacon.set_color(0.5, 0.5, 0.5, 0.5)
        bacon.draw_image(offscreen, 0, 100)
Ejemplo n.º 17
0
    def on_tick(self):
        bacon.clear(0.3, 0.3, 0.3, 1)

        # Here the scene is drawn directly to the window,
        # and where the letters overlap there is double-blending.
        bacon.set_color(0.5, 0.5, 0.5, 0.5)
        self.draw_scene()

        # This time we render the scene to an image first
        bacon.push_target(offscreen)
        bacon.clear(0, 0, 0, 0)
        bacon.set_color(1, 1, 1, 1)
        self.draw_scene()
        bacon.pop_target()

        # Then render the offscreen image back to the windoww,
        # There is no double-blending this time because we precomposited
        # the image.
        bacon.set_color(0.5, 0.5, 0.5, 0.5)
        bacon.draw_image(offscreen, 0, 100)
    def on_tick(self):
        # always clear the screen
        bacon.clear(1, 1, 1, 1)

        # draw the kitten sprite
        kitten.draw()

        # if the pirate sprites alpha is greater than or equal to 1 then set alpha value to negatie
        if (pirate.alpha >= 1):
            self.alpha_value = -(self.alpha_value)  # -0.5
        # if the pirate sprites alpha is lesser than 0 then set alpha value to positive
        elif (pirate.alpha < 0):
            self.alpha_value = abs(self.alpha_value)  # 0.5

        # current alpha = current alpha + (0.5 * bacon.timestep)
        # or
        # current alpha = current alpha + (-0.5 * bacon.timestep)
        pirate.alpha += (self.alpha_value * bacon.timestep)

        # draw the scallywag
        pirate.draw()
Ejemplo n.º 19
0
 def on_tick(self):
     if bacon.Keys.space in bacon.keys:
         bacon.clear(0, 1, 0, 1)
     else:
         bacon.clear(0, 0, 0, 1)
Ejemplo n.º 20
0
 def on_tick(self):
     bacon.clear(0, 0, 0, 1)
     bacon.set_shader(shader)
     brightness.value = bacon.mouse.y / float(bacon.window.height)
     contrast.value = bacon.mouse.x / float(bacon.window.width)
     bacon.draw_image(kitten, 0, 0)
Ejemplo n.º 21
0
 def on_tick(self):
 	bacon.clear(0, 0, 0, 1)
 	bacon.set_color(1, 0, 0, 1)
     bacon.fill_rect(50, 50, 150, 150)
     bacon.set_color(0, 1, 0, 1)
     bacon.draw_rect(50, 50, 150, 150)
Ejemplo n.º 22
0
    def on_tick(self):
        bacon.clear(0, 0, 0, 1)

        # Change the pan of the music based on the mouse position
        music_voice.pan = bacon.mouse.x / bacon.window.width * 2 - 1
Ejemplo n.º 23
0
 def on_tick(self):
     bacon.clear(0, 0, 0, 1)
     bacon.draw_string(font, 'Hello, Bacon!', 50, 50)
Ejemplo n.º 24
0
	def on_tick(self):
		bacon.clear(0, 0, 0, 1)

		# Change the pan of the music based on the mouse position
		music_voice.pan = bacon.mouse.x / bacon.window.width * 2 - 1
Ejemplo n.º 25
0
 def on_tick(self):
     bacon.clear(0, 0, 0, 1)
     bacon.draw_image(kitten, self.offset_x, self.offset_y)
     pass
Ejemplo n.º 26
0
	def on_tick(self):
		bacon.set_blending(bacon.BlendFlags.src_alpha , bacon.BlendFlags.one_minus_src_alpha )
		bacon.clear(0, 0, 0, 1)
		self.box.draw()
		bacon.draw_string(font, "Starship ready.", 10, 30)
		bacon.draw_string(font, "click to initiate", 10, 72)
Ejemplo n.º 27
0
 def on_tick(self):
     bacon.clear(0, 0, 0, 1)
     bacon.draw_string(font, 'Hello, Bacon!', 50, 50)
Ejemplo n.º 28
0
 def on_tick(self):
     bacon.clear(0, 0, 0, 1)
     x, y = bacon.mouse.x, bacon.mouse.y
     bacon.draw_image_region(kitten, x - 50, y - 50, x + 50, y + 50, 
                             x - 50, y - 50, x + 50, y + 50)
Ejemplo n.º 29
0
 def on_tick(self):
     bacon.clear(0, 0, 0, 1)
     x, y = bacon.mouse.x, bacon.mouse.y
     bacon.draw_image_region(kitten, x - 50, y - 50, x + 50, y + 50, x - 50,
                             y - 50, x + 50, y + 50)
Ejemplo n.º 30
0
 def on_tick(self):
     bacon.clear(0, 0, 0, 1)
     bacon.draw_image(kitten, self.offset_x, self.offset_y)
     pass
Ejemplo n.º 31
0
 def on_tick(self):
     bacon.clear(0, 0, 0, 1)
     bacon.set_color(1, 0, 0, 1)
     bacon.fill_rect(50, 50, 150, 150)
     bacon.set_color(0, 1, 0, 1)
     bacon.draw_rect(50, 50, 150, 150)
Ejemplo n.º 32
0
 def on_tick(self):
     bacon.clear(0, 0, 0, 1)
     bacon.set_color(1, 0, 0, 1)
     bacon.draw_image(kitten, 0, 0)
Ejemplo n.º 33
0
 def on_tick(self):
     bacon.clear(0, 0, 0, 1)
Ejemplo n.º 34
0
 def on_tick(self):
     bacon.clear(0, 0, 0, 1)
     bacon.translate(kitten.width / 2, kitten.height / 2)
     bacon.rotate(math.pi / 4)
     bacon.draw_image(kitten, -kitten.width / 2, -kitten.height / 2)
Ejemplo n.º 35
0
 def on_tick(self):
     bacon.clear(0, 0, 0, 1)
     bacon.draw_image_region(kitten, 0, 0, bacon.window.width,
                             bacon.window.height, 0, 0, bacon.window.width,
                             bacon.window.height)
Ejemplo n.º 36
0
 def on_tick(self):
     bacon.clear(0, 0, 0, 1)
     bacon.draw_image(ball_linear, 0, 0, 256, 256)
     bacon.draw_image(ball_nearest, 256, 0, 512, 256)
Ejemplo n.º 37
0
 def on_tick(self):
     bacon.clear(0, 0, 0, 1)
     bacon.draw_image_region(kitten, 0, 0, bacon.window.width, bacon.window.height,
                             0, 0, bacon.window.width, bacon.window.height)
Ejemplo n.º 38
0
 def on_tick(self):
     bacon.clear(0, 0, 0, 1)
Ejemplo n.º 39
0
 def on_tick(self):
     bacon.clear(0, 0, 0, 1)
     glyph_layout.y = bacon.window.height / 2
     glyph_layout.width = bacon.window.width
     bacon.draw_glyph_layout(glyph_layout)
Ejemplo n.º 40
0
 def on_tick(self):
     bacon.clear(0, 0, 0, 1)
     bacon.set_color(1, 0, 0, 1)
     bacon.draw_image(kitten, 0, 0)
Ejemplo n.º 41
0
 def on_tick(self):
     bacon.clear(0, 0, 0, 1)
     glyph_layout.y = bacon.window.height / 2
     glyph_layout.width = bacon.window.width
     bacon.draw_glyph_layout(glyph_layout)