Dawn/src/display/render.h

50 lines
1.2 KiB
C

// Copyright (c) 2021 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "../libs.h"
#include "framebuffer.h"
/**
* Contains information about the current render state, can be used for querying
* how the renderer is currently set up.
*/
typedef struct {
/** Resolution (in pixels). Floats to allow subpixels in future. */
float width, height;
} render_t;
/**
* Initialize the renderer.
*/
void renderInit();
/**
* Render a single frame of the render loop. The renderer is not (currently)
* responsible for render looping.
* @param render The render manager
*/
void renderFrameStart(render_t *render);
/**
* Cleanup a render context.
*/
void renderDispose();
/**
* Sets the internal display resolution.
*
* @param render Render context to resize.
* @param width Width of the display (in pixels).
* @param height Height of the display (in pixels).
*/
void renderSetResolution(render_t *render, float width, float height);
/**
* Reset the framebuffer back to the original backbuffer.
*
* @param render Render to reset the backbuffer to.
*/
void renderResetFramebuffer(render_t *render);