]> git.tdb.fi Git - netvis.git/blobdiff - source/netvis.h
Refactor the rendering code
[netvis.git] / source / netvis.h
index 47f5de5bd31e7b05ea80248fe1ae32f32ffa5669..3739d330ec941de08c03c2698a576269bcfa4b7a 100644 (file)
@@ -22,6 +22,7 @@ Distributed unter the GPL
 
 class Host;
 class Packet;
+class Port;
 class Resolver;
 
 class NetVis: public Msp::Application
@@ -41,7 +42,7 @@ private:
        std::map<unsigned, Host *> hosts;
        std::map<unsigned, Host *> disabled_hosts;
        std::list<Packet *> packets;
-       std::map<unsigned, Msp::GL::Color> port_colors;
+       std::map<unsigned, Port *> ports;
        bool draw_labels;
        bool blend;
 
@@ -50,18 +51,19 @@ private:
        unsigned frames;
        float fps;
 
-       Msp::Debug::Profiler profiler;
-
 public:
        NetVis(int, char **);
        ~NetVis();
 
        const Msp::GL::Font &get_font() const { return *font; }
        const std::map<unsigned, Host *> &get_hosts() const { return hosts; }
+       const std::map<unsigned, Port *> &get_ports() const { return ports; }
 private:
        virtual void tick();
+       void render();
        Host &get_host(unsigned);
-       Msp::GL::Color &get_port_color(unsigned);
+       Msp::GL::Color generate_color(bool) const;
+       const Port &get_port(unsigned);
        void key_press(unsigned, unsigned, wchar_t);
 
        static void capture_handler(unsigned char *, const pcap_pkthdr *, const unsigned char *);