fix render mouselook
This commit is contained in:
parent
15075e33af
commit
965a76000b
6
Gui.cpp
6
Gui.cpp
@ -124,7 +124,9 @@ void Gui::message(const TCOD_ColorRGB& col, const char* text, ...) {
|
|||||||
} while (lineEnd);
|
} while (lineEnd);
|
||||||
}
|
}
|
||||||
void Gui::renderMouseLook() {
|
void Gui::renderMouseLook() {
|
||||||
if (!engine->map->isInFov(engine->mouse.cx, engine->mouse.cy)) {
|
int offset_x = engine->player->x - Engine::VIEW_WIDTH / 2;
|
||||||
|
int offset_y = engine->player->y - Engine::VIEW_HEIGHT / 2;
|
||||||
|
if (!engine->map->isInFov(engine->mouse.cx + offset_x, engine->mouse.cy + offset_y)) {
|
||||||
// if mouse is out of fov, nothing to render
|
// if mouse is out of fov, nothing to render
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -134,7 +136,7 @@ void Gui::renderMouseLook() {
|
|||||||
for (Actor** it = engine->actors.begin(); it != engine->actors.end(); it++) {
|
for (Actor** it = engine->actors.begin(); it != engine->actors.end(); it++) {
|
||||||
Actor* actor = *it;
|
Actor* actor = *it;
|
||||||
// find actors under the mouse cursor
|
// find actors under the mouse cursor
|
||||||
if (actor->x == engine->mouse.cx && actor->y == engine->mouse.cy) {
|
if (actor->x == engine->mouse.cx + offset_x && actor->y == engine->mouse.cy + offset_y) {
|
||||||
if (!first) {
|
if (!first) {
|
||||||
ss << ", ";
|
ss << ", ";
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user