本文整理汇总了C++中CLayer::GetParticleSelectionColor方法的典型用法代码示例。如果您正苦于以下问题:C++ CLayer::GetParticleSelectionColor方法的具体用法?C++ CLayer::GetParticleSelectionColor怎么用?C++ CLayer::GetParticleSelectionColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CLayer
的用法示例。
在下文中一共展示了CLayer::GetParticleSelectionColor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawLayers
void DrawLayers(HDC hdc, int x, int y, int width, int height, int type)
{
double maxHeight = CSnow::current()->getSnowHeight();
double temperatureRange = 40;//max(abs(bottomTemperature - topTemperature), abs(topTemperature));
if(temperatureRange == 0)temperatureRange = 1;
if (maxHeight == 0)
return;
HBRUSH brush;
int h;
int topT, bottomT;
int rightMargin = 40;
RECT rect;
CLayer *layer;
HPEN pen = CreatePen(0, 1, 0);
//HPEN boldPen = CreatePen(0, 3, 0);
HPEN oldPen = (HPEN)SelectObject(hdc, pen);
HPEN dotPen = CreatePen(PS_DASH, 1, RGB(0,0,0));
LOGFONT lFont;
ZeroMemory(&lFont, sizeof(lFont));
lFont.lfHeight = 16;
lFont.lfWeight = FW_BOLD;
wcscpy_s(lFont.lfFaceName, WINDOW_FONT);
HFONT font = CreateFontIndirect(&lFont);
HFONT oldFont = SelectFont(hdc, font);
SetBkMode(hdc, TRANSPARENT);
int dy = 0;
for (int l = 0; l < CSnow::current()->getLayersNum(); l++) {
layer = CSnow::current()->getLayer(l);
//if (type)h = height*CSnow::current()->getLayer(l)->GetHeight(t)/maxHeight;
//else h = height*CSnow::current()->getLayer(l)->GetDensity(t)/maxHeight;
h = (int)(height*layer->GetHeight()/maxHeight);
if (h == 0)
continue;
//draw layer
brush = CreateSolidBrush((type) ? layer->GetParticleColor() : layer->GetDensityColor());
rect.left = x; rect.right = x + width - rightMargin;
rect.top = y + height - dy - (int)h; rect.bottom = y + height - dy;
FillRect(hdc, &rect, brush);
DeleteObject(brush);
//draw layer temperature
topT = (int)((width - rightMargin)*layer->GetTopTemperature()/temperatureRange);
bottomT = (int)((width - rightMargin)*layer->GetBottomTemperature()/temperatureRange);
SelectObject(hdc, dotPen);
SetBkMode(hdc, OPAQUE);
MoveToEx(hdc, x + width - rightMargin + topT - 1, rect.top, NULL);
LineTo(hdc, x + width - rightMargin + bottomT - 1, rect.bottom);
SetBkMode(hdc, TRANSPARENT);
SelectObject(hdc, pen);
if(layer->GetSelection()) {
HPEN boldPen = CreatePen(0, 3, ((type) ? layer->GetParticleSelectionColor() : 0));
SelectObject(hdc, boldPen);
MoveToEx(hdc, rect.left + 1, rect.top + 1, NULL);
LineTo(hdc, rect.left + 1, rect.bottom - 1);
LineTo(hdc, rect.right - 2, rect.bottom - 1);
LineTo(hdc, rect.right - 2, rect.top + 1);
LineTo(hdc, rect.left + 1, rect.top + 1);
SelectObject(hdc, pen);
DeleteObject(boldPen);
}
MoveToEx(hdc, x + width - rightMargin + 10, rect.top, NULL);
LineTo(hdc, x + width - rightMargin + 10, rect.bottom);
TEXTMETRIC tMetric;
GetTextMetrics(hdc, &tMetric);
if (h > tMetric.tmHeight/2) {
SetTextAlign(hdc, TA_LEFT);
SetTextColor(hdc, 0x0);
TextOut(hdc, x + width - rightMargin + 14, (rect.bottom + rect.top)/2 - tMetric.tmHeight/2, layer->ToString(CLayer::HEIGHT, 4).c_str(), layer->ToString(CLayer::HEIGHT, 4).size());
SetTextAlign(hdc, TA_CENTER);
SetTextColor(hdc, 0xffffff);
TextOut(hdc, (x + width - rightMargin)/2, (rect.bottom + rect.top)/2 - tMetric.tmHeight/2, layer->ToString((type) ? CLayer::PARTICLE : CLayer::DENSITY, 4).c_str(), layer->ToString((type) ? CLayer::PARTICLE : CLayer::DENSITY, 4).size());
}
dy += h;
MoveToEx(hdc, x, y + height - dy, NULL);
LineTo(hdc, x + width - rightMargin + 16, y + height - dy);
//draw grid
MoveToEx(hdc, x, y + height - dy + 3, NULL);
LineTo(hdc, x, y + height - dy - 3);
MoveToEx(hdc, x + (width - rightMargin)/4, y + height - dy + 3, NULL);
LineTo(hdc, x + (width - rightMargin)/4, y + height - dy - 3);
MoveToEx(hdc, x + (width - rightMargin)/2, y + height - dy + 3, NULL);
LineTo(hdc, x + (width - rightMargin)/2, y + height - dy - 3);
MoveToEx(hdc, x + (width - rightMargin)/4*3, y + height - dy +3, NULL);
LineTo(hdc, x + (width - rightMargin)/4*3, y + height - dy - 3);
MoveToEx(hdc, x + (width - rightMargin) - 1, y + height - dy + 3, NULL);
LineTo(hdc, x + (width - rightMargin) - 1, y + height - dy - 3);
//.........这里部分代码省略.........