OneNightDuel/ONDClient/GameMain.cs

57 lines
1.4 KiB
C#
Raw Normal View History

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using MonoGameLibrary;
using MonoGameLibrary.Input;
using ONDClient.GUI;
using ONDClient.Net;
using ONDClient.Sound;
namespace ONDClient;
public class GameMain() : Core("OND", 1280, 720, false) {
protected override void Initialize() {
Exiting += (_, _) => {
Client.Disconnect();
};
CommandManager.InitInputListeners();
base.Initialize();
Client.Init();
UIManager.InitUI();
UIManager.DisplayMainMenu();
}
protected override void LoadContent() {
UIManager.LoadAssets();
SoundManager.LoadSounds();
}
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);
spriteBatch.End();
base.Draw(gameTime);
}
}