Пример #1
0
    def __init__(self, screenScale, scl):

        self.spriteLocation = r"Images\Maps\LittleRootTown\TrainerHouseDownStairs.png"

        self.gridpos = p5.Vector(8, 2)

        self.bannedList = [(7, 0), (6, 0), (6, 1), (5, 1), (5, 0), (4, 1),
                           (3, 1), (2, 1), (1, 0), (4, 2), (3, 2), (2, 2),
                           (1, 2), (4, 0), (3, 0), (2, 0), (0, 0), (0, 1),
                           (1, 1), (0, 2), (8, 0), (9, 0), (10, 0), (2, 4),
                           (3, 4), (4, 4), (3, 6), (4, 6), (4, 7), (3, 7),
                           (7, 2), (7, 1), (9, 1), (10, 1), (10, 2), (9, 2),
                           (8, 1)]
        self.bannedfromDown = []
        self.bannedfromUp = []
        self.bannedfromRight = []
        self.bannedfromLeft = []

        self.extraSprite = p5.load_image(
            r"Images\Maps\LittleRootTown\TrainerHouseDownStairsExtraSprites.png"
        )
        self.extraActiveCoords = [(4, 3)]

        self.DoorCoords = [(8, 2), (8, 8), (9, 8)]
        self.DoorDestination = [
            LittlerootTrainerTop, LittlerootOutside, LittlerootOutside
        ]

        super().__init__(screenScale, scl)
Пример #2
0
    def __init__(self, screenScale, scl):

        self.sprite = p5.load_image(self.spriteLocation)
        self.Upscaled = 6
        self.gridWidth = int(self.sprite.size[0] / (self.Upscaled * 16) - 1)
        self.gridHeight = int(self.sprite.size[1] / (self.Upscaled * 16) - 1)

        self.screenScale = screenScale / self.Upscaled
        self.scl = scl
        self.pos = p5.Vector(0, 0)
        self.lockedDir = 0
        self.dir = 0

        self.walkThroughWalls = False
        self.ExtraShowFirst = True

        print("Loaded Map: \"{}\"".format(self))
Пример #3
0
    def __init__(self, screenScale, scl):

        self.spriteLocation = r"Images\Maps\LittleRootTown\LittleRootTownOutside.png"

        self.gridpos = p5.Vector(13, 9)

        self.bannedList = [
            (8, 3), (9, 3), (9, 2), (9, 1), (10, 1), (11, 1), (13, 1), (12, 1),
            (14, 1), (15, 1), (17, 1), (16, 1), (20, 0), (20, 1), (17, 0),
            (23, 1), (21, 1), (22, 1), (24, 1), (25, 1), (26, 1), (26, 3),
            (26, 2), (27, 3), (28, 3), (28, 5), (28, 6), (28, 7), (28, 4),
            (28, 8), (28, 9), (28, 10), (28, 13), (28, 11), (28, 12), (28, 14),
            (28, 15), (28, 16), (27, 16), (26, 16), (26, 17), (26, 18), (24,
                                                                         18),
            (25, 18), (24, 19), (24, 20), (23, 20), (22, 20), (21, 20), (20,
                                                                         20),
            (19, 20), (18, 20), (15, 20), (16, 20), (14, 20), (17, 20), (13,
                                                                         20),
            (12, 20), (11, 20), (10, 20), (9, 20), (9, 19), (9, 18), (8, 18),
            (7, 18), (7, 17), (7, 16), (7, 15), (7, 14), (7, 13), (7, 12),
            (7, 11), (7, 10), (7, 9), (7, 5), (7, 3), (7, 8), (7, 4), (7, 7),
            (7, 6), (10, 8), (11, 8), (12, 8), (14, 8), (14, 7), (13, 7),
            (12, 7), (14, 6), (12, 6), (11, 6), (13, 6), (11, 7), (10, 7),
            (10, 6), (21, 6), (22, 6), (23, 6), (24, 6), (25, 6), (21, 7),
            (22, 7), (23, 7), (25, 7), (24, 8), (25, 8), (23, 8), (21, 8),
            (24, 7), (20, 8), (23, 13), (15, 8), (17, 16), (17, 13), (17, 14),
            (16, 13), (13, 13), (12, 13), (12, 14), (15, 13), (14, 13), (16,
                                                                         14),
            (15, 14), (14, 14), (13, 14), (11, 13), (11, 14), (11, 16),
            (11, 15), (16, 15), (13, 15), (14, 17), (14, 15), (15, 15),
            (17, 15), (14, 16), (13, 16), (12, 16), (12, 15), (16, 16)
        ]
        self.bannedfromDown = []
        self.bannedfromUp = []
        self.bannedfromRight = []
        self.bannedfromLeft = []

        self.extraSprite = p5.load_image(
            r"Images\Maps\LittleRootTown\TrainerHouseDownStairsExtraSprites.png"
        )
        self.extraActiveCoords = [(0, 0)]

        self.DoorCoords = [(13, 8)]
        self.DoorDestination = [LittlerootTrainerBot]
        super().__init__(screenScale, scl)
