Refactor gallery function to separate class (#14)
* refactor gallery function to separate class * typo and version adaptions * clang-format
This commit is contained in:
committed by
Maximilian Kueffner
parent
d6a08f7db3
commit
a760535b92
+7
-13
@@ -1,27 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
|
||||
#include "AppGLFW.hpp"
|
||||
#include "app/PixelariumGallery.hpp"
|
||||
#include "imgui.h"
|
||||
#include "rendering/RenderImageManager.hpp"
|
||||
#include "resources/resource.hpp"
|
||||
#include "utilities/ILog.hpp"
|
||||
|
||||
namespace pixelarium::ui
|
||||
namespace pixelarium::application
|
||||
{
|
||||
/// @brief Default implementation of AppGLFW.
|
||||
/// This can either be used as is, as an example or as a base class
|
||||
/// providing some defaults for a more custom implementation.
|
||||
class DefaultApp : public application::AppGLFW
|
||||
class DefaultApp : public AppGLFW
|
||||
{
|
||||
public:
|
||||
DefaultApp(const utils::log::ILog& log, pixelarium::resources::ImageResourcePool& pool)
|
||||
: application::AppGLFW(log),
|
||||
pool_(pool),
|
||||
render_manager_(std::make_unique<render::RenderImageManager>(pool, log))
|
||||
: application::AppGLFW(log), pool_(pool), gallery(log, pool)
|
||||
{
|
||||
gallery.SetLoadFunction([&]() -> void { this->LoadImage(); });
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -31,16 +29,12 @@ class DefaultApp : public application::AppGLFW
|
||||
|
||||
private:
|
||||
void LoadImage();
|
||||
void ImageGalleryRender();
|
||||
void RenderImages();
|
||||
|
||||
private:
|
||||
resources::ImageResourcePool& pool_;
|
||||
std::unique_ptr<render::RenderImageManager> render_manager_;
|
||||
bool image_listp_{true};
|
||||
bool auto_show_selectd_image_{true};
|
||||
bool demop_{false};
|
||||
ImVec2 curr_dim_;
|
||||
size_t selected_image_{0};
|
||||
application::PixelariumImageGallery gallery;
|
||||
};
|
||||
} // namespace pixelarium::ui
|
||||
} // namespace pixelarium::application
|
||||
|
||||
Reference in New Issue
Block a user