public static void display(GameWorld.World world, Player player, Character doNotDisplay) { DisplayParameters displayParameters = new DisplayParameters(); if (player.wantsStockpilesDisplayed()) { displayParameters.addParameter(DisplayParameter.drawStockpiles); } RasterizerState rs = new RasterizerState(); rs.CullMode = CullMode.None; device.RasterizerState = rs; device.BlendState = BlendState.Opaque; setStatesForMainDraw(player); world.runPreDrawCalculations(); RasterizerState rasterizerState = new RasterizerState(); rasterizerState.FillMode = FillMode.Solid; rasterizerState.CullMode = CullMode.None; device.RasterizerState = rasterizerState; device.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.DarkSlateBlue, 1.0f, 0); device.SetRenderTarget(renderTarget); device.BlendState = BlendState.NonPremultiplied; device.DepthStencilState = new DepthStencilState() { DepthBufferEnable = true }; display3DObjects(world, player, doNotDisplay, effect, displayParameters); effect.Parameters["xWorld"].SetValue(Matrix.Identity); mainRenderImage = (Texture2D)renderTarget; device.SetRenderTarget(null); device.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.DarkSlateBlue, 1.0f, 0); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Opaque, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullNone); spriteBatch.Draw(mainRenderImage, new Vector2(0, 0), Color.White); spriteBatch.End(); WorldMarkupHandler.resetWorldMarkup(); }
public void loadGame() { IFormatter formatter = new BinaryFormatter(); Stream stream = new FileStream("IsaacsCoolSerial.bin", FileMode.Open, FileAccess.Read, FileShare.Read); world = (GameWorld.World)formatter.Deserialize(stream); stream.Close(); world.setUpAfterGameLoad(); GC.Collect(); }
private static void display3DObjects(GameWorld.World world, Player player, Character doNotDisplay, Effect effectToUse, DisplayParameters displayParameters) { effect.Parameters["xOpacity"].SetValue(1f); world.displayActors(device, effectToUse, doNotDisplay); world.displayIslands(device, effectToUse, new BoundingFrustum(viewMatrix * getPerspectiveMatrix(1000)), displayParameters); player.display3D(); foreach (AnimatedBodyPartGroup group in CharactersForThisFrame) { group.draw(device, effectToUse); } CharactersForThisFrame.Clear(); effect.Parameters["xProjection"].SetValue(getPerspectiveMatrix(2000)); sky.draw(device, effectToUse, viewMatrix, getPerspectiveMatrix(2000), player.getCameraLoc()); effect.Parameters["xProjection"].SetValue(getPerspectiveMatrix(1000)); ocean.draw(device, viewMatrix, getPerspectiveMatrix(1000), player.getCameraLoc(), ambientBrightness); effect.CurrentTechnique = effect.Techniques["Instanced"]; WorldMarkupHandler.drawCharacters(device, effect); effect.CurrentTechnique = effect.Techniques["Colored"]; }
public void newGame() { world = new World(); }