Graphics = new GraphicsDeviceManager(this) TicTacToeGame.cs (Replaces Game1 from MonoGame template - the comments are automatically generated by the template - I've left them as they are for now, because I don't have much to add right now, and anyway I've used it mostly as a wrapper class). My game is devided into following classes:
Monogame visual studio code code#
In general - I would like to hear how in general this code could be simplified / reorganized / improved while keeping the functionality.Īssume that all the classes live in namespace TicTacToe and have the following lines in the beginning of each file: using System Properties with setters/getters, attributes vs properties - when should each one be used? When I had an object exposed by objects I've tried to expose it as a property - is it right way to do it? Static functions/classes - should I have them at all? However, I did try to provide XML documentation for all of the functions - Is it considered good practice? Or it is should be done only for the functions I expect to use in future?Ībout the access level - When should I make a class public and where should I leave its visibility as default? If I've got it right - public classes will be available outside of the project - however mixing public classes with non-public sometimes would not compile. Is there an idiomatic way to reduce its size?Ībout the comments in general - Most of my functions are short enough, and taking in account my horrible verbal skills, most of code is still self explanatory. The whole thing seems too big and bloated, although I did try not to repeat myself too much. The whole project itself can be found at github. Keeps score for player and the computer.I am using 7.1 version of C# (value tuples here and there.) I've started learning MonoGame and C# lately, so in order to get more confident with both and do something not completely trivial, I've built a Naughts and Crosses game.