Removed DUSK_ prefix
This commit is contained in:
@@ -20,11 +20,15 @@ void frameBufferInitBackbuffer() {
|
||||
}
|
||||
|
||||
int32_t frameBufferGetWidth(const framebuffer_t *framebuffer) {
|
||||
#if DUSK_DISPLAY_SDL2
|
||||
#if DISPLAY_SDL2
|
||||
if(framebuffer == &FRAMEBUFFER_BACKBUFFER) {
|
||||
int32_t windowWidth, windowHeight;
|
||||
SDL_GetWindowSize(DISPLAY.window, &windowWidth, &windowHeight);
|
||||
return windowWidth;
|
||||
#if DISPLAY_SIZE_DYNAMIC == 0
|
||||
return DISPLAY_WIDTH;
|
||||
#else
|
||||
int32_t windowWidth, windowHeight;
|
||||
SDL_GetWindowSize(DISPLAY.window, &windowWidth, &windowHeight);
|
||||
return windowWidth;
|
||||
#endif
|
||||
}
|
||||
|
||||
assertUnreachable("Framebuffer width not implemented");
|
||||
@@ -33,11 +37,15 @@ int32_t frameBufferGetWidth(const framebuffer_t *framebuffer) {
|
||||
}
|
||||
|
||||
int32_t frameBufferGetHeight(const framebuffer_t *framebuffer) {
|
||||
#if DUSK_DISPLAY_SDL2
|
||||
#if DISPLAY_SDL2
|
||||
if(framebuffer == &FRAMEBUFFER_BACKBUFFER) {
|
||||
int32_t windowWidth, windowHeight;
|
||||
SDL_GetWindowSize(DISPLAY.window, &windowWidth, &windowHeight);
|
||||
return windowHeight;
|
||||
#if DISPLAY_SIZE_DYNAMIC == 0
|
||||
return DISPLAY_HEIGHT;
|
||||
#else
|
||||
int32_t windowWidth, windowHeight;
|
||||
SDL_GetWindowSize(DISPLAY.window, &windowWidth, &windowHeight);
|
||||
return windowHeight;
|
||||
#endif
|
||||
}
|
||||
|
||||
assertUnreachable("Framebuffer height not implemented");
|
||||
@@ -47,7 +55,7 @@ int32_t frameBufferGetHeight(const framebuffer_t *framebuffer) {
|
||||
|
||||
void frameBufferBind(const framebuffer_t *framebuffer) {
|
||||
if(framebuffer == NULL) {
|
||||
#if DUSK_DISPLAY_SDL2
|
||||
#if DISPLAY_SDL2
|
||||
frameBufferBind(&FRAMEBUFFER_BACKBUFFER);
|
||||
#endif
|
||||
|
||||
@@ -56,14 +64,19 @@ void frameBufferBind(const framebuffer_t *framebuffer) {
|
||||
}
|
||||
|
||||
// Bind the framebuffer for rendering
|
||||
#if DUSK_DISPLAY_SDL2
|
||||
#if DISPLAY_SDL2
|
||||
if(framebuffer == &FRAMEBUFFER_BACKBUFFER) {
|
||||
#if PSP
|
||||
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
||||
int32_t windowWidth, windowHeight;
|
||||
SDL_GetWindowSize(DISPLAY.window, &windowWidth, &windowHeight);
|
||||
#else
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
||||
#endif
|
||||
} else {
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, framebuffer->id);
|
||||
#if PSP
|
||||
assertUnreachable("Framebuffers not supported on PSP");
|
||||
#else
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, framebuffer->id);
|
||||
#endif
|
||||
}
|
||||
glViewport(
|
||||
0, 0,
|
||||
@@ -74,6 +87,28 @@ void frameBufferBind(const framebuffer_t *framebuffer) {
|
||||
FRAMEBUFFER_BOUND = framebuffer;
|
||||
}
|
||||
|
||||
void frameBufferClear(uint8_t flags, color_t color) {
|
||||
#if DISPLAY_SDL2
|
||||
GLbitfield glFlags = 0;
|
||||
|
||||
if(flags & FRAMEBUFFER_CLEAR_COLOR) {
|
||||
glFlags |= GL_COLOR_BUFFER_BIT;
|
||||
glClearColor(
|
||||
color.r / 255.0f,
|
||||
color.g / 255.0f,
|
||||
color.b / 255.0f,
|
||||
color.a / 255.0f
|
||||
);
|
||||
}
|
||||
|
||||
if(flags & FRAMEBUFFER_CLEAR_DEPTH) {
|
||||
glFlags |= GL_DEPTH_BUFFER_BIT;
|
||||
}
|
||||
|
||||
glClear(glFlags);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Disposes of the framebuffer using EXT methods.
|
||||
*
|
||||
@@ -82,7 +117,7 @@ void frameBufferBind(const framebuffer_t *framebuffer) {
|
||||
void frameBufferDispose(framebuffer_t *framebuffer) {
|
||||
assertNotNull(framebuffer, "Framebuffer cannot be NULL");
|
||||
|
||||
#if DUSK_DISPLAY_SDL2
|
||||
#if DISPLAY_SDL2
|
||||
if(framebuffer == &FRAMEBUFFER_BACKBUFFER) {
|
||||
assertUnreachable("Cannot dispose of backbuffer");
|
||||
}
|
||||
|
Reference in New Issue
Block a user