public void Draw(SpriteData tex, Point pos, Point center, float rot, float size) { image.Source = tex.imageData; image.Width = tex.Width * size; image.Height = tex.Height * size; image.Margin = new Thickness( pos.X - center.X * size , pos.Y - center.Y * size , 0, 0); image.RenderTransform = new RotateTransform(rot / Math.PI * 180.0, center.X * size, center.Y * size); active = true; }
public static SpriteData Load(string name, float w, float h) { SpriteData sd = new SpriteData().Load(name, w, h, true); return sd; }
public void Draw(SpriteData tex, Point pos, Point center, float size) { image.Source = tex.imageData; image.Width = tex.Width * size; image.Height = tex.Height * size; image.Margin = new Thickness( pos.X - center.X * size , pos.Y - center.Y * size , 0, 0); image.RenderTransform = Identity; active = true; }
public void Initialize() { getInstance = this; #if false images = new BitmapImage[24]; imageSize = new int[24]; try { images[0] = new BitmapImage(new Uri("/MuscleShooting;component/Resource/TargetSample.png", System.UriKind.Relative)); imageSize[0] = 64; for (int i = 0; i < 4; i++) { images[i + 1] = new BitmapImage(new Uri("/ArrowSimulater;component/Resource/fire" + i.ToString() + ".png", System.UriKind.Relative)); imageSize[i + 1] = 64; }//5 for (int i = 0; i < 7; i++) { images[i + 5] = new BitmapImage(new Uri("/ArrowSimulater;component/Resource/Target/Sample/TargetSample" + i.ToString() + ".png", System.UriKind.Relative)); imageSize[i + 5] = 128; }//12 images[12] = new BitmapImage(new Uri("/ArrowSimulater;component/Resource/Score/Kakejiku.png", System.UriKind.Relative)); imageSize[12] = 100; for (int i = 0; i < 10; i++) { images[i + 13] = new BitmapImage(new Uri("/ArrowSimulater;component/Resource/Score/ArrowSimulaterScore" + i.ToString() + ".png", System.UriKind.Relative)); imageSize[i + 13] = 64; }//23 images[23] = new BitmapImage(new Uri("/ArrowSimulater;component/Resource/Score/Kakejiku2.png", System.UriKind.Relative)); imageSize[23] = 100; } catch { Console.WriteLine("false"); } #else spriteData = new SpriteData[100]; for (int i = 0; i < 100; i++) spriteData[i] = new SpriteData(); try { spriteData[0] = SpriteData.Load("Resource/TargetSample.png", 64, 64); for (int i = 0; i < 4; i++) { spriteData[i + 1] = SpriteData.Load("Resource/fire" + i.ToString() + ".png", 64, 64); }//5 for (int i = 0; i < 7; i++) { spriteData[i + 5] = SpriteData.Load("Resource/Target/Sample/TargetSample" + i.ToString() + ".png", 128, 128); }//12 spriteData[12] = SpriteData.Load("Resource/Score/Kakejiku.png", 100, 360); for (int i = 0; i < 10; i++) { spriteData[i + 13] = SpriteData.Load("Resource/Score/ArrowSimulaterScore" + i.ToString() + ".png", 64, 64); }//23 spriteData[23] = SpriteData.Load("Resource/Score/Kakejiku2.png", 100, 360); spriteData[24] = SpriteData.Load("Resource/Player/MuschoMan00.png", 128, 128); // 25 for (int i = 0; i < 8; i++) { spriteData[i + 25] = SpriteData.Load("Resource/Player/MuschoMan1" + i.ToString() + ".png", 128, 128); } // 33 for (int i = 0; i < 4; i++) { spriteData[i + 33] = SpriteData.Load("Resource/Enemy/Angel0" + i.ToString() + ".png", 64, 64); } // 37 for (int i = 0; i < 3; i++) { spriteData[i + 37] = SpriteData.Load("Resource/Shoot/ShootA0" + i.ToString() + ".png", 64, 64); } // 40 for (int i = 0; i < 10; i++) { spriteData[i + 40] = SpriteData.Load("Resource/Shoot/ShootEx0" + i.ToString() + ".png", 128, 128); } } catch { Console.WriteLine("false"); } #endif sprite = new Sprite[SpriteMax]; for (int i = 0; i < SpriteMax; i++) sprite[i] = new Sprite(); index = 0; }