amethyst / amethyst/bracket-lib

Alignment of text vs hollow_box

未关闭
#259 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Rust
星标
1.7k
派生
126
PR 合并指标
30 天内没有已合并 PR

描述

Hello,

Firstly: thank you so much for this library and for your book! I'm having a really fun time learning Rust whilst hacking on a little game idea :)

I've noticed that when drawing text compared to drawing a hollow box using `ctx.draw_hollow_box`, the two do not align up and seem to use different grids - or one is offset on the grid.

In the screenshot below, I've drawn a "T" at (x, y) using `ctx.print(x, y, "T")`. I've then got code that draws a hollow box around the mouse's position:

```
self.map.render(ctx);
let mouse_pos = INPUT.lock().mouse_tile(0);
ctx.set_active_console(2); // separate tile for mouse highlights
ctx.draw_hollow_box(mouse_pos.x, mouse_pos.y, 1, 1, YELLOW, BLACK);
```

I would (perhaps naively) expect here that I could hover over a "T" that's been drawn, and see a yellow box drawn around it, but instead it seems like the boxes are at a different offset:

![Screenshot from 2022-02-15 08-15-22](https://user-images.githubusercontent.com/193238/154021142-ba645215-1a38-48f1-afd5-3cf561e74e33.png)

I think this is probably due to how the cursor is translated into an (x, y) on the grid, but I'm not sure how to resolve or if this is even possible - am I thinking about this in the wrong way?

Thanks again!

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。