summaryrefslogtreecommitdiff
path: root/src/helper.py
diff options
context:
space:
mode:
authorRaindropsSys <contact@minteck.org>2023-09-01 14:54:08 +0200
committerRaindropsSys <contact@minteck.org>2023-09-01 14:54:08 +0200
commitc2f1ed6a85c3895483d36af0f64e2829c3fa3263 (patch)
tree6f6a8efbe62db8576a1abf5409569b37ccf261be /src/helper.py
parent03afd42fdcd52e4a827016828c4ad286de320078 (diff)
downloadblocks-c2f1ed6a85c3895483d36af0f64e2829c3fa3263.tar.gz
blocks-c2f1ed6a85c3895483d36af0f64e2829c3fa3263.tar.bz2
blocks-c2f1ed6a85c3895483d36af0f64e2829c3fa3263.zip
Updated 11 files and added 2 files (automated)
Diffstat (limited to 'src/helper.py')
-rw-r--r--src/helper.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/helper.py b/src/helper.py
index 669ea1b..e391212 100644
--- a/src/helper.py
+++ b/src/helper.py
@@ -1,9 +1,42 @@
from blocks import blocks
import pygame
from math import floor
+from sys import platform
+from pathlib import Path
+import os
texture_map = pygame.image.load('./assets/textures/texture_atlas.png')
+def get_data_path():
+ path = str(Path.home()) + "/.blocks"
+
+ if platform == "darwin":
+ path = str(Path.home()) + "/Library/Application Support/Blocks"
+ elif platform == "win32":
+ path = str(Path.home()).replace("\\", "/") + "/.blocks"
+
+ if not os.path.exists(path):
+ os.mkdir(path)
+
+ if not os.path.exists(path + "/saves"):
+ os.mkdir(path + "/saves")
+
+ if not os.path.exists(path + "/crash_reports"):
+ os.mkdir(path + "/crash_reports")
+
+ return path
+
+def transparent(surface, percentage):
+ screen = pygame.Surface((1280, 720))
+ screen.fill("black")
+ screen.blit(surface, (0, 0))
+
+ surface2 = pygame.Surface((1280, 720))
+ surface2.fill((0, 0, 0, 255*(1-percentage)))
+ screen.blit(pygame.Surface.convert_alpha(surface2), (0, 0))
+
+ return screen
+
def text(text, size, color):
return pygame.font.Font("./assets/font/main.ttf", size).render(text, False, color)