shithub: cstory

Download patch

ref: 59a8c2617f0a6359677b9ce7598252dde68a2f45
parent: d9e7ebac38b281bc62061158a9439ec056618fbc
author: Clownacy <[email protected]>
date: Wed Feb 5 10:52:43 EST 2020

Tweak some variable naming

The enhanced branch calls them the 'internal *screen* width/height',
which I think is more appropriate.

--- a/src/Backends/Rendering.h
+++ b/src/Backends/Rendering.h
@@ -7,7 +7,7 @@
 typedef struct Backend_Surface Backend_Surface;
 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_DrawScreen(void);
 Backend_Surface* Backend_CreateSurface(unsigned int width, unsigned int height);
--- a/src/Backends/Rendering/OpenGL3.cpp
+++ b/src/Backends/Rendering/OpenGL3.cpp
@@ -517,7 +517,7 @@
 // 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
 	SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
@@ -531,7 +531,7 @@
 	SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
 #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)
 	{
@@ -605,9 +605,9 @@
 							glGenTextures(1, &framebuffer.texture_id);
 							glBindTexture(GL_TEXTURE_2D, framebuffer.texture_id);
 						#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
-							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
 							glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 							glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
@@ -617,8 +617,8 @@
 							glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
 						#endif
 
-							framebuffer.width = window_width;
-							framebuffer.height = window_height;
+							framebuffer.width = screen_width;
+							framebuffer.height = screen_height;
 
 							glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, framebuffer.texture_id, 0);
 							glViewport(0, 0, framebuffer.width, framebuffer.height);
--- a/src/Backends/Rendering/SDLSurface.cpp
+++ b/src/Backends/Rendering/SDLSurface.cpp
@@ -41,9 +41,9 @@
 		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)
 	{
--- a/src/Backends/Rendering/SDLTexture.cpp
+++ b/src/Backends/Rendering/SDLTexture.cpp
@@ -115,7 +115,7 @@
 	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:");
 
@@ -126,7 +126,7 @@
 		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)
 	{
@@ -154,12 +154,12 @@
 			SDL_GetRendererInfo(renderer, &info);
 			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)
 			{
-				framebuffer.width = window_width;
-				framebuffer.height = window_height;
+				framebuffer.width = screen_width;
+				framebuffer.height = screen_height;
 
 				// Set-up glyph-batcher
 				spritebatch_config_t config;
--- a/src/Backends/Rendering/Software.cpp
+++ b/src/Backends/Rendering/Software.cpp
@@ -36,9 +36,9 @@
 static unsigned char glyph_colour_channels[3];
 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)
 	{