OpenMiner/include/gui/MouseItemWidget.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

49 lines
1.2 KiB
C++

/*
* =====================================================================================
*
* Filename: MouseItemWidget.hpp
*
* Description:
*
* Created: 23/06/2018 00:50:38
*
* Author: Quentin Bazin, <quent42340@gmail.com>
*
* =====================================================================================
*/
#ifndef MOUSEITEMWIDGET_HPP_
#define MOUSEITEMWIDGET_HPP_
#include "ItemWidget.hpp"
#include "Sprite.hpp"
#include "Text.hpp"
class MouseItemWidget : public ItemWidget {
public:
MouseItemWidget(Widget *parent);
void onEvent(const sf::Event &event) override;
void update(const ItemWidget *currentItemWidget);
void swapItems(ItemWidget &widget, bool isReadOnly = false);
void putItem(ItemWidget &widget);
const ItemStack &getStack() const { return m_inventory.getStack(0, 0); }
private:
void draw(RenderTarget &target, RenderStates states) const override;
void updatePosition(float x, float y);
Inventory m_inventory{1, 1};
const ItemWidget *m_currentItemWidget = nullptr;
Sprite m_tooltipBackground{"texture-toasts", 160, 32};
Text m_tooltipText;
Text m_tooltipInfoText;
};
#endif // MOUSEITEMWIDGET_HPP_