2015-05-12 16:48:58 -06:00
|
|
|
|
using System;
|
|
|
|
|
using Microsoft.Xna.Framework;
|
|
|
|
|
using Microsoft.Xna.Framework.Input;
|
2015-05-12 17:39:34 -06:00
|
|
|
|
using Microsoft.Xna.Framework.Graphics;
|
2015-05-13 11:30:29 -06:00
|
|
|
|
using System.Collections.Generic;
|
2015-05-16 21:50:10 -06:00
|
|
|
|
using TrueCraft.Client.Interface;
|
2015-05-13 11:30:29 -06:00
|
|
|
|
using System.IO;
|
2015-05-13 14:20:35 -06:00
|
|
|
|
using System.Net;
|
2015-05-13 16:26:23 -06:00
|
|
|
|
using TrueCraft.API;
|
2015-05-16 21:50:10 -06:00
|
|
|
|
using TrueCraft.Client.Rendering;
|
2015-05-14 18:47:16 -06:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.ComponentModel;
|
2015-05-17 16:18:09 -06:00
|
|
|
|
using TrueCraft.Core.Networking.Packets;
|
|
|
|
|
using TrueCraft.API.World;
|
2015-05-17 16:52:16 -06:00
|
|
|
|
using System.Collections.Concurrent;
|
2015-05-12 16:48:58 -06:00
|
|
|
|
|
2015-05-16 21:50:10 -06:00
|
|
|
|
namespace TrueCraft.Client
|
2015-05-12 16:48:58 -06:00
|
|
|
|
{
|
|
|
|
|
public class TrueCraftGame : Game
|
|
|
|
|
{
|
2015-05-12 17:30:56 -06:00
|
|
|
|
private MultiplayerClient Client { get; set; }
|
2015-05-12 16:48:58 -06:00
|
|
|
|
private GraphicsDeviceManager Graphics { get; set; }
|
2015-05-13 11:30:29 -06:00
|
|
|
|
private List<IGameInterface> Interfaces { get; set; }
|
|
|
|
|
private FontRenderer DejaVu { get; set; }
|
|
|
|
|
private SpriteBatch SpriteBatch { get; set; }
|
2015-05-13 14:20:35 -06:00
|
|
|
|
private IPEndPoint EndPoint { get; set; }
|
2015-05-30 14:14:35 -06:00
|
|
|
|
private ChunkRenderer ChunkConverter { get; set; }
|
2015-05-13 16:26:23 -06:00
|
|
|
|
private DateTime NextPhysicsUpdate { get; set; }
|
2015-05-29 18:20:24 -06:00
|
|
|
|
private List<ChunkMesh> ChunkMeshes { get; set; }
|
2015-05-24 11:07:13 -06:00
|
|
|
|
private ConcurrentBag<Action> PendingMainThreadActions { get; set; }
|
2015-05-29 18:20:24 -06:00
|
|
|
|
private ConcurrentBag<ChunkMesh> IncomingChunks { get; set; }
|
|
|
|
|
private ConcurrentBag<ChunkMesh> IncomingTransparentChunks { get; set; }
|
|
|
|
|
private List<ChunkMesh> TransparentChunkMeshes { get; set; }
|
2015-05-14 18:47:16 -06:00
|
|
|
|
private Matrix Camera;
|
|
|
|
|
private Matrix Perspective;
|
2015-05-15 15:48:20 -06:00
|
|
|
|
private BoundingFrustum CameraView;
|
2015-05-17 16:18:09 -06:00
|
|
|
|
private bool MouseCaptured;
|
|
|
|
|
private KeyboardState PreviousKeyboardState;
|
2015-05-13 23:09:49 -06:00
|
|
|
|
|
2015-05-14 18:47:16 -06:00
|
|
|
|
private BasicEffect OpaqueEffect, TransparentEffect;
|
2015-05-12 17:39:34 -06:00
|
|
|
|
|
2015-05-13 14:20:35 -06:00
|
|
|
|
public TrueCraftGame(MultiplayerClient client, IPEndPoint endPoint)
|
2015-05-12 16:48:58 -06:00
|
|
|
|
{
|
|
|
|
|
Window.Title = "TrueCraft";
|
2015-05-13 11:30:29 -06:00
|
|
|
|
Content.RootDirectory = "Content";
|
2015-05-12 16:48:58 -06:00
|
|
|
|
Graphics = new GraphicsDeviceManager(this);
|
|
|
|
|
Graphics.IsFullScreen = false;
|
2015-05-12 17:39:34 -06:00
|
|
|
|
Graphics.PreferredBackBufferWidth = 1280;
|
|
|
|
|
Graphics.PreferredBackBufferHeight = 720;
|
2015-05-12 17:30:56 -06:00
|
|
|
|
Client = client;
|
2015-05-13 14:20:35 -06:00
|
|
|
|
EndPoint = endPoint;
|
2015-05-13 16:26:23 -06:00
|
|
|
|
NextPhysicsUpdate = DateTime.MinValue;
|
2015-05-29 18:20:24 -06:00
|
|
|
|
ChunkMeshes = new List<ChunkMesh>();
|
|
|
|
|
TransparentChunkMeshes = new List<ChunkMesh>();
|
|
|
|
|
IncomingChunks = new ConcurrentBag<ChunkMesh>();
|
|
|
|
|
IncomingTransparentChunks = new ConcurrentBag<ChunkMesh>();
|
2015-05-24 11:07:13 -06:00
|
|
|
|
PendingMainThreadActions = new ConcurrentBag<Action>();
|
2015-05-17 16:18:09 -06:00
|
|
|
|
MouseCaptured = true;
|
2015-05-12 16:48:58 -06:00
|
|
|
|
}
|
|
|
|
|
|
2015-05-13 11:30:29 -06:00
|
|
|
|
protected override void Initialize()
|
|
|
|
|
{
|
|
|
|
|
Interfaces = new List<IGameInterface>();
|
|
|
|
|
SpriteBatch = new SpriteBatch(GraphicsDevice);
|
2015-05-13 14:20:35 -06:00
|
|
|
|
base.Initialize(); // (calls LoadContent)
|
2015-05-30 14:14:35 -06:00
|
|
|
|
ChunkConverter = new ChunkRenderer(Graphics.GraphicsDevice, Client.World.World.BlockRepository);
|
2015-05-13 23:09:49 -06:00
|
|
|
|
Client.ChunkLoaded += (sender, e) => ChunkConverter.QueueChunk(e.Chunk);
|
2015-05-29 18:20:24 -06:00
|
|
|
|
Client.ChunkModified += (sender, e) => ChunkConverter.QueueHighPriorityChunk(e.Chunk);
|
2015-05-29 15:46:44 -06:00
|
|
|
|
ChunkConverter.MeshGenerated += ChunkConverter_MeshGenerated;
|
|
|
|
|
ChunkConverter.Start();
|
2015-05-14 18:47:16 -06:00
|
|
|
|
Client.PropertyChanged += HandleClientPropertyChanged;
|
2015-05-13 14:20:35 -06:00
|
|
|
|
Client.Connect(EndPoint);
|
2015-05-13 23:09:49 -06:00
|
|
|
|
var centerX = GraphicsDevice.Viewport.Width / 2;
|
|
|
|
|
var centerY = GraphicsDevice.Viewport.Height / 2;
|
|
|
|
|
Mouse.SetPosition(centerX, centerY);
|
2015-05-14 18:47:16 -06:00
|
|
|
|
UpdateMatricies();
|
2015-05-17 16:18:09 -06:00
|
|
|
|
PreviousKeyboardState = Keyboard.GetState();
|
2015-05-14 18:47:16 -06:00
|
|
|
|
}
|
|
|
|
|
|
2015-05-30 14:14:35 -06:00
|
|
|
|
void ChunkConverter_MeshGenerated(object sender, ChunkRenderer.MeshGeneratedEventArgs e)
|
2015-05-29 15:46:44 -06:00
|
|
|
|
{
|
|
|
|
|
if (e.Transparent)
|
|
|
|
|
IncomingTransparentChunks.Add(e.Mesh);
|
|
|
|
|
else
|
|
|
|
|
IncomingChunks.Add(e.Mesh);
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-14 18:47:16 -06:00
|
|
|
|
void HandleClientPropertyChanged(object sender, PropertyChangedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
switch (e.PropertyName)
|
|
|
|
|
{
|
|
|
|
|
case "Position":
|
|
|
|
|
UpdateMatricies();
|
2015-05-30 14:14:35 -06:00
|
|
|
|
var sorter = new ChunkRenderer.ChunkSorter(new Coordinates3D(
|
2015-05-14 18:47:16 -06:00
|
|
|
|
(int)Client.Position.X, 0, (int)Client.Position.Z));
|
2015-05-24 11:07:13 -06:00
|
|
|
|
PendingMainThreadActions.Add(() => TransparentChunkMeshes.Sort(sorter));
|
2015-05-14 18:47:16 -06:00
|
|
|
|
break;
|
|
|
|
|
}
|
2015-05-13 11:30:29 -06:00
|
|
|
|
}
|
|
|
|
|
|
2015-05-12 17:39:34 -06:00
|
|
|
|
protected override void LoadContent()
|
|
|
|
|
{
|
2015-05-13 11:30:29 -06:00
|
|
|
|
FontFile fontFile;
|
|
|
|
|
using (var f = File.OpenRead(Path.Combine(Content.RootDirectory, "dejavu.fnt")))
|
|
|
|
|
fontFile = FontLoader.Load(f);
|
|
|
|
|
var fontTexture = Content.Load<Texture2D>("dejavu_0.png");
|
|
|
|
|
DejaVu = new FontRenderer(fontFile, fontTexture);
|
|
|
|
|
Interfaces.Add(new ChatInterface(Client, DejaVu));
|
2015-05-14 18:47:16 -06:00
|
|
|
|
|
|
|
|
|
OpaqueEffect = new BasicEffect(GraphicsDevice);
|
|
|
|
|
OpaqueEffect.EnableDefaultLighting();
|
|
|
|
|
OpaqueEffect.DirectionalLight0.SpecularColor = Color.Black.ToVector3();
|
|
|
|
|
OpaqueEffect.DirectionalLight1.SpecularColor = Color.Black.ToVector3();
|
|
|
|
|
OpaqueEffect.DirectionalLight2.SpecularColor = Color.Black.ToVector3();
|
|
|
|
|
OpaqueEffect.TextureEnabled = true;
|
|
|
|
|
OpaqueEffect.Texture = Texture2D.FromStream(GraphicsDevice, File.OpenRead("Content/terrain.png"));
|
2015-05-15 15:48:20 -06:00
|
|
|
|
OpaqueEffect.FogEnabled = true;
|
|
|
|
|
OpaqueEffect.FogStart = 512f;
|
|
|
|
|
OpaqueEffect.FogEnd = 1000f;
|
|
|
|
|
OpaqueEffect.FogColor = Color.CornflowerBlue.ToVector3();
|
2015-05-14 18:47:16 -06:00
|
|
|
|
|
|
|
|
|
TransparentEffect = new BasicEffect(GraphicsDevice);
|
|
|
|
|
TransparentEffect.TextureEnabled = true;
|
|
|
|
|
TransparentEffect.Texture = Texture2D.FromStream(GraphicsDevice, File.OpenRead("Content/terrain.png"));
|
|
|
|
|
|
2015-05-12 17:39:34 -06:00
|
|
|
|
base.LoadContent();
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-13 16:26:23 -06:00
|
|
|
|
protected override void OnExiting(object sender, EventArgs args)
|
2015-05-12 16:48:58 -06:00
|
|
|
|
{
|
2015-05-13 16:26:23 -06:00
|
|
|
|
ChunkConverter.Stop();
|
|
|
|
|
base.OnExiting(sender, args);
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-17 16:18:09 -06:00
|
|
|
|
protected virtual void UpdateKeyboard(GameTime gameTime, KeyboardState state, KeyboardState oldState)
|
2015-05-13 16:26:23 -06:00
|
|
|
|
{
|
|
|
|
|
if (state.IsKeyDown(Keys.Escape))
|
2015-05-12 16:48:58 -06:00
|
|
|
|
Exit();
|
2015-05-17 16:52:16 -06:00
|
|
|
|
|
2015-05-13 16:26:23 -06:00
|
|
|
|
// TODO: Rebindable keys
|
|
|
|
|
// TODO: Horizontal terrain collisions
|
2015-05-17 16:52:16 -06:00
|
|
|
|
|
2015-05-13 23:45:13 -06:00
|
|
|
|
Microsoft.Xna.Framework.Vector3 delta = Microsoft.Xna.Framework.Vector3.Zero;
|
2015-05-17 16:52:16 -06:00
|
|
|
|
|
2015-05-13 16:26:23 -06:00
|
|
|
|
if (state.IsKeyDown(Keys.Left) || state.IsKeyDown(Keys.A))
|
2015-05-13 23:45:13 -06:00
|
|
|
|
delta += Microsoft.Xna.Framework.Vector3.Left;
|
2015-05-13 16:26:23 -06:00
|
|
|
|
if (state.IsKeyDown(Keys.Right) || state.IsKeyDown(Keys.D))
|
2015-05-13 23:45:13 -06:00
|
|
|
|
delta += Microsoft.Xna.Framework.Vector3.Right;
|
2015-05-13 16:26:23 -06:00
|
|
|
|
if (state.IsKeyDown(Keys.Up) || state.IsKeyDown(Keys.W))
|
2015-05-13 23:45:13 -06:00
|
|
|
|
delta += Microsoft.Xna.Framework.Vector3.Forward;
|
2015-05-13 16:26:23 -06:00
|
|
|
|
if (state.IsKeyDown(Keys.Down) || state.IsKeyDown(Keys.S))
|
2015-05-13 23:45:13 -06:00
|
|
|
|
delta += Microsoft.Xna.Framework.Vector3.Backward;
|
2015-05-17 16:18:09 -06:00
|
|
|
|
|
2015-05-17 16:52:16 -06:00
|
|
|
|
if (delta != Microsoft.Xna.Framework.Vector3.Zero)
|
|
|
|
|
{
|
|
|
|
|
var lookAt = Microsoft.Xna.Framework.Vector3.Transform(
|
|
|
|
|
delta, Matrix.CreateRotationY(MathHelper.ToRadians(Client.Yaw)));
|
2015-05-13 23:45:13 -06:00
|
|
|
|
|
2015-05-17 16:52:16 -06:00
|
|
|
|
Client.Position += new TrueCraft.API.Vector3(lookAt.X, lookAt.Y, lookAt.Z) * (gameTime.ElapsedGameTime.TotalSeconds * 4.3717);
|
|
|
|
|
}
|
2015-05-13 23:09:49 -06:00
|
|
|
|
|
2015-05-17 16:52:16 -06:00
|
|
|
|
if (state.IsKeyUp(Keys.Tab) && oldState.IsKeyDown(Keys.Tab))
|
|
|
|
|
MouseCaptured = !MouseCaptured;
|
2015-05-17 16:18:09 -06:00
|
|
|
|
if (MouseCaptured)
|
|
|
|
|
{
|
|
|
|
|
var centerX = GraphicsDevice.Viewport.Width / 2;
|
|
|
|
|
var centerY = GraphicsDevice.Viewport.Height / 2;
|
|
|
|
|
var mouse = Mouse.GetState();
|
|
|
|
|
var look = new Vector2(centerX - mouse.Position.X, centerY - mouse.Position.Y)
|
|
|
|
|
* (float)(gameTime.ElapsedGameTime.TotalSeconds * 70);
|
|
|
|
|
Mouse.SetPosition(centerX, centerY);
|
|
|
|
|
Client.Yaw += look.X;
|
|
|
|
|
Client.Pitch += look.Y;
|
|
|
|
|
Client.Yaw %= 360;
|
2015-05-29 17:43:23 -06:00
|
|
|
|
Client.Pitch = MathHelper.Clamp(Client.Pitch, -89.9f, 89.9f);
|
2015-05-17 16:18:09 -06:00
|
|
|
|
|
|
|
|
|
if (look != Vector2.Zero)
|
|
|
|
|
UpdateMatricies();
|
|
|
|
|
}
|
2015-05-13 16:26:23 -06:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void Update(GameTime gameTime)
|
|
|
|
|
{
|
2015-05-13 11:30:29 -06:00
|
|
|
|
foreach (var i in Interfaces)
|
|
|
|
|
{
|
|
|
|
|
i.Update(gameTime);
|
|
|
|
|
}
|
2015-05-17 16:52:16 -06:00
|
|
|
|
|
2015-05-29 18:20:24 -06:00
|
|
|
|
ChunkMesh mesh;
|
2015-05-24 11:07:13 -06:00
|
|
|
|
if (IncomingChunks.TryTake(out mesh))
|
2015-05-29 18:20:24 -06:00
|
|
|
|
{
|
|
|
|
|
var existing = ChunkMeshes.SingleOrDefault(m => m.Chunk.Chunk.Coordinates == mesh.Chunk.Chunk.Coordinates);
|
|
|
|
|
if (existing != null)
|
|
|
|
|
ChunkMeshes.Remove(existing);
|
2015-05-17 16:52:16 -06:00
|
|
|
|
ChunkMeshes.Add(mesh);
|
2015-05-29 18:20:24 -06:00
|
|
|
|
}
|
|
|
|
|
if (IncomingTransparentChunks.TryTake(out mesh)) // TODO: re-render transparent meshes
|
2015-05-17 16:52:16 -06:00
|
|
|
|
TransparentChunkMeshes.Add(mesh);
|
|
|
|
|
Action action;
|
2015-05-24 11:07:13 -06:00
|
|
|
|
if (PendingMainThreadActions.TryTake(out action))
|
2015-05-17 16:52:16 -06:00
|
|
|
|
action();
|
|
|
|
|
|
|
|
|
|
if (NextPhysicsUpdate < DateTime.Now && Client.LoggedIn)
|
2015-05-13 16:26:23 -06:00
|
|
|
|
{
|
2015-05-17 16:18:09 -06:00
|
|
|
|
IChunk chunk;
|
|
|
|
|
var adjusted = Client.World.World.FindBlockPosition(new Coordinates3D((int)Client.Position.X, 0, (int)Client.Position.Z), out chunk);
|
2015-05-17 16:52:16 -06:00
|
|
|
|
if (chunk != null)
|
2015-05-17 16:18:09 -06:00
|
|
|
|
{
|
|
|
|
|
if (chunk.GetHeight((byte)adjusted.X, (byte)adjusted.Z) != 0)
|
|
|
|
|
Client.Physics.Update();
|
|
|
|
|
}
|
2015-05-17 16:52:16 -06:00
|
|
|
|
// NOTE: This is to make the vanilla server send us chunk packets
|
|
|
|
|
// We should eventually make some means of detecing that we're on a vanilla server to enable this
|
|
|
|
|
// It's a waste of bandwidth to do it on a TrueCraft server
|
|
|
|
|
Client.QueuePacket(new PlayerGroundedPacket { OnGround = true });
|
|
|
|
|
Client.QueuePacket(new PlayerPositionAndLookPacket(Client.Position.X, Client.Position.Y,
|
|
|
|
|
Client.Position.Y + MultiplayerClient.Height, Client.Position.Z, Client.Yaw, Client.Pitch, false));
|
2015-05-13 16:26:23 -06:00
|
|
|
|
NextPhysicsUpdate = DateTime.Now.AddMilliseconds(1000 / 20);
|
|
|
|
|
}
|
2015-05-17 16:18:09 -06:00
|
|
|
|
var state = Keyboard.GetState();
|
|
|
|
|
UpdateKeyboard(gameTime, state, PreviousKeyboardState);
|
|
|
|
|
PreviousKeyboardState = state;
|
2015-05-12 16:48:58 -06:00
|
|
|
|
base.Update(gameTime);
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-14 18:47:16 -06:00
|
|
|
|
private void UpdateMatricies()
|
2015-05-12 16:48:58 -06:00
|
|
|
|
{
|
2015-05-13 23:09:49 -06:00
|
|
|
|
var player = new Microsoft.Xna.Framework.Vector3(
|
|
|
|
|
(float)Client.Position.X,
|
2015-05-16 19:25:16 -06:00
|
|
|
|
(float)(Client.Position.Y + (Client.Size.Height / 2)),
|
2015-05-13 23:09:49 -06:00
|
|
|
|
(float)Client.Position.Z);
|
|
|
|
|
|
|
|
|
|
var lookAt = Microsoft.Xna.Framework.Vector3.Transform(
|
|
|
|
|
new Microsoft.Xna.Framework.Vector3(0, 0, -1),
|
|
|
|
|
Matrix.CreateRotationX(MathHelper.ToRadians(Client.Pitch)) * Matrix.CreateRotationY(MathHelper.ToRadians(Client.Yaw)));
|
|
|
|
|
|
2015-05-14 18:47:16 -06:00
|
|
|
|
Camera = Matrix.CreateLookAt(
|
2015-05-13 23:09:49 -06:00
|
|
|
|
player, player + lookAt,
|
|
|
|
|
Microsoft.Xna.Framework.Vector3.Up);
|
|
|
|
|
|
2015-05-15 15:48:20 -06:00
|
|
|
|
Perspective = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(70f), GraphicsDevice.Viewport.AspectRatio, 0.01f, 1000f);
|
|
|
|
|
|
|
|
|
|
CameraView = new BoundingFrustum(Camera * Perspective);
|
2015-05-17 16:52:16 -06:00
|
|
|
|
|
|
|
|
|
OpaqueEffect.View = TransparentEffect.View = Camera;
|
|
|
|
|
OpaqueEffect.Projection = TransparentEffect.Projection = Perspective;
|
|
|
|
|
OpaqueEffect.World = TransparentEffect.World = Matrix.Identity;
|
2015-05-14 18:47:16 -06:00
|
|
|
|
}
|
2015-05-13 23:09:49 -06:00
|
|
|
|
|
2015-05-14 18:47:16 -06:00
|
|
|
|
protected override void Draw(GameTime gameTime)
|
|
|
|
|
{
|
2015-05-12 16:48:58 -06:00
|
|
|
|
Graphics.GraphicsDevice.Clear(Color.CornflowerBlue);
|
2015-05-13 23:45:13 -06:00
|
|
|
|
GraphicsDevice.SamplerStates[0] = SamplerState.PointClamp;
|
|
|
|
|
GraphicsDevice.SamplerStates[1] = SamplerState.PointClamp;
|
2015-05-17 16:18:09 -06:00
|
|
|
|
GraphicsDevice.BlendState = BlendState.AlphaBlend;
|
2015-05-13 23:09:49 -06:00
|
|
|
|
|
2015-05-15 15:48:20 -06:00
|
|
|
|
int verticies = 0, chunks = 0;
|
2015-05-17 16:52:16 -06:00
|
|
|
|
GraphicsDevice.DepthStencilState = DepthStencilState.Default;
|
|
|
|
|
for (int i = 0; i < ChunkMeshes.Count; i++)
|
2015-05-13 23:09:49 -06:00
|
|
|
|
{
|
2015-05-17 16:52:16 -06:00
|
|
|
|
if (CameraView.Intersects(ChunkMeshes[i].BoundingBox))
|
2015-05-15 15:48:20 -06:00
|
|
|
|
{
|
2015-05-17 16:52:16 -06:00
|
|
|
|
verticies += ChunkMeshes[i].Verticies.VertexCount;
|
|
|
|
|
chunks++;
|
|
|
|
|
ChunkMeshes[i].Draw(OpaqueEffect);
|
2015-05-15 15:48:20 -06:00
|
|
|
|
}
|
2015-05-17 16:52:16 -06:00
|
|
|
|
}
|
|
|
|
|
GraphicsDevice.DepthStencilState = DepthStencilState.DepthRead;
|
|
|
|
|
for (int i = 0; i < TransparentChunkMeshes.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
if (CameraView.Intersects(TransparentChunkMeshes[i].BoundingBox))
|
2015-05-15 15:48:20 -06:00
|
|
|
|
{
|
2015-05-17 16:52:16 -06:00
|
|
|
|
if (TransparentChunkMeshes[i].Verticies != null)
|
|
|
|
|
verticies += TransparentChunkMeshes[i].Verticies.VertexCount;
|
|
|
|
|
TransparentChunkMeshes[i].Draw(TransparentEffect);
|
2015-05-15 15:48:20 -06:00
|
|
|
|
}
|
2015-05-13 23:09:49 -06:00
|
|
|
|
}
|
2015-05-14 18:47:16 -06:00
|
|
|
|
GraphicsDevice.DepthStencilState = DepthStencilState.Default;
|
2015-05-13 23:09:49 -06:00
|
|
|
|
|
2015-05-13 11:30:29 -06:00
|
|
|
|
SpriteBatch.Begin();
|
2015-05-17 16:52:16 -06:00
|
|
|
|
for (int i = 0; i < Interfaces.Count; i++)
|
2015-05-13 11:30:29 -06:00
|
|
|
|
{
|
2015-05-17 16:52:16 -06:00
|
|
|
|
Interfaces[i].DrawSprites(gameTime, SpriteBatch);
|
2015-05-13 11:30:29 -06:00
|
|
|
|
}
|
2015-05-15 15:25:09 -06:00
|
|
|
|
|
|
|
|
|
int fps = (int)(1 / gameTime.ElapsedGameTime.TotalSeconds);
|
2015-05-15 15:48:20 -06:00
|
|
|
|
DejaVu.DrawText(SpriteBatch, 0, GraphicsDevice.Viewport.Height - 30,
|
2015-05-30 14:14:35 -06:00
|
|
|
|
string.Format("{0} FPS, {1} verticies, {2} chunks, {3}", fps + 1, verticies, chunks, Client.Position));
|
2015-05-13 11:30:29 -06:00
|
|
|
|
SpriteBatch.End();
|
2015-05-17 16:52:16 -06:00
|
|
|
|
|
2015-05-12 16:48:58 -06:00
|
|
|
|
base.Draw(gameTime);
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-05-29 17:43:23 -06:00
|
|
|
|
}
|