40 lines
912 B
C++
40 lines
912 B
C++
#ifndef _LEDDISPLAY_HPP_
|
|
#define _LEDDISPLAY_HPP_
|
|
#include <common/string.hpp>
|
|
#include <common/point.hpp>
|
|
|
|
class LedDisplay
|
|
{
|
|
public:
|
|
enum SpecialChar{BlankChar,DashChar};
|
|
LedDisplay(HWND hDisplayWindow,Point windowPoint);
|
|
virtual ~LedDisplay();
|
|
void setNumber(WORD someNumber);
|
|
void setNumber(SpecialChar specialChar);
|
|
WORD getNumber(void)const;
|
|
void paint(void);
|
|
private:
|
|
enum {Width=13,Height=22,Frames=12};
|
|
enum {OffsetDashChar,OffsetBlankChar};
|
|
WORD charPosition(char someDisplayChar)const;
|
|
void positions(WORD &firstOffset,WORD &secondOffset,WORD &thirdOffset)const;
|
|
HBITMAP mhFilm;
|
|
WORD mCurrentNumber;
|
|
SpecialChar mCurrentSpecialChar;
|
|
WORD mHasSpecialChar;
|
|
Point mWindowPoint;
|
|
HWND mhDisplayWindow;
|
|
};
|
|
|
|
inline
|
|
WORD LedDisplay::charPosition(char someChar)const
|
|
{
|
|
return ((Frames-1)-((int)someChar-'0'));
|
|
}
|
|
|
|
inline
|
|
WORD LedDisplay::getNumber(void)const
|
|
{
|
|
return mCurrentNumber;
|
|
}
|
|
#endif |