Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Lcdisplay"/> class.
        /// </summary>
        private Lcdisplay()
        {
            m_defaultFont = FontFactory.GetFont("Microsoft Sans Serif", 13.5f, FontStyle.Regular, GraphicsUnit.Point);

            m_bmpLCD = new Bitmap(G15Width, G15Height, PixelFormat.Format24bppRgb);
            m_bmpLCD.SetResolution(G15DpiX, G15DpiY);
            m_lcdCanvas = Graphics.FromImage(m_bmpLCD);
            m_lcdCanvas.TextRenderingHint = TextRenderingHint.SingleBitPerPixelGridFit;

            m_bmpLCDX = new Bitmap(G15Width, G15Height, PixelFormat.Format24bppRgb);
            m_bmpLCDX.SetResolution(G15DpiX, G15DpiY);
            m_lcdOverlay = Graphics.FromImage(m_bmpLCDX);
            m_lcdOverlay.TextRenderingHint = TextRenderingHint.SingleBitPerPixelGridFit;

            m_buttonStateHld         = DateTime.Now;
            m_cycleTime              = DateTime.Now.AddSeconds(10);
            m_cycleQueueInfoTime     = DateTime.Now.AddSeconds(5);
            m_showingCycledQueueInfo = false;

            Cycle                           = false;
            ShowSystemTime                  = false;
            CycleSkillQueueTime             = false;
            FirstSkillCompletionRemaingTime = TimeSpan.FromTicks(DateTime.Now.Ticks);

            m_buttonDelegate = new ButtonDelegate(OnButtonsPressed);
            LCDInterface.AssignButtonDelegate(m_buttonDelegate);
            LCDInterface.Open("EVEMon", false);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Fetches the content of the <see cref="Graphics"/> object to the G15 screen.
        /// </summary>
        /// <param name="priority"></param>
        private unsafe void UpdateLcdDisplay(uint priority)
        {
            // Locking should not be necesseray but i'll keep it here
            lock (m_bmpLCD)
            {
                int       width  = m_bmpLCD.Width;
                int       height = m_bmpLCD.Height;
                byte[]    buffer = new byte[width * height];
                Rectangle rect   = new Rectangle(0, 0, width, height);

                BitmapData bmData = m_bmpLCD.LockBits(rect, ImageLockMode.ReadOnly, m_bmpLCD.PixelFormat);
                try
                {
                    BitmapData bmDataX = m_bmpLCDX.LockBits(rect, ImageLockMode.ReadOnly, m_bmpLCDX.PixelFormat);
                    try
                    {
                        // Extract bits per pixel and length infos
                        int stride = bmData.Stride;
                        int bpp    = stride / width;
                        int length = stride * height;

                        // Copy the content of the bitmap to our buffers
                        // Unsafe code removes the boundaries checks - a lot faster.
                        fixed(byte *buffer0 = buffer)
                        {
                            byte *output = buffer0;
                            byte *inputX = (byte *)bmDataX.Scan0.ToPointer();
                            byte *input  = (byte *)bmData.Scan0.ToPointer();;

                            for (int i = 0; i < height; i++)
                            {
                                for (int j = 0; j < width; j++)
                                {
                                    *output = (byte)((*input) ^ (*inputX));
                                    inputX += bpp;
                                    input  += bpp;
                                    output++;
                                }
                            }
                        }
                    }
                    finally
                    {
                        m_bmpLCDX.UnlockBits(bmDataX);
                    }
                }
                finally
                {
                    m_bmpLCD.UnlockBits(bmData);
                }

                // Fetches the buffer to the LCD screen
                LCDInterface.DisplayBitmap(ref buffer, priority);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Releases unmanaged and - optionally - managed resources
        /// </summary>
        /// <param name="isDisposing">
        /// <c>true</c> to release both managed and unmanaged resources;
        /// <c>false</c> to release only unmanaged resources.
        /// </param>
        private void Dispose(bool isDisposing)
        {
            if (!m_disposed)
            {
                if (isDisposing || s_singleInstance != null)
                {
                    LCDInterface.Close();
                }

                s_singleInstance = null;
            }
            m_disposed = true;
        }
Exemplo n.º 4
0
        private Lcdisplay()
        {
            m_defaultFont = FontFactory.GetFont("Microsoft Sans Serif", 13.5f, FontStyle.Regular, GraphicsUnit.Point);
            m_bufferOut   = new byte[6880];

            // using standard brushes in a multithreaded app is bad mkay ?
            m_defBrush  = new SolidBrush(Color.Black);
            m_backColor = Color.White;
            m_defPen    = new Pen(m_defBrush);

            m_bmpLCD = new Bitmap(160, 43, PixelFormat.Format24bppRgb);
            m_bmpLCD.SetResolution(46f, 46f);
            m_lcdGraphics = Graphics.FromImage(m_bmpLCD);
            m_lcdGraphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit;

            m_bmpLCDX = new Bitmap(160, 43, PixelFormat.Format24bppRgb);
            m_bmpLCDX.SetResolution(46f, 46f);
            m_lcdGraphicsX = Graphics.FromImage(m_bmpLCDX);
            m_lcdGraphicsX.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit;

            m_lines = new string[3] {
                "", "", ""
            };
            m_formatStringConverted = FORMAT_CHAR_SKILL_TIME_STRING.Replace("[c]", "{0}").Replace("[s]", "{1}").Replace("[t]", "{2}");

            using (Stream strm = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("EVEMon.LogitechG15.EVEMon-all.ico"))
            {
                m_EVEMonSplash = new Icon(strm);
            }

            m_lcd            = new LCDInterface();
            m_buttonDelegate = new ButtonDelegate(this.OnButtonsPressed);
            m_lcd.AssignButtonDelegate(m_buttonDelegate);
            m_lcd.Open("EVEMon", false);
            m_buttonStateHld          = DateTime.Now;
            m_cycleTime               = DateTime.Now.AddSeconds(10);
            m_cycleCompletionTimeTime = DateTime.Now.AddSeconds(5);
            m_cycle                 = false;
            m_showTime              = false;
            m_cycleCompletionTime   = false;
            m_showingCompletionTime = false;
            m_completionString      = "Hotaru Nakayoshi\nhas finished learning skill\nHull Upgrades V";
            m_leasttime             = TimeSpan.FromTicks(DateTime.Now.Ticks);
        }
Exemplo n.º 5
0
        //
        // Constructor
        //

        #region  public G15()
        public G15()
        {
            lcd = new LCDInterface();

            // setup the string formatting
            format_left   = new StringFormat();
            format_right  = new StringFormat();
            format_center = new StringFormat();

            format_left.Alignment   = StringAlignment.Near;
            format_right.Alignment  = StringAlignment.Far;
            format_center.Alignment = StringAlignment.Center;

            // Initialize the brush
            brush = new SolidBrush(Color.White);

            // Create the bitmap
            bmp = new Bitmap(lcd_width, lcd_height, PixelFormat.Format24bppRgb);

            // Create a graphics object from the bitmap
            lcd_graphics = Graphics.FromImage(bmp);
        }
Exemplo n.º 6
0
 public void UpdateLCD(LCDInterface lcdInterface)
 {
     this.denominator = lcdInterface.GetTargetDenominator();
 }
Exemplo n.º 7
0
 public void UpdateFromLCD(LCDInterface lcdInterface)
 {
     this.denominator = lcdInterface.GetTargetDenominator();
     this.DisplayCharge();
     playerAttack.UpdateFractionLabelObject((int)this.numerator, this.denominator);
 }