implement tip popup tip selection and change default brush color to black

This commit is contained in:
2019-01-16 16:10:19 +01:00
parent 3d7b7107d4
commit 7eac018ae4
8 changed files with 105 additions and 25 deletions

View File

@@ -62,6 +62,7 @@ void NodePanelBrush::init()
brush->loaded();
brush->set_icon(path.c_str());
brush->m_brushID = count++;
brush->thumb_path = path;
brush->high_path = path_hi;
brush->brush_name = i;
brush->high_id = const_hash(path_hi.c_str());
@@ -71,6 +72,24 @@ void NodePanelBrush::init()
}
}
kEventResult NodePanelBrush::handle_event(Event* e)
{
switch (e->m_type)
{
case kEventType::MouseUpL:
if (!m_mouse_inside)
{
mouse_release();
destroy();
}
break;
default:
return kEventResult::Available;
break;
}
return kEventResult::Consumed;
}
void NodePanelBrush::handle_click(Node* target)
{
if (target == m_current)
@@ -101,6 +120,11 @@ uint16_t NodePanelBrush::get_texture_id(int index) const
return m_brushes[index]->high_id;
}
std::string NodePanelBrush::get_thumb_path(int index) const
{
return m_brushes[index]->thumb_path;
}
int NodePanelBrush::get_brush_id(int index) const
{
return m_brushes[index]->m_brushID;
@@ -174,6 +198,7 @@ void NodePanelBrushPreset::init()
brush->loaded();
// brush->set_icon(path.c_str());
brush->m_brushID = count++;
brush->thumb_path = path;
brush->high_path = path_hi;
brush->high_id = const_hash(path_hi.c_str());
brush->m_brush.m_tex_id = const_hash(path.c_str());