make a bunch of fields readonly
GitOrigin-RevId: 0c3533c6509a6f0199410e977d3377c34b4a753d
This commit is contained in:
parent
0c7c15c047
commit
4b14aef1b5
@ -28,9 +28,9 @@ namespace SemiColinGames {
|
||||
|
||||
public static bool Enabled;
|
||||
// This is a LinkedList instead of a List because SetFpsText() adds to its front.
|
||||
static LinkedList<string> toasts = new LinkedList<string>();
|
||||
static List<DebugRect> rects = new List<DebugRect>();
|
||||
static List<DebugLine> lines = new List<DebugLine>();
|
||||
static readonly LinkedList<string> toasts = new LinkedList<string>();
|
||||
static readonly List<DebugRect> rects = new List<DebugRect>();
|
||||
static readonly List<DebugLine> lines = new List<DebugLine>();
|
||||
|
||||
static Texture2D whiteTexture;
|
||||
|
||||
|
@ -11,9 +11,9 @@ namespace SemiColinGames {
|
||||
private const int jumpSpeed = -600;
|
||||
private const int gravity = 2400;
|
||||
|
||||
private Texture2D texture;
|
||||
private const int spriteSize = 48;
|
||||
private const int spriteWidth = 7;
|
||||
private readonly Texture2D texture;
|
||||
|
||||
private Point position = new Point(64, 16 * 14);
|
||||
private int jumps = 0;
|
||||
|
@ -7,7 +7,7 @@ using System.Collections.Generic;
|
||||
|
||||
namespace SemiColinGames {
|
||||
public class SneakGame : Game {
|
||||
GraphicsDeviceManager graphics;
|
||||
readonly GraphicsDeviceManager graphics;
|
||||
RenderTarget2D renderTarget;
|
||||
|
||||
SpriteBatch spriteBatch;
|
||||
@ -16,15 +16,15 @@ namespace SemiColinGames {
|
||||
bool paused = false;
|
||||
IDisplay display;
|
||||
|
||||
History<Input> input = new History<Input>(2);
|
||||
readonly History<Input> input = new History<Input>(2);
|
||||
|
||||
FpsCounter fpsCounter = new FpsCounter();
|
||||
readonly FpsCounter fpsCounter = new FpsCounter();
|
||||
Texture2D grasslandBg1;
|
||||
Texture2D grasslandBg2;
|
||||
|
||||
Player player;
|
||||
World world;
|
||||
Camera camera = new Camera();
|
||||
readonly Camera camera = new Camera();
|
||||
|
||||
public SneakGame() {
|
||||
graphics = new GraphicsDeviceManager(this);
|
||||
|
@ -17,8 +17,8 @@ namespace SemiColinGames {
|
||||
}
|
||||
|
||||
class Tile {
|
||||
Texture2D texture;
|
||||
Terrain terrain;
|
||||
readonly Texture2D texture;
|
||||
readonly Terrain terrain;
|
||||
Rectangle position;
|
||||
|
||||
public Tile(Texture2D texture, Terrain terrain, Rectangle position) {
|
||||
@ -84,14 +84,14 @@ namespace SemiColinGames {
|
||||
class World {
|
||||
|
||||
public const int TileSize = 16;
|
||||
int width;
|
||||
int height;
|
||||
Tile[,] tiles;
|
||||
readonly int width;
|
||||
readonly int height;
|
||||
readonly Tile[,] tiles;
|
||||
|
||||
public int Width { get; }
|
||||
public int Height { get; }
|
||||
|
||||
string worldString = @"
|
||||
readonly string worldString = @"
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user