using System; using System.Collections.Generic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using MonoGameLibrary; using MonoGameLibrary.Graphics; using MonoGameLibrary.Input; using ONDClient.GUI; namespace ONDClient; public class GameMain() : Core("OND", 1280, 720, false) { // private GraphicsDeviceManager _graphics; // private SpriteBatch _spriteBatch; protected override void Initialize() { Exiting += (_, _) => { Client.Disconnect(); }; // Client.Connect("127.0.0.1", 9012); CommandManager.InitInputListeners(); // InputManager.AddListener(InputManager.MouseButton.LEFT, (() => Console.WriteLine("LMB pressed at: " + InputManager.MouseState.Position)), InputTiming.PRESS, new InputListenerHook(true)); base.Initialize(); Client.Init(); UIManager.InitUI(); UIManager.DisplayMainMenu(); } protected override void LoadContent() { UIManager.LoadAssets(); SoundManager.LoadSounds(); // spriteBatch = new SpriteBatch(GraphicsDevice); // font = Content.Load("font"); } protected override void Update(GameTime gameTime) { if (Keyboard.GetState().IsKeyDown(Keys.Escape)){ Exit(); } InputManager.NextInputCycle(); Screen.UpdateAll(); if(Client.State == Client.ConnectionState.IDLE) return; Client.Update(); base.Update(gameTime); } protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.Black); spriteBatch.Begin(samplerState:SamplerState.PointClamp); Screen.DrawCurrentAndOverlay(spriteBatch); // Screen.CurrentScreen.Draw(spriteBatch); // spriteBatch.DrawString(font, "Elapsed time: " + gameTime.TotalGameTime.Milliseconds, new Vector2(10, 10), Color.White); spriteBatch.End(); base.Draw(gameTime); } }