Remove the rcore.h include from drm, web, template (#3420)
This commit is contained in:
parent
6d7112fde7
commit
781f717530
3 changed files with 23 additions and 29 deletions
|
@ -47,8 +47,6 @@
|
||||||
*
|
*
|
||||||
**********************************************************************************************/
|
**********************************************************************************************/
|
||||||
|
|
||||||
#include "rcore.h"
|
|
||||||
|
|
||||||
#include <fcntl.h> // POSIX file control definitions - open(), creat(), fcntl()
|
#include <fcntl.h> // POSIX file control definitions - open(), creat(), fcntl()
|
||||||
#include <unistd.h> // POSIX standard function definitions - read(), close(), STDIN_FILENO
|
#include <unistd.h> // POSIX standard function definitions - read(), close(), STDIN_FILENO
|
||||||
#include <termios.h> // POSIX terminal control definitions - tcgetattr(), tcsetattr()
|
#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.scale = (Vector2){ 1.0f, 1.0f };
|
||||||
CORE.Input.Mouse.cursor = MOUSE_CURSOR_ARROW;
|
CORE.Input.Mouse.cursor = MOUSE_CURSOR_ARROW;
|
||||||
CORE.Input.Gamepad.lastButtonPressed = GAMEPAD_BUTTON_UNKNOWN;
|
CORE.Input.Gamepad.lastButtonPressed = GAMEPAD_BUTTON_UNKNOWN;
|
||||||
|
|
||||||
// Initialize platform
|
// Initialize platform
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
InitPlatform();
|
InitPlatform();
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
|
|
||||||
// Initialize rlgl default data (buffers and shaders)
|
// 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
|
// 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);
|
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));
|
events = (AutomationEvent *)RL_CALLOC(MAX_CODE_AUTOMATION_EVENTS, sizeof(AutomationEvent));
|
||||||
CORE.Time.frameCounter = 0;
|
CORE.Time.frameCounter = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Initialize random seed
|
// Initialize random seed
|
||||||
SetRandomSeed((unsigned int)time(NULL));
|
SetRandomSeed((unsigned int)time(NULL));
|
||||||
|
|
||||||
TRACELOG(LOG_INFO, "PLATFORM: DRM: Application initialized successfully");
|
TRACELOG(LOG_INFO, "PLATFORM: DRM: Application initialized successfully");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,7 +300,7 @@ void CloseWindow(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// De-initialize platform
|
// De-initialize platform
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
ClosePlatform();
|
ClosePlatform();
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -721,7 +719,7 @@ static int InitPlatform(void)
|
||||||
platform.gbmSurface = NULL;
|
platform.gbmSurface = NULL;
|
||||||
platform.prevBO = NULL;
|
platform.prevBO = NULL;
|
||||||
platform.prevFB = 0;
|
platform.prevFB = 0;
|
||||||
|
|
||||||
CORE.Window.fullscreen = true;
|
CORE.Window.fullscreen = true;
|
||||||
CORE.Window.flags |= FLAG_FULLSCREEN_MODE;
|
CORE.Window.flags |= FLAG_FULLSCREEN_MODE;
|
||||||
|
|
||||||
|
@ -1034,9 +1032,9 @@ static int InitPlatform(void)
|
||||||
rlLoadExtensions(eglGetProcAddress);
|
rlLoadExtensions(eglGetProcAddress);
|
||||||
|
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_MINIMIZED) > 0) MinimizeWindow();
|
if ((CORE.Window.flags & FLAG_WINDOW_MINIMIZED) > 0) MinimizeWindow();
|
||||||
|
|
||||||
CORE.Window.ready = true; // TODO: Proper validation on windows/context creation
|
CORE.Window.ready = true; // TODO: Proper validation on windows/context creation
|
||||||
|
|
||||||
// If graphic device is no properly initialized, we end program
|
// 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; }
|
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);
|
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
|
InitEvdevInput(); // Evdev inputs initialization
|
||||||
InitGamepad(); // Gamepad init
|
InitGamepad(); // Gamepad init
|
||||||
InitKeyboard(); // Keyboard init (stdin)
|
InitKeyboard(); // Keyboard init (stdin)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,8 +46,6 @@
|
||||||
*
|
*
|
||||||
**********************************************************************************************/
|
**********************************************************************************************/
|
||||||
|
|
||||||
#include "rcore.h"
|
|
||||||
|
|
||||||
// TODO: Include the platform specific libraries
|
// 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.Mouse.cursor = MOUSE_CURSOR_ARROW;
|
||||||
CORE.Input.Gamepad.lastButtonPressed = 0; // GAMEPAD_BUTTON_UNKNOWN
|
CORE.Input.Gamepad.lastButtonPressed = 0; // GAMEPAD_BUTTON_UNKNOWN
|
||||||
CORE.Window.eventWaiting = false;
|
CORE.Window.eventWaiting = false;
|
||||||
|
|
||||||
|
|
||||||
// TODO: Platform specific init window
|
// TODO: Platform specific init window
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
CORE.Window.screen.width = width;
|
CORE.Window.screen.width = width;
|
||||||
|
@ -144,7 +142,7 @@ void InitWindow(int width, int height, const char *title)
|
||||||
CORE.Window.ready = InitGraphicsDevice(width, height);
|
CORE.Window.ready = InitGraphicsDevice(width, height);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Initialize OpenGL context (states and resources)
|
// Initialize OpenGL context (states and resources)
|
||||||
// NOTE: CORE.Window.currentFbo.width and CORE.Window.currentFbo.height not used, just stored as globals in rlgl
|
// 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);
|
rlglInit(CORE.Window.currentFbo.width, CORE.Window.currentFbo.height);
|
||||||
|
@ -711,13 +709,13 @@ static int InitPlatform(void)
|
||||||
rlLoadExtensions(eglGetProcAddress);
|
rlLoadExtensions(eglGetProcAddress);
|
||||||
|
|
||||||
CORE.Window.ready = true;
|
CORE.Window.ready = true;
|
||||||
|
|
||||||
// If graphic device is no properly initialized, we end program
|
// 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; }
|
if (!CORE.Window.ready) { TRACELOG(LOG_FATAL, "PLATFORM: Failed to initialize graphic device"); return -1; }
|
||||||
|
|
||||||
// Initialize hi-res timer
|
// Initialize hi-res timer
|
||||||
InitTimer();
|
InitTimer();
|
||||||
|
|
||||||
// Initialize base path for storage
|
// Initialize base path for storage
|
||||||
CORE.Storage.basePath = GetWorkingDirectory();
|
CORE.Storage.basePath = GetWorkingDirectory();
|
||||||
|
|
||||||
|
|
|
@ -45,8 +45,6 @@
|
||||||
*
|
*
|
||||||
**********************************************************************************************/
|
**********************************************************************************************/
|
||||||
|
|
||||||
#include "rcore.h"
|
|
||||||
|
|
||||||
#define GLFW_INCLUDE_ES2 // GLFW3: Enable OpenGL ES 2.0 (translated to WebGL)
|
#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?)
|
// #define GLFW_INCLUDE_ES3 // GLFW3: Enable OpenGL ES 3.0 (transalted to WebGL2?)
|
||||||
#include "GLFW/glfw3.h" // GLFW3: Windows, OpenGL context and Input management
|
#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;
|
CORE.Input.Gamepad.lastButtonPressed = GAMEPAD_BUTTON_UNKNOWN;
|
||||||
|
|
||||||
// Initialize platform
|
// Initialize platform
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
InitPlatform();
|
InitPlatform();
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -256,7 +254,7 @@ void CloseWindow(void)
|
||||||
rlglClose(); // De-init rlgl
|
rlglClose(); // De-init rlgl
|
||||||
|
|
||||||
// De-initialize platform
|
// De-initialize platform
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
ClosePlatform();
|
ClosePlatform();
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -1005,7 +1003,7 @@ static int InitPlatform(void)
|
||||||
glfwSetCursorEnterCallback(platform.handle, CursorEnterCallback);
|
glfwSetCursorEnterCallback(platform.handle, CursorEnterCallback);
|
||||||
|
|
||||||
glfwMakeContextCurrent(platform.handle);
|
glfwMakeContextCurrent(platform.handle);
|
||||||
|
|
||||||
// Load OpenGL extensions
|
// Load OpenGL extensions
|
||||||
// NOTE: GL procedures address loader is required to load extensions
|
// NOTE: GL procedures address loader is required to load extensions
|
||||||
rlLoadExtensions(glfwGetProcAddress);
|
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, " > 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, " > 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);
|
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
|
CORE.Window.ready = true; // TODO: Proper validation on windows/context creation
|
||||||
|
|
||||||
// If graphic device is no properly initialized, we end program
|
// 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; }
|
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);
|
else SetWindowPosition(GetMonitorWidth(GetCurrentMonitor())/2 - CORE.Window.screen.width/2, GetMonitorHeight(GetCurrentMonitor())/2 - CORE.Window.screen.height/2);
|
||||||
|
|
||||||
// Initialize hi-res timer
|
// Initialize hi-res timer
|
||||||
InitTimer();
|
InitTimer();
|
||||||
|
|
||||||
// Initialize base path for storage
|
// Initialize base path for storage
|
||||||
CORE.Storage.basePath = GetWorkingDirectory();
|
CORE.Storage.basePath = GetWorkingDirectory();
|
||||||
|
|
||||||
// Setup callback functions for the DOM events
|
// Setup callback functions for the DOM events
|
||||||
emscripten_set_fullscreenchange_callback("#canvas", NULL, 1, EmscriptenFullscreenChangeCallback);
|
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)
|
// Support gamepad events (not provided by GLFW3 on emscripten)
|
||||||
emscripten_set_gamepadconnected_callback(NULL, 1, EmscriptenGamepadCallback);
|
emscripten_set_gamepadconnected_callback(NULL, 1, EmscriptenGamepadCallback);
|
||||||
emscripten_set_gamepaddisconnected_callback(NULL, 1, EmscriptenGamepadCallback);
|
emscripten_set_gamepaddisconnected_callback(NULL, 1, EmscriptenGamepadCallback);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue