|
@@ -135,16 +135,70 @@ void InitWindow(int width, int height, const char *title)
|
|
|
CORE.Window.currentFbo.width = width;
|
|
|
CORE.Window.currentFbo.height = height;
|
|
|
|
|
|
- // TODO: Initialize window/display system
|
|
|
-
|
|
|
- // TODO: Initialize input events system
|
|
|
+ // Initialize graphics device
|
|
|
+ // NOTE: returns true if window and graphic device has been initialized successfully
|
|
|
+ CORE.Window.ready = InitGraphicsDevice(width, height);
|
|
|
+
|
|
|
+ // If graphic device is no properly initialized, we end program
|
|
|
+ if (!CORE.Window.ready) { TRACELOG(LOG_FATAL, "PLATFORM: Failed to initialize graphic device"); return; }
|
|
|
+
|
|
|
+ // Initialize hi-res timer
|
|
|
+ InitTimer();
|
|
|
+
|
|
|
+ // Initialize random seed
|
|
|
+ SetRandomSeed((unsigned int)time(NULL));
|
|
|
+
|
|
|
+ // Initialize base path for storage
|
|
|
+ CORE.Storage.basePath = GetWorkingDirectory();
|
|
|
+
|
|
|
+#if defined(SUPPORT_MODULE_RTEXT) && defined(SUPPORT_DEFAULT_FONT)
|
|
|
+ // Load default font
|
|
|
+ // WARNING: External function: Module required: rtext
|
|
|
+ LoadFontDefault();
|
|
|
+ #if defined(SUPPORT_MODULE_RSHAPES)
|
|
|
+ // Set font white rectangle for shapes drawing, so shapes and text can be batched together
|
|
|
+ // WARNING: rshapes module is required, if not available, default internal white rectangle is used
|
|
|
+ Rectangle rec = GetFontDefault().recs[95];
|
|
|
+ if (CORE.Window.flags & FLAG_MSAA_4X_HINT)
|
|
|
+ {
|
|
|
+ // NOTE: We try to maxime rec padding to avoid pixel bleeding on MSAA filtering
|
|
|
+ SetShapesTexture(GetFontDefault().texture, (Rectangle){ rec.x + 2, rec.y + 2, 1, 1 });
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // NOTE: We set up a 1px padding on char rectangle to avoid pixel bleeding
|
|
|
+ SetShapesTexture(GetFontDefault().texture, (Rectangle){ rec.x + 1, rec.y + 1, rec.width - 2, rec.height - 2 });
|
|
|
+ }
|
|
|
+ #endif
|
|
|
+#else
|
|
|
+ #if defined(SUPPORT_MODULE_RSHAPES)
|
|
|
+ // Set default texture and rectangle to be used for shapes drawing
|
|
|
+ // NOTE: rlgl default texture is a 1x1 pixel UNCOMPRESSED_R8G8B8A8
|
|
|
+ Texture2D texture = { rlGetTextureIdDefault(), 1, 1, 1, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 };
|
|
|
+ SetShapesTexture(texture, (Rectangle){ 0.0f, 0.0f, 1.0f, 1.0f }); // WARNING: Module required: rshapes
|
|
|
+ #endif
|
|
|
+#endif
|
|
|
+#if defined(SUPPORT_MODULE_RTEXT) && defined(SUPPORT_DEFAULT_FONT)
|
|
|
+ if ((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0)
|
|
|
+ {
|
|
|
+ // Set default font texture filter for HighDPI (blurry)
|
|
|
+ // RL_TEXTURE_FILTER_LINEAR - tex filter: BILINEAR, no mipmaps
|
|
|
+ rlTextureParameters(GetFontDefault().texture.id, RL_TEXTURE_MIN_FILTER, RL_TEXTURE_FILTER_LINEAR);
|
|
|
+ rlTextureParameters(GetFontDefault().texture.id, RL_TEXTURE_MAG_FILTER, RL_TEXTURE_FILTER_LINEAR);
|
|
|
+ }
|
|
|
+#endif
|
|
|
|
|
|
- // TODO: Initialize assets manager
|
|
|
+#if defined(SUPPORT_EVENTS_AUTOMATION)
|
|
|
+ events = (AutomationEvent *)RL_CALLOC(MAX_CODE_AUTOMATION_EVENTS, sizeof(AutomationEvent));
|
|
|
+ CORE.Time.frameCounter = 0;
|
|
|
+#endif
|
|
|
|
|
|
- // TODO: Initialize base path for storage
|
|
|
- //CORE.Storage.basePath = platform.app->activity->internalDataPath;
|
|
|
+ // TODO: Platform specific init window
|
|
|
+ //--------------------------------------------------------------
|
|
|
+ // ...
|
|
|
+ //--------------------------------------------------------------
|
|
|
|
|
|
- TRACELOG(LOG_INFO, "PLATFORM: Application initialized successfully");
|
|
|
+ TRACELOG(LOG_INFO, "PLATFORM: CUSTOM: Application initialized successfully");
|
|
|
}
|
|
|
|
|
|
// Close window and unload OpenGL context
|