gearmulator

Emulation of classic VA synths of the late 90s/2000s that are based on Motorola 56300 family DSPs
Log | Files | Refs | Submodules | README | LICENSE

lcd.h (1205B)


      1 #pragma once
      2 
      3 #include "juce_gui_basics/juce_gui_basics.h"
      4 
      5 namespace jucePluginEditorLib
      6 {
      7 	class Lcd : public juce::Button, juce::Timer
      8 	{
      9 	public:
     10 		explicit Lcd(Component& _parent, uint32_t _width, uint32_t _height);
     11 		~Lcd() override;
     12 
     13 		void setText(const std::vector<uint8_t> &_text);
     14 		void setCgRam(const std::array<uint8_t, 64> &_data);
     15 
     16 	protected:
     17 		void postConstruct();
     18 
     19 	private:
     20 		void paintButton(juce::Graphics& g, bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override {}
     21 		void paint(juce::Graphics& _g) override;
     22 		juce::Path createPath(uint8_t _character) const;
     23 		void onClicked();
     24 		void timerCallback() override;
     25 
     26 		virtual bool getOverrideText(std::vector<std::vector<uint8_t>>& _lines) = 0;
     27 		virtual const uint8_t* getCharacterData(uint8_t _character) const = 0;
     28 
     29 	private:
     30 		Component& m_parent;
     31 
     32 		std::array<juce::Path, 256> m_characterPaths;
     33 
     34 		const float m_scaleW;
     35 		const float m_scaleH;
     36 
     37 		const uint32_t m_width;
     38 		const uint32_t m_height;
     39 		std::vector<uint8_t> m_overrideText;
     40 		std::vector<uint8_t> m_text;
     41 		std::array<std::array<uint8_t, 8>, 8> m_cgData{{{0}}};
     42 		uint32_t m_charBgColor = 0xff000000;
     43 		uint32_t m_charColor = 0xff000000;
     44 	};
     45 }