Exemple #1
0
        private void LoadFunc(string fn)
        {
            var ir = resourceManager.GetResource <ImageResourceBase>(fn);

            if (ir == null)
            {
                resourceManager.Add(fn, ImageResourceFactoryManager.Factory.Create(device, fn, false));
            }
        }
Exemple #2
0
            public Circle(PPDDevice device, PPDFramework.Resource.ResourceManager resourceManager) : base(device)
            {
                loadCircleImageResource = resourceManager.GetResource <ImageResourceBase>(Utility.Path.Combine("logo", "circle.png"));

                loadCircleImageVertex    = device.GetModule <ShaderCommon>().CreateVertex(362);
                invLoadCircleImageVertex = device.GetModule <ShaderCommon>().CreateVertex(362);
                var tempLoadCircleVertices    = new ColoredTexturedVertex[362];
                var tempInvLoadCircleVertices = new ColoredTexturedVertex[362];

                for (var i = 0; i < tempLoadCircleVertices.Length; i++)
                {
                    tempLoadCircleVertices[i]    = new ColoredTexturedVertex(Vector3.Zero);
                    tempInvLoadCircleVertices[i] = new ColoredTexturedVertex(Vector3.Zero);
                }
                tempLoadCircleVertices[0].Position           = new Vector3(400, 225, 0.5f);
                tempLoadCircleVertices[0].TextureCoordinates = loadCircleImageResource.GetActualUV(new Vector2(0.5f));
                for (int i = 1; i < tempLoadCircleVertices.Length; i++)
                {
                    var rad = (float)((i - 1) * Math.PI / 180);
                    var uv  = new Vector2((float)Math.Sin(rad), -(float)Math.Cos(rad));
                    tempLoadCircleVertices[i].Position = new Vector3(
                        400 + loadCircleImageResource.Width / 2 * uv.X,
                        225 + loadCircleImageResource.Height / 2 * uv.Y,
                        0.5f);
                    tempLoadCircleVertices[i].TextureCoordinates = loadCircleImageResource.GetActualUV((uv / 2 + new Vector2(0.5f)));
                }

                Array.Copy(tempLoadCircleVertices, 1, tempInvLoadCircleVertices, 0, 361);
                Array.Reverse(tempInvLoadCircleVertices, 0, tempInvLoadCircleVertices.Length);
                tempInvLoadCircleVertices[0] = tempLoadCircleVertices[0];
                loadCircleImageVertex.Write(tempLoadCircleVertices);
                invLoadCircleImageVertex.Write(tempInvLoadCircleVertices);
            }
Exemple #3
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 /// <param name="device"></param>
 /// <param name="filename">ファイルパス</param>
 /// <param name="resourceManager">リソースクラス</param>
 public NumberPictureObject(PPDDevice device, Resource.ResourceManager resourceManager, PathObject filename) : base(device)
 {
     imageResource = resourceManager.GetResource <ImageResourceBase>(filename);
     if (imageResource == null)
     {
         imageResource = (ImageResourceBase)resourceManager.Add(filename, ImageResourceFactoryManager.Factory.Create(device, filename, false));
     }
     UpdateResource();
 }
        private void UpdateResource(Color4 color)
        {
            var resourceName = String.Format("ColorTexture_{0}", color);

            resource = resourceManager.GetResource <ColorTextureResourceBase>(resourceName);
            if (resource == null)
            {
                resource = new ColorTextureResource(device, color);
                resourceManager.Add(resourceName, resource);
            }
        }
Exemple #5
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 /// <param name="device"></param>
 /// <param name="filename">ファイルパス</param>
 /// <param name="center">センタリングするか</param>
 /// <param name="resourceManager">リソースマネージャー</param>
 public PictureObject(PPDDevice device, Resource.ResourceManager resourceManager, PathObject filename, bool center) : base(device)
 {
     imageResource = resourceManager.GetResource <ImageResourceBase>(filename);
     if (imageResource == null)
     {
         imageResource = (ImageResourceBase)resourceManager.Add(filename, ImageResourceFactoryManager.Factory.Create(device, filename, false));
     }
     if (center)
     {
         RotationCenter = ScaleCenter = new Vector2(imageResource.Width / 2, imageResource.Height / 2);
         Offset         = new Vector2(-imageResource.Width / 2, -imageResource.Height / 2);
     }
     this.center = center;
     rec         = new RectangleF(0, 0, imageResource.Width, imageResource.Height);
 }
Exemple #6
0
        public MarkConnectionCommon(PPDDevice device, PPDFramework.Resource.ResourceManager resourceManager) : base(device)
        {
            var path = Utility.Path.Combine("connectpic.png");

            ImageResource     = resourceManager.GetResource <ImageResourceBase>(path);
            ActualUVRectangle = ImageResource.GetActualUVRectangle(0, 0, 1, 1);
            r        = new Random();
            Connects = new ColoredTexturedVertex[ConnectionCount][];
            for (int i = 0; i < ConnectionCount; i++)
            {
                Connects[i] = new ColoredTexturedVertex[SplitCount];
                for (int j = 0; j < SplitCount; j++)
                {
                    int x = -MaxWidth / 2 + MaxWidth / SplitCount * j;
                    Connects[i][j] = new ColoredTexturedVertex(new Vector3(x, 0, 0.5f));
                    j++;
                    Connects[i][j] = new ColoredTexturedVertex(new Vector3(x, 0, 0.5f));
                }
            }
            for (int i = 0; i < SplitCount + BaseScale; i++)
            {
                UpdateImpl();
            }
        }