Tweaks
minecraft-pi-docker/pipeline/head This commit looks good Details

This commit is contained in:
TheBrokenRail 2020-10-30 18:44:47 -04:00
parent d3e0310a60
commit 8f1dfecc9a
1 changed files with 10 additions and 6 deletions

View File

@ -177,6 +177,10 @@ static void glfw_scroll(__attribute__((unused)) GLFWwindow *window, __attribute_
} }
} }
// Default Window Size
#define DEFAULT_WIDTH 840
#define DEFAULT_HEIGHT 480
// Init GLFW // Init GLFW
HOOK(SDL_WM_SetCaption, void, (const char *title, __attribute__((unused)) const char *icon)) { HOOK(SDL_WM_SetCaption, void, (const char *title, __attribute__((unused)) const char *icon)) {
FreeImage_Initialise(0); FreeImage_Initialise(0);
@ -196,7 +200,7 @@ HOOK(SDL_WM_SetCaption, void, (const char *title, __attribute__((unused)) const
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfw_window = glfwCreateWindow(840, 480, title, NULL, NULL); glfw_window = glfwCreateWindow(DEFAULT_WIDTH, DEFAULT_HEIGHT, title, NULL, NULL);
if (!glfw_window) { if (!glfw_window) {
fprintf(stderr, "Unable To Create GLFW Window\n"); fprintf(stderr, "Unable To Create GLFW Window\n");
exit(1); exit(1);
@ -227,9 +231,9 @@ HOOK(eglSwapBuffers, EGLBoolean, (__attribute__((unused)) EGLDisplay display, __
static int is_fullscreen = 0; static int is_fullscreen = 0;
// Old Size And Position To Use When Exiting Fullscreen
static int old_width = -1; static int old_width = -1;
static int old_height = -1; static int old_height = -1;
static int old_x = -1; static int old_x = -1;
static int old_y = -1; static int old_y = -1;
@ -434,8 +438,8 @@ HOOK(XGetWindowAttributes, int, (Display *display, Window w, XWindowAttributes *
XWindowAttributes attributes; XWindowAttributes attributes;
attributes.x = 0; attributes.x = 0;
attributes.y = 0; attributes.y = 0;
attributes.width = 640; attributes.width = DEFAULT_WIDTH;
attributes.height = 480; attributes.height = DEFAULT_HEIGHT;
*window_attributes_return = attributes; *window_attributes_return = attributes;
return 1; return 1;
} }
@ -472,6 +476,6 @@ __attribute__((constructor)) static void init() {
setenv("GALLIUM_DRIVER", "virpipe", 1); setenv("GALLIUM_DRIVER", "virpipe", 1);
} }
is_server = mode == 2; is_server = mode == 2;
// Disable X11 When In Server Mode // Video is Handled By GLFW Not SDL
setenv("SDL_VIDEODRIVER", is_server ? "dummy" : "x11", 1); setenv("SDL_VIDEODRIVER", "dummy", 1);
} }