rename Window to OSWindow for namespacing + add alpha timing to draw
parent
9f2cddb4ae
commit
0dcb103994
11
src/Game.cs
11
src/Game.cs
|
@ -3,6 +3,7 @@ using SDL2;
|
||||||
using MoonWorks.Audio;
|
using MoonWorks.Audio;
|
||||||
using MoonWorks.Graphics;
|
using MoonWorks.Graphics;
|
||||||
using MoonWorks.Input;
|
using MoonWorks.Input;
|
||||||
|
using MoonWorks.Window;
|
||||||
|
|
||||||
namespace MoonWorks
|
namespace MoonWorks
|
||||||
{
|
{
|
||||||
|
@ -16,7 +17,7 @@ namespace MoonWorks
|
||||||
double accumulator = 0;
|
double accumulator = 0;
|
||||||
bool debugMode;
|
bool debugMode;
|
||||||
|
|
||||||
public Window Window { get; }
|
public OSWindow Window { get; }
|
||||||
public GraphicsDevice GraphicsDevice { get; }
|
public GraphicsDevice GraphicsDevice { get; }
|
||||||
public AudioDevice AudioDevice { get; }
|
public AudioDevice AudioDevice { get; }
|
||||||
public Inputs Inputs { get; }
|
public Inputs Inputs { get; }
|
||||||
|
@ -47,7 +48,7 @@ namespace MoonWorks
|
||||||
|
|
||||||
Inputs = new Inputs();
|
Inputs = new Inputs();
|
||||||
|
|
||||||
Window = new Window(windowCreateInfo);
|
Window = new OSWindow(windowCreateInfo);
|
||||||
|
|
||||||
GraphicsDevice = new GraphicsDevice(
|
GraphicsDevice = new GraphicsDevice(
|
||||||
Window.Handle,
|
Window.Handle,
|
||||||
|
@ -92,9 +93,11 @@ namespace MoonWorks
|
||||||
accumulator -= timestep;
|
accumulator -= timestep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double alpha = accumulator / timestep;
|
||||||
|
|
||||||
if (updateThisLoop)
|
if (updateThisLoop)
|
||||||
{
|
{
|
||||||
Draw();
|
Draw(timestep, alpha);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -115,6 +118,6 @@ namespace MoonWorks
|
||||||
|
|
||||||
protected abstract void Update(double dt);
|
protected abstract void Update(double dt);
|
||||||
|
|
||||||
protected abstract void Draw();
|
protected abstract void Draw(double dt, double alpha);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
using System;
|
using System;
|
||||||
using SDL2;
|
using SDL2;
|
||||||
|
|
||||||
namespace MoonWorks
|
namespace MoonWorks.Window
|
||||||
{
|
{
|
||||||
public class Window
|
public class OSWindow
|
||||||
{
|
{
|
||||||
internal IntPtr Handle { get; }
|
internal IntPtr Handle { get; }
|
||||||
public ScreenMode ScreenMode { get; }
|
public ScreenMode ScreenMode { get; }
|
||||||
|
|
||||||
public Window(WindowCreateInfo windowCreateInfo)
|
public OSWindow(WindowCreateInfo windowCreateInfo)
|
||||||
{
|
{
|
||||||
var windowFlags = SDL.SDL_WindowFlags.SDL_WINDOW_VULKAN;
|
var windowFlags = SDL.SDL_WindowFlags.SDL_WINDOW_VULKAN;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
namespace MoonWorks
|
namespace MoonWorks.Window
|
||||||
{
|
{
|
||||||
public enum ScreenMode
|
public enum ScreenMode
|
||||||
{
|
{
|
|
@ -1,4 +1,4 @@
|
||||||
namespace MoonWorks
|
namespace MoonWorks.Window
|
||||||
{
|
{
|
||||||
public struct WindowCreateInfo
|
public struct WindowCreateInfo
|
||||||
{
|
{
|
Loading…
Reference in New Issue