Here's an updated version of your code that draws the border using 4 lines instead of one box with a transparent color:
let border_thickness = 1.0;
// Draw top border line
white_pixel_batch.push(DrawParam::default()
.scale(mint::Vector2 { x: platform_p.w.floor, y: border_thickness })
.dest(mint::Point2 {
x: (platform_p.x).round,
y: (platform_p.y + border_thickness / 2.0).round,
})
.color([255, 255, 255, 0])); // Set color to transparent white
// Draw bottom border line
white_pixel_batch.push(DrawParam::default()
.scale(mint::Vector2 { x: platform_p.w.floor, y: border_thickness })
.dest(mint::Point2 {
x: (platform_p.x).round,
y: (platform_p.y + platform_p.h.floor - border_thickness / 2.0).round,
})
.color([255, 255, 255, 0])); // Set color to transparent white
// Draw left border line
white_pixel_batch.push(DrawParam::default()
.scale(mint::Vector2 { x: border_thickness, y: platform_p.h.floor })
.dest(mint::Point2 {
x: (platform_p.x + border_thickness / 2.0).round,
y: (platform_p.y).round,
})
.color([255, 255, 255, 0])); // Set color to transparent white
// Draw right border line
white_pixel_batch.push(DrawParam::default()
.scale(mint::Vector2 { x: border_thickness, y: platform_p.h.floor })
.dest(mint::Point2 {
x: (platform_p.x + platform_p.w.floor - border_thickness / 2.0).round,
y: (platform_p.y).round,
})
.color([255, 255, 255, 0])); // Set color to transparent white
// Draw inner box
white_pixel_batch.push(DrawParam::default()
.scale(mint::Point2{
x: platform_p.w.floor - border_thickness*2.0,
y: platform_p.h.floor - border_thickness*2.0
})
.dest(mint::Point2 {
x: (platform_p.x + border_thickness).round,
y: (platform_p.y + border_thickness).round
})
.color(color));
In this updated code, we first draw the top, bottom, left, and right border lines using transparent white color by setting the alpha channel to 0. Then, we draw the inner box with the original color parameter. Note that we use mint::Vector2 instead of mint::Point2 for the scale parameter of the border lines since we only want to scale in one dimension.