Пример #4
0
    def __init__(self, screenScale, scl):

        self.spriteLocation = r"Images\Maps\LittleRootTown\TrainerHouseUpstairs.png"

        self.gridpos = p5.Vector(4, 4)

        self.bannedList = [(0, 0), (1, 0), (2, 0), (3, 0), (4, 0), (6, 0),
                           (8, 0), (8, 1), (7, 0), (6, 1), (5, 0), (4, 1),
                           (5, 1), (3, 1), (2, 1), (1, 1), (0, 1), (1, 5)]
        self.bannedfromDown = []
        self.bannedfromUp = []
        self.bannedfromRight = []
        self.bannedfromLeft = []

        self.extraSprite = p5.load_image(
            r"Images\Maps\LittleRootTown\TrainerHouseUpstairsExtraSprites.png")
        self.extraActiveCoords = [(1, 4)]

        self.DoorCoords = [(7, 1)]
        self.DoorDestination = [LittlerootTrainerBot]

        super().__init__(screenScale, scl)
Пример #5
0
pr = cProfile.Profile()

t0 = time.time()

frame_path = "./frames/"
if not os.path.exists(frame_path):
    os.mkdir(frame_path)

font = pf.create_font("c:/windows/fonts/arialuni.ttf", 16)

cover_path = "./covers/"
img_L = []
w, h = (80, 60)
for i, file in enumerate(os.listdir(cover_path)[:50]):
    img_path = cover_path + file
    img = pf.load_image(img_path)
    img.size = (w, h)
    clr_thf = ColorThief(img._img)
    d_color = clr_thf.get_color(quality=10)
    # pf.fill(*d_color)
    palette = clr_thf.get_palette(color_count=2, quality=20)
    # palette = None
    img_L.append([img, img_path, d_color, palette])

win_w, win_h = (1280, 720)
t1 = None


def setup():
    global img_L, t1
    ratio = 1.2
Пример #6
0
# make directory
dir_name = os.path.dirname(fn_out)
if dir_name:
    os.makedirs(dir_name, exist_ok=True)

# read the file
df = pd.read_json(fn, lines=True)
df.loc[:, 'label'] = df['category'].str.split('-').str.get(0)
if verbose:
    print(f"Drawings {len(df)} shapes.")

if fn_img:
    if verbose:
        print(f"Loading image {fn_img}.")
    img = load_image(fn_img)


@timeout(60 * 5)
def setup():
    if verbose:
        print(f"Setting up.")
    if fn_img:
        furthest_element = img.height
        size(img.width, img.height)
    else:
        furthest_element = df.location.str.get('y').max()
        furthest_element_height = df[df.location.str.get(
            'y') == furthest_element].dimensions.str.get('height').tolist()[0]
        length = int(furthest_element_height + furthest_element + 10)
        size(375, length)
Пример #7
0
from p5 import setup, draw, run
import p5 as pf
vec = pf.Vector
from operator import add, sub

from reply_processer import

t0 = time.time()

img_path = "./frames/"
if not os.path.exists(img_path):
    os.mkdir(img_path)

cover_path = "./covers/"

img0 = pf.load_image(cover_path+"784489.jpg")
font = pf.create_font("c:/windows/fonts/arialuni.ttf",16)
with open("ninfo_rank.pkl","rb") as rf:
    # ninfo_L: list of floor_num_L
    ct_L, ninfo_L, idx_LL = pickle.load(rf)


# print(len(ninfo_L), len(idx_LL))


def setup():
    ratio = 1.8
    pf.size(1280/ratio,720/ratio)
    pf.text_font(font)
    pf.title("Patato")
    pf.no_loop()