-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
64 lines (46 loc) · 1.94 KB
/
Program.cs
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
60
61
62
63
64
using Raylib_cs;
namespace HelloWorld
{
static class Program
{
public static unsafe void Main()
{
Raylib.InitWindow(1024, 600, "Hello World");
double delta = 1.0;
Color c = new Color();
c.a = 0xff;
Image im = Raylib.GenImageColor(1024, 600, Color.RED);
bool exit = false;
for (int x = 0; x < 1024; x++)
{
c.r = Convert.ToByte((int)(x / 1024.0 * 0xff));
for (int y = 0; y < 600; y++)
{
c.g = Convert.ToByte((int)((1.0 - y / 600.0) * 0xff));
Raylib.ImageDrawPixel(& im, x, y, c);
}
}
Texture2D tex = Raylib.LoadTextureFromImage(im);
Raylib.UnloadImage(im);
while (!Raylib.WindowShouldClose() && !exit)
{
delta = 1000.0 / Raylib.GetFPS();
Raylib.BeginDrawing();
// Raylib.ClearBackground(Color.BLACK);
Raylib.DrawTexture(tex, 0, 0, Color.WHITE);
Raylib.DrawText("FPS: " + Raylib.GetFPS().ToString(), 10, 10, 20, Color.RED);
Raylib.DrawText("D: " + delta.ToString(), 10, 40, 20, Color.RED);
Raylib.DrawText("X: " + Raylib.GetTouchX().ToString(), 10, 70, 20, Color.RED);
Raylib.DrawText("Y: " + Raylib.GetTouchY().ToString(), 10, 100, 20, Color.RED);
if(Raylib.IsMouseButtonDown(MouseButton.MOUSE_LEFT_BUTTON)) {
Raylib.DrawCircle(Raylib.GetTouchX(), Raylib.GetTouchY(), 30, Color.BLUE);
if(Raylib.GetTouchX() < 20 && Raylib.GetTouchY() < 20) {
exit = true;
}
}
Raylib.EndDrawing();
}
Raylib.CloseWindow();
}
}
}