- [Preview Panel] Disabling drawing on top will also set blending mode to additive.

This commit is contained in:
Tanasart 2024-06-20 09:08:40 +07:00
parent a69b16d2c4
commit 1e77dcc18d
3 changed files with 30 additions and 14 deletions

Binary file not shown.

View file

@ -88,26 +88,29 @@ if !ready exit;
draw_set_text(f_p0, fa_left, fa_bottom, project_page == i? COLORS._main_text : COLORS._main_text_sub); draw_set_text(f_p0, fa_left, fa_bottom, project_page == i? COLORS._main_text : COLORS._main_text_sub);
var txt = pages[i]; var txt = pages[i];
var dtxt = __txt(txt); var dtxt = __txt(txt);
var amo = noone; var amo = 0;
switch(txt) { switch(txt) {
case "Sample projects" : amo = ds_list_size(SAMPLE_PROJECTS); break; case "Sample projects" : amo = ds_list_size(SAMPLE_PROJECTS); break;
case "Workshop" : amo = ds_list_size(STEAM_PROJECTS); break; case "Workshop" : amo = ds_list_size(STEAM_PROJECTS); break;
case "Contests" : amo = array_length(contests); break; case "Contests" : dtxt = ""; break;
} }
var tw = ui(16) + string_width(dtxt); var tw = ui(16) + string_width(dtxt);
if(amo) tw += ui(8) + string_width(amo) + ui(8); if(amo) tw += ui(8) + string_width(amo) + ui(6);
if(txt == "Contests") tw = ui(32 + 8);
if(txt == "Contests") tw += ui(32);
var _x1 = min(bx + tw, x1); var _x1 = min(bx + tw, x1);
var _tabW = _x1 - bx; var _tabW = _x1 - bx;
if(project_page == i) { if(project_page == i) {
draw_sprite_stretched_ext(THEME.ui_panel_tab, 1, bx, y0 - ui(32), _tabW, th, COLORS.panel_tab, 1); draw_sprite_stretched_ext(THEME.ui_panel_tab, 1, bx, y0 - ui(32), _tabW, th, COLORS.panel_tab, 1);
tab_cover = BBOX().fromWH(bx, y0, tw, THEME_VALUE.panel_tab_extend); tab_cover = BBOX().fromWH(bx, y0, tw, THEME_VALUE.panel_tab_extend);
} else if(point_in_rectangle(mouse_mx, mouse_my, bx, y0 - ui(32), bx + _tabW, y0)) { } else if(point_in_rectangle(mouse_mx, mouse_my, bx, y0 - ui(32), bx + _tabW, y0)) {
draw_sprite_stretched_ext(THEME.ui_panel_tab, 0, bx, y0 - ui(32), _tabW, th, COLORS.panel_tab_hover, 1); draw_sprite_stretched_ext(THEME.ui_panel_tab, 0, bx, y0 - ui(32), _tabW, th, COLORS.panel_tab_hover, 1);
draw_sprite_stretched_add(THEME.ui_panel_tab, 0, bx, y0 - ui(32), _tabW, th, COLORS.panel_tab_hover, 0.1);
if(mouse_click(mb_left, sFOCUS)) { if(mouse_click(mb_left, sFOCUS)) {
project_page = i; project_page = i;
@ -122,7 +125,7 @@ if !ready exit;
var _btx = bx + ui(8); var _btx = bx + ui(8);
if(txt == "Contests") { if(txt == "Contests") {
draw_sprite_ui(THEME.trophy, 0, _btx + ui(16), y0 - ui(14),,,, CDEF.yellow); draw_sprite_ui(THEME.trophy, 0, _btx + ui(12), y0 - ui(14),,,, COLORS._main_icon);
_btx += ui(32); _btx += ui(32);
} }
@ -135,12 +138,15 @@ if !ready exit;
_btx += ui(8) + string_width(dtxt); _btx += ui(8) + string_width(dtxt);
if(amo && _x1 + ui(32) < x1) { if(amo && _x1 + ui(32) < x1) {
draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, _btx, y0 - ui(26), string_width(amo) + ui(8), ui(24), COLORS._main_icon, 1); var _btw = string_width(amo) + ui(8);
var _bth = ui(22);
_btx += ui(4); var _btc = COLORS._main_icon_light;
if(txt == "Contests") draw_set_color(CDEF.yellow); draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, _btx, y0 - ui(26), _btw, _bth, _btc, 1);
else draw_set_color(COLORS._main_text); draw_sprite_stretched_add(THEME.ui_panel_fg, 1, _btx, y0 - ui(26), _btw, _bth, _btc, 0.1);
_btx += ui(4);
draw_set_text(f_p1, fa_left, fa_bottom, COLORS._main_text_sub);
draw_text(_btx, y0 - ui(4), amo); draw_text(_btx, y0 - ui(4), amo);
} }

View file

@ -704,20 +704,30 @@ function Panel_Preview() : PanelContent() constructor {
st += fr; st += fr;
ed += fr; ed += fr;
var surf, aa, cc;
if(!_top) {
draw_surface_ext_safe(_surf, psx, psy, ss, ss);
BLEND_ADD
}
for( var i = st; i <= ed; i += _step ) { for( var i = st; i <= ed; i += _step ) {
var surf = node.getCacheFrame(i); surf = node.getCacheFrame(i);
if(!is_surface(surf)) continue; if(!is_surface(surf)) continue;
var aa = power(_alph, abs((i - fr) / _step)); aa = power(_alph, abs((i - fr) / _step));
var cc = c_white; cc = c_white;
if(i < fr) cc = _colr[0]; if(i < fr) cc = _colr[0];
else if(i > fr) cc = _colr[1]; else if(i > fr) cc = _colr[1];
draw_surface_ext_safe(surf, psx, psy, ss, ss, 0, cc, aa); draw_surface_ext_safe(surf, psx, psy, ss, ss, 0, cc, aa);
} }
BLEND_NORMAL
if(_top) draw_surface_ext_safe(_surf, psx, psy, ss, ss); if(_top) draw_surface_ext_safe(_surf, psx, psy, ss, ss);
} #endregion } #endregion
function drawNodePreview() { #region function drawNodePreview() { #region