63 lines
No EOL
1.9 KiB
C#
63 lines
No EOL
1.9 KiB
C#
using System;
|
|
using FNAF_Clone.GUI;
|
|
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using Microsoft.Xna.Framework.Input;
|
|
using MonoGameLibrary;
|
|
using MonoGameLibrary.Graphics;
|
|
using MonoGameLibrary.Input;
|
|
|
|
namespace FNAF_Clone;
|
|
|
|
public class GameMain() : Core("fnafkooo", 640, 360, false) {
|
|
// private GraphicsDeviceManager _graphics;
|
|
// private SpriteBatch _spriteBatch;
|
|
|
|
private Screen officeScreen = new(Screen.ScreenType.OFFICE);
|
|
|
|
private TextureAtlas testAtlas;
|
|
|
|
protected override void Initialize() {
|
|
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();
|
|
}
|
|
|
|
protected override void LoadContent() {
|
|
// spriteBatch = new SpriteBatch(GraphicsDevice);
|
|
testAtlas = TextureAtlas.FromFile(content, "images/testBlocks-definition.xml");
|
|
|
|
Screen.AddScreen("office", officeScreen, true);
|
|
officeScreen.AddElement("test",
|
|
new UIElement(testAtlas[0], Point.Zero)
|
|
{Pressable = true, OnMousePress = () => Console.WriteLine("Pressed!")}
|
|
);
|
|
}
|
|
|
|
protected override void Update(GameTime gameTime) {
|
|
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed ||
|
|
Keyboard.GetState().IsKeyDown(Keys.Escape))
|
|
Exit();
|
|
|
|
// TODO: Add your update logic here
|
|
|
|
InputManager.NextInputCycle();
|
|
|
|
Client.Update();
|
|
base.Update(gameTime);
|
|
}
|
|
|
|
protected override void Draw(GameTime gameTime) {
|
|
GraphicsDevice.Clear(Color.CornflowerBlue);
|
|
spriteBatch.Begin();
|
|
|
|
Screen.CurrentScreen.Draw(spriteBatch);
|
|
|
|
spriteBatch.End();
|
|
base.Draw(gameTime);
|
|
}
|
|
} |