Remove the rcore.h include from drm, web, template (#3420)

This commit is contained in:
ubkp 2023-10-14 17:47:35 -03:00 committed by GitHub
parent 6d7112fde7
commit 781f717530
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 29 deletions

View File

@ -47,8 +47,6 @@
*
**********************************************************************************************/
#include "rcore.h"
#include <fcntl.h> // POSIX file control definitions - open(), creat(), fcntl()
#include <unistd.h> // POSIX standard function definitions - read(), close(), STDIN_FILENO
#include <termios.h> // POSIX terminal control definitions - tcgetattr(), tcsetattr()
@ -218,12 +216,12 @@ void InitWindow(int width, int height, const char *title)
CORE.Input.Mouse.scale = (Vector2){ 1.0f, 1.0f };
CORE.Input.Mouse.cursor = MOUSE_CURSOR_ARROW;
CORE.Input.Gamepad.lastButtonPressed = GAMEPAD_BUTTON_UNKNOWN;
// Initialize platform
//--------------------------------------------------------------
//--------------------------------------------------------------
InitPlatform();
//--------------------------------------------------------------
// Initialize rlgl default data (buffers and shaders)
// NOTE: CORE.Window.currentFbo.width and CORE.Window.currentFbo.height not used, just stored as globals in rlgl
rlglInit(CORE.Window.currentFbo.width, CORE.Window.currentFbo.height);
@ -272,10 +270,10 @@ void InitWindow(int width, int height, const char *title)
events = (AutomationEvent *)RL_CALLOC(MAX_CODE_AUTOMATION_EVENTS, sizeof(AutomationEvent));
CORE.Time.frameCounter = 0;
#endif
// Initialize random seed
SetRandomSeed((unsigned int)time(NULL));
TRACELOG(LOG_INFO, "PLATFORM: DRM: Application initialized successfully");
}
@ -302,7 +300,7 @@ void CloseWindow(void)
#endif
// De-initialize platform
//--------------------------------------------------------------
//--------------------------------------------------------------
ClosePlatform();
//--------------------------------------------------------------
@ -721,7 +719,7 @@ static int InitPlatform(void)
platform.gbmSurface = NULL;
platform.prevBO = NULL;
platform.prevFB = 0;
CORE.Window.fullscreen = true;
CORE.Window.flags |= FLAG_FULLSCREEN_MODE;
@ -1034,9 +1032,9 @@ static int InitPlatform(void)
rlLoadExtensions(eglGetProcAddress);
if ((CORE.Window.flags & FLAG_WINDOW_MINIMIZED) > 0) MinimizeWindow();
CORE.Window.ready = true; // TODO: Proper validation on windows/context creation
// If graphic device is no properly initialized, we end program
if (!CORE.Window.ready) { TRACELOG(LOG_FATAL, "PLATFORM: Failed to initialize graphic device"); return -1; }
else SetWindowPosition(GetMonitorWidth(GetCurrentMonitor()) / 2 - CORE.Window.screen.width / 2, GetMonitorHeight(GetCurrentMonitor()) / 2 - CORE.Window.screen.height / 2);
@ -1057,7 +1055,7 @@ static int InitPlatform(void)
InitEvdevInput(); // Evdev inputs initialization
InitGamepad(); // Gamepad init
InitKeyboard(); // Keyboard init (stdin)
return 0;
}

View File

