예제 #1
0
        public static void OnRender()
        {
            if (Offset != 0)
            {
                int consoleHeight = AllodsWindow.Height / 2;

                QMesh.SetVertex(0, 0f, 0f, 0f, 0f, 0f, 64, 64, 64, 192);
                QMesh.SetVertex(1, (float)AllodsWindow.Width, 0f, 0f, 0f, 0f, 64, 64, 64, 192);
                QMesh.SetVertex(2, (float)AllodsWindow.Width, (float)consoleHeight, 0f, 0f, 0f, 16, 16, 16, 192);
                QMesh.SetVertex(3, 0f, (float)consoleHeight, 0f, 0f, 0f, 16, 16, 16, 192);

                QMesh.SetVertex(4, 0f, (float)consoleHeight, 0f, 0f, 0f, 255, 120, 0, 255);
                QMesh.SetVertex(5, (float)AllodsWindow.Width, (float)consoleHeight, 0f, 0f, 0f, 150, 72, 0, 255);
                QMesh.SetVertex(6, (float)AllodsWindow.Width, (float)(consoleHeight + 2), 0f, 0f, 0f, 73, 33, 0, 255);
                QMesh.SetVertex(7, 0f, (float)(consoleHeight + 2), 0f, 0f, 0f, 73, 33, 0, 255);

                QMesh.SetVertex(8, 0f, (float)(consoleHeight + 2), 0f, 0f, 0f, 0, 0, 0, 255);
                QMesh.SetVertex(9, (float)AllodsWindow.Width, (float)(consoleHeight + 2), 0f, 0f, 0f, 0, 0, 0, 255);
                QMesh.SetVertex(10, (float)AllodsWindow.Width, (float)(consoleHeight + 8), 0f, 0f, 0f, 0, 0, 0, 0);
                QMesh.SetVertex(11, 0f, (float)(consoleHeight + 8), 0f, 0f, 0f, 0, 0, 0, 0);

                AllodsWindow.SetTranslation(0f, (float)(Offset - consoleHeight), 0f);
                QMesh.Render("notex");

                // now draw last messages. starts with consoleHeight-Fonts.Font2.LineHeight*2
                int textY = Offset - Fonts.Font2.LineHeight * 2;
                int textX = 3;

                // draw text field
                if (LineEditLeft == null)
                {
                    LineEditLeft = Fonts.Font2.Render(">", Font.Align.Left, 0, 0, false);
                }
                LineEditLeft.Render(textX, textY + 6, 1, 255, 255, 255, 255);
                LineEdit.Resize(12, textY + 4, AllodsWindow.Width - 16, Fonts.Font2.LineHeight + 4);
                LineEdit.SetFont(Fonts.Font2);
                LineEdit.TreeRender();

                for (int i = Messages.Count - 1; i >= 0; i--)
                {
                    ClientConsoleMessage msg = Messages[i];
                    if (msg.Text.Length > 0)
                    {
                        msg.UpdateMesh();
                        if (textY + msg.Mesh.MeshHeight < 0)
                        {
                            break;
                        }

                        textY -= msg.Mesh.MeshHeight;
                        msg.Mesh.Render(textX, textY, 1, 255, 255, 255, 255);
                    }
                }
            }
        }
예제 #2
0
        public override void OnRender()
        {
            //Console.WriteLine("LineEditBase render");
            int selection1x = LEFont.Width(CurrentString.Substring(0, Selection1)) + 2;
            int selection2x = LEFont.Width(CurrentString.Substring(0, Selection2)) + 2;

            int pselection1x = selection1x;
            int pselection2x = selection2x;

            if (pselection2x < pselection1x)
            {
                pselection2x = selection1x;
                pselection1x = selection2x;
            }

            if (selection1x != selection2x)
            {
                byte sr = 0;
                byte sg = 0;
                byte sb = 0;
                SelectionMesh.SetVertex(0, selection1x, 0, 0, 0, 0, sr, sg, sb, 255);
                SelectionMesh.SetVertex(1, selection2x, 0, 0, 0, 0, sr, sg, sb, 255);
                SelectionMesh.SetVertex(2, selection2x, Height, 0, 0, 0, sr, sg, sb, 255);
                SelectionMesh.SetVertex(3, selection1x, Height, 0, 0, 0, sr, sg, sb, 255);
                AllodsWindow.SetTranslation(GlobalX, GlobalY, 0f);
                SelectionMesh.Render("notex");
            }

            if (CurrentStringOld != CurrentString)
            {
                if (CurrentMesh != null)
                {
                    CurrentMesh.Dispose();
                }
                CurrentMesh      = LEFont.Render(CurrentString, Font.Align.Left, Width, Height, false);
                CurrentStringOld = CurrentString;
            }

            CurrentMesh.Render(GlobalX + 2, GlobalY + 2, 1, 255, 255, 255, 255);

            if (CursorVisible)
            {
                CursorMesh.SetVertex(0, selection2x, 0, 0, 0, 0, 255, 255, 255, 255);
                CursorMesh.SetVertex(1, selection2x, Height, 0, 0, 0, 255, 255, 255, 255);
                AllodsWindow.SetTranslation(GlobalX, GlobalY, 0f);
                CursorMesh.Render("notex");
            }
        }
예제 #3
0
 public void Render(string shader, Palette palette, int x, int y, int cx, int cy, int cw, int ch)
 {
     Bind(0);
     if (palette != null)
     {
         palette.Bind(1);
     }
     PrivMesh.SetVertex(0, 0f, 0f, 0f,
                        0f, 0f,
                        255, 255, 255, 255);
     PrivMesh.SetVertex(1, (float)cw, 0f, 0f,
                        (float)(cx + cw), 0f,
                        255, 255, 255, 255);
     PrivMesh.SetVertex(2, (float)cw, (float)ch, 0f,
                        (float)(cx + cw), (float)(cy + ch),
                        255, 255, 255, 255);
     PrivMesh.SetVertex(3, 0f, (float)ch, 0f,
                        0f, (float)(cy + ch),
                        255, 255, 255, 255);
     AllodsWindow.SetTranslation((float)x, (float)y, 0f);
     PrivMesh.Render(shader);
 }
예제 #4
0
        public void Render(int x, int y, int shadow, byte r, byte g, byte b, byte a)
        {
            // if current rgba != LastRGBA, update MeshObject
            // if shadow != 0 and LastShadow == 0, update ShadowMeshObject

            if (shadow != 0 && ShadowMeshObject == null)
            {
                ShadowMeshObject = MeshObject.Clone();
                for (int i = 0; i < ShadowMeshObject.VertexCount; i++)
                {
                    ShadowMeshObject.SetVertexColor(i, 0, 0, 0, 255);
                }
            }

            if (r != LastR || g != LastG || b != LastB || a != LastA)
            {
                for (int i = 0; i < MeshObject.VertexCount; i++)
                {
                    MeshObject.SetVertexColor(i, r, g, b, a);
                }
                LastR = r;
                LastG = g;
                LastB = b;
                LastA = a;
            }

            MeshTexture.Bind();

            if (shadow != 0)
            {
                AllodsWindow.SetTranslation((float)x + shadow, (float)y + shadow, 0f);
                ShadowMeshObject.Render("stencil");
            }

            AllodsWindow.SetTranslation((float)x, (float)y, 0f);
            MeshObject.Render("stencil");
        }