public EnemyShotManager(DeviceContext ctx, RectTargetManager enemyManager, IMovableRectTarget player) { this.context = ctx; this.player = player; this.enemies = enemyManager; this.Initialize(); }
void CreateDeviceResources() { var defaultDevice = new SharpDX.Direct3D11.Device(DriverType.Hardware, DeviceCreationFlags.Debug | DeviceCreationFlags.BgraSupport); var device = defaultDevice.QueryInterface <SharpDX.Direct3D11.Device1>(); var dxgiDevice2 = device.QueryInterface <SharpDX.DXGI.Device2>(); var dxgiAdapter = dxgiDevice2.Adapter; SharpDX.DXGI.Factory2 dxgiFactory2 = dxgiAdapter.GetParent <SharpDX.DXGI.Factory2>(); var desc = new SwapChainDescription1(); desc.Width = 480; desc.Height = 640; desc.Format = Format.B8G8R8A8_UNorm; desc.Stereo = false; desc.SampleDescription = new SampleDescription(1, 0); desc.Usage = Usage.RenderTargetOutput; desc.BufferCount = 2; desc.Scaling = Scaling.AspectRatioStretch; desc.SwapEffect = SwapEffect.FlipSequential; desc.Flags = SwapChainFlags.AllowModeSwitch; this.swapChain = new SwapChain1(dxgiFactory2, device, new ComObject(mWindow), ref desc); var d2dDevice = new SharpDX.Direct2D1.Device(dxgiDevice2); this.d2dDeviceContext = new SharpDX.Direct2D1.DeviceContext(d2dDevice, DeviceContextOptions.None); var backBuffer = this.swapChain.GetBackBuffer <Surface>(0); var displayInfo = DisplayInformation.GetForCurrentView(); this.d2dTarget = new Bitmap1(this.d2dDeviceContext, backBuffer, new BitmapProperties1(new PixelFormat(Format.B8G8R8A8_UNorm, SharpDX.Direct2D1.AlphaMode.Premultiplied), displayInfo.LogicalDpi, displayInfo.LogicalDpi, BitmapOptions.Target | BitmapOptions.CannotDraw)); this.updateList = new List <IUpdatable>(); // 10.5改変 this.playerShotManager = new PlayerShotManager(this.d2dDeviceContext); this.updateList.Add(this.playerShotManager); this.fighterDisplay = new Fighter(this.d2dDeviceContext, playerShotManager); this.fighterDisplay.SetPosition(540, 240); this.displayList = new List <IDrawable>(); this.displayList.Add(this.fighterDisplay); this.displayList.Add(this.playerShotManager); this.targetManager = new RectTargetManager(this.d2dDeviceContext, this.playerShotManager); this.displayList.Add(this.targetManager); this.updateList.Add(this.targetManager); this.enemyShotManager = new EnemyShotManager(this.d2dDeviceContext, this.targetManager, this.fighterDisplay); this.displayList.Add(this.enemyShotManager); this.updateList.Add(this.enemyShotManager); }