Skip to content

Commit 9a4744d

Browse files
README.md updated, shape rendering a bit changed
1 parent d068a5e commit 9a4744d

File tree

2 files changed

+44
-41
lines changed

2 files changed

+44
-41
lines changed

README.md

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,41 @@
1-
# XCoder
2-
Compress / Decompress Brawl Stars SC and CSV files on Windows / Linux / Android!
1+
# XCoder - easy to use modding tool
2+
Multiplatform modding tool for ANY Supercell\`s game.
33

4-
### Credits
5-
This tool is based on Original <a href="https://github.com/MasterDevX/xcoder">XCoder</a>, Developer: <a href="https://github.com/MasterDevX">MasterDevX</a></br>
6-
7-
Many thanks to <a href="https://github.com/spiky-s">spiky_Spike</a> for the provided developments
4+
## About
5+
Work with Supercell\`s files on **any** os! SC and CSV are supported for all Supercell\`s games.
86

97
### Features:
10-
- Easy to use.
11-
- Brawl Stars, Clash games support.
12-
- Multiplatform support (working on Windows, Linux and Android).
13-
- SC compilation / decompilation.
8+
- SC compile / decompile;
9+
- Compression and decompression.
1410

1511
### How to install and use
16-
On Windows:
17-
- Download Python 3.7 or newer version from <a href="https://www.python.org/downloads/">official page</a>.
18-
- Install Python. While Installing, enable such parameters as "Add Python to PATH", "Install pip", "Install py launcher", "Associate files with Python" and "Add Python to environment variables".
19-
- Download XCoder from <a href="https://github.com/Vorono4ka/XCoder/releases">releases page</a> and extract it.
20-
- Install required modules by executing following command: ``` pip install -r requirements.txt```
21-
- Execute "main.py" file
22-
23-
On Linux:
24-
- Download XCoder from <a href="https://github.com/Vorono4ka/XCoder/releases">releases page</a> and extract it.
25-
- Open Terminal and install Python by executing following command:</br>
26-
```sudo apt-get update && sudo apt-get install python3 python3-pip```
27-
- Install required modules:</br>
28-
```sudo pip3 install -r requirements.txt```
29-
- Execute "main.py" file
30-
31-
On Android:
32-
- Download and install PyDroid app from <a href="https://play.google.com/store/apps/details?id=ru.iiec.pydroid3">Google Play</a>.
33-
- Open PyDroid and wait until Python installs.
34-
- Download XCoder from <a href="https://github.com/Vorono4ka/XCoder/releases">releases page</a> and extract it.
35-
- Install loguru using pip
36-
- In PyDroid open and execute "main.py" file
37-
38-
### TODO:
12+
- On Windows:
13+
- Download Python 3.7 or newer version from [official page](https://www.python.org/downloads/);
14+
- Install Python. While Installing, enable such parameters as "Add Python to PATH", "Install pip", "Install py launcher", "Associate files with Python" and "Add Python to environment variables";
15+
- Download XCoder from the [releases page](https://github.com/Vorono4ka/XCoder/releases) and extract it;
16+
- Locate the extracted directory and install required modules:
17+
```pip install -r requirements.txt```;
18+
- Execute "main.py" file.
19+
20+
- On Linux:
21+
- Open Terminal and install Python by executing following command:
22+
```sudo apt-get update && sudo apt-get install python3 python3-pip```;
23+
- Download XCoder from the [releases page](https://github.com/Vorono4ka/XCoder/releases) and extract it;
24+
- Locate the extracted directory and install required modules by executing following command:
25+
```sudo pip3 install -r requirements.txt```;
26+
- Execute "main.py" file.
27+
28+
- On Android:
29+
- Download and install PyDroid app from [Google Play](https://play.google.com/store/apps/details?id=ru.iiec.pydroid3);
30+
- Open PyDroid and wait until Python installs;
31+
- Download XCoder from the [releases page](https://github.com/Vorono4ka/XCoder/releases) and extract it;
32+
- Install loguru using pip;
33+
- In PyDroid open and execute "main.py" file.
34+
35+
### In the plans:
3936
- CSV updating.
37+
38+
## Credits
39+
This tool is based on Original [XCoder](https://github.com/MasterDevX/xcoder), Developer: [MasterDevX](https://github.com/MasterDevX)</br>
40+
41+
Many thanks to [spiky_Spike](https://github.com/spiky-s) for the provided developments

system/lib/objects/shape.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,11 @@ def render(self):
154154
return rendered_region
155155

156156
def get_image(self) -> Image:
157-
img_mask = Image.new('L', (self.texture.width, self.texture.height), 0)
158-
159-
color = 255
160-
ImageDraw.Draw(img_mask).polygon([point.position for point in self._uv_points], fill=color)
161-
162157
left, top, right, bottom = get_sides(self._uv_points)
163158
width, height = get_size(left, top, right, bottom)
164159
width, height = max(width, 1), max(height, 1)
160+
if width + height == 1: # The same speed as without this return
161+
return Image.new('RGBA', (width, height), color=self.texture.image.get_pixel(left, top))
165162

166163
if width == 1:
167164
right += 1
@@ -171,6 +168,10 @@ def get_image(self) -> Image:
171168

172169
bbox = left, top, right, bottom
173170

171+
color = 255
172+
img_mask = Image.new('L', (self.texture.width, self.texture.height), 0)
173+
ImageDraw.Draw(img_mask).polygon([point.position for point in self._uv_points], fill=color)
174+
174175
rendered_region = Image.new('RGBA', (width, height))
175176
rendered_region.paste(self.texture.image.crop(bbox), (0, 0), img_mask.crop(bbox))
176177

@@ -194,16 +195,16 @@ def get_xy(self, index: int):
194195
def get_x(self, index: int):
195196
return self._xy_points[index].x
196197

198+
def get_y(self, index: int):
199+
return self._xy_points[index].y
200+
197201
def get_position(self) -> Tuple[float, float]:
198202
left, top, _, _ = get_sides(self._transformed_points)
199203
return left, top
200204

201205
def get_sides(self) -> Tuple[float, float, float, float]:
202206
return get_sides(self._transformed_points)
203207

204-
def get_y(self, index: int):
205-
return self._xy_points[index].y
206-
207208
def apply_matrix(self, matrix: Matrix2x3 = None) -> None:
208209
"""Applies affine matrix to shape (xy) points. If matrix is none, copies the points.
209210

0 commit comments

Comments
 (0)