diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index 339b1121e..b17f987ce 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -248,6 +248,7 @@ {"name":"Spout","order":13,"path":"extensions/Spout/Spout.yy",}, {"name":"Steamworks","order":2,"path":"extensions/Steamworks/Steamworks.yy",}, {"name":"TabletStuff","order":15,"path":"extensions/TabletStuff/TabletStuff.yy",}, + {"name":"winwin","order":5,"path":"extensions/winwin/winwin.yy",}, {"name":"YYFirebaseFirestore","order":1,"path":"extensions/YYFirebaseFirestore/YYFirebaseFirestore.yy",}, {"name":"_f_code_s","order":18,"path":"fonts/_f_code_s/_f_code_s.yy",}, {"name":"_f_code","order":9,"path":"fonts/_f_code/_f_code.yy",}, @@ -1377,6 +1378,7 @@ {"name":"wav_file_object","order":2,"path":"scripts/wav_file_object/wav_file_object.yy",}, {"name":"widget","order":5,"path":"scripts/widget/widget.yy",}, {"name":"window_functions","order":2,"path":"scripts/window_functions/window_functions.yy",}, + {"name":"winwin_extras","order":6,"path":"scripts/winwin_extras/winwin_extras.yy",}, {"name":"sh_2d_light","order":10,"path":"shaders/sh_2d_light/sh_2d_light.yy",}, {"name":"sh_3d_depth","order":6,"path":"shaders/sh_3d_depth/sh_3d_depth.yy",}, {"name":"sh_3d_extrude_corner","order":7,"path":"shaders/sh_3d_extrude_corner/sh_3d_extrude_corner.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index 270e0f1f5..6f782f5e6 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -680,6 +680,8 @@ {"$GMIncludedFile":"","%Name":"Canvas.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Templates","name":"Canvas.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, {"$GMIncludedFile":"","%Name":"Canvas.pxc","CopyToMask":-1,"filePath":"datafiles/Welcome files/Templates","name":"Canvas.pxc","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, {"$GMIncludedFile":"","%Name":"Welcome files.zip","CopyToMask":-1,"filePath":"datafiles/Welcome files","name":"Welcome files.zip","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, + {"$GMIncludedFile":"","%Name":"winwin.html","CopyToMask":-1,"filePath":"datafiles","name":"winwin.html","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, + {"$GMIncludedFile":"","%Name":"winwin.html","CopyToMask":-1,"filePath":"datafiles","name":"winwin.html","resourceType":"GMIncludedFile","resourceVersion":"2.0",}, ], "isEcma":false, "LibraryEmitters":[], @@ -713,6 +715,7 @@ {"id":{"name":"Spout","path":"extensions/Spout/Spout.yy",},}, {"id":{"name":"Steamworks","path":"extensions/Steamworks/Steamworks.yy",},}, {"id":{"name":"TabletStuff","path":"extensions/TabletStuff/TabletStuff.yy",},}, + {"id":{"name":"winwin","path":"extensions/winwin/winwin.yy",},}, {"id":{"name":"YYFirebaseFirestore","path":"extensions/YYFirebaseFirestore/YYFirebaseFirestore.yy",},}, {"id":{"name":"_f_code_s","path":"fonts/_f_code_s/_f_code_s.yy",},}, {"id":{"name":"_f_code","path":"fonts/_f_code/_f_code.yy",},}, @@ -2025,6 +2028,7 @@ {"id":{"name":"widget","path":"scripts/widget/widget.yy",},}, {"id":{"name":"window_functions","path":"scripts/window_functions/window_functions.yy",},}, {"id":{"name":"windowManager","path":"scripts/windowManager/windowManager.yy",},}, + {"id":{"name":"winwin_extras","path":"scripts/winwin_extras/winwin_extras.yy",},}, {"id":{"name":"sh_2d_light","path":"shaders/sh_2d_light/sh_2d_light.yy",},}, {"id":{"name":"sh_3d_depth","path":"shaders/sh_3d_depth/sh_3d_depth.yy",},}, {"id":{"name":"sh_3d_extrude_corner","path":"shaders/sh_3d_extrude_corner/sh_3d_extrude_corner.yy",},}, diff --git a/datafiles/winwin.html b/datafiles/winwin.html new file mode 100644 index 000000000..ee5448b58 --- /dev/null +++ b/datafiles/winwin.html @@ -0,0 +1,1049 @@ + + +winwin cheat sheet + + + + + + + + + + + + + + + + + +
+ +
+
+
+

Windows' windows

This is a "cheat sheet" for "winwin" extension by YellowAfterlife. +

+The extension can be found on itch.io. +

+The source code can be found on GitHub.

+
+
+Click on sections to expand/collapse them.
Quick display controls: +CategoriesSectionsEverything
+
+

+ + + + + + + + + + + + + +

Getting started
Basics
Basics
winwin_update()

+ Call this once a frame! +


winwin_create(x, y, width, height, config)​

+ Creates a new window! +

+ xywh are in screen coordinates. +

+ config is a winwin_config. +

+ For example, +

+var config = new winwin_config();
+config.caption = "Hello!";
+config.resize = true;
+window = winwin_create(window_get_x() - 400, window_get_y(), 350, 600, config);
+
winwin_destroy(window)

+ Destroys a previously created window. +

winwin_exists(window)​

+ Returns whether the specified window exists. +

+ This also checks whether the passed reference is a window at all (e.g. not an undefined). +


winwin_config()
winwin_config()

+ This struct holds a variety of properties that can be set when creating new windows. +

+ You can create one using new winwin_config() and fill out the desired variables. +

caption: string

+ Shown in the window's title bar, if visible. +

kind: int
resize: bool

+ Whether the window can be resized (defaults to false). +

show: bool

+ Whether the window should be shown immediately after creation. +

+ Setting this to false can be convenient if you're going to do + additional setup before showing the window to the user yourself + (using winwin_set_visible). +

+ Defaults to true. +

topmost

+ Whether the window should be marked as stay-on-top. +

+ Same effect as winwin_set_topmost. +

+ Defaults to false. +

taskbar_button

+ Whether the window should have a taskbar shown for it. +

+ Same effect as winwin_set_taskbar_button_visible. +

+ Currently only works for borderless windows + since tool windows can't have a taskbar button + and regular windows require additional setup for this. +

+ Defaults to true. +

clickthrough

+ Whether the window should be click-through. +

+ Same effect as winwin_get_clickthrough. +

+ Defaults to false. +

noactivate

+ Whether the window should not be possible to activate/focus. +

+ Same effect as winwin_set_noactivate. +

+ Defaults to false. +

per_pixel_alpha
close_button

+ Whether the window's close button should be enabled and what it should do. +

+ Same effect as winwin_set_close_button. +

+ Defaults to 1. +

vsync

+ Indicates the window's vertical synchronization state. +

+ Same effect as winwin_set_vsync. +

+ Defaults to 0. +

thread

+ Whether the window should do its message handling on a different thread. +

+ This takes marginally more resources and might have situational implications + (because the window is no longer owned by the thread where your game code and extensions run), + but this prevents the game window from freezing while the additional windows are being dragged around. +

+ It is not possible to make winwin_main threaded, + but you could use Gameframe + or hide your main window and draw the game to another one. +

+ Defaults to false. +

owner
winwin_main

+ This is a reference to your main game window. +

+ It enables using a handful of extension functions on it, with some remarks:

    +
  • Input functions just call the respective GM functions + since GM is responsible for input handling on the game window. +
  • Drawing functions (like winwin_draw_begin) don't really work + and don't have to be used either. +
  • Cursor functions don't work, but you can use the built-in functions + (and/or Native Cursors). +
Drawing
Drawing
winwin_draw_begin(window)​

+ Starts drawing to the specified window. +

+ By most means this is like surface_set_target, but for windows. +

+ Returns whether successful. + Can fail if you're already drawing to another window. +

winwin_draw_clear(color, alpha = 1)

+ The built-in draw_clear and draw_clear_alpha functions cannot draw to additional + windows because they respect the game's original drawing bounds, + so I'm giving you this helper function for clearing the window to whatever color and opacity. +

winwin_draw_sync()​

+ If you're doing a surface_set_target while drawing to an additional window, + call this after surface_reset_target to make GM draw to that window window again + (otherwise the subsequent drawing operations will end up in the main window instead). +

+ Returns whether successful. + Returns false if you're not drawing to a window. +

winwin_draw_end()​

+ Stops drawing to the specified window and updates its contents. +

+ This happens immediately and can be used to display debug information + in additional windows while the game is busy (e.g. generating a level). +

+ Returns whether successful. + Returns false if you're not drawing to a window. +

+ A typical use of drawing functions might look as following: +

+winwin_draw_begin(my_window);
+winwin_draw_clear(c_white);
+draw_set_color(c_black);
+draw_text(5, 5, "Hello!");
+winwin_draw_end();
+
winwin_resize_buffer(window, width, height)​

+ Changes internal drawing buffer size of a window. +

+ You shouldn't have to call this explicitly since it'll be called for you a few frames + after a window's size changes. +

+ Returns whether successful. +

Known issues

+ I do not go through the trouble of completely clearing-restoring the drawing state, + so there are occasional opportunities for self-sabotage if you are setting your own + matrices / clip rectangles / etc. +

Input
Input

+ To be fair, you could just use keyboard_check_direct as a replacement for most of these, but where's the fun in that? +

Keyboard
Keyboard
winwin_keyboard_check(window, key)​
winwin_keyboard_check_pressed(window, key)​
winwin_keyboard_check_released(window, key)​

+ Text entry: +

winwin_keyboard_get_string(window)​

+ Like keyboard_string, but for additional windows. +

+ The behaviour should generally be identical to how the built-in variable works, but without erasing it when the window loses focus (why's that a thing, anyway?). +

winwin_keyboard_set_string(window, string)​

+ Changes the current keyboard string for a window. +

+ Settings: +

winwin_keyboard_get_max_string_length(window)​

+ Returns how long a keyboard_string of the given window is allowed to get, in characters. +

+ Default is 128. +

winwin_keyboard_set_max_string_length(window)​

+ Changes how long a keyboard_string of the given window is allowed to get, in characters. +

+ Returns whether successful. +

Mouse
Mouse
winwin_mouse_is_over(window)​

+ Returns whether the cursor is currently over the given window. +

winwin_mouse_get_x(window)​int

+ Like window_mouse_get_x, but for additional windows. +

winwin_mouse_get_y(window)​int

+ Like window_mouse_get_y, but for additional windows. +

+ Buttons: +

winwin_mouse_check_button(window, button)​
winwin_mouse_check_button_pressed(window, button)​
winwin_mouse_check_button_released(window, button)​

+ Wheel: +

winwin_mouse_wheel_up(window)​
winwin_mouse_wheel_down(window)​
winwin_mouse_wheel_get_delta_x(window)​int

+ Returns horizontal wheel delta since last frame. +

+ Per Microsoft documentation, 120 units should be equivalent to one wheel tick. +

winwin_mouse_wheel_get_delta_y(window)​int

+ Returns vertical wheel delta since last frame. +

+ Per Microsoft documentation, 120 units should be equivalent to one wheel tick. +

Gamepad

+ Doing gamepad polling for each window would be both high-effort and computationally taxing, + but you can use extensions to poll gamepad input regardless of what window has focus + (XInput, + DirectInput) +

Position and size
Position and size

+ These return the current position/size of a window.
+ They'll return undefined if the window has been closed or cannot be measured. +

winwin_get_x(window)​
winwin_get_y(window)​
winwin_get_width(window)​
winwin_get_height(window)​

+ These change position/size of a window: +

winwin_set_position(window, x, y)​
winwin_set_size(window, width, height)​
winwin_set_rectangle(window, x, y, width, height)​

+ These let you change min/max size of a window.
+ Pass undefined instead of a size to not restrict: +

window_set_min_width(window, ?min_width?)​
window_set_min_height(window, ?min_height?)​
window_set_max_width(window, ?max_width?)​
window_set_max_height(window, ?max_height?)​

+ These return min/max size of a window (or undefined if not set): +

window_get_min_width(window)​
window_get_min_height(window)​
window_get_max_width(window)​
window_get_max_height(window)​
Properties
Properties
winwin_set_caption(window, caption)​

+ Changes the caption/title of a window, like window_set_caption. +

+ Returns whether successful. +

winwin_get_caption(window)​

+ Returns the caption/title of a window. +


winwin_set_visible(window, visible)​

+ Shows/hides a window. +

+ Returns whether successful. +

winwin_get_visible(window)​

+ Returns whether a window is visible. +


winwin_set_owner(window, owner)

+ Changes the window owner (GWLP_HWNDPARENT). +

+ Linked windows always appear over the owner window, + minimize along with it, and are generally what you want + for any pop-out panels and alike. +

+ owner can be undefined to un-link. +

winwin_get_owner(window)​

+ Returns the current window owner + (or undefined if not linked). +


winwin_set_taskbar_button_visible(window, show_button)​

+ Changes whether the taskbar button is visible. +

+ Currently only works for borderless windows (see winwin_config.taskbar_button). +

+ Returns whether successful. +

winwin_get_taskbar_button_visible(window)​

+ Returns whether a window's taskbar button is visible. +


winwin_set_clickthrough(window, enable_clickthrough)​

+ Changes whether a window is click-through. +

+ Click-through windows let through all mouse events - good for overlays + or making some portions of the window + (e.g. ones with per-pixel transparency) non-interactive. +

+ Returns whether successful. +

winwin_get_clickthrough(window)​

+ Returns whether a window is click-through. +


winwin_set_noactivate(window, disable_activation)​

+ Returns whether the window should have activation disabled. +

+ This prevents giving it focus in most usual means. +

+ Returns whether successful. +

winwin_get_noactivate(window)​

+ Returns whether a window has activation disabled. +


winwin_set_close_button(window, state)​

+ Changes a window's close button state. Allowed values are:

    +
  • 0 (or false): close button is visibly disabled +
  • 1 (or true): close button is enabled;
    + Closing the window destroys it, which you can check for using winwin_exists. +
  • 2: close button is enabled;
    + Closing the window hides it (as with winwin_set_visible), + which you can check for using winwin_get_visible. +

+ Returns whether successful. +

winwin_get_close_button(window)​

+ Returns a window's close button state. +


winwin_set_vsync(window, vsync)​

+ Changes whether drawing to a specific window uses vertical synchronization. +

+ Using values larger than 1 will draw every N-th blank. +

+ The intricacies of using vsync across multiple windows of the same application + have not been extensively studied. +

winwin_get_vsync(window)​

+ Returns the window's vertical synchronization value. +

Z-Order
Z-Order
winwin_order_after(window, other_window)​

+ Puts the window in front of another window. +

+ Returns whether successful. +

winwin_order_front(window)​

+ Moves the window to the front (like when giving it focus). +

+ Returns whether successful. +

winwin_order_back(window)​

+ Moves the window to the back. +

+ Returns whether successful. +


winwin_set_topmost(window, enable)​

+ Changes whether the window should be stay-on-top. +

+ Returns whether successful. +

winwin_get_topmost(window)​

+ Returns whether the window is stay-on-top. +

Focus
Focus
winwin_has_focus(window)​

+ Like window_has_focus, but for additional windows. +

winwin_get_focus()​

+ Returns the window that currently has keyboard focus, + or undefined if there's none or it's not part of the current application. +

hscript error!
+{ fileName => hscript, lineNumber => 9 } hscript:9: Invalid number of parameters. Got 1, required 2 for function 'msdn'
+Called from hscript/Interp.hx line 415
+Called from a C function
+Called from hscript/Interp.hx line 684
+Called from hscript/Interp.hx line 381
+Called from hscript/Interp.hx line 259
+Called from hscript/Interp.hx line 258
+Called from hscript/Interp.hx line 254
+Called from dmd/tags/TagExec.hx line 76
winwin_set_focus(window)​

+ Forces keyboard focus upon a window. +

+ Returns whether successful. +

Window shapes
Window shapes

+ Consider these a trimmed-down version of + window_shape. +

winwin_get_alpha(window)​

+ Returns opacity of a window in 0..1 range. +

winwin_set_alpha(window, alpha)​

+ Changes opacity of a window (alpha being a 0..1 range). +

+ Returns whether successful. +


winwin_set_chromakey(window, color)​

+ Changes the chromakey color for a window. +

+ Pixels that fully match this color will be see-through and click-through. +

+ Pass -1 instead of the color to disable chromakey. +

winwin_get_chromakey(window)​int

+ Returns the window's chromakey color (-1 if disabled). +


winwin_enable_per_pixel_alpha(window)​
winwin_enable_per_pixel_alpha(window)

+ Quoting my own notes from window_shape, +

+ This function calls + DwmEnableBlurBehindWindow + for a zero-sized region. +

+ Doing so also happens to enable partial transparency support for the contents of the window + ("The alpha values in the window are honored"). +

+ For example, if you did +

+draw_clear_alpha(c_black, 0);
+

+ in a Draw event of the only instance in a room, your window would look like an empty frame. +

+ For a proper setup, make sure that + "Clear Display Buffer", + "Enable Viewports" (with at least one view set up), + and "Clear Viewport Background" + are enabled for the room; + see desktop_friend project for a slightly more sophisticated example. +

+ Now let's talk about the conditions and caveats: +

Premultiplied alpha

+ Windows expects the window pixels to have premultiplied alpha. +

+ In short, instead of just color, the pixels should be colored with +

+merge_color(c_black, color, alpha)
+

+ For sprites, all recent GameMaker versions have a "Premultiply alpha" checkbox + in the Texture Settings; +

+ For text and primitives, you'll need to use the above formula; +

+ For mixing multiple semi-transparent images together, see the classic + GameMaker surface problems and solutions. +

+ If you don't use pre-multiplied alpha, your window will still work, + but the semi-transparent bright portions will appear lighter than they should be. +

Hit testing

+ According to Windows, just because a pixel is now almost or completely transparent, + that doesn't mean that you can't click it! +

+ You can use the extension's other functions (be it shapes or chromakey) + to narrow down the window's shape, or use the + winwin_set_clickthrough function + to make the window clickable/un-clickable + based on where the cursor is. +

One-way ticket

+ The function has been around since Windows 7, + yet it doesn't seem like you can go back to an opaque window + once you have called it - even if you pass dwFlags of 0. +

+ You can "top-up" the opacity of the window contents by drawing a black rectangle + with bm_add blend mode or any rectangle with gpu_set_colourwriteenable + (or draw_set_colour_write_enable for GMS1) of (0, 0, 0, 1). +

Cursors
Cursors
winwin_set_cursor(window, cursor)​

+ Changes the window's current cursor, using GameMaker cr_ constants. +

+ You can also use -18 (cr_no from GM8) for a 🚫 cursor. +

+ Returns whether successful. +

winwin_get_cursor(window)​

+ Returns which cursor (out of the built-in set) the window is currently using. +

+ If it's not using any of those, returns undefined. +

+ Custom cursors: +

winwin_set_cursor_handle(window, hcursor)​

+ Changes the window's current cursor to a new HCURSOR (ptr). +

+ You can only get these from other extensions. +

winwin_get_cursor_handle(window)​

+ Returns the window's current cursor as HCURSOR. +

+ Make sure to not accidentally delete winwin's cursors as these are shared + between all windows. +

Working with other extensions
Other functions
Known issues
    +
  1. If the user has set up a custom Max Frame Rate override in NVIDIA Control Panel, + the limit works as (value / active window count) instead. +

    + The underlying cause seems to be that NVIDIA driver counts Present calls + on per-process basis rather than per-window. +

    + I haven't come up with a Cool Workaround for this yet, + but if the user has set up it themselves, they can also remove the override. +

  2. Drawing with shaders into additional windows works weird. +

    + Probably changes some D3D11 state that I'm not aware of. +

    + For now, you can draw things with shaders onto a surface and then draw that surface + into a window. +

+
+
+ +
+ + diff --git a/objects/_p_dialog/Create_0.gml b/objects/_p_dialog/Create_0.gml index d477d45e3..8ddedb928 100644 --- a/objects/_p_dialog/Create_0.gml +++ b/objects/_p_dialog/Create_0.gml @@ -3,6 +3,10 @@ #macro DIALOG_DRAW_BG draw_sprite_stretched(THEME.dialog, 0, dialog_x - 8, dialog_y - 8, dialog_w + 16, dialog_h + 16); #macro DIALOG_DRAW_FOCUS draw_sprite_stretched_ext(THEME.dialog, 1, dialog_x - 8, dialog_y - 8, dialog_w + 16, dialog_h + 16, COLORS._main_accent, 1); +#macro DIALOG_WINCLEAR if(window != noone) { winwin_draw_clear(COLORS.panel_bg_clear, 0); } +#macro DIALOG_PREDRAW if(window != noone) { winwin_draw_begin(window); WINDOW_ACTIVE = window; } +#macro DIALOG_POSTDRAW if(window != noone) { winwin_draw_end(); WINDOW_ACTIVE = noone; } + #region data on_top = false; @@ -21,6 +25,9 @@ dialog_x = 0; dialog_y = 0; + title = "dialog"; + window = noone; + title_height = 64; padding = 20; @@ -55,26 +62,83 @@ mouse_active = true; if(!draggable) return; - if(dialog_dragging) { - dialog_x = clamp(dialog_drag_sx + mouse_mx - dialog_drag_mx, ui(16) - dialog_w, WIN_W - ui(16)); - dialog_y = clamp(dialog_drag_sy + mouse_my - dialog_drag_my, ui(16) - dialog_h, WIN_H - ui(16)); + WINDOW_ACTIVE = window; - if(mouse_release(mb_left)) - dialog_dragging = false; - } - - if(mouse_draggable && point_in_rectangle(mouse_mx, mouse_my, dialog_x, dialog_y, dialog_x + dialog_w, dialog_y + ui(title_height))) { - mouse_active = false; - if(mouse_press(mb_left, sFOCUS)) { - dialog_dragging = true; - dialog_drag_sx = dialog_x; - dialog_drag_sy = dialog_y; - dialog_drag_mx = mouse_mx; - dialog_drag_my = mouse_my; + if(window == noone) { + if(dialog_dragging) { + var _dx = dialog_drag_sx + mouse_mx - dialog_drag_mx; + var _dy = dialog_drag_sy + mouse_my - dialog_drag_my; + + var _wx = window_get_x(); + var _wy = window_get_y(); + + if(point_in_rectangle(mouse_raw_x, mouse_raw_y, _wx, _wy, _wx + WIN_W, _wy + WIN_H)) { + dialog_x = clamp(_dx, ui(16) - dialog_w, WIN_W - ui(16)); + dialog_y = clamp(_dy, ui(16) - dialog_h, WIN_H - ui(16)); + + } else if(PREFERENCES.multi_window) { + o_main.dialog_popup_to = 1; + o_main.dialog_popup_x = mouse_mx; + o_main.dialog_popup_y = mouse_my; + + if(mouse_release(mb_left)) { + var _wconfig = new winwin_config(); + _wconfig.kind = winwin_kind_borderless; + _wconfig.caption = title; + _wconfig.topmost = true; + _wconfig.per_pixel_alpha = true; + _wconfig.resize = true; + _wconfig.owner = winwin_main; + + window = winwin_create(_wx + _dx, _wy + _dy, dialog_w, dialog_h, _wconfig); + dialog_x = 0; + dialog_y = 0; + } + } + + if(mouse_release(mb_left)) + dialog_dragging = false; + } + + if(mouse_draggable && point_in_rectangle(mouse_mx, mouse_my, dialog_x, dialog_y, dialog_x + dialog_w, dialog_y + title_height)) { + mouse_active = false; + if(mouse_press(mb_left, sFOCUS)) { + dialog_dragging = true; + dialog_drag_sx = dialog_x; + dialog_drag_sy = dialog_y; + dialog_drag_mx = mouse_mx; + dialog_drag_my = mouse_my; + } + } + + } else { + + if(dialog_dragging) { + var _dx = dialog_drag_sx + mouse_raw_x - dialog_drag_mx; + var _dy = dialog_drag_sy + mouse_raw_y - dialog_drag_my; + + winwin_set_position(window, _dx, _dy); + + if(mouse_release(mb_left)) + dialog_dragging = false; + } + + if(mouse_draggable && point_in_rectangle(mouse_mx, mouse_my, 0, 0, dialog_w, title_height)) { + mouse_active = false; + // print($"{mouse_mx}, {mouse_my} / {mouse_press(mb_left, sFOCUS)}"); + + if(mouse_press(mb_left, sFOCUS)) { + dialog_dragging = true; + dialog_drag_sx = winwin_get_x(window); + dialog_drag_sy = winwin_get_y(window); + dialog_drag_mx = mouse_raw_x; + dialog_drag_my = mouse_raw_y; + } } } mouse_draggable = true; + WINDOW_ACTIVE = noone; } dialog_resizable = false; @@ -93,46 +157,99 @@ if(!active) return; if(!dialog_resizable) return; - if(dialog_resizing & 1 << 0 != 0) { - var ww = dialog_resiz_sw + (mouse_mx - dialog_resiz_mx); - ww = clamp(ww, dialog_w_min, dialog_w_max); - dialog_w = ww; - } - - if(dialog_resizing & 1 << 1 != 0) { - var hh = dialog_resiz_sh + (mouse_my - dialog_resiz_my); - hh = clamp(hh, dialog_h_min, dialog_h_max); - dialog_h = hh; - } - - if(mouse_release(mb_left)) dialog_resizing = 0; - - if(sHOVER && distance_to_line(mouse_mx, mouse_my, dialog_x + dialog_w, dialog_y, dialog_x + dialog_w, dialog_y + dialog_h) < 12) { + if(window == noone) { + if(dialog_resizing & 1 << 0 != 0) { + var ww = dialog_resiz_sw + (mouse_mx - dialog_resiz_mx); + ww = clamp(ww, dialog_w_min, dialog_w_max); + dialog_w = ww; + } - mouse_active = false; - CURSOR = cr_size_we; - if(mouse_press(mb_left, sFOCUS)) { - dialog_resizing |= 1 << 0; - dialog_resiz_sw = dialog_w; - dialog_resiz_mx = mouse_mx; - dialog_resiz_my = mouse_my; + if(dialog_resizing & 1 << 1 != 0) { + var hh = dialog_resiz_sh + (mouse_my - dialog_resiz_my); + hh = clamp(hh, dialog_h_min, dialog_h_max); + dialog_h = hh; } - } - if(sHOVER && distance_to_line(mouse_mx, mouse_my, dialog_x, dialog_y + dialog_h, dialog_x + dialog_w, dialog_y + dialog_h) < 12) { + if(mouse_release(mb_left)) dialog_resizing = 0; - mouse_active = false; - if(CURSOR == cr_size_we) - CURSOR = cr_size_nwse; - else - CURSOR = cr_size_ns; - - if(mouse_press(mb_left, sFOCUS)) { - dialog_resizing |= 1 << 1; - dialog_resiz_sh = dialog_h; - dialog_resiz_mx = mouse_mx; - dialog_resiz_my = mouse_my; + if(sHOVER && distance_to_line(mouse_mx, mouse_my, dialog_x + dialog_w, dialog_y, dialog_x + dialog_w, dialog_y + dialog_h) < 12) { + + mouse_active = false; + CURSOR = cr_size_we; + if(mouse_press(mb_left, sFOCUS)) { + dialog_resizing |= 1 << 0; + dialog_resiz_sw = dialog_w; + dialog_resiz_mx = mouse_mx; + dialog_resiz_my = mouse_my; + } + } + + if(sHOVER && distance_to_line(mouse_mx, mouse_my, dialog_x, dialog_y + dialog_h, dialog_x + dialog_w, dialog_y + dialog_h) < 12) { + + mouse_active = false; + if(CURSOR == cr_size_we) CURSOR = cr_size_nwse; + else CURSOR = cr_size_ns; + + if(mouse_press(mb_left, sFOCUS)) { + dialog_resizing |= 1 << 1; + dialog_resiz_sh = dialog_h; + dialog_resiz_mx = mouse_mx; + dialog_resiz_my = mouse_my; + } } + + } else { + WINDOW_ACTIVE = window; + + var ww = dialog_resiz_sw; + var hh = dialog_resiz_sh; + + if(dialog_resizing & 1 << 0 != 0) { + ww = dialog_resiz_sw + (mouse_raw_x - dialog_resiz_mx); + ww = clamp(ww, dialog_w_min, dialog_w_max); + } + + if(dialog_resizing & 1 << 1 != 0) { + hh = dialog_resiz_sh + (mouse_raw_y - dialog_resiz_my); + hh = clamp(hh, dialog_h_min, dialog_h_max); + } + + if(dialog_resizing != 0) { + winwin_set_size(window, ww, hh); + if(mouse_release(mb_left)) dialog_resizing = 0; + } + + if(sHOVER && distance_to_line(mouse_mx, mouse_my, dialog_w, 0, dialog_w, dialog_h) < 12) { + + mouse_active = false; + CURSOR = cr_size_we; + + if(mouse_press(mb_left, sFOCUS)) { + dialog_resizing |= 1 << 0; + dialog_resiz_sw = dialog_w; + dialog_resiz_sh = dialog_h; + dialog_resiz_mx = mouse_raw_x; + dialog_resiz_my = mouse_raw_y; + } + } + + if(sHOVER && distance_to_line(mouse_mx, mouse_my, 0, dialog_h, dialog_w, dialog_h) < 12) { + + mouse_active = false; + if(CURSOR == cr_size_we) CURSOR = cr_size_nwse; + else CURSOR = cr_size_ns; + + if(mouse_press(mb_left, sFOCUS)) { + dialog_resizing |= 1 << 1; + dialog_resiz_sw = dialog_w; + dialog_resiz_sh = dialog_h; + dialog_resiz_mx = mouse_raw_x; + dialog_resiz_my = mouse_raw_y; + } + } + + winwin_set_cursor(window, CURSOR); + WINDOW_ACTIVE = noone; } } #endregion @@ -152,27 +269,39 @@ function checkFocus() { if(!active) return; + WINDOW_ACTIVE = window; - var _mx = FILE_IS_DROPPING? FILE_DROPPING_X : mouse_mx; - var _my = FILE_IS_DROPPING? FILE_DROPPING_Y : mouse_my; + if(window == noone) { + var _mx = FILE_IS_DROPPING? FILE_DROPPING_X : mouse_mx; + var _my = FILE_IS_DROPPING? FILE_DROPPING_Y : mouse_my; - if(point_in(_mx, _my)) { - if(depth < DIALOG_DEPTH_HOVER) { - DIALOG_DEPTH_HOVER = depth; - HOVER = self.id; + if(point_in(_mx, _my)) { + if(depth < DIALOG_DEPTH_HOVER) { + DIALOG_DEPTH_HOVER = depth; + HOVER = self.id; + } } + } else { + if(winwin_mouse_is_over(window)) + HOVER = self.id; } + + WINDOW_ACTIVE = noone; } function checkDepth() { if(!active) return; if(HOVER != self.id) return; - if(mouse_press(mb_any) && FOCUS != self.id) { + WINDOW_ACTIVE = window; + + if(mouse_press(mb_any)) { setFocus(self.id, "Dialog"); with(_p_dialog) other.depth = min(other.depth, depth - 1); } + + WINDOW_ACTIVE = noone; } function onFocusBegin() {} @@ -203,6 +332,8 @@ if(!active) return; if(!DIALOG_CLICK) return; + WINDOW_ACTIVE = window; + if(!init_pressing && mouse_press(mb_any)) { if(!isTop()) return; diff --git a/objects/_p_dialog/Destroy_0.gml b/objects/_p_dialog/Destroy_0.gml index 719188541..d9b5b6445 100644 --- a/objects/_p_dialog/Destroy_0.gml +++ b/objects/_p_dialog/Destroy_0.gml @@ -7,4 +7,6 @@ ds_list_remove(DIALOGS, self); if(parent) array_remove(parent.children, id); -if(!passthrough) MOUSE_BLOCK = true; \ No newline at end of file +if(!passthrough) MOUSE_BLOCK = true; + +if(window != noone) winwin_destroy(window); \ No newline at end of file diff --git a/objects/_p_dialog/Draw_73.gml b/objects/_p_dialog/Draw_73.gml new file mode 100644 index 000000000..59000af01 --- /dev/null +++ b/objects/_p_dialog/Draw_73.gml @@ -0,0 +1,3 @@ +if(window != noone) { + winwin_draw_end(); +} \ No newline at end of file diff --git a/objects/_p_dialog/Draw_74.gml b/objects/_p_dialog/Draw_74.gml new file mode 100644 index 000000000..631261657 --- /dev/null +++ b/objects/_p_dialog/Draw_74.gml @@ -0,0 +1 @@ +/// @description Insert description here diff --git a/objects/_p_dialog/Draw_75.gml b/objects/_p_dialog/Draw_75.gml new file mode 100644 index 000000000..631261657 --- /dev/null +++ b/objects/_p_dialog/Draw_75.gml @@ -0,0 +1 @@ +/// @description Insert description here diff --git a/objects/_p_dialog/Step_1.gml b/objects/_p_dialog/Step_1.gml index efa0c16c1..c284313d3 100644 --- a/objects/_p_dialog/Step_1.gml +++ b/objects/_p_dialog/Step_1.gml @@ -13,10 +13,16 @@ if !active exit; #endregion #region resize + if(window != noone) { + dialog_w = winwin_get_width(window); + dialog_h = winwin_get_height(window); + } + if(_dialog_h != dialog_h || _dialog_w != dialog_w) { _dialog_h = dialog_h; _dialog_w = dialog_w; if(onResize != -1) onResize(); } -#endregion \ No newline at end of file +#endregion + diff --git a/objects/_p_dialog/_p_dialog.yy b/objects/_p_dialog/_p_dialog.yy index dcb993a0b..33913c6be 100644 --- a/objects/_p_dialog/_p_dialog.yy +++ b/objects/_p_dialog/_p_dialog.yy @@ -6,6 +6,8 @@ {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":1,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":2,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":1,"eventType":3,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":74,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":75,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, ], "managed":true, "name":"_p_dialog", diff --git a/objects/o_dialog_color_selector/Draw_75.gml b/objects/o_dialog_color_selector/Draw_75.gml index f6b90f114..e7ac7c522 100644 --- a/objects/o_dialog_color_selector/Draw_75.gml +++ b/objects/o_dialog_color_selector/Draw_75.gml @@ -1,2 +1,4 @@ /// @description -selector.colorPicker(); \ No newline at end of file + +selector.colorPicker(); +event_inherited(); \ No newline at end of file diff --git a/objects/o_dialog_gradient/Draw_75.gml b/objects/o_dialog_gradient/Draw_75.gml index f6b90f114..e7ac7c522 100644 --- a/objects/o_dialog_gradient/Draw_75.gml +++ b/objects/o_dialog_gradient/Draw_75.gml @@ -1,2 +1,4 @@ /// @description -selector.colorPicker(); \ No newline at end of file + +selector.colorPicker(); +event_inherited(); \ No newline at end of file diff --git a/objects/o_dialog_palette/Draw_75.gml b/objects/o_dialog_palette/Draw_75.gml index f6b90f114..5444b8fdf 100644 --- a/objects/o_dialog_palette/Draw_75.gml +++ b/objects/o_dialog_palette/Draw_75.gml @@ -1,2 +1,3 @@ /// @description -selector.colorPicker(); \ No newline at end of file +selector.colorPicker(); +event_inherited(); \ No newline at end of file diff --git a/objects/o_dialog_panel/Draw_64.gml b/objects/o_dialog_panel/Draw_64.gml index b421a91f7..72fd8feda 100644 --- a/objects/o_dialog_panel/Draw_64.gml +++ b/objects/o_dialog_panel/Draw_64.gml @@ -1,116 +1,125 @@ /// @description if !ready exit; -#region base UI - var p = ui(8); - var m_in = point_in_rectangle(mouse_mxs, mouse_mys, dialog_x + p, dialog_y + p, dialog_x + dialog_w - p, dialog_y + dialog_h - p); - var m_ot = point_in_rectangle(mouse_mxs, mouse_mys, dialog_x, dialog_y, dialog_x + dialog_w, dialog_y + dialog_h); - - DIALOG_DRAW_BG -#endregion +DIALOG_PREDRAW +DIALOG_WINCLEAR -#region content - if(!is_undefined(content) && content != noone) { - content.panel = self; - - var cx = dialog_x + content.showHeader * padding; - var cy = dialog_y + content.showHeader * (padding + title_height); - content.x = cx; - content.y = cy; - content.onStepBegin(); - - content.pFOCUS = sFOCUS && m_in; - content.pHOVER = sHOVER && m_in; - - panel = surface_verify(panel, dialog_w - content.showHeader * padding * 2, - dialog_h - content.showHeader * (padding * 2 + title_height)); - if(!is_surface(mask_surface)) - resetMask(); - - surface_set_target(panel); - draw_clear(COLORS.panel_bg_clear); - content.drawContent(panel); - - gpu_set_blendmode(bm_subtract); - draw_surface_safe(mask_surface); - gpu_set_blendmode(bm_normal); - surface_reset_target(); - - content.drawGUI(); - - draw_surface(panel, cx, cy); - } -#endregion +title = content.title; +var p = ui(8); +var m_in = point_in_rectangle(mouse_mxs, mouse_mys, dialog_x + p, dialog_y + p, dialog_x + dialog_w - p, dialog_y + dialog_h - p); +var m_ot = point_in_rectangle(mouse_mxs, mouse_mys, dialog_x, dialog_y, dialog_x + dialog_w, dialog_y + dialog_h); -#region overlay - if(content.showHeader) { - draw_sprite_stretched_ext(THEME.ui_panel_bg, 3, dialog_x + 3, dialog_y + 3, dialog_w - 6, title_height + 2, COLORS._main_icon_light, 1); - draw_set_text(f_p2, fa_left, fa_top, COLORS._main_text_sub); - draw_text_cut(dialog_x + ui(32), dialog_y + ui(8), content.title, dialog_w - ui(32 + 32)); - - var _bx = dialog_x + dialog_w - ui(28); - var _by = dialog_y + ui(8); - var _bs = ui(20); - - if(instanceof(content) != "Panel_Menu") - if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, mouse_ui, sFOCUS, sHOVER, "", THEME.window_exit) == 2) { - onDestroy(); - instance_destroy(); - } - - _bx -= ui(8); - // draw_set_color(COLORS.panel_toolbar_separator); - // draw_line_width(_bx + ui(4), _by, _bx + ui(4), _by + _bs, 2); - - for (var i = 0, n = array_length(content.title_actions); i < n; i++) { - var _b = content.title_actions[i]; - - _bx -= _bs; - _b.setFocusHover(sFOCUS, sHOVER); - _b.draw(_bx, _by, _bs, _bs, mouse_ui, THEME.button_hide); - _bs -= ui(4); - } - } +DIALOG_DRAW_BG + +if(!is_undefined(content) && content != noone) { // content + content.panel = self; - var bx = content.showHeader? dialog_x + ui(8) : dialog_x + ui(24); - var by = content.showHeader? dialog_y + ui(8) : dialog_y + ui(18); - var txt = destroy_on_click_out? __txt("Pin") : __txt("Unpin"); - var cc = destroy_on_click_out? COLORS._main_icon : COLORS._main_icon_light; - var ind = !destroy_on_click_out; - var ss = content.showHeader? ui(20) : ui(28); - var sc = content.showHeader? 0.75 : 1; + var cx = dialog_x + content.showHeader * padding; + var cy = dialog_y + content.showHeader * (padding + title_height); + content.x = cx; + content.y = cy; + + content.onStepBegin(); + + content.pFOCUS = sFOCUS && m_in; + content.pHOVER = sHOVER && m_in; + + panel = surface_verify(panel, dialog_w - content.showHeader * padding * 2, + dialog_h - content.showHeader * (padding * 2 + title_height)); + if(!is_surface(mask_surface)) + resetMask(); + + DIALOG_POSTDRAW + surface_set_target(panel); + draw_clear(COLORS.panel_bg_clear); + + WINDOW_ACTIVE = window; + content.drawContent(panel); + WINDOW_ACTIVE = noone; + + gpu_set_blendmode(bm_subtract); + draw_surface_safe(mask_surface); + gpu_set_blendmode(bm_normal); + surface_reset_target(); + DIALOG_PREDRAW + + content.drawGUI(); + draw_surface(panel, cx, cy); +} + +if(content.showHeader) { + var _tx = window == noone? dialog_x + ui(32) : dialog_x + ui(10); + + draw_sprite_stretched_ext(THEME.ui_panel_bg, 3, dialog_x + 3, dialog_y + 3, dialog_w - 6, title_height + 2, COLORS._main_icon_light, 1); + draw_set_text(f_p2, fa_left, fa_top, COLORS._main_text_sub); + draw_text_cut(_tx, dialog_y + ui(8), content.title, dialog_w - ui(32 + 32)); + + var _bx = dialog_x + dialog_w - ui(28); + var _by = dialog_y + ui(8); + var _bs = ui(20); if(instanceof(content) != "Panel_Menu") - if(buttonInstant(THEME.button_hide, bx, by, ss, ss, mouse_ui, sFOCUS, sHOVER, txt, THEME.pin, ind, cc,, sc) == 2) - destroy_on_click_out = !destroy_on_click_out; - - if(sFOCUS) { - DIALOG_DRAW_FOCUS - - if(!m_in && m_ot) { - var p = DIALOG_PAD; - var p2 = DIALOG_PAD * 2; - draw_sprite_stretched_ext(THEME.dialog, 1, dialog_x - p, dialog_y - p, dialog_w + p2, dialog_h + p2, c_white, 0.4); - - if(DOUBLE_CLICK) { - content.dragSurface = surface_clone(panel); - o_main.panel_dragging = content; - content.in_dialog = false; - - instance_destroy(); - } else if(mouse_press(mb_right)) { - menuCall("panel_window_menu", [ - menuItem(__txt("Move"), function() { - content.dragSurface = surface_clone(panel); - o_main.panel_dragging = content; - content.in_dialog = false; - panel_mouse = 1; - - instance_destroy(); - }), - ]); - } - - } + if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, [ mouse_mx, mouse_my ], sFOCUS, sHOVER, "", THEME.window_exit) == 2) { + DIALOG_POSTDRAW + onDestroy(); + instance_destroy(); } -#endregion \ No newline at end of file + + _bx -= ui(8); + // draw_set_color(COLORS.panel_toolbar_separator); + // draw_line_width(_bx + ui(4), _by, _bx + ui(4), _by + _bs, 2); + + for (var i = 0, n = array_length(content.title_actions); i < n; i++) { + var _b = content.title_actions[i]; + + _bx -= _bs; + _b.setFocusHover(sFOCUS, sHOVER); + _b.draw(_bx, _by, _bs, _bs, [ mouse_mx, mouse_my ], THEME.button_hide); + _bs -= ui(4); + } +} + +var bx = content.showHeader? dialog_x + ui(8) : dialog_x + ui(24); +var by = content.showHeader? dialog_y + ui(8) : dialog_y + ui(18); +var txt = destroy_on_click_out? __txt("Pin") : __txt("Unpin"); +var cc = destroy_on_click_out? COLORS._main_icon : COLORS._main_icon_light; +var ind = !destroy_on_click_out; +var ss = content.showHeader? ui(20) : ui(28); +var sc = content.showHeader? 0.75 : 1; + +if(window == noone && instanceof(content) != "Panel_Menu") { + var b = buttonInstant(THEME.button_hide, bx, by, ss, ss, [ mouse_mx, mouse_my ], sFOCUS, sHOVER, txt, THEME.pin, ind, cc, 1, sc); + if(b == 2) destroy_on_click_out = !destroy_on_click_out; +} + +if(sFOCUS) { + DIALOG_DRAW_FOCUS + + if(window == noone && !m_in && m_ot) { + var p = DIALOG_PAD; + var p2 = DIALOG_PAD * 2; + draw_sprite_stretched_ext(THEME.dialog, 1, dialog_x - p, dialog_y - p, dialog_w + p2, dialog_h + p2, c_white, 0.4); + + if(DOUBLE_CLICK) { + content.dragSurface = surface_clone(panel); + o_main.panel_dragging = content; + content.in_dialog = false; + + instance_destroy(); + } else if(mouse_press(mb_right)) { + menuCall("panel_window_menu", [ + menuItem(__txt("Move"), function() { + content.dragSurface = surface_clone(panel); + o_main.panel_dragging = content; + content.in_dialog = false; + panel_mouse = 1; + + instance_destroy(); + }), + ]); + } + + } +} + +DIALOG_POSTDRAW \ No newline at end of file diff --git a/objects/o_dialog_panel/Draw_75.gml b/objects/o_dialog_panel/Draw_75.gml index 752456f8d..8a25982cc 100644 --- a/objects/o_dialog_panel/Draw_75.gml +++ b/objects/o_dialog_panel/Draw_75.gml @@ -1,3 +1,5 @@ /// @description if(!is_undefined(content) && content != noone) - content.drawGUI(); \ No newline at end of file + content.drawGUI(); + +event_inherited(); \ No newline at end of file diff --git a/objects/o_dialog_preference/Create_0.gml b/objects/o_dialog_preference/Create_0.gml index ae383a300..aa76e2757 100644 --- a/objects/o_dialog_preference/Create_0.gml +++ b/objects/o_dialog_preference/Create_0.gml @@ -211,6 +211,14 @@ event_inherited(); "test_mode", new checkBox(function() /*=>*/ { PREFERENCES.test_mode = !PREFERENCES.test_mode; should_restart = true; PREF_SAVE(); }) )); + + if(PREFERENCES.test_mode) { + ds_list_add(pref_global, new __Panel_Linear_Setting_Item_Preference( + __txtx("pref_exp_popup_dialog", "[Experimental] Pop-up Dialog"), + "multi_window", + new checkBox(function() /*=>*/ { PREFERENCES.multi_window = !PREFERENCES.multi_window; PREF_SAVE(); }) + )); + } ds_list_add(pref_global, __txt("Paths")); diff --git a/objects/o_main/Draw_75.gml b/objects/o_main/Draw_75.gml index c0e811011..72485bfaf 100644 --- a/objects/o_main/Draw_75.gml +++ b/objects/o_main/Draw_75.gml @@ -180,6 +180,7 @@ if(winMan_isMinimized()) exit; NODE_DROPPER_TARGET_CAN = false; panelDisplayDraw(); + dialogGUIDraw(); #endregion #region debug diff --git a/objects/o_main/Step_0.gml b/objects/o_main/Step_0.gml index 7f5a37cba..294297c15 100644 --- a/objects/o_main/Step_0.gml +++ b/objects/o_main/Step_0.gml @@ -1,6 +1,6 @@ /// @description init if(winMan_isMinimized()) exit; -winManStep() +winManStep(); //print("===== Step start ====="); diff --git a/objects/o_main/Step_1.gml b/objects/o_main/Step_1.gml index 3ce8b6997..3a4d9baaa 100644 --- a/objects/o_main/Step_1.gml +++ b/objects/o_main/Step_1.gml @@ -1,4 +1,6 @@ /// @description init +if(PREFERENCES.multi_window) winwin_update(); + global.__debug_runner++; global.cache_call = 0; global.cache_hit = 0; @@ -22,7 +24,11 @@ _FILE_DROPPED = false; minimized = false; } - game_set_speed(window_has_focus() || IS_PLAYING? PREFERENCES.ui_framerate : PREFERENCES.ui_framerate_non_focus, gamespeed_fps); + var foc = window_has_focus(); + if(HOVER && instance_exists(HOVER) && HOVER.window != noone) foc = true; + + game_set_speed(foc || IS_PLAYING? PREFERENCES.ui_framerate : PREFERENCES.ui_framerate_non_focus, gamespeed_fps); + WINDOW_ACTIVE = noone; #endregion #region fpss @@ -81,17 +87,17 @@ _FILE_DROPPED = false; if(mouse_release(mb_any)) DIALOG_CLICK = true; HOVER = noone; - with(_p_dialog) checkMouse(); + with(_p_dialog) checkMouse(); WINDOW_ACTIVE = noone; if(PANEL_MAIN != 0) PANEL_MAIN.stepBegin(); DIALOG_DEPTH_HOVER = 0; - with(_p_dialog) checkFocus(); - with(_p_dialog) checkDepth(); + with(_p_dialog) checkFocus(); WINDOW_ACTIVE = noone; + with(_p_dialog) checkDepth(); WINDOW_ACTIVE = noone; - with(_p_dialog) doDrag(); - with(_p_dialog) doResize(); + with(_p_dialog) doDrag(); WINDOW_ACTIVE = noone; + with(_p_dialog) doResize(); WINDOW_ACTIVE = noone; #endregion #region auto save @@ -276,4 +282,4 @@ _FILE_DROPPED = false; #endregion //if(global.cache_call) print($"CACHE called: {global.cache_call} | hit: {global.cache_hit} ({global.cache_hit / global.cache_call * 100}%)"); -//if(!is_struct(FOCUS)) print(FOCUS); \ No newline at end of file +// print($"{is_struct(HOVER)? instanceof(HOVER) : HOVER}, {is_struct(FOCUS)? instanceof(FOCUS) : FOCUS}"); \ No newline at end of file diff --git a/scripts/contextMenu_controller/contextMenu_controller.gml b/scripts/contextMenu_controller/contextMenu_controller.gml index 5c7380fad..90c78e5e5 100644 --- a/scripts/contextMenu_controller/contextMenu_controller.gml +++ b/scripts/contextMenu_controller/contextMenu_controller.gml @@ -7,13 +7,18 @@ function menuCall(menu_id = "", menu = [], _x = 0, _y = 0, align = fa_left, context = noone) { if(array_empty(menu)) return noone; + + FOCUS_BEFORE = FOCUS; _x = _x == 0? mouse_mx + ui(4) : _x; _y = _y == 0? mouse_my + ui(4) : _y; - FOCUS_BEFORE = FOCUS; - var dia = dialogCall(o_dialog_menubox, _x, _y); + + // if(WINDOW_ACTIVE != noone) { + // dia.window = WINDOW_ACTIVE; + // } + if(menu_id != "" && ds_map_exists(CONTEXT_MENU_CALLBACK, menu_id)) { var callbacks = CONTEXT_MENU_CALLBACK[? menu_id]; diff --git a/scripts/draw_UI_scale/draw_UI_scale.gml b/scripts/draw_UI_scale/draw_UI_scale.gml index 6d3b036c7..9ff15ee68 100644 --- a/scripts/draw_UI_scale/draw_UI_scale.gml +++ b/scripts/draw_UI_scale/draw_UI_scale.gml @@ -23,7 +23,7 @@ function line_get_width(txt, font = noone, offset = 0) { #region global #macro TEXTBOX_HEIGHT line_get_height(f_p1, 8) #macro BUTTON_HEIGHT line_get_height(f_p1, 12) - + function ui(val) { INLINE return round(val * UI_SCALE); diff --git a/scripts/globals/globals.gml b/scripts/globals/globals.gml index e70561a6f..59fb2855f 100644 --- a/scripts/globals/globals.gml +++ b/scripts/globals/globals.gml @@ -60,6 +60,7 @@ globalvar FOCUS, FOCUS_STR, FOCUS_CONTENT, HOVER, HOVERING_ELEMENT, _HOVERING_ELEMENT; globalvar DOUBLE_CLICK, DOUBLE_CLICK_POS; globalvar DIALOG_CLICK; + globalvar WINDOW_ACTIVE; DOUBLE_CLICK_POS = [ 0, 0 ]; DOUBLE_CLICK = false; @@ -78,6 +79,7 @@ ADD_NODE_PAGE = 0; ADD_NODE_SCROLL = 0; + WINDOW_ACTIVE = noone; #endregion #region macro @@ -93,18 +95,18 @@ #macro UI_SCALE PREFERENCES.display_scaling - #macro mouse_mx (PEN_USE? PEN_X : device_mouse_x_to_gui(0)) - #macro mouse_my (PEN_USE? PEN_Y : device_mouse_y_to_gui(0)) + #macro mouse_mx (PEN_USE? PEN_X : (WINDOW_ACTIVE == noone? device_mouse_x_to_gui(0) : winwin_mouse_get_x(WINDOW_ACTIVE))) + #macro mouse_my (PEN_USE? PEN_Y : (WINDOW_ACTIVE == noone? device_mouse_y_to_gui(0) : winwin_mouse_get_y(WINDOW_ACTIVE))) #macro mouse_mxs (FILE_IS_DROPPING? FILE_DROPPING_X : mouse_mx) #macro mouse_mys (FILE_IS_DROPPING? FILE_DROPPING_Y : mouse_my) - #macro mouse_raw_x (device_mouse_raw_x(0) + window_get_x()) - #macro mouse_raw_y (device_mouse_raw_y(0) + window_get_y()) + #macro mouse_raw_x display_mouse_get_x() + #macro mouse_raw_y display_mouse_get_y() #macro mouse_ui [device_mouse_x_to_gui(0), device_mouse_y_to_gui(0)] #macro sFOCUS (FOCUS == self.id) - #macro sHOVER (!CURSOR_IS_LOCK && HOVER == self.id) + #macro sHOVER (!CURSOR_IS_LOCK && (HOVER == self.id || (WINDOW_ACTIVE != noone && winwin_mouse_is_over(WINDOW_ACTIVE)))) #macro DELTA_TIME delta_time / 1_000_000 diff --git a/scripts/mouse_input/mouse_input.gml b/scripts/mouse_input/mouse_input.gml index e1815afbb..a848d451b 100644 --- a/scripts/mouse_input/mouse_input.gml +++ b/scripts/mouse_input/mouse_input.gml @@ -11,95 +11,105 @@ #macro SCROLL_SPEED PREFERENCES.mouse_wheel_speed #macro MOUSE_MOVED (window_mouse_get_delta_x() || window_mouse_get_delta_y()) + #macro mouse_wheel_up mouse_wheel_up_override + #macro __mouse_wheel_up mouse_wheel_up + + #macro mouse_wheel_down mouse_wheel_down_override + #macro __mouse_wheel_down mouse_wheel_down + function setMouseWrap() { INLINE MOUSE_WRAP = true; } #endregion -function mouse_click(mouse, focus = true) { #region +function mouse_click(mouse, focus = true) { INLINE if(MOUSE_BLOCK) return false; if(!focus) return false; if(PEN_RIGHT_CLICK) return mouse == mb_right; - return mouse_check_button(mouse); -} #endregion + return WINDOW_ACTIVE == noone? mouse_check_button(mouse) : winwin_mouse_check_button(WINDOW_ACTIVE, mouse); +} -function mouse_press(mouse, focus = true) { #region +function mouse_press(mouse, focus = true) { INLINE if(MOUSE_BLOCK) return false; if(!focus) return false; if(PEN_RIGHT_PRESS) return mouse == mb_right; - return mouse_check_button_pressed(mouse); -} #endregion + if(WINDOW_ACTIVE == noone) return mouse_check_button_pressed(mouse); + if(mouse != mb_any) return winwin_mouse_check_button_pressed(WINDOW_ACTIVE, mouse); + + return winwin_mouse_check_button_pressed(WINDOW_ACTIVE, mb_left) || winwin_mouse_check_button_pressed(WINDOW_ACTIVE, mb_right); +} -function mouse_release(mouse, focus = true) { #region +function mouse_release(mouse, focus = true) { INLINE if(!focus) return false; if(PEN_RIGHT_RELEASE) return mouse == mb_right; - return mouse_check_button_released(mouse) || ((mouse == mb_left || mouse == mb_any) && PEN_RELEASED); -} #endregion + var rl = WINDOW_ACTIVE == noone? mouse_check_button_released(mouse) : winwin_mouse_check_button_released(WINDOW_ACTIVE, mouse); + return rl || ((mouse == mb_left || mouse == mb_any) && PEN_RELEASED); +} -function mouse_lclick(focus = true) { #region +function mouse_lclick(focus = true) { INLINE if(MOUSE_BLOCK) return false; if(!focus) return false; if(PEN_RIGHT_CLICK || PEN_RIGHT_RELEASE) return false; - return mouse_check_button(mb_left); -} #endregion + return WINDOW_ACTIVE == noone? mouse_check_button(mb_left) : winwin_mouse_check_button(WINDOW_ACTIVE, mb_left); +} -function mouse_lpress(focus = true) { #region +function mouse_lpress(focus = true) { INLINE if(MOUSE_BLOCK) return false; if(!focus) return false; if(PEN_RIGHT_PRESS) return false; - return mouse_check_button_pressed(mb_left); -} #endregion + return WINDOW_ACTIVE == noone? mouse_check_button_pressed(mb_left) : winwin_mouse_check_button_pressed(WINDOW_ACTIVE, mb_left); +} -function mouse_lrelease(focus = true) { #region +function mouse_lrelease(focus = true) { INLINE if(!focus) return false; if(PEN_RIGHT_RELEASE) return false; if(PEN_RELEASED) return true; - return mouse_check_button_released(mb_left); -} #endregion + return WINDOW_ACTIVE == noone? mouse_check_button_released(mb_left) : winwin_mouse_check_button_released(WINDOW_ACTIVE, mb_left); +} -function mouse_rclick(focus = true) { #region +function mouse_rclick(focus = true) { INLINE if(MOUSE_BLOCK) return false; if(!focus) return false; if(PEN_RIGHT_CLICK) return true; - return mouse_check_button(mb_right); -} #endregion + return WINDOW_ACTIVE == noone? mouse_check_button(mb_right) : winwin_mouse_check_button(WINDOW_ACTIVE, mb_right); +} -function mouse_rpress(focus = true) { #region +function mouse_rpress(focus = true) { INLINE if(MOUSE_BLOCK) return false; if(!focus) return false; if(PEN_RIGHT_PRESS) return true; - return mouse_check_button_pressed(mb_right); -} #endregion + return WINDOW_ACTIVE == noone? mouse_check_button_pressed(mb_right) : winwin_mouse_check_button_pressed(WINDOW_ACTIVE, mb_right); +} -function mouse_rrelease(focus = true) { #region +function mouse_rrelease(focus = true) { INLINE if(!focus) return false; if(PEN_RIGHT_RELEASE) return true; - return mouse_check_button_released(mb_right); -} #endregion + return WINDOW_ACTIVE == noone? mouse_check_button_released(mb_right) : winwin_mouse_check_button_released(WINDOW_ACTIVE, mb_right); +} -function mouse_lock(mx = CURSOR_LOCK_X, my = CURSOR_LOCK_Y) { #region +function mouse_lock(mx = CURSOR_LOCK_X, my = CURSOR_LOCK_Y) { INLINE CURSOR_LOCK = true; @@ -107,4 +117,7 @@ function mouse_lock(mx = CURSOR_LOCK_X, my = CURSOR_LOCK_Y) { #region CURSOR_LOCK_Y = my; window_mouse_set(CURSOR_LOCK_X, CURSOR_LOCK_Y); -} #endregion \ No newline at end of file +} + +function mouse_wheel_up_override() { return WINDOW_ACTIVE == noone? __mouse_wheel_up() : winwin_mouse_wheel_up(WINDOW_ACTIVE); } +function mouse_wheel_down_override() { return WINDOW_ACTIVE == noone? __mouse_wheel_down() : winwin_mouse_wheel_down(WINDOW_ACTIVE); } \ No newline at end of file diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index a377a54ac..34465b5d4 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -864,7 +864,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor { var sBase = surface_get_target(); try { - update(frame); + if(attributes.update_graph) update(frame); } catch(exception) { var sCurr = surface_get_target(); while(surface_get_target() != sBase) diff --git a/scripts/node_json_file_write/node_json_file_write.gml b/scripts/node_json_file_write/node_json_file_write.gml index 99a59f84b..53e6574bf 100644 --- a/scripts/node_json_file_write/node_json_file_write.gml +++ b/scripts/node_json_file_write/node_json_file_write.gml @@ -23,7 +23,10 @@ function Node_Json_File_Write(_x, _y, _group = noone) : Node(_x, _y, _group) con json_save_struct(path, cont); } - static update = function(frame = CURRENT_FRAME) { writeFile(); } + static update = function(frame = CURRENT_FRAME) { + writeFile(); + } + static onInspector1Update = function() { writeFile(); } static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { diff --git a/scripts/panel_data/panel_data.gml b/scripts/panel_data/panel_data.gml index ee46ef768..549958355 100644 --- a/scripts/panel_data/panel_data.gml +++ b/scripts/panel_data/panel_data.gml @@ -401,10 +401,14 @@ function Panel(_parent, _x, _y, _w, _h) constructor { if(con && point_in_rectangle(_mx, _my, x + ui(2), y + ui(2), x + w - ui(4), y + h - ui(4))) { HOVER = self; + // print($"Hovering {instanceof(con)} : {mouse_press(mb_any)} : {random(1)}") + if(mouse_press(mb_any)) setFocus(self); + if(FOCUS == self && con) FOCUS_STR = con.context_str; + } else { for(var i = 0; i < array_length(childs); i++) childs[i].stepBegin(); @@ -905,6 +909,7 @@ function PanelContent() constructor { dragSurface = surface_create(1, 1); showHeader = true; + window = noone; title_actions = []; @@ -942,6 +947,7 @@ function PanelContent() constructor { function onStepBegin() { mx = mouse_mx - x; my = mouse_my - y; + window = WINDOW_ACTIVE; stepBegin(); } diff --git a/scripts/panel_function/panel_function.gml b/scripts/panel_function/panel_function.gml index f854aa889..ee1c69e67 100644 --- a/scripts/panel_function/panel_function.gml +++ b/scripts/panel_function/panel_function.gml @@ -29,7 +29,7 @@ #endregion #region functions - function clearPanel() { #region + function clearPanel() { delete PANEL_MAIN; delete PANEL_MENU; delete PANEL_INSPECTOR; @@ -45,9 +45,9 @@ PANEL_COLLECTION = {}; PANEL_FILE = 0; - } #endregion + } - function getPanelFromName(name, create = false, focus = true) { #region + function getPanelFromName(name, create = false, focus = true) { switch(name) { case "Panel_Menu" : var p = (create || findPanel(name))? new Panel_Menu() : PANEL_MENU; if(focus) { PANEL_MENU = p; } return p; case "Panel_Inspector" : var p = (create || findPanel(name))? new Panel_Inspector() : PANEL_INSPECTOR; if(focus) { PANEL_INSPECTOR = p; } return p; @@ -75,14 +75,14 @@ } return noone; - } #endregion + } function LoadPanelStruct(struct) { PANEL_MAIN = new Panel(noone, ui(2), ui(2), WIN_SW - ui(4), WIN_SH - ui(4)); loadPanelStruct(PANEL_MAIN, struct); } - function loadPanelStruct(panel, str) { #region + function loadPanelStruct(panel, str) { var cont = str.content; if(variable_struct_exists(str, "split")) { @@ -111,14 +111,14 @@ _pnCont.deserialize(_content); } } - } #endregion + } function loadPanel(path) { CURRENT_PANEL = json_load_struct(path); LoadPanelStruct(CURRENT_PANEL.panel); } - function checkPanelValid() { #region + function checkPanelValid() { var val = true; var _mst = ""; if(!is_instanceof(PANEL_GRAPH.panel, Panel)) { val = false; _mst += "Graph, " }; @@ -136,16 +136,16 @@ } return val; - } #endregion + } - function panelAdd(panel, create = false, focus = true) { #region + function panelAdd(panel, create = false, focus = true) { var pan = getPanelFromName(panel, create, focus); if(pan == noone) return noone; return dialogPanelCall(pan, noone, noone, { focus }); - } #endregion + } - function panelObjectInit() { #region + function panelObjectInit() { PANEL_MAIN = new Panel(noone, ui(2), ui(2), WIN_SW - ui(4), WIN_SH - ui(4)); PANEL_MENU = new Panel_Menu(); PANEL_INSPECTOR = new Panel_Inspector(); @@ -153,18 +153,18 @@ PANEL_PREVIEW = new Panel_Preview(); PANEL_GRAPH = new Panel_Graph(); PANEL_COLLECTION = new Panel_Collection(); - } #endregion + } - function resetPanel(check = true) { #region + function resetPanel(check = true) { clearPanel(); panelObjectInit(); loadPanelStruct(PANEL_MAIN, CURRENT_PANEL.panel); PANEL_MAIN.refresh(); if(check) checkPanelValid(); - } #endregion + } - function __initPanel() { #region + function __initPanel() { directory_verify($"{DIRECTORY}layouts"); if(check_version($"{DIRECTORY}layouts/version")) @@ -174,9 +174,9 @@ panelDisplayInit(); checkPanelValid(); - } #endregion + } - function setPanel() { #region + function setPanel() { globalvar CURRENT_PANEL; panelObjectInit(); @@ -188,9 +188,9 @@ PANEL_MAIN.refresh(); PANEL_MAIN.refreshSize(); - } #endregion + } - function findPanel(_type, _pane = PANEL_MAIN) { #region + function findPanel(_type, _pane = PANEL_MAIN) { var pan = _findPanel(_type, _pane); if(pan) return pan; @@ -200,9 +200,9 @@ } return noone; - } #endregion + } - function _findPanel(_type, _pane, _res = noone) { #region + function _findPanel(_type, _pane, _res = noone) { if(instanceof(_pane) != "Panel") return _res; @@ -218,13 +218,13 @@ } return _res; - } #endregion + } - function findPanels(_type, _pane = PANEL_MAIN) { #region + function findPanels(_type, _pane = PANEL_MAIN) { return _findPanels(_type, _pane, []); - } #endregion + } - function _findPanels(_type, _pane, _arr = []) { #region + function _findPanels(_type, _pane, _arr = []) { if(!is_instanceof(_pane, Panel)) return _arr; @@ -239,9 +239,9 @@ _arr = _findPanels(_type, _pane.childs[i], _arr); return _arr; - } #endregion + } - function panelInit() { #region + function panelInit() { panel_dragging = noone; panel_hovering = noone; panel_split = 0; @@ -254,9 +254,14 @@ panel_draw_y1 = noone; panel_draw_y1_to = noone; panel_draw_depth = 0; - } #endregion + + dialog_popup = 0; + dialog_popup_to = 0; + dialog_popup_x = 0; + dialog_popup_y = 0; + } - function panelDraw() { #region + function panelDraw() { panel_draw_x0 = panel_draw_x0 == noone? panel_draw_x0_to : lerp_float(panel_draw_x0, panel_draw_x0_to, 3); panel_draw_y0 = panel_draw_y0 == noone? panel_draw_y0_to : lerp_float(panel_draw_y0, panel_draw_y0_to, 3); panel_draw_x1 = panel_draw_x1 == noone? panel_draw_x1_to : lerp_float(panel_draw_x1, panel_draw_x1_to, 3); @@ -264,25 +269,28 @@ panel_draw_depth = lerp_float(panel_draw_depth, panel_split == 4, 3); + var _rr = THEME_VALUE.panel_corner_radius; + if(panel_draw_x0_to != noone) { draw_set_color(COLORS._main_accent); if(panel_split == 4) { var dist = ui(8) * panel_draw_depth; draw_set_alpha(.2); - draw_roundrect_ext(panel_draw_x0 - dist, panel_draw_y0 - dist, panel_draw_x1 - dist, panel_draw_y1 - dist, THEME_VALUE.panel_corner_radius, THEME_VALUE.panel_corner_radius, false); + draw_roundrect_ext(panel_draw_x0 - dist, panel_draw_y0 - dist, panel_draw_x1 - dist, panel_draw_y1 - dist, _rr, _rr, false); draw_set_alpha(1.); - draw_roundrect_ext(panel_draw_x0 - dist, panel_draw_y0 - dist, panel_draw_x1 - dist, panel_draw_y1 - dist, THEME_VALUE.panel_corner_radius, THEME_VALUE.panel_corner_radius, true); + draw_roundrect_ext(panel_draw_x0 - dist, panel_draw_y0 - dist, panel_draw_x1 - dist, panel_draw_y1 - dist, _rr, _rr, true); draw_set_alpha(.2); - draw_roundrect_ext(panel_draw_x0 + dist, panel_draw_y0 + dist, panel_draw_x1 + dist, panel_draw_y1 + dist, THEME_VALUE.panel_corner_radius, THEME_VALUE.panel_corner_radius, false); + draw_roundrect_ext(panel_draw_x0 + dist, panel_draw_y0 + dist, panel_draw_x1 + dist, panel_draw_y1 + dist, _rr, _rr, false); draw_set_alpha(1.); - draw_roundrect_ext(panel_draw_x0 + dist, panel_draw_y0 + dist, panel_draw_x1 + dist, panel_draw_y1 + dist, THEME_VALUE.panel_corner_radius, THEME_VALUE.panel_corner_radius, true); + draw_roundrect_ext(panel_draw_x0 + dist, panel_draw_y0 + dist, panel_draw_x1 + dist, panel_draw_y1 + dist, _rr, _rr, true); + } else { draw_set_alpha(.4); - draw_roundrect_ext(panel_draw_x0, panel_draw_y0, panel_draw_x1, panel_draw_y1, THEME_VALUE.panel_corner_radius, THEME_VALUE.panel_corner_radius, false); + draw_roundrect_ext(panel_draw_x0, panel_draw_y0, panel_draw_x1, panel_draw_y1, _rr, _rr, false); draw_set_alpha(1.); - draw_roundrect_ext(panel_draw_x0, panel_draw_y0, panel_draw_x1, panel_draw_y1, THEME_VALUE.panel_corner_radius, THEME_VALUE.panel_corner_radius, true); + draw_roundrect_ext(panel_draw_x0, panel_draw_y0, panel_draw_x1, panel_draw_y1, _rr, _rr, true); } } @@ -340,13 +348,33 @@ panel_draw_depth = 0; } } - } #endregion + } - function panelSerialize(_content = false) { #region + function dialogGUIDraw() { + draw_set_color(COLORS._main_accent); + dialog_popup = lerp_float(dialog_popup, dialog_popup_to, 5); + dialog_popup_to = 0; + + if(dialog_popup > 0) { + var _rr = THEME_VALUE.panel_corner_radius; + var dpw = ui(24) * dialog_popup; + var dph = ui(24) * dialog_popup; + + var dpx = clamp(dialog_popup_x, 8 + dpw, WIN_W - 8 - dpw); + var dpy = clamp(dialog_popup_y, 8 + dph, WIN_H - 8 - dph); + + draw_set_alpha(.4); + draw_roundrect_ext(dpx - dpw, dpy - dph, dpx + dpw, dpy + dph, _rr, _rr, false); + draw_set_alpha(1.); + draw_roundrect_ext(dpx - dpw, dpy - dph, dpx + dpw, dpy + dph, _rr, _rr, true); + } + } + + function panelSerialize(_content = false) { return { panel : _panelSerialize(PANEL_MAIN, _content) }; - } #endregion + } - function _panelSerialize(_panel, _content = false) { #region + function _panelSerialize(_panel, _content = false) { var cont = {}; var ind = 0; @@ -372,13 +400,13 @@ } return cont; - } #endregion + } - function panelSerializeArray() { #region + function panelSerializeArray() { return _panelSerializeArray(PANEL_MAIN); - } #endregion + } - function _panelSerializeArray(panel) { #region + function _panelSerializeArray(panel) { var cont = []; if(!array_empty(panel.childs)) { @@ -391,7 +419,7 @@ } return cont; - } #endregion + } #endregion #region fullscreen diff --git a/scripts/panel_inspector/panel_inspector.gml b/scripts/panel_inspector/panel_inspector.gml index e08908a72..6edc15d7c 100644 --- a/scripts/panel_inspector/panel_inspector.gml +++ b/scripts/panel_inspector/panel_inspector.gml @@ -658,7 +658,7 @@ function Panel_Inspector() : PanelContent() constructor { } draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); - draw_text_add(ui(8), yy + hg / 2, edt[0]); + draw_text_alpha(ui(8), yy + hg / 2, edt[0]); var _param = new widgetParam(wx0, yy, ww, hg, val, {}, _m, x + contentPane.x, y + contentPane.y); _param.s = hg; diff --git a/scripts/panel_preview_window/panel_preview_window.gml b/scripts/panel_preview_window/panel_preview_window.gml index 9d71e7413..8c20c4029 100644 --- a/scripts/panel_preview_window/panel_preview_window.gml +++ b/scripts/panel_preview_window/panel_preview_window.gml @@ -41,8 +41,8 @@ function Panel_Preview_Window() : PanelContent() constructor { function reset() { scale = 0; - panx = 0; - pany = 0; + panx = 0; + pany = 0; } function changeChannel(_index) { @@ -115,7 +115,7 @@ function Panel_Preview_Window() : PanelContent() constructor { if(mouse_release(mb_middle)) panning = false; } - + if(mouse_press(mb_middle, pFOCUS)) { panning = true; pan_mx = mouse_mx; @@ -133,6 +133,8 @@ function Panel_Preview_Window() : PanelContent() constructor { else if(scale > 0.25) inc = 0.25; else inc = 0.05; + //if(WINDOW_ACTIVE != noone) print($"{winwin_mouse_wheel_down(WINDOW_ACTIVE)} : {winwin_mouse_wheel_up(WINDOW_ACTIVE)} : {random(1)}"); + var s = scale; if(mouse_wheel_down()) { for( var i = 0, n = array_length(scale_levels) - 1; i < n; i++ ) { diff --git a/scripts/preferences/preferences.gml b/scripts/preferences/preferences.gml index 3a3fb87f0..2dd9a95af 100644 --- a/scripts/preferences/preferences.gml +++ b/scripts/preferences/preferences.gml @@ -171,6 +171,10 @@ #endregion + #region ////////////////////////////////////////////////////////////////////// EXPERIMENT /////////////////////////////////////////////////////////////////////// + PREFERENCES.multi_window = false; + #endregion + PREFERENCES_DEF = variable_clone(PREFERENCES); #endregion diff --git a/scripts/surface_functions/surface_functions.gml b/scripts/surface_functions/surface_functions.gml index 9171d850c..ea5e30eda 100644 --- a/scripts/surface_functions/surface_functions.gml +++ b/scripts/surface_functions/surface_functions.gml @@ -1,3 +1,7 @@ +#macro surface_reset_target surface_reset_target_override +#macro __surface_reset_target surface_reset_target +function surface_reset_target_override() { __surface_reset_target(); winwin_draw_sync(); } + #region ==================================== DRAW ==================================== function draw_surface_safe(surface, _x = 0, _y = 0) { #region diff --git a/scripts/winwin_extras/winwin_extras.gml b/scripts/winwin_extras/winwin_extras.gml new file mode 100644 index 000000000..53d799f29 --- /dev/null +++ b/scripts/winwin_extras/winwin_extras.gml @@ -0,0 +1,22 @@ +global.__winwin_map = ds_map_create(); + +function winwin(_ptr) constructor { + __ptr__ = _ptr; +} + +function winwin_config() constructor { + static caption = "Window"; + static kind = winwin_kind_normal; + static resize = false; + static show = true; + static topmost = false; + static taskbar_button = true; // can only disable for borderless! + static clickthrough = false; + static noactivate = false; + static per_pixel_alpha = false; + static thread = false; + static vsync = 0; + static close_button = 1; + static owner = undefined; +} + diff --git a/scripts/winwin_extras/winwin_extras.yy b/scripts/winwin_extras/winwin_extras.yy new file mode 100644 index 000000000..ba896914a --- /dev/null +++ b/scripts/winwin_extras/winwin_extras.yy @@ -0,0 +1,13 @@ +{ + "$GMScript":"v1", + "%Name":"winwin_extras", + "isCompatibility":false, + "isDnD":false, + "name":"winwin_extras", + "parent":{ + "name":"WinMan", + "path":"folders/_extensions/WinMan.yy", + }, + "resourceType":"GMScript", + "resourceVersion":"2.0", +} \ No newline at end of file