Deferred showing window until after the first frame has rendered
Fixes #97
This commit is contained in:
+2
-2
@@ -89,8 +89,8 @@ int main(int argc, char **argv) {
|
|||||||
SDL_GetCurrentDisplayMode(0, &dm);
|
SDL_GetCurrentDisplayMode(0, &dm);
|
||||||
|
|
||||||
window = SDL_CreateWindow(
|
window = SDL_CreateWindow(
|
||||||
"", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
|
"", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, dm.w * 0.8, dm.h * 0.8,
|
||||||
dm.w * 0.8, dm.h * 0.8, SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI);
|
SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_HIDDEN);
|
||||||
init_window_icon();
|
init_window_icon();
|
||||||
ren_init(window);
|
ren_init(window);
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdbool.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "lib/stb/stb_truetype.h"
|
#include "lib/stb/stb_truetype.h"
|
||||||
@@ -65,6 +66,11 @@ void ren_init(SDL_Window *win) {
|
|||||||
|
|
||||||
void ren_update_rects(RenRect *rects, int count) {
|
void ren_update_rects(RenRect *rects, int count) {
|
||||||
SDL_UpdateWindowSurfaceRects(window, (SDL_Rect*) rects, count);
|
SDL_UpdateWindowSurfaceRects(window, (SDL_Rect*) rects, count);
|
||||||
|
static bool initial_frame = true;
|
||||||
|
if (initial_frame) {
|
||||||
|
SDL_ShowWindow(window);
|
||||||
|
initial_frame = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user