master
parent
7ef54795e8
commit
4720ca3c0c
Binary file not shown.
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
68
main.py
68
main.py
|
@ -70,11 +70,10 @@ if settings_data["size"] == SIZE_CHOICES[0]:
|
|||
FONT_SIZE = 12
|
||||
elif FONT == FONTS[2]:
|
||||
FONT_SIZE = 11
|
||||
puzzle_size = (128, 128)
|
||||
non_movable_area = pygame.Rect(8, 19, 128, 128)
|
||||
timer_area = pygame.Rect(22, 1, 55, 12)
|
||||
puzzle_size = (128, 128)
|
||||
win_area = pygame.Rect(55, 70, 55, 12)
|
||||
y = 25
|
||||
size = [20, 25, 100, 15]
|
||||
cons = [15, 195, 12, 3, 9]
|
||||
scaled_size = (18, 21, 108, 108)
|
||||
|
@ -89,31 +88,29 @@ elif settings_data["size"] == SIZE_CHOICES[1]:
|
|||
elif FONT == FONTS[2]:
|
||||
FONT_SIZE = 16
|
||||
puzzle_size = (180, 180)
|
||||
win_area = pygame.Rect(71, 98, 55, 12)
|
||||
non_movable_area = pygame.Rect(11, 26, 180, 180)
|
||||
timer_area = pygame.Rect(27, 2, 86, 16)
|
||||
y = 35
|
||||
win_area = pygame.Rect(71, 98, 55, 12)
|
||||
size = [30, 35, 110, 25]
|
||||
cons = [25, 247, 18, 3, 13]
|
||||
scaled_size = (22, 26, 158, 158)
|
||||
|
||||
else:
|
||||
WIDTH, HEIGHT = 202, 216
|
||||
WIDTH, HEIGHT = 396, 425
|
||||
INT = 2
|
||||
if FONT == FONTS[0]:
|
||||
FONT_SIZE = 15
|
||||
FONT_SIZE = 27
|
||||
elif FONT == FONTS[1]:
|
||||
FONT_SIZE = 17
|
||||
FONT_SIZE = 22
|
||||
elif FONT == FONTS[2]:
|
||||
FONT_SIZE = 16
|
||||
puzzle_size = (180, 180)
|
||||
FONT_SIZE = 21
|
||||
puzzle_size = (360, 360)
|
||||
non_movable_area = pygame.Rect(18, 48, 360, 360)
|
||||
timer_area = pygame.Rect(49, 5, 86, 32)
|
||||
win_area = pygame.Rect(71, 98, 55, 12)
|
||||
non_movable_area = pygame.Rect(11, 26, 180, 180)
|
||||
timer_area = pygame.Rect(27, 2, 86, 16)
|
||||
y = 45
|
||||
size = [40, 45, 120, 35]
|
||||
cons = [35, 270, 18, 3, 15]
|
||||
scaled_size = (22, 26, 158, 158)
|
||||
size = [50, 55, 120, 35]
|
||||
cons = [35, 455, 25, 13, 26]
|
||||
scaled_size = (43, 48, 310, 310)
|
||||
|
||||
puzzle_version = settings_data["grid"]
|
||||
|
||||
|
@ -303,6 +300,8 @@ def quick_game():
|
|||
def render_albums():
|
||||
global current_mode, album_name
|
||||
current_hovered_index = -1
|
||||
size_to_y = {"small": 25, "medium": 35, "big": 65}
|
||||
y = size_to_y[settings_data["size"]]
|
||||
|
||||
for hover_index, album in enumerate(storage["albums"]):
|
||||
album_rect = pygame.Rect(size[0], y, size[2], size[3])
|
||||
|
@ -314,7 +313,7 @@ def render_albums():
|
|||
render_text(album, (size[1], y), screen)
|
||||
y += cons[0]
|
||||
|
||||
if album_hover and event.type == pygame.MOUSEBUTTONDOWN:
|
||||
if album_hover and pygame.mouse.get_pressed()[0]:
|
||||
album_name = album
|
||||
if album_name != album:
|
||||
album_name = None
|
||||
|
@ -346,11 +345,7 @@ class ImageRender:
|
|||
|
||||
def image_load(self):
|
||||
global current_img, current_album
|
||||
if settings_data["size"] == SIZE_CHOICES[0]:
|
||||
self.scaled_size = (18, 21, 108, 108)
|
||||
else:
|
||||
self.scaled_size = (22, 26, 158, 158)
|
||||
|
||||
self.scaled_size = scaled_size
|
||||
image_list = storage["albums"][self.album_name]
|
||||
image_names = list(image_list.keys())
|
||||
|
||||
|
@ -571,7 +566,7 @@ def update_puzzle_data(completed, sorted, current_time, current_moves, real_time
|
|||
# SETTINGS MODE
|
||||
def play_music():
|
||||
music_file = settings_data["music"]["version"]
|
||||
volume = settings_data["music_volume"]
|
||||
volume = settings_data["music"]["volume"]
|
||||
pygame.mixer.music.load("misc/" + music_file + ".mp3")
|
||||
pygame.mixer.music.set_volume(volume)
|
||||
pygame.mixer.music.play(-1)
|
||||
|
@ -589,12 +584,11 @@ def play_sound():
|
|||
def set_hue():
|
||||
global hue_value
|
||||
if settings_data["style"] == STYLE_CHOICES[0]:
|
||||
hue_value = settings_data["gui color"][0]
|
||||
x = 0
|
||||
elif settings_data["style"] == STYLE_CHOICES[2]:
|
||||
hue_value = settings_data["gui color"][1]
|
||||
x = 1
|
||||
|
||||
hue_value = settings_data["gui color"][x]
|
||||
keys = pygame.key.get_pressed()
|
||||
if keys[pygame.K_LEFT]:
|
||||
hue_value = (hue_value - 1) % 360
|
||||
|
@ -607,7 +601,7 @@ def set_hue():
|
|||
|
||||
settings_data["gui color"][x] = hue_value
|
||||
with open(SETTINGS_FILE, "w") as settings_file:
|
||||
settings_file.write(json.dumps(settings_data))
|
||||
json.dump(settings_data, settings_file)
|
||||
|
||||
def change_hue(image, hue):
|
||||
new_image = image.copy()
|
||||
|
@ -665,7 +659,7 @@ if settings_data["size"] == SIZE_CHOICES[0]:
|
|||
BACKGROUND_IMAGE = Image((0, 64), (0, 0), (WIDTH, HEIGHT))
|
||||
ver1_layer = sprite_sheet.get_sprite((147, 64), WIDTH, HEIGHT, color_key=(255, 0, 128))
|
||||
ver2_layer = sprite_sheet.get_sprite((294, 64), WIDTH, HEIGHT, color_key=(255, 0, 128))
|
||||
else:
|
||||
elif settings_data["size"] == SIZE_CHOICES[1]:
|
||||
px16 = (16, 16)
|
||||
px20 = (20, 20)
|
||||
timer_button = Button((0, 0), (8, 4), px16)
|
||||
|
@ -687,6 +681,28 @@ else:
|
|||
BACKGROUND_IMAGE = Image((0, 84), (0, 0), (WIDTH, HEIGHT))
|
||||
ver1_layer = sprite_sheet.get_sprite((205, 84), WIDTH, HEIGHT, color_key=(255, 0, 128))
|
||||
ver2_layer = sprite_sheet.get_sprite((410, 84), WIDTH, HEIGHT, color_key=(255, 0, 128))
|
||||
else:
|
||||
px32 = (32, 32)
|
||||
px40 = (40, 40)
|
||||
timer_button = Button((0, 0), (12, 6), px32)
|
||||
menu_button = Button((35, 0), (241, 6), px32)
|
||||
hint_button = Button((72, 0), (278, 6), px32)
|
||||
shuffle_button = Button((105, 0), (315, 6), px32)
|
||||
close_button = Button((140, 0), (352, 6), px32)
|
||||
finished_button = Button((175, 0), (12, 6), px32)
|
||||
not_finished_button = Button((210, 0), (8, 6), px32)
|
||||
delete_button = Button((245, 0), (278, 6), px32)
|
||||
continue_button = Button((280, 0), (315, 6), px32)
|
||||
settings_button = Button((315, 0), (12, 6), px32)
|
||||
quick_add_button = Button((86, 70), (49, 6), (187, 32))
|
||||
new_button = Button((350, 0), (241, 6), px32)
|
||||
info_button = Button((385, 0), (12, 6), px32)
|
||||
stats_button = Button((420, 0), (278, 6), px32)
|
||||
to_left_button = Button((0, 70), (130, 372), px40)
|
||||
to_right_button = Button((43, 70), (226, 372), px40)
|
||||
BACKGROUND_IMAGE = Image((0, 156), (0, 0), (WIDTH, HEIGHT))
|
||||
ver1_layer = sprite_sheet.get_sprite((399, 156), WIDTH, HEIGHT, color_key=(255, 0, 128))
|
||||
ver2_layer = sprite_sheet.get_sprite((798, 156), WIDTH, HEIGHT, color_key=(255, 0, 128))
|
||||
|
||||
path_components = puzzle_data[f'current {puzzle_version}']['selected_image'].split('/')[2:]
|
||||
current_data = storage[path_components[0]]
|
||||
|
|
|
@ -85,11 +85,11 @@
|
|||
"10.png": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
"00:00:34",
|
||||
"00:00:04",
|
||||
0
|
||||
1,
|
||||
2290,
|
||||
"00:01:13",
|
||||
"00:00:00",
|
||||
4
|
||||
]
|
||||
},
|
||||
"Birds": {
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"puzzle 4x4": [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 0]], "puzzle 3x3": [[1, 2, 3], [4, 5, 6], [7, 8, 0]], "current 4x4": {"matrix": [[6, 8, 0, 12], [1, 11, 13, 15], [5, 7, 14, 4], [2, 9, 10, 3]], "selected_image": "/images/albums/Original images/10.png"}, "current 3x3": {"matrix": [[3, 6, 7], [5, 4, 1], [0, 8, 2]], "selected_image": "/images/albums/Birds/1.png"}}
|
||||
{"puzzle 4x4": [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 0]], "puzzle 3x3": [[1, 2, 3], [4, 5, 6], [7, 8, 0]], "current 4x4": {"matrix": [[15, 1, 0, 4], [13, 3, 10, 5], [9, 12, 14, 6], [2, 7, 11, 8]], "selected_image": "/images/albums/Original images/10.png"}, "current 3x3": {"matrix": [[3, 6, 7], [5, 4, 1], [0, 8, 2]], "selected_image": "/images/albums/Birds/1.png"}}
|
Loading…
Reference in New Issue