Implementing layer visibility, layer view controls.
This commit is contained in:
@@ -176,6 +176,8 @@ public:
|
||||
/// Toggles the level grid.
|
||||
void ToggleGrid();
|
||||
|
||||
int GetLayerIndexFromName(const std::string &name);
|
||||
|
||||
bool Open() override;
|
||||
|
||||
Vector2i GetTilesetCellFromMouse();
|
||||
|
@@ -8,17 +8,22 @@
|
||||
|
||||
#include <Data/Level.hpp>
|
||||
|
||||
using namespace JUI::UDimLiterals;
|
||||
|
||||
class LayerView : public JUI::Window
|
||||
{
|
||||
public:
|
||||
Event<std::string, bool> LayerVisibilityToggled;
|
||||
Event<std::string> ActiveLayerSelected;
|
||||
LayerView() : JUI::Window()
|
||||
{
|
||||
this->Title("Layers");
|
||||
Name("LayerView");
|
||||
|
||||
scroller = new JUI::ScrollingRect(this->Content());
|
||||
scroller->Size({100_percent, 100_percent});
|
||||
|
||||
layout = new JUI::VerticalListLayout(scroller);
|
||||
layout = new JUI::VerticalListLayout(this->Content());
|
||||
|
||||
}
|
||||
explicit LayerView(Widget* parent) : LayerView()
|
||||
@@ -37,12 +42,30 @@ public:
|
||||
for (auto layer : level->layers)
|
||||
{
|
||||
auto* rect = new JUI::Rect(layout);
|
||||
auto* label = new JUI::Text(rect);
|
||||
label->Content(layer->name);
|
||||
rect->Size({100_percent, 20_px});
|
||||
auto* vis_chk = new JUI::Checkbox(rect);
|
||||
vis_chk->Size({20_px, 20_px});
|
||||
auto* label = new JUI::TextButton(rect);
|
||||
label->Name("Label");
|
||||
label->Position({20_px, 0_px});
|
||||
label->Size({100_percent-20_px, 20_px});
|
||||
label->Content(layer->name);
|
||||
label->TextColor(Colors::Black);
|
||||
|
||||
label->OnReleaseEvent += [this, label, layer] (auto a, auto b, auto c) mutable {
|
||||
ActiveLayerSelected.Invoke(layer->name);
|
||||
label->BaseBGColor(Colors::Gray);
|
||||
};
|
||||
|
||||
vis_chk->OnReleaseEvent += [this, layer](auto a, auto b, auto c) mutable {
|
||||
LayerVisibilityToggled.Invoke(layer->name, !layer->visible);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
entry_elements.push_back(rect);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -47,7 +47,8 @@ public:
|
||||
/// The vertical parallax scrolling factor for this layer.
|
||||
float parallax_y;
|
||||
|
||||
bool visible;
|
||||
bool visible = true;
|
||||
int order;
|
||||
float opacity;
|
||||
|
||||
|
||||
@@ -125,5 +126,4 @@ public:
|
||||
|
||||
protected:
|
||||
bool grid_allocated = false;
|
||||
|
||||
};
|
||||
|
@@ -60,7 +60,6 @@ namespace TestGame
|
||||
|
||||
JUI::Scene* scene = nullptr;
|
||||
|
||||
|
||||
Player* player = nullptr;
|
||||
|
||||
bool data_ready = false;
|
||||
|
Reference in New Issue
Block a user