void
sstSequence::Draw( vsRenderQueue *queue )
{
	vsDisplayList *list = queue->GetGenericList();

	float musicTime = m_mode->GetMusicTime();
//	vsColor baseColor = vsColor::Blue;
//	vsColor c = vsColor::Blue;
	for ( int i = 0; i < m_beatCount; i++ )
		m_segment[i].m_color = vsColor::Blue * GetBrightnessForTimeDelta( musicTime - m_segment[i].m_time );

	float starBrightness = 0.5f;

	float starFadeInTime = 2.0f;
	float starFadeOutTime = 2.0f;

	if ( musicTime < m_start + starFadeInTime )
	{
		starBrightness = vsInterpolate( (musicTime-m_start) / starFadeInTime, 0.f, starBrightness );
	}
	else if ( musicTime < m_end - starFadeOutTime )
	{
		starBrightness = 0.5f;
	}
	else
	{
		float startFadingOutTime = m_end - starFadeOutTime;

		starBrightness = vsInterpolate( (musicTime-startFadingOutTime) / starFadeOutTime, starBrightness, 0.f );
	}

	list->SetColor( vsColor(1.0f, 1.0f, 1.0f, starBrightness) );
	for ( int i = 0; i < m_beatCount; i++ )
	{
		DrawStar( list, i );
	}

	for ( int i = 0; i < m_beatCount; i++ )
	{
		DrawTarget( list, i );

		if ( i < m_beatCount-1 )
		{
			DrawConnectingLine( list, i, i+1 );
		}
	}
}
示例#2
0
static void
DrawIconCell(XmLGridCell cell,
             Widget w,
             int row,
             XRectangle *clipRect,
             XmLGridDrawStruct *ds)
	{
	XmLTreeWidget t;
	XmLTreeRow rowp;
	XmLGridCellRefValues *cellValues;
	XmLGridCellIcon *icon;
	XRectangle *cellRect, rect;
	Display *dpy;
	Window win;
	char *thisLine;
	int i, clipSet, pixWidth, pixHeight;
	int xoff, xoff2, midy, oddFlag, x1, y1, x2, y2;
	Pixmap pixmap, pixmask;

	t = (XmLTreeWidget)w;
	rowp = (XmLTreeRow)XmLGridGetRow(w, XmCONTENT, row);
	dpy = XtDisplay(w);
	win = XtWindow(w);
	cellValues = cell->cell.refValues;
	if (cellValues->type != XmICON_CELL)
		return;
	icon = (XmLGridCellIcon *)cell->cell.value;
	if (!icon)
		return;
	cellRect = ds->cellRect;
	if (!t->tree.linesData)
		{
		XmLWarning(w, "DrawIconCell() - no lines data calculated");
		return;
		}

	/* draw background */
	XSetForeground(dpy, ds->gc, cell->cell.refValues->background);
	XFillRectangle(dpy, win, ds->gc, clipRect->x, clipRect->y,
		clipRect->width, clipRect->height);

	if (t->grid.singleColScrollMode)
		oddFlag = t->grid.singleColScrollPos & 1;
	else
		oddFlag = 0;

	pixWidth = 0;
	xoff = t->tree.levelSpacing;
	xoff2 = xoff * 2;
	y1 = cellRect->y;
	y2 = cellRect->y + cellRect->height - 1;
	midy = cellRect->y + cellRect->height / 2;
	if (midy & 1)
		midy += 1;

	/* draw connecting lines and pixmap */
	XSetForeground(dpy, ds->gc, t->tree.lineColor);
	thisLine = &t->tree.linesData[row * (t->tree.linesMaxLevel + 1)];
	for (i = 0; i <= t->tree.linesMaxLevel; i++)
		{
		x1 = cellRect->x + (xoff2 * i);
		if (x1 >= clipRect->x + (int)clipRect->width)
			continue;
		switch (thisLine[i])
			{
			case 'O':
				rect.x = x1;
				rect.y = cellRect->y;
				rect.width = cellRect->width;
				rect.height = cellRect->height;
				if (icon->pix.pixmap != XmUNSPECIFIED_PIXMAP)
					{
					pixmap = icon->pix.pixmap;
					pixmask = icon->pix.pixmask;
					pixWidth = icon->pix.width;
					pixHeight = icon->pix.height;
					}
				else
					{
					if (!t->tree.defaultPixmapsCreated)
						CreateDefaultPixmaps(t);
					if (rowp->tree.expands && rowp->tree.isExpanded)
						{
						pixmap = t->tree.folderOpenPixmap;
						pixmask = t->tree.folderOpenPixmask;
						}
					else if (rowp->tree.expands)
						{
						pixmap = t->tree.folderPixmap;
						pixmask = t->tree.folderPixmask;
						}
					else
						{
						pixmap = t->tree.filePixmap;
						pixmask = t->tree.filePixmask;
						}
					pixWidth = 16;
					pixHeight = 16;
					}
				XmLPixmapDraw(w, pixmap, pixmask, pixWidth, pixHeight,
					XmALIGNMENT_BOTTOM_LEFT, ds->gc, &rect, clipRect);
				break;
			case 'I':
				DrawConnectingLine(dpy, win, ds->gc, clipRect, oddFlag,
					x1 + xoff, y1, x1 + xoff, y2);
				break;
			case 'E':
				DrawConnectingLine(dpy, win, ds->gc, clipRect, oddFlag,
					x1 + xoff, y1, x1 + xoff, y2);
				DrawConnectingLine(dpy, win, ds->gc, clipRect, oddFlag,
					x1 + xoff, midy, x1 + xoff2, midy);
				break;
			case 'L':
				DrawConnectingLine(dpy, win, ds->gc, clipRect, oddFlag,
					x1 + xoff, y1, x1 + xoff, midy);
				DrawConnectingLine(dpy, win, ds->gc, clipRect, oddFlag,
					x1 + xoff, midy, x1 + xoff2, midy);
				break;
			case 'P':
				DrawConnectingLine(dpy, win, ds->gc, clipRect, oddFlag,
					x1 + xoff, midy, x1 + xoff, y2);
				DrawConnectingLine(dpy, win, ds->gc, clipRect, oddFlag,
					x1 + xoff, midy, x1 + xoff2, midy);
				break;
			case '-':
				DrawConnectingLine(dpy, win, ds->gc, clipRect, oddFlag,
					x1 + xoff, midy, x1 + xoff2, midy);
				break;
			}
		}

	clipSet = 0;

	/* draw expand/collapse graphic */
	rect.x = cellRect->x + (rowp->tree.level - 1) * xoff2 + xoff - 5;
	rect.y = midy - 5;
	rect.width = 11;
	rect.height = 11;
	i = XmLRectIntersect(&rect, clipRect);
	if (rowp->tree.expands && rowp->tree.level && i != XmLRectOutside)
		{
		if (i == XmLRectPartial)
			{
			clipSet = 1;
			XSetClipRectangles(dpy, ds->gc, 0, 0, clipRect, 1, Unsorted);
			}
		x1 = rect.x;
		x2 = rect.x + rect.width - 1;
		y1 = rect.y;
		y2 = rect.y + rect.height - 1;
		XSetForeground(dpy, ds->gc, cellValues->background);
		XFillRectangle(dpy, win, ds->gc, x1, y1, 11, 11);
		XSetForeground(dpy, ds->gc, t->tree.lineColor);
		XDrawLine(dpy, win, ds->gc, x1 + 2, y1 + 1, x2 - 2, y1 + 1);
		XDrawLine(dpy, win, ds->gc, x2 - 1, y1 + 2, x2 - 1, y2 - 2);
		XDrawLine(dpy, win, ds->gc, x1 + 2, y2 - 1, x2 - 2, y2 - 1);
		XDrawLine(dpy, win, ds->gc, x1 + 1, y1 + 2, x1 + 1, y2 - 2);
		XSetForeground(dpy, ds->gc, t->tree.pmColor);
		if (!rowp->tree.isExpanded)
			XDrawLine(dpy, win, ds->gc, x1 + 5, y1 + 3, x1 + 5, y1 + 7);
		XDrawLine(dpy, win, ds->gc, x1 + 3, y1 + 5, x1 + 7, y1 + 5);
		}

	/* draw select background and highlight */
	i = rowp->tree.level * xoff2 + pixWidth + XmLICON_SPACING;
	rect.x = cellRect->x + i;
	rect.y = cellRect->y;
	rect.height = cellRect->height;
	rect.width = 0;
	if (t->grid.colCount == 1 && rowp->tree.stringWidthValid)
		rect.width = rowp->tree.stringWidth + 4;
	else if ((int)cellRect->width > i)
		rect.width = cellRect->width - i;
	i = XmLRectIntersect(&rect, clipRect);
	if (i != XmLRectOutside && ds->drawSelected)
		{
		if (i == XmLRectPartial && !clipSet)
			{
			clipSet = 1;
			XSetClipRectangles(dpy, ds->gc, 0, 0, clipRect, 1, Unsorted);
			}
		XSetForeground(dpy, ds->gc, ds->selectBackground);
		XFillRectangle(dpy, win, ds->gc, rect.x, rect.y,
			rect.width, rect.height);
		}
	if (ds->drawFocusType != XmDRAW_FOCUS_NONE &&
		t->grid.highlightThickness >= 2)
		{
		if (i == XmLRectPartial && !clipSet)
			{
			clipSet = 1;
			XSetClipRectangles(dpy, ds->gc, 0, 0, clipRect, 1, Unsorted);
			}
		XSetForeground(dpy, ds->gc, t->manager.highlight_color);
		x1 = rect.x;
		x2 = rect.x + rect.width - 1;
		y1 = rect.y;
		y2 = rect.y + rect.height - 1;
		XDrawLine(dpy, win, ds->gc, x1, y1, x2, y1);
		if (ds->drawFocusType == XmDRAW_FOCUS_CELL ||
			ds->drawFocusType == XmDRAW_FOCUS_RIGHT)
			XDrawLine(dpy, win, ds->gc, x2, y1, x2, y2);
		XDrawLine(dpy, win, ds->gc, x1, y2, x2, y2);
		XDrawLine(dpy, win, ds->gc, x1, y1, x1, y2);
		y1 += 1;
		y2 -= 1;
		XDrawLine(dpy, win, ds->gc, x1, y2, x2, y2);
		XDrawLine(dpy, win, ds->gc, x1, y1, x2, y1);
		x1 += 1;
		x2 -= 1;
		XDrawLine(dpy, win, ds->gc, x1, y1, x1, y2);
		if (ds->drawFocusType == XmDRAW_FOCUS_CELL ||
			ds->drawFocusType == XmDRAW_FOCUS_RIGHT)
			XDrawLine(dpy, win, ds->gc, x2, y1, x2, y2);
		}

	/* draw string */
	if (icon->string)
		{
		if (ds->drawSelected == True)
			XSetForeground(dpy, ds->gc, ds->selectForeground);
		else
			XSetForeground(dpy, ds->gc, cellValues->foreground);
		XmLStringDraw(w, icon->string, ds->stringDirection,
			cellValues->fontList, XmALIGNMENT_LEFT,
			ds->gc, &rect, clipRect);
		}

	if (clipSet)
		XSetClipMask(dpy, ds->gc, None);
	}