Compare commits
No commits in common. "40668745ac488baeb7417a5b32b725d8703085d4" and "f5fab463db37712b90b64115dc5d2203868e92f2" have entirely different histories.
40668745ac
...
f5fab463db
|
@ -1,15 +0,0 @@
|
||||||
{
|
|
||||||
"version": "0.2.0",
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"name": "Python: Main",
|
|
||||||
"type": "debugpy",
|
|
||||||
"request": "launch",
|
|
||||||
"program": "${workspaceFolder}/main.py",
|
|
||||||
"args": [],
|
|
||||||
"cwd": "${workspaceFolder}",
|
|
||||||
"console": "integratedTerminal"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
27
main.py
27
main.py
|
@ -6,14 +6,13 @@ import ctypes
|
||||||
import json
|
import json
|
||||||
from tkinter import Tk, filedialog
|
from tkinter import Tk, filedialog
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import os
|
|
||||||
|
|
||||||
script_dir = os.path.dirname(os.path.abspath(__file__))
|
|
||||||
|
|
||||||
# INITIALIZATION
|
# INITIALIZATION
|
||||||
pygame.init()
|
pygame.init()
|
||||||
FPS = 60
|
FPS = 60
|
||||||
|
|
||||||
|
MAIN_PATH = "C:/Users/User/Documents/Coding/Picture_Puzzle/"
|
||||||
|
# School: MAIN_PATH = "C:/Users/RVKG/Documents/My Palettes/Picture Puzzle/"
|
||||||
IMAGES_PATH = "images/albums/"
|
IMAGES_PATH = "images/albums/"
|
||||||
SIZE_PATH = "images/assets/"
|
SIZE_PATH = "images/assets/"
|
||||||
|
|
||||||
|
@ -126,8 +125,8 @@ if current_size == SIZE_CHOICES[0]:
|
||||||
# --> list[1] (38, 53, 38) - position y for element in spritesheet
|
# --> list[1] (38, 53, 38) - position y for element in spritesheet
|
||||||
# --> list[2] (80, 80, 10) - width of element in settings mode
|
# --> list[2] (80, 80, 10) - width of element in settings mode
|
||||||
# --> list[3] (12, 12, 16) - heigth of element
|
# --> list[3] (12, 12, 16) - heigth of element
|
||||||
arrow1 = (207, 0, 10, 13)
|
arrow1 = (261, 0, 10, 13)
|
||||||
arrow2 = (220, 0, 10, 13)
|
arrow2 = (274, 0, 10, 13)
|
||||||
spaces2 = [4, 5, 2, 5, 60, 42]
|
spaces2 = [4, 5, 2, 5, 60, 42]
|
||||||
spaces3 = [10, 20, 23]
|
spaces3 = [10, 20, 23]
|
||||||
|
|
||||||
|
@ -155,9 +154,9 @@ elif current_size == SIZE_CHOICES[1]:
|
||||||
f_line = [135, 38, 100, 16]
|
f_line = [135, 38, 100, 16]
|
||||||
s_line = [135, 58, 100, 16]
|
s_line = [135, 58, 100, 16]
|
||||||
s_button = [238, 38, 12, 20]
|
s_button = [238, 38, 12, 20]
|
||||||
arrow1 = (263, 0, 13, 17)
|
arrow1 = (261, 0, 10, 13)
|
||||||
arrow2 = (280, 0, 13, 17)
|
arrow2 = (274, 0, 10, 13)
|
||||||
spaces2 = [4, 3, 3, 5, 60, 42]
|
spaces2 = [4, 5, 2, 5, 60, 42]
|
||||||
spaces3 = [10, 20, 23]
|
spaces3 = [10, 20, 23]
|
||||||
if current_style == STYLE_CHOICES[2]:
|
if current_style == STYLE_CHOICES[2]:
|
||||||
spaces2[1] = 2
|
spaces2[1] = 2
|
||||||
|
@ -306,6 +305,7 @@ class Button:
|
||||||
text_surface = font.render(self.popup_text, True, (0, 0, 0), (255, 255, 225))
|
text_surface = font.render(self.popup_text, True, (0, 0, 0), (255, 255, 225))
|
||||||
text_rect = text_surface.get_rect(center=mouse_pos)
|
text_rect = text_surface.get_rect(center=mouse_pos)
|
||||||
|
|
||||||
|
# Increase the size of the popup surface
|
||||||
popup_width = text_rect.width + 14
|
popup_width = text_rect.width + 14
|
||||||
popup_height = text_rect.height + 14
|
popup_height = text_rect.height + 14
|
||||||
|
|
||||||
|
@ -462,7 +462,7 @@ class ImageRender:
|
||||||
return
|
return
|
||||||
|
|
||||||
self.current = image_names[self.index]
|
self.current = image_names[self.index]
|
||||||
selected_image = pygame.image.load(IMAGES_PATH + self.album_name + "/" + self.current)
|
selected_image = pygame.image.load(MAIN_PATH + IMAGES_PATH + self.album_name + "/" + self.current)
|
||||||
self.scaled_image = pygame.transform.scale(selected_image, (self.scaled_size[2], self.scaled_size[3]))
|
self.scaled_image = pygame.transform.scale(selected_image, (self.scaled_size[2], self.scaled_size[3]))
|
||||||
current_img = self.current
|
current_img = self.current
|
||||||
current_album = self.album_name
|
current_album = self.album_name
|
||||||
|
@ -551,9 +551,7 @@ def load_puzzle():
|
||||||
|
|
||||||
puzzle_version = settings_data["grid"]
|
puzzle_version = settings_data["grid"]
|
||||||
image_path = puzzle_data[f'current {puzzle_version}']['selected_image']
|
image_path = puzzle_data[f'current {puzzle_version}']['selected_image']
|
||||||
path_parts = image_path.split('/')
|
puzzle_image = pygame.image.load(MAIN_PATH + image_path)
|
||||||
real_image_path = os.path.abspath(os.path.join(script_dir, *path_parts))
|
|
||||||
puzzle_image = pygame.image.load(real_image_path)
|
|
||||||
|
|
||||||
directions = {"up": [4, 8, 12],
|
directions = {"up": [4, 8, 12],
|
||||||
"down": [],
|
"down": [],
|
||||||
|
@ -754,7 +752,7 @@ def data_set(setting, value):
|
||||||
settings_data[gui] = value
|
settings_data[gui] = value
|
||||||
elif setting == music:
|
elif setting == music:
|
||||||
if isinstance(value, str):
|
if isinstance(value, str):
|
||||||
settings_data[music]["version"] = value
|
settings_data[sound]["version"] = value
|
||||||
else:
|
else:
|
||||||
settings_data[music]["volume"] = value
|
settings_data[music]["volume"] = value
|
||||||
update_music_volume()
|
update_music_volume()
|
||||||
|
@ -768,7 +766,6 @@ def data_set(setting, value):
|
||||||
with open(SETTINGS_FILE, "w") as settings_file:
|
with open(SETTINGS_FILE, "w") as settings_file:
|
||||||
json.dump(settings_data, settings_file, indent=2)
|
json.dump(settings_data, settings_file, indent=2)
|
||||||
|
|
||||||
|
|
||||||
def play_music():
|
def play_music():
|
||||||
music_file = settings_data[music]["version"]
|
music_file = settings_data[music]["version"]
|
||||||
music_file = music_file.replace(" ", "_")
|
music_file = music_file.replace(" ", "_")
|
||||||
|
@ -814,7 +811,7 @@ def set_hue():
|
||||||
|
|
||||||
sprite_sheet.set_hue(hue_value)
|
sprite_sheet.set_hue(hue_value)
|
||||||
|
|
||||||
pygame.image.save(sprite_sheet.sheet, SIZE_PATH + str(INT) + STYLE_PATH + "spritesheet.png")
|
pygame.image.save(sprite_sheet.sheet, MAIN_PATH + SIZE_PATH + str(INT) + STYLE_PATH + "spritesheet.png")
|
||||||
|
|
||||||
settings_data[gui][x] = hue_value
|
settings_data[gui][x] = hue_value
|
||||||
with open(SETTINGS_FILE, "w") as settings_file:
|
with open(SETTINGS_FILE, "w") as settings_file:
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
129,
|
99,
|
||||||
"00:01:24",
|
"00:01:11",
|
||||||
"00:00:59",
|
"00:00:46",
|
||||||
4
|
6
|
||||||
],
|
],
|
||||||
"2.png": [
|
"2.png": [
|
||||||
0,
|
0,
|
||||||
|
|
|
@ -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": [[15, 7, 2, 3], [10, 14, 5, 4], [13, 6, 0, 12], [9, 1, 8, 11]], "selected_image": "images/albums/Original images/1.png"}, "current 3x3": {"matrix": [[6, 7, 0], [3, 4, 1], [5, 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": [[6, 13, 10, 2], [4, 3, 5, 12], [11, 14, 8, 0], [1, 7, 9, 15]], "selected_image": "images/albums/Original images/2.png"}, "current 3x3": {"matrix": [[3, 6, 7], [5, 4, 1], [0, 8, 2]], "selected_image": "/images/albums/Birds/1.png"}}
|
|
@ -1,17 +1,17 @@
|
||||||
{
|
{
|
||||||
"size": "medium",
|
"size": "big",
|
||||||
"style": "classic",
|
"style": "dark",
|
||||||
"grid": "4x4",
|
"grid": "4x4",
|
||||||
"gui color": 0,
|
"gui color": 0,
|
||||||
"music": {
|
"music": {
|
||||||
"on": true,
|
"on": true,
|
||||||
"volume": 1,
|
"volume": 0,
|
||||||
"version": "sunny day"
|
"version": "serenity"
|
||||||
},
|
},
|
||||||
"sound": {
|
"sound": {
|
||||||
"on": true,
|
"on": true,
|
||||||
"volume": 4,
|
"volume": 12,
|
||||||
"version": "puzzle"
|
"version": "wood"
|
||||||
},
|
},
|
||||||
"display": "time",
|
"display": "time",
|
||||||
"language": "english",
|
"language": "english",
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue