void QuadTree::draw(Core::Engine& engine){ glm::vec4 farbe(0,0,0,0); if(level_ == 0){ farbe = glm::vec4(0,0,0,1); } else if(level_ == 1){ farbe = glm::vec4(0,0,255,1); } else if(level_ == 2){ farbe = glm::vec4(255,0,0,1); } else if(level_ == 3){ farbe = glm::vec4(0,255,0,1); } else if(level_ == 4){ farbe = glm::vec4(255,255,0,1); } if(nodes_.size() > 0){ for(int i = 0; i < nodes_.size(); ++i){ nodes_.at(i)->draw(engine); } } engine.renderSystem().renderPrimitive(EL_STROKE_QUAD, glm::vec2(bounds_.x, bounds_.y), glm::vec2(bounds_.w, bounds_.h), farbe, 0); for(int i = 0; i < collisionBoxes_.size(); ++i){ CollisionBox *cb = collisionBoxes_.at(i); Util::Struct::FloatRect bounds = cb->bounds(); engine.renderSystem().renderPrimitive(EL_STROKE_QUAD, glm::vec2(cb->parent().parent().pos().x + bounds.x, cb->parent().parent().pos().y + bounds.y), glm::vec2(bounds.w, bounds.h), farbe, 0); } }
/** * Determines the color to use for a given flight. * * @param mode the mode of the flight * @param error whether the flight is erroneous * @param towflight whether the flight is a towflight * @param departed whether the flight has departed * @param landed whether the flight has landed * @return the color for the flight as QColor */ QColor flightColor (Flight::Mode mode, bool error, bool towflight, bool departed, bool landed) { // The purpose of this contraption is to be able to verify that each case // has been handled. // The columns contain the respective indirector macros - for the mode // column, one of dontCare, local, coming or leaving; for the boolean // columns one of t (the variable must be true), f (the variable must be // false) or x (the variable is ignored). The first matching condition is // used. // Mode Towflight // Departed // Landed // Erroneous // Color // // Erroneous flights farbe (dontCare, t, x, x, t, lightRed); // Erroneous towflight farbe (dontCare, f, x, x, t, lightRed); // Erroneous flight // Program errors - if a flight has landed, but not departed, the error // flag must be true farbe (leaving , x, f, t, x, magenta ); // Leaving flight farbe (local , x, f, t, x, magenta ); // Local flight // Coming flights farbe (coming, f, x, f, f, lightBlue ); // Flying farbe (coming, f, x, t, f, lightGreen); // Landed farbe (coming, t, x, x, f, magenta ); // Program error - coming towflights are not valid // Leaving flights farbe (leaving, f, f, x, f, lightYellow); // Prepared farbe (leaving, f, t, x, f, lightGreen ); // Leaving (landing is not recorded) farbe (leaving, t, f, x, f, yellow ); // Prepared towflight (cannot happen) farbe (leaving, t, t, x, f, lightGreen ); // Leaving towflight // Local flights farbe (local, f, f, x, f, lightYellow); // nicht gestartet farbe (local, f, t, f, f, lightBlue ); // Flug in der Luft farbe (local, f, t, t, f, lightGreen ); // gelandeter Flug farbe (local, t, f, x, f, yellow ); // nicht gestarteter Schleppflug (gibt es nicht) farbe (local, t, t, f, f, towBlue ); // Schleppflug in der Luft farbe (local, t, t, t, f, lightGreen ); // gelandeter Schleppflug return QColor (255, 255, 255); // Default: weiß }