-
Notifications
You must be signed in to change notification settings - Fork 0
/
Game.cs
78 lines (65 loc) · 1.79 KB
/
Game.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using Engine.AssetManagement;
using Engine.BackEnd;
using Engine.Utils;
using OpenTK;
using OpenTK.Input;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Engine;
using System.Threading;
using Engine.FrontEnd;
using OpenTK.Windowing.Common;
using Julia4D;
namespace Game
{
public class GameInstance : IGameHandler
{
JuliaGameThread gameThread;
public void OnClosing()
{
gameThread.OnClosing();
}
public static void CreateGameThread<T>(Processor processor, ref T target, Dictionary<string, object> app_config)
{
target = (T)Activator.CreateInstance(typeof(T), processor, app_config);
}
public void OnInit(Processor processor, Dictionary<string, object> app_config)
{
CreateGameThread(processor, ref gameThread, app_config);
}
public void OnKeyDown(KeyboardKeyEventArgs e)
{
gameThread.OnKeyDown(e);
}
public void OnKeyUp(KeyboardKeyEventArgs e)
{
gameThread.OnKeyUp(e);
}
public void OnMouseDown(MouseButtonEventArgs e)
{
gameThread.OnMouseDown(e);
}
public void OnMouseMove(MouseMoveEventArgs e)
{
gameThread.OnMouseMove(e);
}
public void OnMouseUp(MouseButtonEventArgs e)
{
gameThread.OnMouseUp(e);
}
public void OnMouseWheel(MouseWheelEventArgs e)
{
gameThread.OnMouseWheel(e);
}
public void OnResize(int newWidth, int newHeight)
{
gameThread.OnResize(newWidth, newHeight);
}
public void OnUpdate(double dt, double t)
{
gameThread.Tick(t, dt);
}
}
}