Skip to content

Commit

Permalink
Only draw navtunnel corners at full brightness so it's less distracting
Browse files Browse the repository at this point in the history
  • Loading branch information
kko committed Mar 31, 2012
1 parent 33ee7eb commit e2942a9
Showing 1 changed file with 29 additions and 12 deletions.
41 changes: 29 additions & 12 deletions src/WorldView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1619,6 +1619,7 @@ Widget(), m_worldview(worldview)
void NavTunnelWidget::Draw() {
Body *navtarget = Pi::player->GetNavTarget();
if (navtarget != NULL) {
m_worldview->m_renderer->SetBlendMode(Graphics::BLEND_ALPHA);
const Color green = Color(0.f, 1.f, 0.f, 0.8f);

vector2f indvec = vector2f(m_worldview->m_navTargetIndicator.pos[0], m_worldview->m_navTargetIndicator.pos[1]);
Expand Down Expand Up @@ -1705,23 +1706,39 @@ void NavTunnelWidget::Draw() {
i++;
}
}
m_worldview->m_renderer->SetBlendMode(Graphics::BLEND_SOLID);
}
}

void NavTunnelWidget::DrawTargetGuideSquare(const float pos[2], const float size, const Color &c)
{
const float x1 = float(pos[0] - size);
const float x2 = float(pos[0] + size);
const float y1 = float(pos[1] - size);
const float y2 = float(pos[1] + size);

const vector2f vts[] = {
vector2f(x1, y1),
vector2f(x2, y1),
vector2f(x2, y2),
vector2f(x1, y2)
};
m_worldview->m_renderer->DrawLines2D(4, vts, c, Graphics::LINE_LOOP);
const float x1 = float(pos[0] - size);
const float x2 = float(pos[0] + size);
const float y1 = float(pos[1] - size);
const float y2 = float(pos[1] + size);

const vector3f vts[] = {
vector3f(x1, y1, 0.f),
vector3f(pos[0], y1, 0.f),
vector3f(x2, y1, 0.f),
vector3f(x2, pos[1], 0.f),
vector3f(x2, y2, 0.f),
vector3f(pos[0], y2, 0.f),
vector3f(x1, y2, 0.f),
vector3f(x1, pos[1], 0.f)
};
const Color black(0.f);
const Color col[] = {
c,
black,
c,
black,
c,
black,
c,
black
};
m_worldview->m_renderer->DrawLines(8, vts, col, Graphics::LINE_LOOP);
}

void NavTunnelWidget::GetSizeRequested(float size[2]) {
Expand Down

0 comments on commit e2942a9

Please sign in to comment.