Make the new launcher cross-platform.

This commit is contained in:
UnknownShadow200 2015-10-19 18:31:22 +11:00
parent f639de8f7b
commit c205b03726
5 changed files with 22 additions and 5 deletions

View File

@ -60,7 +60,12 @@ namespace Launcher2 {
Window.Visible = true;
Drawer = new GdiPlusDrawer2D( null );
Init();
SetScreen( new ResourcesScreen( this ) );
if( !ResourceFetcher.CheckAllResourcesExist() ) {
SetScreen( new ResourcesScreen( this ) );
} else {
SetScreen( new MainScreen( this ) );
}
while( true ) {
Window.ProcessEvents();
@ -78,10 +83,8 @@ namespace Launcher2 {
if( screen != null )
screen.Dirty = false;
WinWindowInfo info = (WinWindowInfo)Window.WindowInfo;
IntPtr dc = info.DeviceContext;
using( Graphics g = Graphics.FromHdc( dc ) )
IntPtr hwnd = Window.WindowInfo.WinHandle;
using( Graphics g = Graphics.FromHwnd( hwnd ) )
g.DrawImage( Framebuffer, 0, 0, Framebuffer.Width, Framebuffer.Height );
}

View File

@ -13,5 +13,6 @@ namespace OpenTK.Platform
/// <summary>Descibes an OS window.</summary>
public interface IWindowInfo : IDisposable
{
IntPtr WinHandle { get; }
}
}

View File

@ -88,6 +88,11 @@ namespace OpenTK.Platform.MacOS
#endregion
// TODO: I have no idea if this is right.
public IntPtr WinHandle {
get { return windowRef; }
}
#region IDisposable Members
public void Dispose()

View File

@ -112,5 +112,9 @@ namespace OpenTK.Platform.Windows {
~WinWindowInfo() {
Dispose(false);
}
public IntPtr WinHandle {
get { return WindowHandle; }
}
}
}

View File

@ -77,5 +77,9 @@ namespace OpenTK.Platform.X11 {
public override int GetHashCode() {
return WindowHandle.GetHashCode() ^ Display.GetHashCode();
}
public IntPtr WinHandle {
get { return WindowHandle; }
}
}
}