public InterfaceManager(TradingGame game) { this.game = game; this.console = new GraphicConsole(game, 100, 37); this.interfaces = new Dictionary <string, Interface>(); CurrentCursorPosition = Point.Empty; PreviousCursorPosition = Point.Empty; this.game.MouseDown += Game_MouseDown; this.game.MouseUp += Game_MouseUp; this.game.MouseEnter += Game_MouseEnter; this.game.MouseLeave += Game_MouseLeave; this.game.MouseMove += Game_MouseMove; this.game.MouseWheel += Game_MouseWheel; this.game.KeyPress += Game_KeyPress; this.game.KeyUp += Game_KeyUp; this.game.KeyDown += Game_KeyDown; this.interfaces.Add("Start", new StartScreen(this)); this.interfaces.Add("NewGame", new NewGameScreen(this)); this.interfaces.Add("Ship", new ShipScreen(this)); this.interfaces.Add("Travel", new TravelScreen(this)); this.interfaces.Add("System", new SystemScreen(this)); this.interfaces.Add("Trading", new TradingScreen(this)); this.interfaces.Add("Build", new BuildScreen(this)); this.interfaces.Add("Stock", new StockMarketScreen(this)); this.interfaces.Add("Combat", new CombatScreen(this)); this.interfaces.Add("Final", new FinalScreen(this)); ChangeInterface("Start"); }
} //Default public GraphicConsole(TradingGame game, int bufferWidth, int bufferHeight) { this.game = game; this.left = 0; this.top = 0; this.bufferWidth = bufferWidth; this.bufferHeight = bufferHeight; this.foregroundColor = Color.White; this.backgroundColor = Color.Black; this.drawingBounds = new Rectangle(0, 0, bufferWidth, bufferHeight); this.drawingUtilities = new DrawingUtilities(this); this.charset = new Charset(game.Content, 8, 12); this.initShader(); this.consoleShader.Use(); this.characterMatrix = new CharToken[this.bufferWidth, this.bufferHeight]; for (int y = 0; y < this.bufferHeight; y++) { for (int x = 0; x < this.bufferWidth; x++) { this.characterMatrix[x, y] = new CharToken() { X = x, Y = y, Token = ' ', TextureCoords = new Vector2(0.0f, 0.0f), ForegroundColor = Color.White, BackgroundColor = Color.Black }; } } this.setVertexBuffer(); game.MouseMove += Window_MouseMove; //For updating CursorLeft and CursorTop //Initialze OpenGL drawing settings GL.Enable(EnableCap.Texture2D); GL.Enable(EnableCap.Blend); GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); GL.BindTexture(TextureTarget.Texture2D, charset.TextureID); }
public GameManager(TradingGame game) { this.game = game; //Init Factories Factories.ProductFactory.Init(); Factories.ModFactory.Init(); Factories.ShipFactory.Init(); systems = new List <StarSystem>(); factions = new List <Faction>(); Ships = new List <Ship>(); Pathfinder = new Pathfinder(this); CombatSimulator = new CombatSimulator(this); }
//TODO Create a bounding function that prevents drawing out of a specific square public GraphicConsole(TradingGame game) : this(game, 80, 30) { } //Default