public static extern int SDL_PeepEvents( Event *events, int numevents, SDL_eventaction action, uint minType, uint maxType );
public static extern int WaitEventTimeout(Event *evt, int timeout);
public static extern int WaitEvent(Event *evt);
public static extern int PushEvent(Event *evt);
public static extern int PollEvent(Event *evt);
public static extern int PeepEvents(Event *events, int numevents, EventAction action, EventType minType, EventType maxType);
public static extern int Service(Host *host, Event * @event, uint timeout);
/// <summary>To be documented.</summary> public static unsafe void CmdWaitEvents2(this KhrSynchronization2 thisApi, [Count(Count = 0)] CommandBuffer commandBuffer, [Count(Count = 0)] uint eventCount, [Count(Computed = "eventCount"), Flow(FlowDirection.In)] Event *pEvents, [Count(Computed = "eventCount"), Flow(FlowDirection.In)] ReadOnlySpan <DependencyInfoKHR> pDependencyInfos) { // SpanOverloader thisApi.CmdWaitEvents2(commandBuffer, eventCount, pEvents, in pDependencyInfos.GetPinnableReference()); }
public void Run() { _renderer = new SdlRenderer(); _map = new Map(50, 30); var snakes = new[] { new Snake(0, _map, 10, _map.Height / 2), new Snake(1, _map, _map.Width - 10, _map.Height / 2) }; _map.CreateRandomFruit(); var gameObjects = new List <IGameObject>(); gameObjects.AddRange(snakes); _gameObjects = gameObjects.ToArray(); unsafe { var evt = new Event(); Event *e = &evt; bool quit = false; long? last = null; while (!quit) { while (SDL.PollEvent(e) != 0) { switch (e->Type) { case EventType.Quit: quit = true; break; case EventType.KeyDown: switch (e->Keyboard.Keysym.Sym) { case Keycode.Q: quit = true; break; case Keycode.Up: snakes[0].Input(InputType.Up); break; case Keycode.Down: snakes[0].Input(InputType.Down); break; case Keycode.Left: snakes[0].Input(InputType.Left); break; case Keycode.Right: snakes[0].Input(InputType.Right); break; } break; } } var current = DateTime.UtcNow.Ticks; if (last == null) { last = current; } Update(current - last.Value); last = current; Render(); } } SDL.Quit(); }