-
카테고리
-
세부 분야
게임 프로그래밍
for mac 관련해서 질문 드려요
20.12.22 07:48 작성 조회수 27
0
삭제된 글입니다
답변을 작성해보세요.
0
LINGO
질문자2020.12.22
//board.cs
using System;
namespace RealgorionEx
{
class EmptyClass
{
public enum TileType
{
Empty,
Wall
}
public int Size { get; private set; }
public TileType[,] tileType { get; private set; }
public void settingTile(int Size)
{
this.Size = Size;
tileType = new TileType[Size, Size];
//블럭의 타입 설정
for (int y = 0; y < Size; y++)
{
for (int x = 0; x < Size; x++)
{
if (y == 0 || x == 0 || y == Size - 1 || x == Size - 1)
tileType[y, x] = TileType.Wall;
else
tileType[y, x] = TileType.Empty;
}
}
}
public void makingtile()
{
ConsoleColor NowColor = Console.ForegroundColor;
for (int y = 0; y < Size; y++)
{
for (int x = 0; x < Size; x++)
{
Console.ForegroundColor = settingColor(tileType[y, x]);
Console.Write('\u25CF');
}
Console.WriteLine();
}
Console.ForegroundColor = NowColor;
}
private ConsoleColor settingColor(TileType type)
{
switch(type)
{
case TileType.Empty:
return ConsoleColor.Green;
case TileType.Wall:
return ConsoleColor.Red;
default:
return ConsoleColor.Green;
}
}
}
}
0
LINGO
질문자2020.12.22
// Program.cs
namespace RealgorionEx
{
class MainClass
{
public static void Main(string[] args)
{
EmptyClass emptyClass = new EmptyClass();
emptyClass.settingTile(25);
int a = 1;
int lasttick = 0;
while (true)
{
#region //프레임관리
int currentTick = Environment.TickCount & Int32.MaxValue;
if (currentTick - lasttick < 5000 / 30)
continue;
lasttick = currentTick;
Console.CursorVisible = false;
Console.SetCursorPosition(0, 0);
Console.WriteLine(a);
a++;
#endregion
emptyClass.makingtile();
}
}
}
}
답변 2