Ejemplo n.º 1
0
    def __init__(self, width, height, title):
        """ Init """
        super().__init__(width, height, title)

        arcade.configure_logging()

        arcade.set_background_color(arcade.color.AMAZON)

        self.player_list = None
        self.wall_list = None
        self.bullet_list = None
        self.item_list = None
        self.player_sprite = None
        self.physics_engine: Optional[PymunkPhysicsEngine] = None

        # Track the current state of what key is pressed
        self.left_pressed = False
        self.right_pressed = False
        self.up_pressed = False
        self.down_pressed = False
Ejemplo n.º 2
0
from itertools import cycle
import arcade
from arcade import gl

# Do the math to figure out our screen dimensions
SCREEN_WIDTH = 2048
SCREEN_HEIGHT = 1024
SCREEN_TITLE = "Subpixel Experiment"

import logging
arcade.configure_logging(logging.DEBUG)


class MyGame(arcade.Window):
    def __init__(self, width, height, title):
        """
        Set up the application.
        """
        super().__init__(width, height, title, resizable=True)
        self.time = 0
        self.sprites = arcade.SpriteList()

        # Just grab all the image resources we can find
        resources = [
            getattr(arcade.resources, resource)
            for resource in dir(arcade.resources)
            if resource.startswith('image_')
        ]
        resource_cycle = cycle(resources)
        # We only care about sprites of this size
        sprite_size = 128
Ejemplo n.º 3
0
"""
Starting Template Simple

Once you have learned how to use classes, you can begin your program with this
template.

If Python and Arcade are installed, this example can be run from the command line with:
python -m arcade.examples.starting_template_simple
"""
import arcade

SCREEN_WIDTH = 800
SCREEN_HEIGHT = 600
SCREEN_TITLE = "GUI Example"

arcade.configure_logging()

class MyClickableText(arcade.experimental.gui.ClickableText):
    def __init__(self, center_x:float, center_y:float, text:str):
        super().__init__(center_x=center_x,
                         center_y=center_y,
                         text_color=arcade.color.GRAY,
                         text_color_mouse_over=arcade.color.WHITE,
                         font_size=20,
                         text=text)

    def on_click(self):
        print("Click!")


class MyGame(arcade.Window):
Ejemplo n.º 4
0
def test_logging():
    arcade.configure_logging(logging.WARNING)
    logger = logging.getLogger('arcade')
    assert logger.level == logging.WARNING