OpenMiner/client/include/gui/CraftingWidget.hpp

50 lines
1.5 KiB
C++
Raw Normal View History

/*
* =====================================================================================
*
* Filename: CraftingWidget.hpp
*
* Description:
*
* Created: 25/06/2018 02:26:18
*
* Author: Quentin Bazin, <quent42340@gmail.com>
*
* =====================================================================================
*/
#ifndef CRAFTINGWIDGET_HPP_
#define CRAFTINGWIDGET_HPP_
#include "InventoryWidget.hpp"
class Recipe;
class CraftingWidget : public Widget {
public:
CraftingWidget(Client &client, Inventory &craftingInventory, Widget *parent = nullptr);
void onMouseEvent(const SDL_Event &event, MouseItemWidget &mouseItemWidget);
void update() override;
2018-06-25 03:49:53 +02:00
const ItemWidget *currentItemWidget() const { return m_craftingResultInventoryWidget.currentItemWidget() ? m_craftingResultInventoryWidget.currentItemWidget() : m_craftingInventoryWidget.currentItemWidget(); }
InventoryWidget &craftingInventoryWidget() { return m_craftingInventoryWidget; }
InventoryWidget &craftingResultInventoryWidget() { return m_craftingResultInventoryWidget; }
protected:
Client &m_client;
Inventory &m_craftingInventory;
InventoryWidget m_craftingInventoryWidget{m_client, this};
Inventory m_craftingResultInventory{1, 1};
InventoryWidget m_craftingResultInventoryWidget{m_client, this};
private:
2018-12-29 02:23:23 +01:00
void draw(gk::RenderTarget &target, gk::RenderStates states) const override;
const Recipe *m_recipe = nullptr;
};
#endif // CRAFTINGWIDGET_HPP_