-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
59 lines (48 loc) · 1.72 KB
/
Copy pathProgram.cs
File metadata and controls
59 lines (48 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
using Snake.Core;
using System;
using System.Diagnostics;
namespace Snake
{
class Program
{
public static int height;
public static int width;
static float fixedUpdateTime = 0.5f;
static public bool running = true;
static void Main()
{
Console.CursorVisible = false;
Console.WriteLine("Введите ширину карты");
string str = Console.ReadLine();
while (!int.TryParse(str, out width))
{
Console.WriteLine("Введите хотя бы число пожалуйста(((");
str = Console.ReadLine();
}
Console.WriteLine("Введите высоту карты");
str = Console.ReadLine();
while (!int.TryParse(str, out height))
{
Console.WriteLine("Введите хотя бы число пожалуйста(((");
str = Console.ReadLine();
}
RootControler.Activate();
Console.WriteLine("Урааа, подготовка завершена!");
Thread.Sleep(1000);
Console.Clear();
Stopwatch stopwatch = Stopwatch.StartNew();
float lastFixedUpdateTime = -fixedUpdateTime;
while (running)
{
float currentTime = (float)stopwatch.Elapsed.TotalSeconds;
Updater.Update();
if (currentTime >= lastFixedUpdateTime + fixedUpdateTime)
{
lastFixedUpdateTime = currentTime;
Updater.FixedUpdate();
Updater.FixedDrawUpdate();
}
}
}
}
}