e2D 1.4.18__tar.gz → 1.4.19__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.
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 Riko Mari
3
+ Copyright (c) 2025 Riccardo Mariani
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: e2D
3
- Version: 1.4.18
3
+ Version: 1.4.19
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
@@ -17,7 +17,7 @@ class Vector2D:
17
17
  self.x = x
18
18
  self.y = y
19
19
 
20
- def distance_to(self, other, rooted=True) -> float:
20
+ def distance_to(self, other, rooted=True) -> int|float:
21
21
  d = (self.x - other.x)**2 + (self.y - other.y)**2
22
22
  return d**(1/2) if rooted else d
23
23
 
@@ -71,7 +71,7 @@ class Vector2D:
71
71
  return self.__round__(n)
72
72
 
73
73
  @classmethod
74
- def randomize(cls, start, end) -> "Vector2D":
74
+ def randomize(cls, start, end, func=lambda val:val) -> "Vector2D":
75
75
  if not isinstance(start, Vector2D):
76
76
  if isinstance(start, (int, float)):
77
77
  start = Vector2D(start, start)
@@ -82,7 +82,7 @@ class Vector2D:
82
82
  end = Vector2D(end, end)
83
83
  else:
84
84
  raise Exception(f"\nArg end must be in [Vector2D, int, float, tuple, list] not a [{type(end)}]\n")
85
- return start + Vector2D(_rnd.random(), _rnd.random()) * (end - start)
85
+ return start + Vector2D(func(_rnd.random()), func(_rnd.random())) * (end - start)
86
86
 
87
87
  def dot_product(self, other) -> float:
88
88
  return self.x * other.x + self.y * other.y
@@ -39,7 +39,7 @@ class Vector2D:
39
39
  self.x : int|float
40
40
  self.y : int|float
41
41
 
42
- def distance_to(self:"Vector2D", other:"Vector2D", rooted:bool=True) -> float:
42
+ def distance_to(self:"Vector2D", other:"Vector2D", rooted:bool=True) -> int|float:
43
43
  """
44
44
  # Calculate the distance between the current Vector2D other and another other.
45
45
 
@@ -264,7 +264,7 @@ class Vector2D:
264
264
  ...
265
265
 
266
266
  @classmethod
267
- def randomize(cls, start:"int|float|Vector2D", end:"int|float|Vector2D") -> "Vector2D":
267
+ def randomize(cls, start:"int|float|Vector2D", end:"int|float|Vector2D", func:Callable[[int|float], int|float]=lambda val:val) -> "Vector2D":
268
268
  """
269
269
  # Generate a random Vector2D point within the specified range.
270
270
 
@@ -76,7 +76,7 @@ class RootEnv:
76
76
 
77
77
  @property
78
78
  def delta(self) -> int:
79
- return self.clock.get_time()
79
+ return self.clock.get_time() / 1000
80
80
 
81
81
  def get_teoric_max_fps(self) -> float:
82
82
  rawdelta = self.clock.get_rawtime()
@@ -123,11 +123,11 @@ class RootEnv:
123
123
  def print(self,
124
124
  text : str,
125
125
  position : Vector2D,
126
- color : pg.Color = WHITE_COLOR_PYG,
126
+ color : pg.color.Color = WHITE_COLOR_PYG,
127
127
  pivot_position : __LITERAL_PIVOT_POSITIONS__ = "top_left",
128
128
  font : pg.font.Font = FONT_ARIAL_32,
129
- bg_color : None|pg.Color = None,
130
- border_color : pg.Color = WHITE_COLOR_PYG,
129
+ bg_color : None|pg.color.Color = None,
130
+ border_color : pg.color.Color = WHITE_COLOR_PYG,
131
131
  border_width : float = 0.0,
132
132
  border_radius : int|list[int]|tuple[int,int,int,int] = -1,
133
133
  margin : Vector2D = Vector2D.zero(),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: e2D
3
- Version: 1.4.18
3
+ Version: 1.4.19
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.4.18
3
+ version = 1.4.19
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!
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