dc8d781393
* 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?)
53 lines
1.3 KiB
C++
53 lines
1.3 KiB
C++
/*
|
|
* =====================================================================================
|
|
*
|
|
* Filename: InventoryState.hpp
|
|
*
|
|
* Description:
|
|
*
|
|
* Created: 20/06/2018 23:11:44
|
|
*
|
|
* Author: Quentin Bazin, <quent42340@gmail.com>
|
|
*
|
|
* =====================================================================================
|
|
*/
|
|
#ifndef INVENTORYSTATE_HPP_
|
|
#define INVENTORYSTATE_HPP_
|
|
|
|
#include <memory>
|
|
|
|
#include "ApplicationState.hpp"
|
|
#include "Config.hpp"
|
|
#include "RectangleShape.hpp"
|
|
#include "Shader.hpp"
|
|
#include "WorkbenchWidget.hpp"
|
|
|
|
class InventoryState : public ApplicationState {
|
|
public:
|
|
InventoryState(ApplicationState *parent = nullptr);
|
|
|
|
template<typename T, typename... Args>
|
|
void setupWidget(Args &&...args) {
|
|
m_widget.reset(new T(std::forward<Args>(args)...));
|
|
|
|
m_widget->setScale(GUI_SCALE, GUI_SCALE, 1);
|
|
m_widget->setPosition(SCREEN_WIDTH / 2.0 - m_widget->getGlobalBounds().width / 2.0,
|
|
SCREEN_HEIGHT / 2.0 - m_widget->getGlobalBounds().height / 2.0, 0);
|
|
}
|
|
|
|
void onEvent(const sf::Event &event) override;
|
|
|
|
void update() override;
|
|
|
|
private:
|
|
void draw(RenderTarget &target, RenderStates states) const override;
|
|
|
|
Shader m_shader;
|
|
|
|
std::unique_ptr<Widget> m_widget;
|
|
|
|
RectangleShape m_background;
|
|
};
|
|
|
|
#endif // INVENTORYSTATE_HPP_
|