game/mario/blocks/coineditorblock.hpp

32 lines
831 B
C++

#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 );
void render() override;
void updateSizeAndPosition() override;
void addOne();
void subtractOne();
void setAmount( int amount );
void onScrollUp() override;
void onScrollDown() override;
uint8_t getData() override;
void setData( uint8_t data ) override;
private:
void updateText();
int _amount = 1;
std::shared_ptr< SDLPP::TextRenderer > _amount_text;
constexpr static double size_divisor = 1.5;
constexpr static uint8_t max_amount = 15;
};
#endif