// The GameClass constructor. Here we create, but not show, the GameSettings form. // The public GameClass(MainClass mainClass, Control owner) { gameState = GameStates.Loading; this.owner = owner; this.mainClass = mainClass; splash = new SplashScreen(this); splash.ShowDialog(); gameSettings = new SpaceWar.GameSettings(this); gameSettings.Location = new Point(owner.Bounds.Right, owner.Bounds.Top); gravity = gameSettings.Gravity; gameSpeed = gameSettings.GameSpeed; bounceBack = gameSettings.Bounce; inverseGravity = gameSettings.InverseGravity; blackHole = gameSettings.BlackHole; localDevice = new Microsoft.DirectX.DirectDraw.Device(); localDevice.SetCooperativeLevel(owner, Microsoft.DirectX.DirectDraw.CooperativeLevelFlags.Normal); DXUtil.Timer(DirectXTimer.Start); SpaceWar.RotatableShape.CreateShapes(); input = new InputClass(this.owner); soundHandler = new SoundHandler(this.owner); try { netPeer = new PlayClass(this); } catch (DirectXException e) { MessageBox.Show(owner, e.ToString()); } }
public static Microsoft.DirectX.DirectDraw.Surface bb; //backbuffer public static void init(System.Windows.Forms.Control targ) { //#if!zezuExt dddev = new Microsoft.DirectX.DirectDraw.Device(); dddev.SetCooperativeLevel(targ, Microsoft.DirectX.DirectDraw.CooperativeLevelFlags.Normal); didr.SurfaceCaps caps = new Microsoft.DirectX.DirectDraw.SurfaceCaps(); caps.PrimarySurface = true; didr.SurfaceDescription desc = new Microsoft.DirectX.DirectDraw.SurfaceDescription(caps); fb = new didr.Surface(desc, dddev); fb.Clipper = new Microsoft.DirectX.DirectDraw.Clipper(dddev); fb.Clipper.Window = targ; caps.PrimarySurface = false; desc.Width = 640; desc.Height = 480; //desc.PixelFormatStructure.RgbBitCount= 16; bb = new didr.Surface(desc, dddev); bb.ColorFill(0); //#endif pvr.bitinfo = new DC4Ever.pvr.BITMAPINFOHEADER(); pvr.bitinfo.biSize = 40; pvr.bitinfo.biWidth = 640; pvr.bitinfo.biHeight = -480; pvr.bitinfo.biPlanes = 1; pvr.bitinfo.biBitCount = 16; pvr.bitinfo.biSizeImage = 640 * 480 * 2; }
// The GameClass constructor. Here we create, but not show, the GameSettings form. // The public GameClass(MainClass mainClass, Control owner) { gameState = GameStates.Loading; this.owner = owner; this.mainClass = mainClass; splash = new SplashScreen(this); splash.ShowDialog(); gameSettings = new SpaceWar.GameSettings(this); gameSettings.Location = new Point(owner.Bounds.Right,owner.Bounds.Top); gravity = gameSettings.Gravity; gameSpeed = gameSettings.GameSpeed; bounceBack = gameSettings.Bounce; inverseGravity = gameSettings.InverseGravity; blackHole = gameSettings.BlackHole; localDevice = new Microsoft.DirectX.DirectDraw.Device(); localDevice.SetCooperativeLevel(owner, Microsoft.DirectX.DirectDraw.CooperativeLevelFlags.Normal); DXUtil.Timer(DirectXTimer.Start); SpaceWar.RotatableShape.CreateShapes(); input = new InputClass(this.owner); soundHandler = new SoundHandler(this.owner); try { netPeer = new PlayClass(this); } catch(DirectXException e) { MessageBox.Show(owner,e.ToString()); } }