libGML 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ {
2
+ "python.REPL.enableREPLSmartSend": false
3
+ }
libGML/__init__.py ADDED
File without changes
File without changes
libGML/core/vector2.py ADDED
@@ -0,0 +1,14 @@
1
+ import pygame
2
+
3
+ class Vector2:
4
+ def __init__(self, x, y):
5
+ self.x = x
6
+ self.y = y
7
+
8
+ def __iadd__(self, other):
9
+ self.x = other.x
10
+ self.y = other.y
11
+ return self
12
+
13
+ def __mul__(self, other):
14
+ return Vector2(self.x * other, self.y * other)
libGML/core/world.py ADDED
@@ -0,0 +1,64 @@
1
+ import pygame
2
+ import json
3
+
4
+ class World:
5
+ def __init__(self, sc):
6
+ self.sc = sc
7
+
8
+ def load_room(self, filename):
9
+ with open(filename, 'r', encoding='utf-8') as f:
10
+ data = json.load(f)
11
+ return data
12
+
13
+ def draw_tile(self, atlas_name, x, y, atlas, width, height):
14
+ wall = atlas.get(atlas_name)
15
+ wallModed = pygame.transform.scale(wall, (width, height))
16
+ self.sc.blit(wallModed, (x, y))
17
+
18
+ #def trigger_room(self, player_rect):
19
+ # if self.map_l2 is None:
20
+ # return None
21
+
22
+ # col = player_rect.centerx // BrickWallX
23
+ # row = player_rect.centery // BrickWallX
24
+
25
+ # rows = len(self.map_l2)
26
+ # if rows == 0:
27
+ # return False
28
+ # cols = len(self.map_l2[0])
29
+
30
+ # if not (0 <= row < rows and 0 <= col < cols):
31
+ # return False
32
+
33
+ # tile_id = self.map_l2[row][col]
34
+ # key = str(tile_id) if isinstance(tile_id, int) else tile_id
35
+ # return key == "13"
36
+
37
+ def draw_layer(self, map, atlas, width, height):
38
+ self.map = map
39
+ rows = len(map)
40
+ cols = len(map[0]) if rows > 0 else 0
41
+ for row in range(rows):
42
+ for col in range(cols):
43
+ for i in atlas.keys():
44
+ tile = map[row][col]
45
+ x = col * width
46
+ y = row * height
47
+ if tile == i:
48
+ self.draw_tile(i, x, y, atlas, width, height)
49
+
50
+ def can_move_to(self, rect, tile_size, blocked_tiles, map):
51
+ corners = [
52
+ (rect.left, rect.top),
53
+ (rect.right - 1, rect.top),
54
+ (rect.left, rect.bottom - 1),
55
+ (rect.right - 1, rect.bottom - 1)
56
+ ]
57
+ for cx, cy in corners:
58
+ mx = int(cx // tile_size)
59
+ my = int(cy // tile_size)
60
+ if not (0 <= my < len(map) and 0 <= mx < len(map[0])):
61
+ return False
62
+ if map[my][mx] in blocked_tiles:
63
+ return False
64
+ return True
File without changes
@@ -0,0 +1,30 @@
1
+ import pygame
2
+
3
+ class Sprite:
4
+ def __init__(self):
5
+ self.x = None
6
+ self.y = None
7
+ self.width = None
8
+ self.height = None
9
+
10
+ def move(self, dest, rect):
11
+ new = rect.copy()
12
+ new.x += dest[0]
13
+ new.y += dest[1]
14
+ return new
15
+
16
+ def draw(self, surface, rect, texture):
17
+ self.sc = surface
18
+ self.sc.blit(texture, (rect.x, rect.y))
19
+
20
+ def create_sprite(self, x, y, width, height, texture):
21
+ self.x = x
22
+ self.y = y
23
+ self.width = width
24
+ self.height = height
25
+ rect = pygame.Rect(x, y, width, height)
26
+
27
+ return rect
28
+
29
+ def load_texture(self, filename):
30
+ return pygame.image.load(filename)
@@ -0,0 +1,11 @@
1
+ import pygame
2
+
3
+ class Transform():
4
+ def __init__(self):
5
+ pass
6
+
7
+ def scale(self, dest, src):
8
+ return pygame.transform.scale(src, dest)
9
+
10
+ def rotate(self, angle, src):
11
+ return pygame.transform.rotate(src, angle)
File without changes
@@ -0,0 +1,33 @@
1
+ import pygame
2
+
3
+ class Keyboard:
4
+ def __init__(self):
5
+ self.keyses = {
6
+ "W": pygame.K_w,
7
+ "A": pygame.K_a,
8
+ "S": pygame.K_s,
9
+ "D": pygame.K_d,
10
+ "Q": pygame.K_q,
11
+ "E": pygame.K_e,
12
+ "R": pygame.K_r,
13
+ "T": pygame.K_t,
14
+ "U": pygame.K_u,
15
+ "V": pygame.K_v,
16
+ "UP": pygame.K_UP,
17
+ "DOWN": pygame.K_DOWN,
18
+ "LEFT": pygame.K_LEFT,
19
+ "RIGHT": pygame.K_RIGHT
20
+ }
21
+ self.keys = pygame.key.get_pressed()
22
+
23
+ def is_pressed(self, key) -> bool:
24
+ self.keys = pygame.key.get_pressed()
25
+ if not self.keys[self.keyses.get(key)]:
26
+ return False
27
+ return self.keys[self.keyses[key]]
28
+
29
+ def update(self):
30
+ pass
31
+
32
+ def get_pressed(self):
33
+ return self.keys
File without changes
File without changes
@@ -0,0 +1,18 @@
1
+ Metadata-Version: 2.5
2
+ Name: libGML
3
+ Version: 0.1.0
4
+ Summary: A lightweight game library built on Pygame
5
+ Project-URL: Homepage, https://github.com/ImPulseStory/libGML
6
+ Author-email: ImPulseStory <sihiskin9@email.com>
7
+ License: MIT
8
+ License-File: LICENSE
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Topic :: Games/Entertainment
14
+ Requires-Python: >=3.9
15
+ Requires-Dist: pygame>=2.0.0
16
+ Description-Content-Type: text/markdown
17
+
18
+ libGML - Game Making Library - легкая библиотека, которая дает инструменты для таких нудных кусков кода на pygame как коллизии, отрисовка мира, создание и передвижение спрайтов... Это версия 0.1! В текущий момент реализованы: коллизии, отрисвока мира, создание спрайтов(игроков) и более удобная работа с клавиатурой. В будущем я буду поддерживать этот проект всеми силыми, что бы из маленькой коробки с инструментами моя библиотека превратилась во что то большее. Я знаю о таких же обертках над pygame как hooman и viper, но у нас с ними другая философия. Я предлагаю интсрументы и не забираю доступ к pygame, а не пытаюсь все перекинуть на движок, у меня есть где развернуться) Вся документация, пример кода доступны к файле DOCS.md, так же пример кода который вы можете запустить лежит в папке tests скачать библиотеку вы также сможете 20 августа в 11:00 (или раньше или позже) всем до скорого! 0.2 не за горами!
@@ -0,0 +1,16 @@
1
+ libGML/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ libGML/.vscode/settings.json,sha256=KAHA2hI46BruI2K-IWJc_KeJ6pv2EHqJtb5kbixLZdI,48
3
+ libGML/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ libGML/core/vector2.py,sha256=QdGS0Kuv1e8fjS7AuPZOwoXm5KnCMCiyx-gpZQDp3gE,289
5
+ libGML/core/world.py,sha256=6XsNQkNMTQzGDm4Chw_mS3e0Ghca9h9Vcrl-D_jzMt4,2009
6
+ libGML/graphics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ libGML/graphics/sprite.py,sha256=T4zizhUZ3Ob1vjka8fUbAdiqfoLew587QHB4gpXzUlw,700
8
+ libGML/graphics/transform.py,sha256=1gTvbF6NEH3wkuIx_WKydR-vHD9b0ARAFxUqjo1deI0,238
9
+ libGML/input/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
+ libGML/input/keyboard.py,sha256=ifwsITQQm-TBkHQSPcrDJIkb_cL_tiaBsIXPNghrdDo,854
11
+ libGML/physics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
+ libGML/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
+ libgml-0.1.0.dist-info/METADATA,sha256=whqTegOaEiXVIDH_BoRZHOLlgM0s8p4KLg5wCJeUJCQ,2150
14
+ libgml-0.1.0.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
15
+ libgml-0.1.0.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
+ libgml-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.32.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
File without changes