Ejemplo n.º 1
0
        void GLPaint1(C2DGraphics gr, GuiControlStyle stl)
        {
            gr.SetColor(GetPaintColor(stl));

            float scale = 1;

            if (mCtlState == CtlState.Hover)
            {
                scale = (float)stl.HoverSize / 100f;
            }
            if (mCtlState == CtlState.Pressed)
            {
                scale = (float)stl.PressedSize / 100f;
            }


            if ((scale < 0.999f) || (scale > 1.001f))
            {
                float w   = (float)Width * scale;
                float h   = (float)Height * scale;
                float scx = ((float)Width - w) / 2f;
                float scy = ((float)Height - h) / 2f;
                gr.Image(mGLImageCach, 0, 0, mGLImageCach.w, mGLImageCach.h, scx, scy, w, h);
            }
            else
            {
                gr.Image(mGLImageCach, 0, 0, mGLImageCach.w, mGLImageCach.h, 0, 0, Width, Height);
            }
        }
Ejemplo n.º 2
0
        public override void OnGLPaint(C2DGraphics gr)
        {
            base.OnGLPaint(gr);
            if (mGLImageCach == null)
            {
                mGLImageCach = gr.GetImage(mGLImage);
                if (mGLImageCach == null)
                {
                    return;
                }
                mSubImgWidth = mGLImageCach.w / Style.SubImgCount;
            }
            GuiControlStyle stl = Style;

            if (stl.SubImgCount == 4)
            {
                GLPaint4(gr);
            }
            if (stl.SubImgCount == 1)
            {
                GLPaint1(gr, stl);
            }
            C2DImage cimg = stl.CheckedImageCach;

            if (Enabled && (cimg != null))
            {
                int chimgw = cimg.w / 2;
                int posx   = Checked ? chimgw : 0;
                gr.SetColor(stl.CheckedColor);
                gr.Image(cimg, posx, 0, chimgw, cimg.h, 0, 0, Width, Height);
            }
        }
Ejemplo n.º 3
0
 public override void OnGLPaint(C2DGraphics gr)
 {
     base.OnGLPaint(gr);
     if (mGLImageCach == null)
     {
         mGLImageCach = gr.GetImage(mGLImage);
         if (mGLImageCach == null)
         {
             return;
         }
         gr.SetColor(Style.ForeColor);
         gr.Image(mGLImageCach, 0, 0, mGLImageCach.w, mGLImageCach.h, 0, 0, Width, Height);
     }
 }
Ejemplo n.º 4
0
        public override void Show(C2DGraphics g2d, int w, int h)
        {
            if (!visible)
            {
                return;
            }
            int iw = 0, ih = 0;

            g2d.GetImageDim(imgname, ref iw, ref ih);
            int px = GuiConfig.GetPosition(0, w, iw, x, docking[1]);
            int py = GuiConfig.GetPosition(0, h, ih, y, docking[0]);

            g2d.SetColor(color);
            g2d.Image(imgname, px, py);
        }
Ejemplo n.º 5
0
        void GLPaint4(C2DGraphics gr)
        {
            int index = (int)mCtlState;

            if (Enabled == false)
            {
                index = 3;
            }
            if (mGLImageCach != null)
            {
                gr.SetColor(Color.White);
                mSrcrc.X = mSubImgWidth * index;
                gr.Image(mGLImageCach, mSubImgWidth * index, 0, mSubImgWidth, mGLImageCach.h, 0, 0, Width, Height);
            }
        }
Ejemplo n.º 6
0
        void DrawForeground()
        {
            int w = glControl1.Width;
            int h = glControl1.Height;

            Set2DView();

            /*gr2d.Rectangle(0,0,w,70,Color.RoyalBlue);
             * GL.Color3(Color.White);
             * gr2d.Image("cwlogo_round", w / 2 - 50, 0);*/
            if (!Render3dSpace)
            {
                gr2d.SetColor(Color.White);
                gr2d.Image((int)mColorBuffer, 0, 1, 1, 0, 0, 0, Width, Height);
            }
            guiconf.DrawForeground(gr2d, glControl1.Width, glControl1.Height);

            foreach (ctlBgnd cb in ctlBgndList)
            {
                gr2d.SetColor(cb.col);
                gr2d.Panel9(cb.imageName, cb.x, cb.y, cb.w, cb.h);
            }

            /*
             * if (ctlViewOptions.SliceVisible && (m_sliceTex != -1))
             * {
             *  int px = w - m_sliceViewW - 20;
             *  gr2d.SetColor(Color.FromArgb(50, 255, 255, 255));
             *  gr2d.Image(m_sliceTex, 0, 1, 0, 1, px, 90, m_sliceViewW, m_sliceViewH);
             * }
             */
            foreach (Control subctl in mainViewSplitContainer.Panel2.Controls)
            {
                if (subctl.GetType().IsSubclassOf(typeof(ctlUserPanel)))
                {
                    ((ctlUserPanel)subctl).GLRedraw(gr2d, subctl.Location.X, subctl.Location.Y);
                }
            }

            gr2d.ResetDrawingRegion();
            //SetAlpha(m_showalpha);
            Set3DView();
        }
Ejemplo n.º 7
0
        void GLPaint4(C2DGraphics gr)
        {
            int index = (int)mCtlState;

            if (Enabled == false)
            {
                index = 3;
            }
            if (mGLImageCach != null)
            {
                gr.SetColor(Color.White);
                mSrcrc.X = mSubImgWidth * index;
                gr.Image(mGLImageCach, mSubImgWidth * index, 0, mSubImgWidth, mGLImageCach.h, 0, 0, Width, Height);

                /*if (Enabled && (mCheckImage != null))
                 * {
                 *  mCheckrc.X = Checked ? mSubChkImgWidth : 0;
                 *  gr.DrawImage(mCheckImage, mDstrc, mCheckrc, GraphicsUnit.Pixel);
                 * }*/
            }
        }