diff --git a/src/Core/Game.bf b/src/Core/Game.bf index ff54467..84b8731 100644 --- a/src/Core/Game.bf +++ b/src/Core/Game.bf @@ -95,7 +95,7 @@ namespace Strawberry if (PlatformLayer.Closed()) return; - uint32 tick = PlatformLayer.Tick; + uint32 tick = PlatformLayer.Ticks; msCounter += (tick - prevTick); prevTick = tick; diff --git a/src/PlatformLayer/GL.bf b/src/PlatformLayer/GL.bf index ab3515d..87d9c16 100644 --- a/src/PlatformLayer/GL.bf +++ b/src/PlatformLayer/GL.bf @@ -1,7 +1,29 @@ using System; -namespace Strawberry { - class GL { +namespace Strawberry +{ + class GLTexture : Texture + { + private uint32 handle; + + public this(int width, int height, void* pixels) + { + Width = width; + Height = height; + + GL.glGenTextures(1, &handle); + GL.glBindTexture(GL.GL_TEXTURE_2D, handle); + GL.glTexImage2D(GL.GL_TEXTURE_2D, 0, GL.GL_RGBA, width, height, 0, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, pixels); + } + + public ~this() + { + GL.glDeleteTextures(1, &handle); + } + } + + class GL + { public function void* GetProcAddressFunc(StringView procname); public const uint GL_DEPTH_BUFFER_BIT = 0x00000100; diff --git a/src/PlatformLayer/PlatformLayer.bf b/src/PlatformLayer/PlatformLayer.bf index 57a50dd..dbf9e02 100644 --- a/src/PlatformLayer/PlatformLayer.bf +++ b/src/PlatformLayer/PlatformLayer.bf @@ -11,7 +11,7 @@ namespace Strawberry public abstract void RenderEnd(); //Update - public abstract uint32 Tick { get; } // Milliseconds since game launched + public abstract uint32 Ticks { get; } // Milliseconds since game launched //Input public abstract void UpdateInput(); @@ -21,4 +21,10 @@ namespace Strawberry public abstract bool PollGamepadButton(int gamepadID, Buttons button); public abstract float PollGamepadAxis(int gamepadID, Axes axis); } + + public abstract class Texture + { + public int Width { get; protected set; } + public int Height { get; protected set; } + } } diff --git a/src/PlatformLayer/SDL2PlatformLayer.bf b/src/PlatformLayer/SDL2PlatformLayer.bf index dfa0493..7dd89b9 100644 --- a/src/PlatformLayer/SDL2PlatformLayer.bf +++ b/src/PlatformLayer/SDL2PlatformLayer.bf @@ -89,7 +89,7 @@ namespace Strawberry return (SDL.PollEvent(out event) != 0 && event.type == .Quit); } - public override uint32 Tick => SDL.GetTicks(); + public override uint32 Ticks => SDL.GetTicks(); public override void RenderBegin() {