コード例 #1
0
ファイル: objDrawer.cs プロジェクト: RikkiRu/Helia_1_5
        public textDrawer(float sizeX, string text, Color textColor, Color backgoundColor, ContentAlignment aligin)
        {
            int length = text.Length;
            if(length==0) length=1;

            float sizeY = sizeX / (length) * 2;
            texData = new modelData(getTextBitmap(text, textColor, backgoundColor));

            switch (aligin)
            {
                default:
                    sizeX = sizeX / 2;
                    sizeY = sizeY / 2;
                    vertexes[0].x = -sizeX;
                    vertexes[0].y = -sizeY;
                    vertexes[1].x = sizeX;
                    vertexes[1].y = -sizeY;
                    vertexes[2].x = sizeX;
                    vertexes[2].y = sizeY;
                    vertexes[3].x = -sizeX;
                    vertexes[3].y = sizeY;
                    break;

                case ContentAlignment.TopLeft:
                    vertexes[0].x = 0;
                    vertexes[0].y = 0;
                    vertexes[1].x = sizeX;
                    vertexes[1].y = 0;
                    vertexes[2].x = sizeX;
                    vertexes[2].y = sizeY;
                    vertexes[3].x = 0;
                    vertexes[3].y = sizeY;
                    break;

                case ContentAlignment.BottomLeft:
                    vertexes[0].x = 0;
                    vertexes[0].y = -sizeY;
                    vertexes[1].x = sizeX;
                    vertexes[1].y = -sizeY;
                    vertexes[2].x = sizeX;
                    vertexes[2].y = 0;
                    vertexes[3].x = 0;
                    vertexes[3].y = 0;
                    break;

                case ContentAlignment.MiddleRight:
                    sizeY = sizeY / 2;
                    vertexes[0].x = -sizeX;
                    vertexes[0].y = -sizeY;
                    vertexes[1].x = 0;
                    vertexes[1].y = -sizeY;
                    vertexes[2].x = 0;
                    vertexes[2].y = sizeY;
                    vertexes[3].x = -sizeX;
                    vertexes[3].y = sizeY;
                    break;
            }
        }
コード例 #2
0
ファイル: objDrawer.cs プロジェクト: RikkiRu/Helia_1_5
 public void changeText(string text, Color textColor, Color backgoundColor)
 {
     texData = new modelData(getTextBitmap(text, textColor, backgoundColor));
 }
コード例 #3
0
ファイル: objDrawer.cs プロジェクト: RikkiRu/Helia_1_5
        public static void loadTextures()
        {
            textStatic[0].u = 0; textStatic[1].u = 1; textStatic[2].u = 1; textStatic[3].u = 0;
            textStatic[0].v = 0; textStatic[1].v = 0; textStatic[2].v = 1; textStatic[3].v = 1;

            texData = new modelData[30];
            texData[0] = new modelData("n_for");
            texData[1] = new modelData("pFlat");
            texData[2] = new modelData("n_grass");
            texData[3] = new modelData("none");
            texData[4] = new modelData("pOverlay");

            texData[5] = new modelData("planetIcon");
            texData[6] = new modelData("o2");
            texData[7] = new modelData("h2o");
            texData[8] = new modelData("smile");
            texData[9] = new modelData("man");

            texData[10] = new modelData("apple");
            texData[11] = new modelData("gears");
            texData[12] = new modelData("break");
            texData[13] = new modelData("book");
            texData[14] = new modelData("waterKaplya");

            texData[15] = new modelData("sun", 3, 20);
            texData[16] = new modelData("onePixel");
            texData[17] = new modelData("newPlayer");
            texData[18] = new modelData("select");
        }