本文整理汇总了C++中Palette::SetColor方法的典型用法代码示例。如果您正苦于以下问题:C++ Palette::SetColor方法的具体用法?C++ Palette::SetColor怎么用?C++ Palette::SetColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Palette
的用法示例。
在下文中一共展示了Palette::SetColor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Command
Bool PaletteSubDialog::Command(Int32 id,const BaseContainer &msg)
{
GeDynamicArray<Palette> pals;
Palette pal;
Filename fn;
switch (id)
{
case 3:
switch(msg.GetInt32(BFM_ACTION_VALUE)){
case ACTION_NEW:
pal.SetColor(0, Color(0.f, 0.f, 0.f).SetSource(COLOR_SOURCE_DISPLAY));
id = Palette::AddPalette(pal);
m_controlsShown = FALSE;
LoadPalette(id);
SaveSettings();
Palette::UpdateAll();
return TRUE;
case ACTION_LOAD:
if(fn.FileSelect(FILESELECTTYPE_ANYTHING, FILESELECT_LOAD, "Load")){
String s = fn.GetString();
if(Palette::LoadASEFile(s, pal)){
id = Palette::AddPalette(pal);
m_controlsShown = FALSE;
LoadPalette(id);
SaveSettings();
Palette::UpdateAll();
}
}
return TRUE;
case ACTION_SAVE:
if(fn.FileSelect(FILESELECTTYPE_ANYTHING, FILESELECT_SAVE, "Save", "ase")){
String s = fn.GetString();
Palette::SaveASEFile(s, m_palette);
}
return TRUE;
case ACTION_LABEL:
ShowControls(!m_showControls);
return TRUE;
}
if(msg.GetInt32(BFM_ACTION_VALUE) >= ACTION_COUNT){
m_controlsShown = FALSE;
LoadPalette(msg.GetInt32(BFM_ACTION_VALUE)-ACTION_COUNT);
SaveSettings();
}
return TRUE;
case IDC_LAYOUT_DIRECTION:
m_controlsShown = FALSE;
LoadPalette(m_paletteID);
SaveSettings();
break;
case IDC_ROWS:
PaletteLayout();
SaveSettings();
break;
case IDC_LABELCHECKBOX:
GetBool(m_labelCheckArea, m_showLabel);
LoadPalette(m_paletteID);
SaveSettings();
break;
case IDC_NAME:
if(m_nameArea != NULL){
GetString(m_nameArea, m_palette.m_name);
Palette::SetPaletteName(m_paletteID, m_palette.m_name);
LoadPalette(m_paletteID);
}
break;
case IDC_HIDE:
ShowControls(FALSE);
break;
case IDC_SEARCHTEXT:
PaletteLayout();
SaveSettings();
break;
case IDC_CREATEMATERIAL:
{
Bool linkColors;
GetBool(m_linkColor,linkColors);
for(Int32 i=m_palette.m_colors.GetCount()-1;i>=0;--i){
BaseMaterial *mat = BaseMaterial::Alloc(Mmaterial);
String name = "PaletteMaterial";
if(m_palette[i].m_name != ""){
name = m_palette[i].m_name;
}
mat->SetName(name);
if(mat != nullptr){
BaseChannel *chan = mat->GetChannel(CHANNEL_COLOR);
if(chan != nullptr){
BaseContainer bc;
if(linkColors){
bc.SetInt32(BASECHANNEL_SHADERID, PALETTE_SHADER_ID);
chan->SetData(bc);
BaseShader *bs = chan->GetShader();
BaseContainer* data = bs->GetDataInstance();
data->SetInt32(PALETTESHADER_PALETTE_ID, 1+m_paletteID);
data->SetInt32(PALETTESHADER_COLOR_ID, 1+i);
} else {
// Color Shader ID: 5832
bc.SetInt32(BASECHANNEL_SHADERID, 5832);
chan->SetData(bc);
//.........这里部分代码省略.........