本文整理汇总了C++中Layer::GetLayerMgr方法的典型用法代码示例。如果您正苦于以下问题:C++ Layer::GetLayerMgr方法的具体用法?C++ Layer::GetLayerMgr怎么用?C++ Layer::GetLayerMgr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Layer
的用法示例。
在下文中一共展示了Layer::GetLayerMgr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnPageChanged
void LibraryPanel::OnPageChanged(wxBookCtrlEvent& event)
{
ee::LibraryPanel::OnPageChanged(event);
Layer* curr = static_cast<LibraryPage*>(GetCurrPage())->GetLayer();
ee::ChangeLayerMgrSJ::Instance()->Change(curr->GetLayerMgr());
curr->SetEditable(true);
static_cast<LibraryPage*>(m_pages[event.GetSelection()])->UpdateStatusFromLayer();
Refresh();
}
示例2: Load
void FileIO::Load(const char* filename, LibraryPanel* library,
StagePanel* stage, ee::GroupTreePanel* grouptree)
{
// ee::SymbolMgr::Instance()->Clear();
Json::Value value;
Json::Reader reader;
std::locale::global(std::locale(""));
std::ifstream fin(filename);
std::locale::global(std::locale("C"));
reader.parse(fin, value);
fin.close();
SettingCfg* cfg = SettingCfg::Instance();
std::string dir = ee::FileHelper::GetFileDir(filename);
// settings
if (!value["settings"].isNull()) {
cfg->m_terrain2d_anim = value["settings"]["terrain2d"].asBool();
}
// size
cfg->m_map_width = value["size"]["width"].asInt();
cfg->m_map_height = value["size"]["height"].asInt();
if (value["size"]["view width"].isNull()) {
cfg->m_view_width = cfg->m_map_width;
cfg->m_view_height = cfg->m_map_height;
} else {
cfg->m_view_dx = value["size"]["view offset x"].asInt();
cfg->m_view_dy = value["size"]["view offset y"].asInt();
cfg->m_view_width = value["size"]["view width"].asInt();
cfg->m_view_height = value["size"]["view height"].asInt();
}
stage->BuildGrids(cfg->m_map_width, cfg->m_map_height);
// camera
auto canvas = std::dynamic_pointer_cast<ee::CameraCanvas>(stage->GetCanvas());
if (canvas->GetCamera()->Type() == s2::CAM_ORTHO2D)
{
auto cam = std::dynamic_pointer_cast<s2::OrthoCamera>(canvas->GetCamera());
float s = value["camera"]["scale"].asDouble();
float x = value["camera"]["x"].asDouble(),
y = value["camera"]["y"].asDouble();
cam->Set(sm::vec2(x, y), s);
}
// screen
if (!value["screen"]["multi_col"].isNull()) {
std::string str = value["screen"]["multi_col"].asString();
stage->GetScreenMultiColor() = gum::str2color(str, s2s::RGBA);
}
if (!value["screen"]["add_col"].isNull()) {
std::string str = value["screen"]["add_col"].asString();
pt2::Color col = gum::str2color(str, s2s::RGBA);
col.a = 0;
stage->GetScreenAddColor() = col;
}
if (!value["screen"]["post effect"].isNull()) {
std::string filepath = value["screen"]["post effect"].asString();
filepath = ee::FileHelper::GetAbsolutePath(dir, filepath);
sl::ColGradingProg* prog = NULL;
sl::ShaderMgr* mgr = sl::ShaderMgr::Instance();
sl::FilterShader* shader = static_cast<sl::FilterShader*>(mgr->GetShader(sl::FILTER));
if (shader) {
prog = static_cast<sl::ColGradingProg*>(shader->GetProgram(sl::FM_COL_GRADING));
}
if (prog)
{
gum::Config* cfg = gum::Config::Instance();
bool ori_alpha_cfg = cfg->GetPreMulAlpha();
cfg->SetPreMulAlpha(false);
auto img = ee::ImageMgr::Instance()->GetItem(filepath);
cfg->SetPreMulAlpha(ori_alpha_cfg);
if (img) {
SettingCfg::Instance()->m_post_effect_file = filepath;
prog->SetLUTTex(img->GetTexID());
std::dynamic_pointer_cast<StageCanvas>(stage->GetCanvas())->EnableColGrading(true);
}
}
}
// layers
stage->SetResDir(dir);
LoadLayers(value["layer"], stage, library, dir);
// libraries
if (value["library"].isNull()) {
library->LoadSymbolFromLayer();
} else {
library->LoadFromFile(value["library"], dir);
}
library->Refresh();
Layer* layer = static_cast<LibraryPage*>(library->GetCurrPage())->GetLayer();
ee::ChangeLayerMgrSJ::Instance()->Change(layer->GetLayerMgr());
}