mirror of
https://github.com/MaddyThorson/StrawberryBF.git
synced 2024-11-28 16:58:56 +08:00
Texture setup
This commit is contained in:
parent
7329e98beb
commit
5cef6c2b26
|
@ -95,7 +95,7 @@ namespace Strawberry
|
|||
if (PlatformLayer.Closed())
|
||||
return;
|
||||
|
||||
uint32 tick = PlatformLayer.Tick;
|
||||
uint32 tick = PlatformLayer.Ticks;
|
||||
msCounter += (tick - prevTick);
|
||||
prevTick = tick;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user