handle OS window size changes
parent
40a2b31e90
commit
5a5fbc0c77
12
src/Game.cs
12
src/Game.cs
|
@ -213,10 +213,22 @@ namespace MoonWorks
|
||||||
case SDL.SDL_EventType.SDL_CONTROLLERDEVICEREMOVED:
|
case SDL.SDL_EventType.SDL_CONTROLLERDEVICEREMOVED:
|
||||||
HandleControllerRemoved(_event);
|
HandleControllerRemoved(_event);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SDL.SDL_EventType.SDL_WINDOWEVENT:
|
||||||
|
HandleWindowEvent(_event);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void HandleWindowEvent(SDL.SDL_Event evt)
|
||||||
|
{
|
||||||
|
if (evt.window.windowEvent == SDL.SDL_WindowEventID.SDL_WINDOWEVENT_SIZE_CHANGED)
|
||||||
|
{
|
||||||
|
Window.SizeChanged((uint) evt.window.data1, (uint) evt.window.data2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void HandleTextInput(SDL.SDL_Event evt)
|
private void HandleTextInput(SDL.SDL_Event evt)
|
||||||
{
|
{
|
||||||
// Based on the SDL2# LPUtf8StrMarshaler
|
// Based on the SDL2# LPUtf8StrMarshaler
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using SDL2;
|
using SDL2;
|
||||||
|
|
||||||
namespace MoonWorks
|
namespace MoonWorks
|
||||||
|
@ -81,6 +81,12 @@ namespace MoonWorks
|
||||||
Height = height;
|
Height = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal void SizeChanged(uint width, uint height)
|
||||||
|
{
|
||||||
|
Width = width;
|
||||||
|
Height = height;
|
||||||
|
}
|
||||||
|
|
||||||
protected virtual void Dispose(bool disposing)
|
protected virtual void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
if (!IsDisposed)
|
if (!IsDisposed)
|
||||||
|
|
Loading…
Reference in New Issue