Exemple #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)
Exemple #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)
Exemple #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)
 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)
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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	)
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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()
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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
Exemple #23
0
 def on_tick(self):
     bacon.clear(0, 0, 0, 1)
     bacon.draw_string(font, 'Hello, Bacon!', 50, 50)
Exemple #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
Exemple #25
0
 def on_tick(self):
     bacon.clear(0, 0, 0, 1)
     bacon.draw_image(kitten, self.offset_x, self.offset_y)
     pass
Exemple #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)
Exemple #27
0
 def on_tick(self):
     bacon.clear(0, 0, 0, 1)
     bacon.draw_string(font, 'Hello, Bacon!', 50, 50)
Exemple #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)
Exemple #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)
 def on_tick(self):
     bacon.clear(0, 0, 0, 1)
     bacon.draw_image(kitten, self.offset_x, self.offset_y)
     pass
Exemple #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)
Exemple #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)
Exemple #33
0
 def on_tick(self):
     bacon.clear(0, 0, 0, 1)
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #38
0
 def on_tick(self):
     bacon.clear(0, 0, 0, 1)
Exemple #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)
Exemple #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)
Exemple #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)