Unified functions: InitGraphicsDevice()

Following XNA style, now we have InitGraphicsDevice(), replacing
InitDisplay() + InitGraphics()
This commit is contained in:
raysan5 2016-06-25 21:28:50 +02:00
parent 5f7ac64c44
commit 9ee96bea95

View File

@ -238,8 +238,7 @@ extern void UnloadDefaultFont(void); // [Module: text] Unloads default fo
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Module specific Functions Declaration // Module specific Functions Declaration
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
static void InitDisplay(int width, int height); // Initialize display device and framebuffer static void InitGraphicsDevice(int width, int height); // Initialize graphics device
static void InitGraphics(void); // Initialize OpenGL graphics
static void SetupFramebufferSize(int displayWidth, int displayHeight); static void SetupFramebufferSize(int displayWidth, int displayHeight);
static void InitTimer(void); // Initialize timer static void InitTimer(void); // Initialize timer
static double GetTime(void); // Returns time since InitTimer() was run static double GetTime(void); // Returns time since InitTimer() was run
@ -300,11 +299,8 @@ void InitWindow(int width, int height, const char *title)
// Store window title (could be useful...) // Store window title (could be useful...)
windowTitle = title; windowTitle = title;
// Init device display (monitor, LCD, ...) // Init graphics device (display device and OpenGL context)
InitDisplay(width, height); InitGraphicsDevice(width, height);
// Init OpenGL graphics
InitGraphics();
// Load default font for convenience // Load default font for convenience
// NOTE: External function (defined in module: text) // NOTE: External function (defined in module: text)
@ -1453,7 +1449,7 @@ bool IsButtonReleased(int button)
// Initialize display device and framebuffer // Initialize display device and framebuffer
// NOTE: width and height represent the screen (framebuffer) desired size, not actual display size // NOTE: width and height represent the screen (framebuffer) desired size, not actual display size
// If width or height are 0, default display size will be used for framebuffer size // If width or height are 0, default display size will be used for framebuffer size
static void InitDisplay(int width, int height) static void InitGraphicsDevice(int width, int height)
{ {
screenWidth = width; // User desired width screenWidth = width; // User desired width
screenHeight = height; // User desired height screenHeight = height; // User desired height
@ -1763,11 +1759,8 @@ static void InitDisplay(int width, int height)
TraceLog(INFO, "Viewport offsets: %i, %i", renderOffsetX, renderOffsetY); TraceLog(INFO, "Viewport offsets: %i, %i", renderOffsetX, renderOffsetY);
} }
#endif // defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI) #endif // defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI)
}
// Initialize OpenGL graphics // Initialize OpenGL context (states and resources)
static void InitGraphics(void)
{
rlglInit(); // Init rlgl rlglInit(); // Init rlgl
rlglInitGraphics(renderOffsetX, renderOffsetY, renderWidth, renderHeight); // Init graphics (OpenGL stuff) rlglInitGraphics(renderOffsetX, renderOffsetY, renderWidth, renderHeight); // Init graphics (OpenGL stuff)
@ -2213,11 +2206,8 @@ static void AndroidCommandCallback(struct android_app *app, int32_t cmd)
} }
else else
{ {
// Init device display (monitor, LCD, ...) // Init graphics device (display device and OpenGL context)
InitDisplay(screenWidth, screenHeight); InitGraphicsDevice(screenWidth, screenHeight);
// Init OpenGL graphics
InitGraphics();
// Load default font for convenience // Load default font for convenience
// NOTE: External function (defined in module: text) // NOTE: External function (defined in module: text)