X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fhost.cpp;h=afa61b71e775a4eaa5ab49c8c87fc799ce5f71b0;hb=cb4b88367edde2829e40015f0bc02d653db2a6a8;hp=c18f117ba11d3dc360328ad0eb539c3d4e8939ed;hpb=cc29ebb178d4695573f10a829534cb660e14e79d;p=netvis.git diff --git a/source/host.cpp b/source/host.cpp index c18f117..afa61b7 100644 --- a/source/host.cpp +++ b/source/host.cpp @@ -38,15 +38,15 @@ void Host::set_name(const string &n) if(local) { - unsigned dot = name.find('.'); + string::size_type dot = name.find('.'); short_name = name.substr(0, dot); } else { - unsigned dot = name.size(); + string::size_type dot = name.size(); for(unsigned i=0; (dot>0 && dot!=string::npos); ++i) { - unsigned prev = name.rfind('.', dot-1); + string::size_type prev = name.rfind('.', dot-1); if(prev+151) break; dot = prev; @@ -100,8 +100,9 @@ void Host::tick(const Msp::Time::TimeDelta &td) return; const map &hosts = netvis.get_hosts(); - float fx = -pos.x*0.1; - float fy = -pos.y*0.1; + float center_force = (local ? 0.5 : 0.1); + float fx = -pos.x*center_force; + float fy = -pos.y*center_force; for(map::const_iterator i=hosts.begin(); i!=hosts.end(); ++i) { if(i->second!=this) @@ -136,8 +137,8 @@ void Host::render() const if(!active) return; - GL::PushMatrix push_; - GL::translate(static_cast(pos.x), static_cast(pos.y), 0); + GL::MatrixStack::Push push_(GL::MatrixStack::modelview()); + GL::MatrixStack::modelview() *= GL::Matrix::translation(static_cast(pos.x), static_cast(pos.y), 0); GL::Immediate imm((GL::COLOR4_UBYTE, GL::TEXCOORD2, GL::VERTEX2)); imm.begin(GL::QUADS); @@ -149,10 +150,9 @@ void Host::render() const imm.end(); const GL::Font &font = netvis.get_font(); - GL::translate(-static_cast(font.get_string_width(short_name)*5), 6, 0); - GL::scale_uniform(10); + GL::MatrixStack::modelview() *= GL::Matrix::translation(-static_cast(font.get_string_width(short_name)*5), 6, 0); + GL::MatrixStack::modelview() *= GL::Matrix::scaling(10); - imm.color(1.0f, 1.0f, 1.0f); - font.draw_string(short_name, imm); + font.draw_string(short_name); GL::Texture::unbind(); }