private static void Main() { ThreadedConsole.WriteLine("Starting the engine..."); using (var game = new Engine()) game.Run(); ThreadedConsole.WriteLine("Engine shut down, exiting..."); }
protected override void Initialize() { ThreadedConsole.WriteLine("[Engine] Initializing components..."); ThreadedConsole.WriteLine("[Engine] Further initialization handed over to SceneManager..."); SceneManager.Initialize(); base.Initialize(); }
protected override void LoadContent() { ThreadedConsole.WriteLine("[Engine] Loading Fonts..."); Fonts.LoadContent(); ThreadedConsole.WriteLine("[Engine] Further content loading handed over to SceneManager..."); SceneManager.LoadContent(); Sw.Start(); }
public override void LoadContent() { ThreadedConsole.WriteLine("[Scene][InfiniteWorld] Loading content..."); UIRect.Initialize(); //lightMask = Engine.Instance.Content.Load<Texture2D>("Shaders/lightmask"); //effect1 = Engine.Instance.Content.Load<Effect>("Shaders/lighteffect"); ThreadedConsole.WriteLine("[Scene][InfiniteWorld] Loading handed over to base class."); base.LoadContent(); }
public void ConnectAsync(string ip, ushort port) { ThreadedConsole.WriteLine("Connecting to Server..."); ReceiveQueue.Start(OnPacket); Socket = new ClientSocket(this); Socket.OnDisconnect += Disconnected; Socket.OnConnected += Connected; Socket.ConnectAsync(ip, port); }
public override void Initialize() { ThreadedConsole.WriteLine("[Scene][InfiniteWorld] Initializing components..."); TileSet = new TileSet(32); TileSet.Slice(); Entities.Add(new Player(32, 0.1f)); Entities.Add(new Cursor(32)); lightsTarget = new RenderTarget2D(Engine.Graphics.GraphicsDevice, Engine.Graphics.PreferredBackBufferWidth, Engine.Graphics.PreferredBackBufferHeight); mainTarget = new RenderTarget2D(Engine.Graphics.GraphicsDevice, Engine.Graphics.PreferredBackBufferWidth, Engine.Graphics.PreferredBackBufferHeight); ThreadedConsole.WriteLine("[Scene][InfiniteWorld] Initialization handed over to base class."); base.Initialize(); }
internal static void Handle(Player player, MsgLogin packet) { player.UniqueId = packet.UniqueId; var(user, pass) = packet.GetUserPass(); ThreadedConsole.WriteLine("[Net][MsgLogin] Login Packet for Player " + user + " using password: "******"[Net][MsgLogin] " + user + " failed to authenticate! (not implemented)"); } else { ThreadedConsole.WriteLine("[Net][MsgLogin] " + user + " authenticated! (not implemented)"); } }
public static void Handle(Player player, byte[] buffer) { var msgPing = (MsgPing)buffer; if (msgPing.Ping == 0) { player.Socket.Send(msgPing); } else { ThreadedConsole.WriteLine("[Net][MsgPing] Ping: " + msgPing.Ping); FpsCounter.Ping = msgPing.Ping; } }
internal static Entity Spawn(uint uniqueId, Vector2 position) { var entity = new Entity(32, 0.01f) { UniqueId = uniqueId, Position = position, Destination = position }; entity.Initialize(); entity.LoadContent(); entity.Position = position; entity.Destination = position; Collections.Entities.TryAdd(entity.UniqueId, entity); ThreadedConsole.WriteLine("[Entity] Spawning new Entity#" + entity.UniqueId); return(entity); }
public Engine() { ThreadedConsole.WriteLine("[Engine] Initializing Engine..."); IsFixedTimeStep = true; Graphics = new GraphicsDeviceManager(this) { SynchronizeWithVerticalRetrace = GraphicsSettings.Instance.VSync, PreferredBackBufferHeight = GraphicsSettings.Instance.Height, PreferredBackBufferWidth = GraphicsSettings.Instance.Width, IsFullScreen = GraphicsSettings.Instance.Fullscreen, }; TargetElapsedTime = TimeSpan.FromMilliseconds(6); ThreadedConsole.WriteLine("[Engine] Applying Graphics Settings..."); Graphics.ApplyChanges(); Content.RootDirectory = "Content"; IsMouseVisible = true; Instance = this; ThreadedConsole.WriteLine("[Engine] Creating SpriteBatch..."); SpriteBatch = new SpriteBatch(GraphicsDevice); ThreadedConsole.WriteLine("[Engine] Starting Scene 0..."); SceneManager.SetState(SceneEnum.Splash); }
public static void Handle(Player player, MsgWalk packet) { var uniqueId = packet.UniqueId; var location = new Vector2(packet.X, packet.Y); var tickCount = packet.TickCount; Entity entity = null; if (uniqueId == player.UniqueId) { return; } if (Collections.Entities.TryGetValue(uniqueId, out entity)) { ThreadedConsole.WriteLine("[Net][MsgWalk] Walk Packet for existing Player #" + entity.UniqueId); entity.MoveTo(location); } else { entity = Entity.Spawn(uniqueId, location); ThreadedConsole.WriteLine("[Net][MsgWalk] Walk Packet for New Player #" + entity.UniqueId); SceneManager.CurrentScene.Entities.Add(entity); } }
public InfiniteWorld() { ThreadedConsole.WriteLine("[Scene][InfiniteWorld] Constructor called!"); }
public void Destroy() { ThreadedConsole.WriteLine("[Entity] Destructor called. Killing Entity#" + UniqueId); State = SpriteState.Disposing; Collections.Entities.TryRemove(UniqueId, out _); }
private void Disconnected() { ThreadedConsole.WriteLine("[Player][Net] DISCONNECTED! Reconnecting..."); ConnectAsync(Ip, Port); }
private void Connected() { ThreadedConsole.WriteLine("[Player][Net] CONNECTED! :D"); IsConnected = true; }