Пример #1
0
//______________________________________________
qreal TabBarData::opacity( const QPoint& position ) const {

      if ( !enabled() ) return OpacityInvalid;

      const QTabBar* local( qobject_cast<const QTabBar*>( target().data() ) );
      if ( !local ) return OpacityInvalid;

      int index( local->tabAt( position ) );
      if ( index < 0 ) return OpacityInvalid;
      else if ( index == currentIndex() ) return currentOpacity();
      else if ( index == previousIndex() ) return previousOpacity();
      else return OpacityInvalid;

      }
Пример #2
0
void X_Drawer(int pnum)
{
#define XHAIR_LINE_WIDTH    1.f

    player_t* player = players + pnum;
    int xhair = MINMAX_OF(0, cfg.xhair, NUM_XHAIRS);
    float scale, oldLineWidth, color[4];
    Point2Rawf origin;
    RectRaw win;

    if(pnum < 0 || pnum >= MAXPLAYERS) return;

    // Is there a crosshair to draw?
    if(xhair == 0) return;

    color[CA] = currentOpacity(player);
    if(!(color[CA] > 0)) return;

    R_ViewWindowGeometry(pnum, &win);
    origin.x = win.origin.x + (win.size.width  / 2);
    origin.y = win.origin.y + (win.size.height / 2);
    scale = .125f + MINMAX_OF(0, cfg.xhairSize, 1) * .125f * win.size.height * ((float)80/SCREENHEIGHT);

    oldLineWidth = DGL_GetFloat(DGL_LINE_WIDTH);
    DGL_SetFloat(DGL_LINE_WIDTH, XHAIR_LINE_WIDTH);

    currentColor(player, color);
    DGL_Color4fv(color);

    GL_DrawSvg3(VG_XHAIR1 + (xhair-1), &origin, scale, MINMAX_OF(0.f, cfg.xhairAngle, 1.f) * 360);

    // Restore the previous state.
    DGL_SetFloat(DGL_LINE_WIDTH, oldLineWidth);

#undef XHAIR_LINE_WIDTH
}