2018-06-25 02:39:23 +02:00
|
|
|
/*
|
|
|
|
* =====================================================================================
|
|
|
|
*
|
|
|
|
* 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"
|
|
|
|
|
2018-06-30 03:47:39 +02:00
|
|
|
class Recipe;
|
2018-06-25 03:00:49 +02:00
|
|
|
|
2018-06-25 02:39:23 +02:00
|
|
|
class CraftingWidget : public Widget {
|
|
|
|
public:
|
2019-01-26 20:29:13 +01:00
|
|
|
CraftingWidget(Client &client, Inventory &craftingInventory, Widget *parent = nullptr);
|
2018-06-25 02:39:23 +02:00
|
|
|
|
2018-12-28 06:19:40 +01:00
|
|
|
void onMouseEvent(const SDL_Event &event, MouseItemWidget &mouseItemWidget);
|
2018-06-25 02:39:23 +02:00
|
|
|
|
2018-06-27 05:39:56 +02:00
|
|
|
void update() override;
|
2018-06-25 03:49:53 +02:00
|
|
|
|
2018-06-25 22:30:38 +02:00
|
|
|
const ItemWidget *currentItemWidget() const { return m_craftingResultInventoryWidget.currentItemWidget() ? m_craftingResultInventoryWidget.currentItemWidget() : m_craftingInventoryWidget.currentItemWidget(); }
|
|
|
|
|
2018-06-29 07:38:57 +02:00
|
|
|
InventoryWidget &craftingInventoryWidget() { return m_craftingInventoryWidget; }
|
|
|
|
InventoryWidget &craftingResultInventoryWidget() { return m_craftingResultInventoryWidget; }
|
|
|
|
|
2018-06-27 09:07:57 +02:00
|
|
|
protected:
|
2019-01-26 20:29:13 +01:00
|
|
|
Client &m_client;
|
|
|
|
|
2018-06-29 07:16:51 +02:00
|
|
|
Inventory &m_craftingInventory;
|
2019-01-26 20:29:13 +01:00
|
|
|
InventoryWidget m_craftingInventoryWidget{m_client, this};
|
2018-06-25 02:39:23 +02:00
|
|
|
|
|
|
|
Inventory m_craftingResultInventory{1, 1};
|
2019-01-26 20:29:13 +01:00
|
|
|
InventoryWidget m_craftingResultInventoryWidget{m_client, this};
|
2018-06-25 03:00:49 +02:00
|
|
|
|
2018-06-27 09:07:57 +02:00
|
|
|
private:
|
2018-12-29 02:23:23 +01:00
|
|
|
void draw(gk::RenderTarget &target, gk::RenderStates states) const override;
|
2018-06-27 09:07:57 +02:00
|
|
|
|
2018-06-30 03:47:39 +02:00
|
|
|
const Recipe *m_recipe = nullptr;
|
2018-06-25 02:39:23 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CRAFTINGWIDGET_HPP_
|