rename Window to OSWindow for namespacing + add alpha timing to draw

pull/14/head
cosmonaut 2021-01-25 13:02:35 -08:00
parent 9f2cddb4ae
commit 0dcb103994
4 changed files with 12 additions and 9 deletions

View File

@ -3,6 +3,7 @@ using SDL2;
using MoonWorks.Audio;
using MoonWorks.Graphics;
using MoonWorks.Input;
using MoonWorks.Window;
namespace MoonWorks
{
@ -16,7 +17,7 @@ namespace MoonWorks
double accumulator = 0;
bool debugMode;
public Window Window { get; }
public OSWindow Window { get; }
public GraphicsDevice GraphicsDevice { get; }
public AudioDevice AudioDevice { get; }
public Inputs Inputs { get; }
@ -47,7 +48,7 @@ namespace MoonWorks
Inputs = new Inputs();
Window = new Window(windowCreateInfo);
Window = new OSWindow(windowCreateInfo);
GraphicsDevice = new GraphicsDevice(
Window.Handle,
@ -92,9 +93,11 @@ namespace MoonWorks
accumulator -= timestep;
}
double alpha = accumulator / timestep;
if (updateThisLoop)
{
Draw();
Draw(timestep, alpha);
}
}
}
@ -115,6 +118,6 @@ namespace MoonWorks
protected abstract void Update(double dt);
protected abstract void Draw();
protected abstract void Draw(double dt, double alpha);
}
}

View File

@ -1,14 +1,14 @@
using System;
using SDL2;
namespace MoonWorks
namespace MoonWorks.Window
{
public class Window
public class OSWindow
{
internal IntPtr Handle { get; }
public ScreenMode ScreenMode { get; }
public Window(WindowCreateInfo windowCreateInfo)
public OSWindow(WindowCreateInfo windowCreateInfo)
{
var windowFlags = SDL.SDL_WindowFlags.SDL_WINDOW_VULKAN;

View File

@ -1,4 +1,4 @@
namespace MoonWorks
namespace MoonWorks.Window
{
public enum ScreenMode
{

View File

@ -1,4 +1,4 @@
namespace MoonWorks
namespace MoonWorks.Window
{
public struct WindowCreateInfo
{