| 134 | Lemon::GUI::LayoutContainer* menuContainer; |
| 135 | |
| 136 | class MenuWidget : public Lemon::GUI::Widget{ |
| 137 | MenuObject* obj; |
| 138 | Lemon::Graphics::TextObject label = Lemon::Graphics::TextObject(); |
| 139 | |
| 140 | public: |
| 141 | MenuWidget(MenuObject& obj, rect_t bounds) : Widget(bounds){ |
| 142 | this->obj = &obj; |
| 143 | |
| 144 | label = Lemon::Graphics::TextObject(fixedBounds.pos + (vector2i_t){0, fixedBounds.size.y / 2}, this->obj->name); |
| 145 | label.SetColour({255, 255, 255, 255}); |
| 146 | } |
| 147 | |
| 148 | void Paint(surface_t* surface){ |
| 149 | if(Lemon::Graphics::PointInRect(fixedBounds, menuWindow->lastMousePos)){ |
| 150 | Lemon::Graphics::DrawRect(fixedBounds, Lemon::colours[Lemon::Colour::Foreground], surface); |
| 151 | } |
| 152 | |
| 153 | label.Render(surface); |
| 154 | } |
| 155 | |
| 156 | void OnMouseUp(vector2i_t pos){ |
| 157 | obj->Open(fixedBounds.pos + (vector2i_t){fixedBounds.size.x, 0}); |
| 158 | } |
| 159 | |
| 160 | void UpdateFixedBounds(){ |
| 161 | Widget::UpdateFixedBounds(); |
| 162 | |
| 163 | label.SetPos(fixedBounds.pos + (vector2i_t){2, fixedBounds.size.y / 2}); |
| 164 | } |
| 165 | }; |
| 166 | |
| 167 | void OnPaint(surface_t* surface){ |
| 168 | |