converted all TODOs into Issues
GitOrigin-RevId: aae80308b34fcfa7a99b8dc97c56ee33ceb900ef
This commit is contained in:
parent
c9d3bc7f66
commit
660d163119
@ -45,7 +45,6 @@ namespace SemiColinGames {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void DrawToast(SpriteBatch spriteBatch, SpriteFont font) {
|
public static void DrawToast(SpriteBatch spriteBatch, SpriteFont font) {
|
||||||
// TODO: this use of toast isn't thread-safe.
|
|
||||||
if (toast == null) {
|
if (toast == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -45,10 +45,7 @@ namespace SemiColinGames {
|
|||||||
Rectangle oldBbox = Bbox(oldPosition);
|
Rectangle oldBbox = Bbox(oldPosition);
|
||||||
Rectangle playerBbox = Bbox(position);
|
Rectangle playerBbox = Bbox(position);
|
||||||
bool standingOnGround = false;
|
bool standingOnGround = false;
|
||||||
// TODO: implement https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm
|
|
||||||
// e.g. http://members.chello.at/~easyfilter/bresenham.html
|
|
||||||
// TODO: currently player doesn't fall through a gap one tile wide; presumably this will
|
|
||||||
// be fixed by switching to a line-rasterization approach.
|
|
||||||
foreach (var rect in collisionTargets) {
|
foreach (var rect in collisionTargets) {
|
||||||
playerBbox = Bbox(position);
|
playerBbox = Bbox(position);
|
||||||
|
|
||||||
@ -100,9 +97,6 @@ namespace SemiColinGames {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: refactor input to have a virtual "which directions & buttons were being pressed"
|
|
||||||
// instead of complicated if-statements in this function.
|
|
||||||
// TODO: refactor to use a state-machine.
|
|
||||||
void UpdateFromInput(
|
void UpdateFromInput(
|
||||||
GameTime time, History<GamePadState> gamePad, History<KeyboardState> keyboard) {
|
GameTime time, History<GamePadState> gamePad, History<KeyboardState> keyboard) {
|
||||||
if ((gamePad[0].IsButtonDown(Buttons.A) && gamePad[1].IsButtonUp(Buttons.A) ||
|
if ((gamePad[0].IsButtonDown(Buttons.A) && gamePad[1].IsButtonUp(Buttons.A) ||
|
||||||
@ -124,8 +118,6 @@ namespace SemiColinGames {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Vector2 leftStick = gamePad[0].ThumbSticks.Left;
|
Vector2 leftStick = gamePad[0].ThumbSticks.Left;
|
||||||
// TODO: have keyboard directions cancel each other out if mutually-incompatible keys are
|
|
||||||
// held down?
|
|
||||||
if (gamePad[0].IsButtonDown(Buttons.DPadLeft) || leftStick.X < -0.5 ||
|
if (gamePad[0].IsButtonDown(Buttons.DPadLeft) || leftStick.X < -0.5 ||
|
||||||
keyboard[0].IsKeyDown(Keys.A)) {
|
keyboard[0].IsKeyDown(Keys.A)) {
|
||||||
facing = Facing.Left;
|
facing = Facing.Left;
|
||||||
@ -162,7 +154,6 @@ namespace SemiColinGames {
|
|||||||
pose = Pose.Jumping;
|
pose = Pose.Jumping;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: also bound player position by the right edge of the World?
|
|
||||||
position.X = Math.Max(position.X, 0 + spriteWidth);
|
position.X = Math.Max(position.X, 0 + spriteWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,7 +192,6 @@ namespace SemiColinGames {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void Draw(SpriteBatch spriteBatch, Camera camera, GameTime time) {
|
public void Draw(SpriteBatch spriteBatch, Camera camera, GameTime time) {
|
||||||
// TODO: don't create so many "new" things that could be cached / precomputed.
|
|
||||||
int index = spritePosition(pose, time);
|
int index = spritePosition(pose, time);
|
||||||
Rectangle textureSource = new Rectangle(index * spriteSize, 0, spriteSize, spriteSize);
|
Rectangle textureSource = new Rectangle(index * spriteSize, 0, spriteSize, spriteSize);
|
||||||
Vector2 spriteCenter = new Vector2(spriteSize / 2, spriteSize / 2);
|
Vector2 spriteCenter = new Vector2(spriteSize / 2, spriteSize / 2);
|
||||||
|
@ -51,17 +51,15 @@ namespace SemiColinGames {
|
|||||||
protected override void LoadContent() {
|
protected override void LoadContent() {
|
||||||
spriteBatch = new SpriteBatch(GraphicsDevice);
|
spriteBatch = new SpriteBatch(GraphicsDevice);
|
||||||
font = Content.Load<SpriteFont>("font");
|
font = Content.Load<SpriteFont>("font");
|
||||||
// TODO: decouple things like Player and World from their textures.
|
|
||||||
player = new Player(Content.Load<Texture2D>("player_1x"));
|
player = new Player(Content.Load<Texture2D>("player_1x"));
|
||||||
world = new World(Content.Load<Texture2D>("grassland"));
|
world = new World(Content.Load<Texture2D>("grassland"));
|
||||||
// TODO: move backgrounds into World.
|
|
||||||
grasslandBg1 = Content.Load<Texture2D>("grassland_bg1");
|
grasslandBg1 = Content.Load<Texture2D>("grassland_bg1");
|
||||||
grasslandBg2 = Content.Load<Texture2D>("grassland_bg2");
|
grasslandBg2 = Content.Load<Texture2D>("grassland_bg2");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called once per game. Unloads all game content.
|
// Called once per game. Unloads all game content.
|
||||||
protected override void UnloadContent() {
|
protected override void UnloadContent() {
|
||||||
// TODO: Unload any non ContentManager content here.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Updates the game world.
|
// Updates the game world.
|
||||||
|
@ -35,7 +35,6 @@ namespace SemiColinGames {
|
|||||||
Vector2 drawPos = new Vector2(position.Left - camera.Left, position.Top);
|
Vector2 drawPos = new Vector2(position.Left - camera.Left, position.Top);
|
||||||
switch (terrain) {
|
switch (terrain) {
|
||||||
case Terrain.Grass: {
|
case Terrain.Grass: {
|
||||||
// TODO: hold these rectangles statically instead of making them anew constantly.
|
|
||||||
Rectangle source = new Rectangle(3 * size, 0 * size, size, size);
|
Rectangle source = new Rectangle(3 * size, 0 * size, size, size);
|
||||||
spriteBatch.Draw(texture, drawPos, source, Color.White);
|
spriteBatch.Draw(texture, drawPos, source, Color.White);
|
||||||
break;
|
break;
|
||||||
@ -112,7 +111,6 @@ namespace SemiColinGames {
|
|||||||
"...................................................................] [.............] [..............................................................] [......................................................." };
|
"...................................................................] [.............] [..............................................................] [......................................................." };
|
||||||
|
|
||||||
public World(Texture2D texture) {
|
public World(Texture2D texture) {
|
||||||
// TODO: better error handling for if the string[] isn't rectangular.
|
|
||||||
width = worldDesc[0].Length;
|
width = worldDesc[0].Length;
|
||||||
height = worldDesc.Length;
|
height = worldDesc.Length;
|
||||||
tiles = new Tile[width, height];
|
tiles = new Tile[width, height];
|
||||||
|
Loading…
Reference in New Issue
Block a user