Pixel-Composer/scripts/mac_window_init/mac_window_init.gml

56 lines
1.1 KiB
Plaintext

enum WINDOW_DRAG_MODE {
_move = 1 << 0,
resize_n = 1 << 1,
resize_e = 1 << 2,
resize_s = 1 << 3,
resize_w = 1 << 4,
}
function mac_window_init() {
globalvar __win_is_maximized, __win_min_x, __win_min_y, __win_min_w, __win_min_h;
__win_delay = 2;
__win_is_dragging = 0;
__win_drag_mx = 0;
__win_drag_my = 0;
__win_drag_sx = 0;
__win_drag_sy = 0;
__win_drag_sw = 0;
__win_drag_sh = 0;
__win_is_maximized = false;
__win_min_x = 0;
__win_min_y = 0;
__win_min_w = 0;
__win_min_h = 0;
}
function mac_window_maximize() {
if(__win_is_maximized) return;
__win_is_maximized = true;
__win_min_x = window_get_x();
__win_min_y = window_get_y();
__win_min_w = window_get_width();
__win_min_h = window_get_height();
var _w = display_get_width();
var _h = display_get_height();
room_width = _w;
room_height = _h;
display_set_gui_size(_w, _h);
gameframe_drag_set_rect(0, 0, _w, _h);
display_refresh();
}
function mac_window_minimize() {
if(!__win_is_maximized) return;
__win_is_maximized = false;
gameframe_drag_set_rect(__win_min_x, __win_min_y, __win_min_w, __win_min_h);
display_refresh();
}