Skip to content

Commit

Permalink
Allow program to work without the Realtime Blur extension files
Browse files Browse the repository at this point in the history
  • Loading branch information
Bentroen committed Sep 12, 2021
1 parent ba1a1d3 commit 634b383
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 4 deletions.
1 change: 1 addition & 0 deletions Minecraft Note Block Studio.yyp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion objects/obj_popup/Draw_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ theme = obj_controller.theme
if (!mouse_rectangle(x1, y1, w, h)) {global.popup = 0 instance_destroy()}
if (alarm[0] > -1) exit
if (alpha < 1) alpha += 0.25 * (30 / (room_speed * obj_controller.currspeed)) * (1 + (theme != 3))
if (theme = 3 && obj_controller.acrylic) draw_surface_blur(application_surface, x, y, maxw + 16, 20 + 18 * (!singleline), 0.5)
if (theme = 3 && obj_controller.acrylic) draw_surface_blur_alt(application_surface, x, y, maxw + 16, 20 + 18 * (!singleline), 0.5)
if (theme != 3) {
if (singleline) {
draw_sprite_ext(spr_tooltip_sl_left, theme, x, y, 1, 1, 0, -1, alpha)
Expand Down
12 changes: 12 additions & 0 deletions scripts/blur_scripts_alt/blur_scripts.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 43 additions & 0 deletions scripts/blur_scripts_alt/blur_scripts_alt.gml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Provided as a replacement to blur_scripts.gml, which belongs to
* the Realtime Blur extension by Foxy Of Jungle:
* https://marketplace.yoyogames.com/assets/9540/blur-realtime-performance
*
* Since it's a paid extension, the source code cannot be published
* to the repository, so the extension files must be added manually
* to the project folder after cloning.
*
* Note Block Studio will work just fine without the extension, but
* the transparency effects for the Fluent theme will be missing the
* blur effect.
*/

function sprite_create_blur_alt(sprite, downamount, width, height, blurradius, quality, directions) {
// Returns a sprite index
try {
return sprite_create_blur(sprite, downamount, width, height, blurradius, quality, directions);
} catch (exc) {
var surf = surface_create(width, height);
surface_set_target(surf);
draw_sprite_stretched(sprite, 0, 0, 0, width, height);
surface_reset_target();
var spr = sprite_create_from_surface(surf, 0, 0, width, height, 0, 0, 0, 0);
surface_free(surf);
return spr;
}
}

function draw_surface_blur_alt(surface, x, y, w, h, downamount) {
try {
draw_surface_blur(surface, x, y, w, h, downamount);
} catch (exc) {
var surf = surface_create(w, h);
surface_set_target(surf);
draw_surface_part(surf, x, y, w, h, 0, 0);
surface_reset_target();
surface_free(surf);
}
}

// NB: wave, sprite_blur_clear and sprite_draw_blur were suppressed
// from this script as they aren't currently used.
12 changes: 12 additions & 0 deletions scripts/blur_scripts_alt/blur_scripts_alt.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion scripts/control_create/control_create.gml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function control_create() {
if (wpaperexist) {
wpaper = sprite_add(data_directory + "Wallpaper.jpg", 1, 0, 0, 0, 0)
if (display_width / display_height < sprite_get_width(wpaper) / sprite_get_height(wpaper)) wpaperside = 1
wpaperblur = sprite_create_blur(wpaper, 0.25, sprite_get_width(wpaper), sprite_get_height(wpaper), 300, 8, 16)
wpaperblur = sprite_create_blur_alt(wpaper, 0.25, sprite_get_width(wpaper), sprite_get_height(wpaper), 300, 8, 16)
}

// Audio
Expand Down
2 changes: 1 addition & 1 deletion scripts/draw_msg/draw_msg.gml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function draw_msg(){
y1 = msgy
y2 = msgy - 20
draw_set_color(7368816)
if (theme = 3 && msgalpha >= 0.5 && acrylic) draw_surface_blur(application_surface, x1 - 10, y1 - 30, x2 - x1 + 20, 40, 0.5)
if (theme = 3 && msgalpha >= 0.5 && acrylic) draw_surface_blur_alt(application_surface, x1 - 10, y1 - 30, x2 - x1 + 20, 40, 0.5)
if (theme = 3) draw_roundrect(x1 - 10, y1 + 10, x2 + 10, y2 - 10, 1)
draw_set_color(15790320)
if (theme = 1) draw_set_color(13160660)
Expand Down
2 changes: 1 addition & 1 deletion scripts/menu_draw/menu_draw.gml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function menu_draw() {
draw_sprite_ext(spr_shadowext, 3 + 5 * (obj_controller.fdark && theme = 3), dx + menu_wid[m] + 1, dy + 9, 1, hei - 7, 0, -1, 1)
draw_sprite(spr_shadowext, 4 + 5 * (obj_controller.fdark && theme = 3), dx + menu_wid[m] + 1, dy + 4)
}
if (theme = 3 && o.acrylic) draw_surface_blur(application_surface, dx, dy, menu_wid[m] + 1, hei + 1, 0.5)
if (theme = 3 && o.acrylic) draw_surface_blur_alt(application_surface, dx, dy, menu_wid[m] + 1, hei + 1, 0.5)
if (theme = 3 && o.acrylic) draw_set_alpha(0.6)
if (theme = 3 && o.acrylic) draw_acrylic_texture(dx, dy, menu_wid[m] + 1, hei + 1)
if (theme != 3) draw_rectangle(dx, dy, dx + menu_wid[m], dy + hei, 0)
Expand Down

0 comments on commit 634b383

Please sign in to comment.