Added frame buffer support.

This commit is contained in:
2021-05-05 07:37:25 -07:00
parent 8546a2bcf8
commit 0d997bc08b
12 changed files with 170 additions and 45 deletions

34
src/display/framebuffer.h Normal file
View File

@ -0,0 +1,34 @@
/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include <dawn/dawn.h>
#include "texture.h"
/**
* Creates a new frame buffer that can be rendered to.
*
* @param width Width of the frame buffer (in pixels).
* @param height Height of the frame buffer (in pixels).
* @return A renderable frame buffer.
*/
framebuffer_t * frameBufferCreate(int32_t width, int32_t height);
/**
* Use a given frame buffer as the current rendering context.
*
* @param frameBuffer Frame buffer to use, or NULL to not use any.
* @param clear Whether or not to clear the frame buffer prior to rendering.
*/
void frameBufferUse(framebuffer_t *frameBuffer, bool clear);
/**
* Dispose/cleanup a previously created frame buffer.
*
* @param frameBuffer Frame Buffer to clean.
*/
void frameBufferDispose(framebuffer_t *frameBuffer);