@ -46,8 +46,6 @@
*
**********************************************************************************************/
#include "rcore.h"
// TODO: Include the platform specific libraries
//----------------------------------------------------------------------------------
@ -130,8 +128,8 @@ void InitWindow(int width, int height, const char *title)
CORE.Input.Mouse.cursor = MOUSE_CURSOR_ARROW;
CORE.Input.Gamepad.lastButtonPressed = 0; // GAMEPAD_BUTTON_UNKNOWN
CORE.Window.eventWaiting = false;
// TODO: Platform specific init window
//--------------------------------------------------------------
CORE.Window.screen.width = width;
@ -144,7 +142,7 @@ void InitWindow(int width, int height, const char *title)
CORE.Window.ready = InitGraphicsDevice(width, height);
// Initialize OpenGL context (states and resources)
// NOTE: CORE.Window.currentFbo.width and CORE.Window.currentFbo.height not used, just stored as globals in rlgl
rlglInit(CORE.Window.currentFbo.width, CORE.Window.currentFbo.height);
@ -711,13 +709,13 @@ static int InitPlatform(void)
rlLoadExtensions(eglGetProcAddress);
CORE.Window.ready = true;
// If graphic device is no properly initialized, we end program
if (!CORE.Window.ready) { TRACELOG(LOG_FATAL, "PLATFORM: Failed to initialize graphic device"); return -1; }
// Initialize hi-res timer
InitTimer();
// Initialize base path for storage
CORE.Storage.basePath = GetWorkingDirectory();

View File

@ -45,8 +45,6 @@
*
**********************************************************************************************/
#include "rcore.h"
#define GLFW_INCLUDE_ES2 // GLFW3: Enable OpenGL ES 2.0 (translated to WebGL)
// #define GLFW_INCLUDE_ES3 // GLFW3: Enable OpenGL ES 3.0 (transalted to WebGL2?)
#include "GLFW/glfw3.h" // GLFW3: Windows, OpenGL context and Input management
@ -177,7 +175,7 @@ void InitWindow(int width, int height, const char *title)
CORE.Input.Gamepad.lastButtonPressed = GAMEPAD_BUTTON_UNKNOWN;
// Initialize platform
//--------------------------------------------------------------
//--------------------------------------------------------------
InitPlatform();
//--------------------------------------------------------------
@ -256,7 +254,7 @@ void CloseWindow(void)
rlglClose(); // De-init rlgl
// De-initialize platform
//--------------------------------------------------------------
//--------------------------------------------------------------
ClosePlatform();
//--------------------------------------------------------------
@ -1005,7 +1003,7 @@ static int InitPlatform(void)
glfwSetCursorEnterCallback(platform.handle, CursorEnterCallback);
glfwMakeContextCurrent(platform.handle);
// Load OpenGL extensions
// NOTE: GL procedures address loader is required to load extensions
rlLoadExtensions(glfwGetProcAddress);
@ -1029,19 +1027,19 @@ static int InitPlatform(void)
TRACELOG(LOG_INFO, " > Screen size: %i x %i", CORE.Window.screen.width, CORE.Window.screen.height);
TRACELOG(LOG_INFO, " > Render size: %i x %i", CORE.Window.render.width, CORE.Window.render.height);
TRACELOG(LOG_INFO, " > Viewport offsets: %i, %i", CORE.Window.renderOffset.x, CORE.Window.renderOffset.y);
CORE.Window.ready = true; // TODO: Proper validation on windows/context creation
// If graphic device is no properly initialized, we end program
if (!CORE.Window.ready) { TRACELOG(LOG_FATAL, "PLATFORM: Failed to initialize graphic device"); return -1; }
else SetWindowPosition(GetMonitorWidth(GetCurrentMonitor())/2 - CORE.Window.screen.width/2, GetMonitorHeight(GetCurrentMonitor())/2 - CORE.Window.screen.height/2);
// Initialize hi-res timer
InitTimer();
// Initialize base path for storage
CORE.Storage.basePath = GetWorkingDirectory();
// Setup callback functions for the DOM events
emscripten_set_fullscreenchange_callback("#canvas", NULL, 1, EmscriptenFullscreenChangeCallback);
@ -1070,7 +1068,7 @@ static int InitPlatform(void)
// Support gamepad events (not provided by GLFW3 on emscripten)
emscripten_set_gamepadconnected_callback(NULL, 1, EmscriptenGamepadCallback);
emscripten_set_gamepaddisconnected_callback(NULL, 1, EmscriptenGamepadCallback);
return 0;
}