rename engine to src
This commit is contained in:
63
src/node_panel_layer.h
Normal file
63
src/node_panel_layer.h
Normal file
@@ -0,0 +1,63 @@
|
||||
#pragma once
|
||||
#include "node_border.h"
|
||||
#include "node_text.h"
|
||||
#include "node_checkbox.h"
|
||||
#include "node_slider.h"
|
||||
#include "node_button_custom.h"
|
||||
|
||||
class NodeLayer : public NodeBorder
|
||||
{
|
||||
public:
|
||||
std::function<void(NodeLayer* target)> on_selected;
|
||||
std::function<void(NodeLayer* target, float opacity)> on_opacity_changed;
|
||||
std::function<void(NodeLayer* target, bool visible)> on_visibility_changed;
|
||||
std::function<void(NodeLayer* target, bool highlight)> on_highlight;
|
||||
bool m_selected = false;
|
||||
glm::vec4 m_color_normal = glm::vec4(.4, .4, .4, 1);
|
||||
glm::vec4 m_color_selected = glm::vec4(.3, .3, .3, 1);
|
||||
glm::vec4 m_color_hover = glm::vec4(.5, .5, .5, 1);
|
||||
std::string m_label_text;
|
||||
NodeText* m_label;
|
||||
NodeCheckBox* m_visibility;
|
||||
NodeSliderH* m_opacity;
|
||||
virtual Node* clone_instantiate() const override;
|
||||
virtual void clone_children(Node* dest) const override;
|
||||
virtual void clone_copy(Node* dest) const override;
|
||||
virtual void init() override;
|
||||
virtual void parse_attributes(kAttribute ka, const tinyxml2::XMLAttribute* attr) override;
|
||||
virtual void loaded() override;
|
||||
virtual kEventResult handle_event(Event* e) override;
|
||||
virtual void draw() override;
|
||||
void set_name(const char* s);
|
||||
};
|
||||
|
||||
class NodePanelLayer : public Node
|
||||
{
|
||||
NodeButtonCustom* btn_add;
|
||||
NodeButtonCustom* btn_remove;
|
||||
NodeButtonCustom* btn_up;
|
||||
NodeButtonCustom* btn_down;
|
||||
int id_counter = 0;
|
||||
public:
|
||||
std::function<void(Node* target, int old_idx, int new_idx)> on_layer_change;
|
||||
std::function<void(Node* target, int idx, float value)> on_layer_opacity_changed;
|
||||
std::function<void(Node* target, int idx, bool visible)> on_layer_visibility_changed;
|
||||
std::function<void(Node* target, int idx, bool highlight)> on_layer_highlight_changed;
|
||||
std::function<void(Node* target, int index)> on_layer_delete;
|
||||
std::function<void(Node* target)> on_layer_add;
|
||||
std::function<void(Node* target, int old_idx, int new_idx)> on_layer_order;
|
||||
NodeLayer* m_current_layer = nullptr;
|
||||
std::vector<NodeLayer*> m_layers;
|
||||
NodeBorder* m_layers_container;
|
||||
virtual Node* clone_instantiate() const override;
|
||||
virtual void init() override;
|
||||
void add_layer();
|
||||
void add_layer(const char* name);
|
||||
NodeLayer* get_layer_at(int index);
|
||||
void remove_layer(NodeLayer* layer);
|
||||
void handle_layer_opacity(NodeLayer* target, float value);
|
||||
void handle_layer_visibility(NodeLayer* target, bool visible);
|
||||
void handle_layer_highlight(NodeLayer* target, bool highlight);
|
||||
void handle_layer_selected(NodeLayer* target);
|
||||
void clear();
|
||||
};
|
||||
Reference in New Issue
Block a user