Repository navigation
Fix controller inventory background, remove stone background for MKB - #49
leduythuccs wants to merge 5 commits into
Conversation
Controller inventory backgrounds are centered in the panel, so sprite coordinates differ from panel coordinates. Offset the copied frames accordingly, include their borders, and draw the belt frames. The game draws its own panel behind the controller inventory, so keep the expanded background transparent instead of filling it with stone, which covered the top menu. Center the equipment, grid and belt row in the panel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace background of MKB with controller mainpanelbg.sprite, scaled with panel size
|
|
||
| const auto gridOffset = Point{ ((cellCountXmax - cellCountX) / 2) * cellWidth, ((cellCountYmax - cellCountY) / 2) * cellHeight }; | ||
| const auto widgetsOffset = Point{ 100, 0 }; | ||
| const auto gridOffset = Point{ (cellCountXmax - cellCountX) * cellWidth / 2, (cellCountYmax - cellCountY) * cellHeight / 2 }; |
There was a problem hiding this comment.
the old formula is off by half a cell if the different is odd number. Is it intended?
I fixed it so the grid center correctly
There was a problem hiding this comment.
Hmm I was trying to move grid in "discrete" steps, so for odd it does not jumping. it is not off, so yes it is intended. So we don't have half-cell distance from left-border when we have max-1 width, just padding on a right.
There is 0 reason to do so, though. Probably better with your suggestin.
| } | ||
| } | ||
|
|
||
| void Bitmap::drawScaled(Rect destRect, const Bitmap& src, Rect srcRect) |
There was a problem hiding this comment.
No, this is something we should avoid, all stuff in json have like "scale: 1.2" and stuff, so at least no rescaling, I wish we can remove blender later, but rescaled is suspicios
There was a problem hiding this comment.
gotcha. Let me think of another way to fix it. Originally I use draw, then realized, for some reasons, the MKB panel is actually larger than the cropped controller panel.
There was a problem hiding this comment.
he MKB panel is actually larger than the cropped controller panel.
yeah, tile still should work. At worst we can resort and mirror and copy (flip image vertically) to not see horizontal tile repeat. but vertical tiling must be possible seamless with this texture.
| } else { | ||
| Rect stoneRect = s_panelBgStoneRect; | ||
| stoneRect /= downscale; | ||
| bmp.drawScaled({ .topLeft = {}, .size = newSize }, desc.lowres ? panelBgLowend : panelBgHighre, stoneRect); |
There was a problem hiding this comment.
You stretching panelBg? that does no feel right... Especially with shittiest 2x2 linear interpolation AI did.
I think we can safely tile with background. It repeats itself if you look ar backround itself, it is periodic at least horizontally. (around 80% of width start repeating pattern).
so make a cut and the tileWith like it was with stone
| if (bd.rect.size.width > 0) { | ||
| const int margin = desc.controller ? s_ctrlFrameMargin : 10; // extra borders | ||
| bd.rect.expand(margin); | ||
| bd.moveTo -= Point{ margin, margin }; |
There was a problem hiding this comment.
+= -margin, -margin
and remove -= overload please.
Maybe it's me but it is confusing to deal with -= (displacement) especialy when displacement can be negative (i was thinking removing += and add move/displace instead). as in mathematical sense you can't add two points, you can apply displacement vector to a point. current += already a dirty code for convenience.
(same for another -= you added)
|
|
||
| const auto gridOffset = Point{ ((cellCountXmax - cellCountX) / 2) * cellWidth, ((cellCountYmax - cellCountY) / 2) * cellHeight }; | ||
| const auto widgetsOffset = Point{ 100, 0 }; | ||
| const auto gridOffset = Point{ (cellCountXmax - cellCountX) * cellWidth / 2, (cellCountYmax - cellCountY) * cellHeight / 2 }; |
There was a problem hiding this comment.
Hmm I was trying to move grid in "discrete" steps, so for odd it does not jumping. it is not off, so yes it is intended. So we don't have half-cell distance from left-border when we have max-1 width, just padding on a right.
There is 0 reason to do so, though. Probably better with your suggestin.
|
I am adding you as collaborator, so it will be easier to patch (no need to fork, pull og commits its, just make MR any time and merge). won't grant you direct push to master :D |
Fixes #46
Most of the hardcoded number is generated by claude code,
Controller layout
(maxCols - cols) * cellWidth / 2offsetdrawBlendedto respect the transparent backgroundRemove stone background for MKB
controller/panel/mainpanelbg.sprite(plus its.lowendversion)drawScaledis needed because MKB panel is larger than the controller panelResult
8x12 layout