protected MonochromeLCDDisplay(string friendlyName, bool autoStartable)
        {
            try
            {
                Connect(friendlyName, false, AppletCapabilities.Monochrome);

                Device = new Device();
                Device.Open(this, DeviceType.Monochrome);

                Surface = new Surface(160, 43, 1);
                UpdateLcdScreen += _UpdateLcdScreen;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Beispiel #2
0
        public override bool Draw(Surface a_Surface)
        {
            if (m_Changed)
            {
                //m_Changed = false;

                int text_x = m_Position.X;
                int text_width;
                int prev_text_width = prev_len;
                int bar_x = m_Position.X;

                prev_len = text_width = m_Font.MeasureWidth(m_Str);
                if (prev_text_width < 0)
                {
                    prev_text_width = text_width;
                }

                int bar_width = prev_text_width;

                // MaxWidth < 0 means right aligned, X will be the rightmost position
                if (m_MaxWidth < 0)
                {
                    if (text_width > 0 - m_MaxWidth)
                        text_width = 0 - m_MaxWidth;
                    text_x = m_Position.X - text_width;
                    bar_x = m_Position.X - bar_width;
                }
                else
                {
                    if (text_width > m_MaxWidth) text_width = m_MaxWidth;
                    if (bar_width > m_MaxWidth) bar_width = m_MaxWidth;
                }

                a_Surface.Bar(bar_x, m_Position.Y, bar_width - 1, 6, color == Surface.PIXEL_ON ? Surface.PIXEL_OFF : Surface.PIXEL_ON);
                a_Surface.Print(m_Str, text_x, m_Position.Y, m_Font, color, text_x + text_width);

                return true;
            }

            return false;
        }
Beispiel #3
0
 public abstract bool Draw(Surface a_Surface);