]> git.tdb.fi Git - netvis.git/blobdiff - source/host.cpp
Restructure packet handling
[netvis.git] / source / host.cpp
index fca3a304e545d29eefafd8201958020c92b6470e..afa61b71e775a4eaa5ab49c8c87fc799ce5f71b0 100644 (file)
@@ -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+15<name.size() && i>1)
                                break;
                        dot = prev;
@@ -137,8 +137,8 @@ void Host::render() const
        if(!active)
                return;
 
-       GL::PushMatrix push_;
-       GL::translate(static_cast<int>(pos.x), static_cast<int>(pos.y), 0);
+       GL::MatrixStack::Push push_(GL::MatrixStack::modelview());
+       GL::MatrixStack::modelview() *= GL::Matrix::translation(static_cast<int>(pos.x), static_cast<int>(pos.y), 0);
 
        GL::Immediate imm((GL::COLOR4_UBYTE, GL::TEXCOORD2, GL::VERTEX2));
        imm.begin(GL::QUADS);
@@ -150,10 +150,9 @@ void Host::render() const
        imm.end();
 
        const GL::Font &font = netvis.get_font();
-       GL::translate(-static_cast<int>(font.get_string_width(short_name)*5), 6, 0);
-       GL::scale_uniform(10);
+       GL::MatrixStack::modelview() *= GL::Matrix::translation(-static_cast<int>(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();
 }