Skip to content

Commit b0e9f35

Browse files
committed
Version 1.2 fixed rotation in html5
1 parent 3d3ea5d commit b0e9f35

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

scripts/outline_drawer/outline_drawer.gml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function outline_drawer(_viewport = 0, _outline_color = c_white, _outline_alpha
2626

2727
// html flips the final surface vertically... hell knows, why.
2828
// so, on html we need to draw it upside down.
29-
__draw_yscale = (os_browser != browser_not_a_browser) ? -1 : 1;
29+
__flip_vertical = (os_browser != browser_not_a_browser);
3030

3131
viewport = _viewport;
3232
camera = view_get_camera(_viewport);
@@ -141,10 +141,19 @@ function outline_drawer(_viewport = 0, _outline_color = c_white, _outline_alpha
141141
surface_reset_target();
142142

143143
//Draw surface 2
144-
draw_surface_ext(__outline_surface_2,
145-
_obj.bbox_left - outline_strength - 1,
146-
(__draw_yscale == 1 ? _obj.bbox_top - outline_strength - 1 : _obj.bbox_bottom + outline_strength + 2),
147-
1, __draw_yscale, 0, c_white, 1);
144+
if (__flip_vertical) {
145+
// as we increase the surface only when needed but never shrink (for performance)
146+
// we need the current_dimensions here for correct rendering in html (surface_get_height)
147+
draw_surface_ext(__outline_surface_2,
148+
_obj.bbox_left - outline_strength - 1,
149+
_obj.bbox_top + surface_get_height(__outline_surface_2) - outline_strength - 1,
150+
1, -1, 0, c_white, 1);
151+
} else {
152+
draw_surface_ext(__outline_surface_2,
153+
_obj.bbox_left - outline_strength - 1,
154+
_obj.bbox_top - outline_strength - 1,
155+
1, 1, 0, c_white, 1);
156+
}
148157

149158
return true;
150159

0 commit comments

Comments
 (0)