Пример #1
0
def test_texture_transform():
    window = MyGame(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE)
    window.setup()
    window.test()
    window.close()
    # arcade.run()
    arcade.cleanup_texture_cache()
Пример #2
0
    def draw_field(self):
        if self.background is not None:
            arcade.draw_lrwh_rectangle_textured(0, 0, self.box.box_sizes[0],
                                                self.box.box_sizes[1],
                                                self.background)
        else:
            arcade.cleanup_texture_cache()
            if self.box.field is None:
                return
            gx = numpy.arange(0, self.box.box_sizes[0], 50)
            gy = numpy.arange(0, self.box.box_sizes[1], 50)
            for x in gx:
                for y in gy:
                    position = self.box.center.copy()
                    position[0] = x
                    position[1] = y
                    value = 10 * self.box.field.equation(position=position)
                    try:
                        arcade.draw_line(x, y, x + value[0], y + value[1],
                                         [255, 255, 255], 1)
                        arcade.draw_circle_filled(x + value[0], y + value[1],
                                                  2, [255, 255, 255])
                    except Exception:
                        pass

            self.background = arcade.Texture("background",
                                             arcade.get_image(0, 0))
Пример #3
0
    def __init__(self):
        """ Initializer """
        # Call the parent class initializer
        super().__init__(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE)

        arcade.cleanup_texture_cache()

        # Set the working directory (where we expect to find files) to the same
        # directory this .py file is in. You can leave this out of your own
        # code, but it is needed to easily run the examples using "python -m"
        # as mentioned at the top of this program.
        file_path = os.path.dirname(os.path.abspath(__file__))
        os.chdir(file_path)

        # Variables that will hold sprite lists
        self.coin_list = None
        self.player_list = None
        self.player = None

        self.performance_timing = PerformanceTiming(results_file=RESULTS_FILE,
                                                    start_n=0,
                                                    increment_n=1000,
                                                    end_time=60)

        arcade.set_background_color(arcade.color.AMAZON)

        # Open file to save timings
        self.results_file = open(RESULTS_FILE, "w")

        self.frame = 0
Пример #4
0
    def draw_field(self):
        if self.background is not None:
            arcade.draw_lrwh_rectangle_textured(0, 0, self.box.box_sizes[0],
                                                self.box.box_sizes[1],
                                                self.background)
        else:
            arcade.cleanup_texture_cache()
            if self.box.field == None:
                return
            gx = numpy.arange(0, self.box.box_sizes[0], 80)
            gy = numpy.arange(0, self.box.box_sizes[1], 80)
            for x in gx:
                for y in gy:
                    speed = 100 * self.box.field.getvalue([x, y])
                    try:
                        arcade.draw_line(x, y, x + speed[0], y + speed[1],
                                         [255, 255, 255], 1)
                        arcade.draw_circle_filled(x + speed[0], y + speed[1],
                                                  2, [255, 255, 255])
                    except:
                        pass

            self.background = arcade.Texture("background",
                                             arcade.get_image(0, 0))
Пример #5
0
def test_sprite():
    window = MyTestWindow(SCREEN_WIDTH, SCREEN_HEIGHT, "Test Sprite Sizes")
    window.test()
    window.close()
    arcade.cleanup_texture_cache()
Пример #6
0
def test_textured_rects():
    window = MyTestWindow(SCREEN_WIDTH, SCREEN_HEIGHT, "Test Textures")
    window.test()
    window.close()
    arcade.cleanup_texture_cache()