olijeffers0n / rustplus

Rust+ API Wrapper Written in Python for the Game: Rust
https://rplus.ollieee.xyz/
MIT License
102 stars 28 forks source link

Added grid generation #66

Closed Shurik244 closed 3 months ago

olijeffers0n commented 3 months ago

Please Run Black :)

Shurik244 commented 3 months ago

I decided to keep it simple, PermanentMarker, doesn't have unique fonts (As far as I understand), so if no font is specified, the default Pillow font will be automatically loaded

In the future it will be possible to leave the user the choice of which font to use

Why there are problems in the corner, I do not know, alas so generated grid, perhaps because the program can not use the entire canvas for the grid

Grid = 146 Map = 4250 (I tested on it)

And that's why I had to make an offset of 5 pixels down and to the right, then the grid is as close as possible to what we see in the game

UPD: I figured I'd do the math and figure it out myself.

So if we have the size of 1 square 146. And the size of the map, let's say 4250.

In this case to find out how many squares will be along the map we must divide the size of the map by the size of the square.

4250 / 146 = 29.1095890411 Unless this number is even, we cannot fill the entire canvas

I'm not a mathematician, I could be wrong somewhere.

Shurik244 commented 3 months ago

Spent some time, works on Windows 10/Ubuntu/ArchLinux