Skip to content

Commit

Permalink
screen go brrr
Browse files Browse the repository at this point in the history
  • Loading branch information
jossse69 committed Sep 24, 2023
1 parent 8eb16a0 commit cc64e2d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
internal class Constants
{
public const int ScreenWidth = 80;
public const int ScreenHeight = 25;
public const int ScreenWidth = 120;
public const int ScreenHeight = 37;
}
}
6 changes: 3 additions & 3 deletions src/Map.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ public static Map GenerateMap(int width, int height, List<GameObject> objects, U
int roomWidth = random.Next(MIN_ROOM_SIZE, MAX_ROOM_SIZE + 1);
int roomHeight = random.Next(MIN_ROOM_SIZE, MAX_ROOM_SIZE + 1);

int x = random.Next(0, width - roomWidth);
int y = random.Next(5, height - roomHeight);
int x = random.Next(0, Math.Clamp(width - roomWidth, 0, 78 - roomWidth));
int y = random.Next(8, height - roomHeight);

var newRoom = new Rectangle(x, y, roomWidth, roomHeight);

Expand Down Expand Up @@ -138,7 +138,7 @@ public static Map GenerateMap(int width, int height, List<GameObject> objects, U
{
for (int y = 0; y < height; y++)
{
if (x == 0 || x == width - 1 || y <= 5 || y == height - 2)
if (x == 0 || x == width + 78 || y <= 5 || y == height)
{
map[x, y] = new Tile(TileType.Wall);
}
Expand Down
24 changes: 18 additions & 6 deletions src/UI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ public UI(ScreenContainer Display)
public void Draw(GameObject player)
{
var width = display.Width;
var height = 4;
var height = 6;
var logheight = display.Height;
var logwidth = 79;
var surface = display.Map;

// draw the background
Expand All @@ -35,23 +37,33 @@ public void Draw(GameObject player)
}
}

surface.DrawLine(new Point(39, 0), new Point(39, height), 179, Color.DarkGray, Color.Black);
surface.DrawLine(new Point(0, height), new Point(width, height), 196, Color.DarkGray, Color.Black);
surface.SetCellAppearance(39, height, new ColoredGlyph(Color.DarkGray, Color.Black, 193));
// draw the log's background
for (var i = logwidth; i < width; i++)
{
for (var j = 0; j < logheight; j++)
{
surface.SetCellAppearance(i, j, new ColoredGlyph(Color.White, Color.Black, ' '));

}
}

surface.DrawLine(new Point(logwidth, 0), new Point(logwidth, logheight), 179, Color.DarkGray, Color.Black);
surface.DrawLine(new Point(0, height), new Point(logwidth, height), 196, Color.DarkGray, Color.Black);
surface.SetCellAppearance(logwidth, height, new ColoredGlyph(Color.DarkGray, Color.Black, 180));
surface.Print(0, 0, "HP: " + player.Fighter.HP + " / " + player.Fighter.maxHP);

// draw the messages of the message bus
var y = 0; // start drawing messages from the second row

var messageCount = Messages.Count;
var maxMessages = height;
var maxMessages = logheight;
var startIndex = Math.Max(0, messageCount - maxMessages);
var endIndex = messageCount;

for (var index = startIndex; index < endIndex; index++)
{
var message = Messages[index];
surface.Print(40, y, message);
surface.Print(logwidth + 1, y, message);
y++;
}
}
Expand Down

0 comments on commit cc64e2d

Please sign in to comment.