2021-07-24 18:48:37 +00:00
|
|
|
#ifndef COIN_BLOCK_H
|
|
|
|
#define COIN_BLOCK_H
|
|
|
|
|
|
|
|
#include "../blocks.hpp"
|
|
|
|
#include "../global_vars.hpp"
|
|
|
|
#include "../sprites.hpp"
|
|
|
|
#include "../../sdlpp/sdlpp_textrenderer.hpp"
|
|
|
|
|
|
|
|
class CoinEditorBlock : public MarioBlock {
|
|
|
|
public:
|
|
|
|
CoinEditorBlock( int x, int y,
|
|
|
|
std::shared_ptr< SDLPP::Renderer > renderer );
|
2021-08-04 22:32:17 +00:00
|
|
|
void render() override;
|
|
|
|
void updateSizeAndPosition() override;
|
2021-07-24 18:48:37 +00:00
|
|
|
void addOne();
|
|
|
|
void subtractOne();
|
|
|
|
void setAmount( int amount );
|
2021-08-04 22:32:17 +00:00
|
|
|
void onScrollUp() override;
|
|
|
|
void onScrollDown() override;
|
2021-08-07 10:13:23 +00:00
|
|
|
uint8_t getData() const override;
|
2021-08-04 22:32:17 +00:00
|
|
|
void setData( uint8_t data ) override;
|
2021-07-24 18:48:37 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
void updateText();
|
|
|
|
int _amount = 1;
|
|
|
|
std::shared_ptr< SDLPP::TextRenderer > _amount_text;
|
2021-08-04 22:32:17 +00:00
|
|
|
constexpr static double size_divisor = 1.5;
|
|
|
|
constexpr static uint8_t max_amount = 15;
|
2021-07-24 18:48:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|