OpenMiner/include/gui/CraftingWidget.hpp
exilief dc8d781393 Switching from SDL to SFML (#14)
* Add SFML support besides SDL. Choose with global macro USE_SDL / USE_SFML.

+ Small fixes to make it compile on MinGW (with Glad instead of GLEW -> option NO_GLEW)

* Add SFML support besides SDL (Part 3). Cleaned up some macros.

* Add SFML support besides SDL (Part 4). Small SFML fixes. Changed Spaces->Tabs

* Add SFML support besides SDL (Part 5). Cleaning up more macros + small fixes.

* Port to SFML. Removed all SDL code.

* Small changes

* Conversion functions to/from SFML types for Vector2/3 and Color.

* Removed unused SDL files

* Changes for SFML port

* Changes for SFML port

* Fixed line endings (probably?)
2018-12-26 18:36:46 +01:00

48 lines
1.4 KiB
C++

/*
* =====================================================================================
*
* 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(Inventory &craftingInventory, Widget *parent = nullptr);
void onMouseEvent(const sf::Event &event, MouseItemWidget &mouseItemWidget);
void update() override;
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:
Inventory &m_craftingInventory;
InventoryWidget m_craftingInventoryWidget{this};
Inventory m_craftingResultInventory{1, 1};
InventoryWidget m_craftingResultInventoryWidget{this};
private:
void draw(RenderTarget &target, RenderStates states) const override;
const Recipe *m_recipe = nullptr;
};
#endif // CRAFTINGWIDGET_HPP_