Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mMenuUI->AddMenu("File");
- mMenuUI->AddMenuItem(0, "Open",
- [&]() -> void
- {
- std::string filename;
- bool open = Engine::FileDialog::Show(mSctex->mLog, "Open Image", "Image Files\0*.jpg;*.jpeg;*.png;*.bmp;*.tga;*.dds;*.tif;*.gif;*.sctex\0All Files\0*.*\0", Engine::FileDialog::Type::OPEN_FILE_DIALOG, filename);
- if (open)
- {
- mSctex->mTextureFilename = filename;
- mSctex->mLoadTexture = true;
- // Reset miplevel, view and exposure when loading a new image
- mSctex->mCurrentMiplevel = 0.0f;
- mSctex->mTransform = Engine::mat3();
- mSctex->mExposure = 1.0f;
- }
- });
- mMenuUI->AddMenuItem(0, "Save",
- [&]() -> void
- {
- std::string filename;
- bool save = Engine::FileDialog::Show(mSctex->mLog, "Save Compressed Image", "Skye Cuillin Texture\0*.sctex\0All Files\0*.*\0", Engine::FileDialog::Type::SAVE_FILE_DIALOG, filename);
- if (save)
- {
- Engine::LoaderSctex* sctexLoader = new Engine::LoaderSctex(mSctex->mLog);
- std::vector<Engine::LoaderSctex::Image> data;
- for (size_t i = 0; i < mSctex->mCompressedLevels; i++)
- {
- Engine::LoaderSctex::Image image;
- image.mWidth = mSctex->mCompressedWidth[i];
- image.mHeight = mSctex->mCompressedHeight[i];
- image.mData = mSctex->mCompressedData[i];
- data.push_back(image);
- }
- sctexLoader->Save(filename, mSctex->mCompressedFormat, data);
- delete sctexLoader;
- }
- });
- mMenuUI->AddMenuItem(0, "Exit",
- [&]() -> void
- {
- Engine::EventChannel chan(mEventSystem);
- chan.Broadcast(Engine::Scheduler::StopEvent());
- });
- mMenuUI->AddMenu("Edit");
- mMenuUI->AddMenuItem(1, "Compress", [&]() -> void { mCompressDialogUI->Show(); });
- mMenuUI->AddMenu("View");
- mMenuUI->AddMenuItem(2, "Mip Level Up", [&]() -> void { mSctex->MipLevelUp(); });
- mMenuUI->AddMenuItem(2, "Mip Level Down", [&]() -> void { mSctex->MipLevelDown(); });
- mMenuUI->AddMenuItem(2, "Reset View", [&]() -> void { mSctex->mTransform = Engine::mat3(); });
- mMenuUI->AddMenuItem(2, "Reset Exposure", [&]() -> void { mSctex->mExposure = 1.0f; });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement