Tweak some variable naming
The enhanced branch calls them the 'internal *screen* width/height', which I think is more appropriate.
This commit is contained in:
parent
d9e7ebac38
commit
59a8c2617f
5 changed files with 16 additions and 16 deletions
|
@ -7,7 +7,7 @@
|
||||||
typedef struct Backend_Surface Backend_Surface;
|
typedef struct Backend_Surface Backend_Surface;
|
||||||
typedef struct Backend_Glyph Backend_Glyph;
|
typedef struct Backend_Glyph Backend_Glyph;
|
||||||
|
|
||||||
Backend_Surface* Backend_Init(const char *window_title, int window_width, int window_height, BOOL fullscreen);
|
Backend_Surface* Backend_Init(const char *window_title, int screen_width, int screen_height, BOOL fullscreen);
|
||||||
void Backend_Deinit(void);
|
void Backend_Deinit(void);
|
||||||
void Backend_DrawScreen(void);
|
void Backend_DrawScreen(void);
|
||||||
Backend_Surface* Backend_CreateSurface(unsigned int width, unsigned int height);
|
Backend_Surface* Backend_CreateSurface(unsigned int width, unsigned int height);
|
||||||
|
|
|
@ -517,7 +517,7 @@ static void GlyphBatch_DestroyTexture(SPRITEBATCH_U64 texture_id, void *udata)
|
||||||
// Render-backend initialisation
|
// Render-backend initialisation
|
||||||
// ====================
|
// ====================
|
||||||
|
|
||||||
Backend_Surface* Backend_Init(const char *window_title, int window_width, int window_height, BOOL fullscreen)
|
Backend_Surface* Backend_Init(const char *window_title, int screen_width, int screen_height, BOOL fullscreen)
|
||||||
{
|
{
|
||||||
#ifdef USE_OPENGLES2
|
#ifdef USE_OPENGLES2
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
|
||||||
|
@ -531,7 +531,7 @@ Backend_Surface* Backend_Init(const char *window_title, int window_width, int wi
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
window = SDL_CreateWindow(window_title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, window_width, window_height, SDL_WINDOW_OPENGL);
|
window = SDL_CreateWindow(window_title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, screen_width, screen_height, SDL_WINDOW_OPENGL);
|
||||||
|
|
||||||
if (window != NULL)
|
if (window != NULL)
|
||||||
{
|
{
|
||||||
|
@ -605,9 +605,9 @@ Backend_Surface* Backend_Init(const char *window_title, int window_width, int wi
|
||||||
glGenTextures(1, &framebuffer.texture_id);
|
glGenTextures(1, &framebuffer.texture_id);
|
||||||
glBindTexture(GL_TEXTURE_2D, framebuffer.texture_id);
|
glBindTexture(GL_TEXTURE_2D, framebuffer.texture_id);
|
||||||
#ifdef USE_OPENGLES2
|
#ifdef USE_OPENGLES2
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, window_width, window_height, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, screen_width, screen_height, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
|
||||||
#else
|
#else
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, window_width, window_height, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, screen_width, screen_height, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
|
||||||
#endif
|
#endif
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
|
@ -617,8 +617,8 @@ Backend_Surface* Backend_Init(const char *window_title, int window_width, int wi
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
framebuffer.width = window_width;
|
framebuffer.width = screen_width;
|
||||||
framebuffer.height = window_height;
|
framebuffer.height = screen_height;
|
||||||
|
|
||||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, framebuffer.texture_id, 0);
|
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, framebuffer.texture_id, 0);
|
||||||
glViewport(0, 0, framebuffer.width, framebuffer.height);
|
glViewport(0, 0, framebuffer.width, framebuffer.height);
|
||||||
|
|
|
@ -41,9 +41,9 @@ static void RectToSDLRect(const RECT *rect, SDL_Rect *sdl_rect)
|
||||||
sdl_rect->h = 0;
|
sdl_rect->h = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Backend_Surface* Backend_Init(const char *window_title, int window_width, int window_height, BOOL fullscreen)
|
Backend_Surface* Backend_Init(const char *window_title, int screen_width, int screen_height, BOOL fullscreen)
|
||||||
{
|
{
|
||||||
window = SDL_CreateWindow(window_title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, window_width, window_height, 0);
|
window = SDL_CreateWindow(window_title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, screen_width, screen_height, 0);
|
||||||
|
|
||||||
if (window != NULL)
|
if (window != NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -115,7 +115,7 @@ static void GlyphBatch_DestroyTexture(SPRITEBATCH_U64 texture_id, void *udata)
|
||||||
SDL_DestroyTexture((SDL_Texture*)texture_id);
|
SDL_DestroyTexture((SDL_Texture*)texture_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
Backend_Surface* Backend_Init(const char *window_title, int window_width, int window_height, BOOL fullscreen)
|
Backend_Surface* Backend_Init(const char *window_title, int screen_width, int screen_height, BOOL fullscreen)
|
||||||
{
|
{
|
||||||
puts("Available SDL2 render drivers:");
|
puts("Available SDL2 render drivers:");
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ Backend_Surface* Backend_Init(const char *window_title, int window_width, int wi
|
||||||
puts(info.name);
|
puts(info.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
window = SDL_CreateWindow(window_title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, window_width, window_height, 0);
|
window = SDL_CreateWindow(window_title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, screen_width, screen_height, 0);
|
||||||
|
|
||||||
if (window != NULL)
|
if (window != NULL)
|
||||||
{
|
{
|
||||||
|
@ -154,12 +154,12 @@ Backend_Surface* Backend_Init(const char *window_title, int window_width, int wi
|
||||||
SDL_GetRendererInfo(renderer, &info);
|
SDL_GetRendererInfo(renderer, &info);
|
||||||
printf("Selected SDL2 render driver: %s\n", info.name);
|
printf("Selected SDL2 render driver: %s\n", info.name);
|
||||||
|
|
||||||
framebuffer.texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA32, SDL_TEXTUREACCESS_TARGET, window_width, window_height);
|
framebuffer.texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA32, SDL_TEXTUREACCESS_TARGET, screen_width, screen_height);
|
||||||
|
|
||||||
if (framebuffer.texture != NULL)
|
if (framebuffer.texture != NULL)
|
||||||
{
|
{
|
||||||
framebuffer.width = window_width;
|
framebuffer.width = screen_width;
|
||||||
framebuffer.height = window_height;
|
framebuffer.height = screen_height;
|
||||||
|
|
||||||
// Set-up glyph-batcher
|
// Set-up glyph-batcher
|
||||||
spritebatch_config_t config;
|
spritebatch_config_t config;
|
||||||
|
|
|
@ -36,9 +36,9 @@ static Backend_Surface framebuffer;
|
||||||
static unsigned char glyph_colour_channels[3];
|
static unsigned char glyph_colour_channels[3];
|
||||||
static Backend_Surface *glyph_destination_surface;
|
static Backend_Surface *glyph_destination_surface;
|
||||||
|
|
||||||
Backend_Surface* Backend_Init(const char *window_title, int window_width, int window_height, BOOL fullscreen)
|
Backend_Surface* Backend_Init(const char *window_title, int screen_width, int screen_height, BOOL fullscreen)
|
||||||
{
|
{
|
||||||
window = SDL_CreateWindow(window_title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, window_width, window_height, 0);
|
window = SDL_CreateWindow(window_title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, screen_width, screen_height, 0);
|
||||||
|
|
||||||
if (window != NULL)
|
if (window != NULL)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue