コード例 #1
0
ファイル: main.py プロジェクト: chmod555/kaa
            elif event.is_pressing(Keycode.kp_3):
                self.text_node.origin_alignment = Alignment.bottom_right
            elif event.is_pressing(Keycode.w):
                self.camera.position += Vector(0., -0.3)
            elif event.is_pressing(Keycode.s):
                self.camera.position += Vector(0., 0.3)
            elif event.is_pressing(Keycode.a):
                self.camera.position += Vector(-0.3, 0.)
            elif event.is_pressing(Keycode.d):
                self.camera.position += Vector(0.3, 0.)
            elif event.is_pressing(Keycode.i):
                self.camera.scale += Vector(0.05, 0.05)
            elif event.is_pressing(Keycode.o):
                self.camera.scale += Vector(-0.05, -0.05)
            elif event.is_pressing(Keycode.r):
                self.camera.rotation_degrees += 5.
            elif event.is_pressing(Keycode.f):
                self.camera.position = self.text_node.position

        print("Mouse position: {}".format(self.input.get_mouse_position()))


if __name__ == '__main__':
    engine = Engine(virtual_resolution=Vector(10, 10))
    engine.window.show()
    engine.run(FontDemoScene())

    print(" * Deleting engine")
    del engine
    print(" * Ending script")
コード例 #2
0
                    if not self.collisions_enabled:
                        self.obj1_hitbox.collision_mask = HitboxMask.side
                        self.obj2_hitbox.collision_mask = HitboxMask.side
                        print("Objects will NOT collide")
                    else:
                        self.obj1_hitbox.collision_mask = HitboxMask.all
                        self.obj2_hitbox.collision_mask = HitboxMask.all
                        print("Objects will collide")
                if event.keyboard_key.key == Keycode.f:
                    self.engine.window.fullscreen = not self.engine.window.fullscreen
                if event.keyboard_key.key == Keycode.l:
                    self.engine.window.size = self.engine.window.size + Vector(
                        20, 20)
                if event.keyboard_key.key == Keycode.v:
                    self.engine.window.center()

        if self.input.keyboard.is_pressed(Keycode.q):
            print("q Pressed - Exiting")
            self.engine.quit()
        elif self.input.keyboard.is_pressed(Keycode.x) and self.space:
            self.space.delete()
            self.space = None


if __name__ == '__main__':
    engine = Engine(virtual_resolution=Vector(10, 10))
    engine.window.title = engine.window.title + "Test 123"
    engine.window.size = Vector(800, 600)
    engine.window.center()
    engine.run(MyScene())