game/mario/blocks/coineditorblock.hpp

31 lines
806 B
C++
Raw Permalink Normal View History

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:
2021-10-18 08:10:43 +00:00
CoinEditorBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> renderer);
void render() override;
void updateSizeAndPosition() override;
2021-07-24 18:48:37 +00:00
void addOne();
void subtractOne();
2021-10-18 08:10:43 +00:00
void setAmount(int amount);
void onScrollUp() override;
void onScrollDown() override;
2021-08-07 10:13:23 +00:00
uint8_t getData() const override;
2021-10-18 08:10:43 +00:00
void setData(uint8_t data) override;
2021-07-24 18:48:37 +00:00
private:
void updateText();
int _amount = 1;
2021-10-18 08:10:43 +00:00
std::shared_ptr<SDLPP::TextRenderer> _amount_text;
constexpr static double size_divisor = 1.5;
constexpr static uint8_t max_amount = 15;
2021-07-24 18:48:37 +00:00
};
#endif