e2D 1.3.4__tar.gz → 1.3.5__tar.gz
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.
- {e2D-1.3.4 → e2D-1.3.5}/PKG-INFO +1 -1
- {e2D-1.3.4 → e2D-1.3.5}/e2D/plots.py +15 -13
- {e2D-1.3.4 → e2D-1.3.5}/e2D.egg-info/PKG-INFO +1 -1
- {e2D-1.3.4 → e2D-1.3.5}/setup.cfg +1 -1
- {e2D-1.3.4 → e2D-1.3.5}/LICENSE +0 -0
- {e2D-1.3.4 → e2D-1.3.5}/README.md +0 -0
- {e2D-1.3.4 → e2D-1.3.5}/e2D/__init__.py +0 -0
- {e2D-1.3.4 → e2D-1.3.5}/e2D/envs.py +0 -0
- {e2D-1.3.4 → e2D-1.3.5}/e2D/utils.py +0 -0
- {e2D-1.3.4 → e2D-1.3.5}/e2D.egg-info/SOURCES.txt +0 -0
- {e2D-1.3.4 → e2D-1.3.5}/e2D.egg-info/dependency_links.txt +0 -0
- {e2D-1.3.4 → e2D-1.3.5}/e2D.egg-info/requires.txt +0 -0
- {e2D-1.3.4 → e2D-1.3.5}/e2D.egg-info/top_level.txt +0 -0
- {e2D-1.3.4 → e2D-1.3.5}/pyproject.toml +0 -0
{e2D-1.3.4 → e2D-1.3.5}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: e2D
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.5
|
|
4
4
|
Summary: Python library for 2D games. Streamlines dev with keyboard/mouse input, vector calculations, color manipulation, and collision detection. Simplify game creation and unleash creativity!
|
|
5
5
|
Home-page: https://github.com/marick-py/e2D
|
|
6
6
|
Author: Riccardo Mariani
|
|
@@ -13,6 +13,7 @@ class Function:
|
|
|
13
13
|
self.plot : Plot
|
|
14
14
|
self.color = color
|
|
15
15
|
self.function = function
|
|
16
|
+
self.__layer_surface__ :pg.Surface= None #type: ignore
|
|
16
17
|
|
|
17
18
|
def update_points(self) -> None:
|
|
18
19
|
self.update_function(self.function)
|
|
@@ -82,7 +83,7 @@ class Function:
|
|
|
82
83
|
class __PlotSettings__:
|
|
83
84
|
def __init__(self, plot:Plot) -> None:
|
|
84
85
|
self.plot = plot
|
|
85
|
-
self.settings :dict
|
|
86
|
+
self.settings :dict= {
|
|
86
87
|
"use_real_time_rendering" : True,
|
|
87
88
|
"show_corners_coords" : True,
|
|
88
89
|
|
|
@@ -110,8 +111,9 @@ class __PlotSettings__:
|
|
|
110
111
|
def print_current_settings(self) -> None:
|
|
111
112
|
longest_key = max(map(len, self.settings))
|
|
112
113
|
longest_type = max(map(lambda setting: len(str(type(setting)).split("'")[1]), self.settings.values()))
|
|
114
|
+
split_string = '"'
|
|
113
115
|
for setting in self.settings:
|
|
114
|
-
print(f"{setting}{' '*(longest_key-len(setting))} :{str(type(self.settings[setting])).split(
|
|
116
|
+
print(f"{setting}{' '*(longest_key-len(setting))} :{str(type(self.settings[setting])).split(split_string)[1]}{' '*(longest_type-len(str(type(self.settings[setting])).split(split_string)[1]))}=\t{self.settings[setting]}")
|
|
115
117
|
|
|
116
118
|
def set(self, key:str, new_value) -> None:
|
|
117
119
|
if not (key in self.settings): raise ValueError(f"The key [{key}] does not exist...")
|
|
@@ -124,7 +126,7 @@ class __PlotSettings__:
|
|
|
124
126
|
def get(self, key:str) -> bool|V2|Vector2D|int|float:
|
|
125
127
|
return self.settings[key]
|
|
126
128
|
|
|
127
|
-
def
|
|
129
|
+
def multiple_get(self, keys:list[str]) -> list[bool|V2|Vector2D|int|float]:
|
|
128
130
|
return [self.get(key) for key in keys]
|
|
129
131
|
|
|
130
132
|
class Plot:
|
|
@@ -182,19 +184,19 @@ class Plot:
|
|
|
182
184
|
return (real_position - self.position) * (self.bottom_right_plot_coord - self.top_left_plot_coord) / self.size + self.top_left_plot_coord
|
|
183
185
|
|
|
184
186
|
def render(self) -> None:
|
|
185
|
-
self.canvas.fill(self.settings.get("bg_color"))
|
|
187
|
+
self.canvas.fill(self.settings.get("bg_color")) #type: ignore
|
|
186
188
|
if self.top_left_x < 0 < self.bottom_right_x:
|
|
187
189
|
pg.draw.line(self.canvas,
|
|
188
|
-
self.settings.get("axes_default_color") if (x_color:=self.settings.get("x_axis_color"))==None else x_color,
|
|
190
|
+
self.settings.get("axes_default_color") if (x_color:=self.settings.get("x_axis_color"))==None else x_color, #type: ignore
|
|
189
191
|
self.__plot2real__(V2(0, self.top_left_y))(),
|
|
190
192
|
self.__plot2real__(V2(0, self.bottom_right_y))(),
|
|
191
|
-
self.settings.get("axes_default_width") if (x_width:=self.settings.get("x_axis_width"))==None else x_width)
|
|
193
|
+
self.settings.get("axes_default_width") if (x_width:=self.settings.get("x_axis_width"))==None else x_width) #type: ignore
|
|
192
194
|
if self.bottom_right_y < 0 < self.top_left_y:
|
|
193
195
|
pg.draw.line(self.canvas,
|
|
194
|
-
self.settings.get("axes_default_color") if (y_color:=self.settings.get("y_axis_color"))==None else y_color,
|
|
196
|
+
self.settings.get("axes_default_color") if (y_color:=self.settings.get("y_axis_color"))==None else y_color, #type: ignore
|
|
195
197
|
self.__plot2real__(V2(self.top_left_x, 0))(),
|
|
196
198
|
self.__plot2real__(V2(self.bottom_right_x, 0))(),
|
|
197
|
-
self.settings.get("axes_default_width") if (y_width:=self.settings.get("y_axis_width"))==None else y_width)
|
|
199
|
+
self.settings.get("axes_default_width") if (y_width:=self.settings.get("y_axis_width"))==None else y_width) #type: ignore
|
|
198
200
|
|
|
199
201
|
for function in self.functions: function.draw()
|
|
200
202
|
|
|
@@ -232,7 +234,7 @@ class Plot:
|
|
|
232
234
|
if event.type == pg.MOUSEWHEEL:
|
|
233
235
|
|
|
234
236
|
range_n = self.settings.get("distance_to_axis_for_scalar_zoom")
|
|
235
|
-
scalar = V2(0 if abs(self.plot_center_real_position.x - self.rootEnv.mouse.position.x) < range_n else 1, 0 if abs(self.plot_center_real_position.y - self.rootEnv.mouse.position.y) < range_n else 1)
|
|
237
|
+
scalar = V2(0 if abs(self.plot_center_real_position.x - self.rootEnv.mouse.position.x) < range_n else 1, 0 if abs(self.plot_center_real_position.y - self.rootEnv.mouse.position.y) < range_n else 1) #type: ignore
|
|
236
238
|
self.current_zoom += event.y * scalar
|
|
237
239
|
|
|
238
240
|
self.update_grid(True)
|
|
@@ -259,14 +261,14 @@ class Plot:
|
|
|
259
261
|
def draw(self) -> None:
|
|
260
262
|
self.rootEnv.screen.blit(self.canvas, self.position())
|
|
261
263
|
if self.is_mouse_in_rect and self.settings.get("show_cursor_coords"):
|
|
262
|
-
self.rootEnv.print(str(round(self.plot_mouse_position, .1)), self.rootEnv.mouse.position, fixed_sides=TEXT_FIXED_SIDES_BOTTOM_MIDDLE)
|
|
264
|
+
self.rootEnv.print(str(round(self.plot_mouse_position, .1)), self.rootEnv.mouse.position, fixed_sides=TEXT_FIXED_SIDES_BOTTOM_MIDDLE) #type: ignore
|
|
263
265
|
|
|
264
266
|
data = [
|
|
265
267
|
[f"ZOOM:", TEXT_FIXED_SIDES_TOP_LEFT, self.settings.get("show_zoom_info")],
|
|
266
|
-
[f" x: {self.current_zoom.x:.{self.settings.get(
|
|
267
|
-
[f" y: {self.current_zoom.y:.{self.settings.get(
|
|
268
|
+
[f" x: {self.current_zoom.x:.{self.settings.get('info_precision')}f};", TEXT_FIXED_SIDES_TOP_LEFT, self.settings.get("show_zoom_info")],
|
|
269
|
+
[f" y: {self.current_zoom.y:.{self.settings.get('info_precision')}f};", TEXT_FIXED_SIDES_TOP_LEFT, self.settings.get("show_zoom_info")],
|
|
268
270
|
]
|
|
269
271
|
|
|
270
272
|
for i, (d, fixed_side, show) in enumerate(data):
|
|
271
273
|
if show:
|
|
272
|
-
self.rootEnv.print(d, self.settings.get("top_left_info_position") + self.settings.get("info_spacing") * i, fixed_sides=fixed_side)
|
|
274
|
+
self.rootEnv.print(d, self.settings.get("top_left_info_position") + self.settings.get("info_spacing") * i, fixed_sides=fixed_side) #type: ignore
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: e2D
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.5
|
|
4
4
|
Summary: Python library for 2D games. Streamlines dev with keyboard/mouse input, vector calculations, color manipulation, and collision detection. Simplify game creation and unleash creativity!
|
|
5
5
|
Home-page: https://github.com/marick-py/e2D
|
|
6
6
|
Author: Riccardo Mariani
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[metadata]
|
|
2
2
|
name = e2D
|
|
3
|
-
version = 1.3.
|
|
3
|
+
version = 1.3.5
|
|
4
4
|
author = Riccardo Mariani
|
|
5
5
|
author_email = ricomari2006@gmail.com
|
|
6
6
|
description = Python library for 2D games. Streamlines dev with keyboard/mouse input, vector calculations, color manipulation, and collision detection. Simplify game creation and unleash creativity!
|
{e2D-1.3.4 → e2D-1.3.5}/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|