Files
Elvenbane/common.py

21 lines
513 B
Python

import os
import json
import uuid
from dataclasses import dataclass, field
from copy import deepcopy
import pygame
def scale_image(image, n):
orig_size = image.get_size()
new_size = (int(orig_size[0] * n), int(orig_size[1] * n))
return pygame.transform.smoothscale(image, new_size)
def path_exists(data, path):
current = data
for key in path:
if isinstance(current, dict) and key in current:
current = current[key]
else:
return False
return True