area unit

This commit is contained in:
Tanasart 2024-09-02 16:53:15 +07:00
parent 922a41b79e
commit 4b62aa01b8
7 changed files with 53 additions and 33 deletions

View file

@ -315,6 +315,16 @@ event_inherited();
}) })
)); ));
ds_list_add(pref_appr, new __Panel_Linear_Setting_Item_Preference(
__txtx("pref_ui_frame_rate", "UI inactive frame rate"),
"ui_framerate_non_focus",
new textBox(TEXTBOX_INPUT.number, function(str) /*=>*/ {
PREFERENCES.ui_framerate_non_focus = max(1, round(real(str)));
game_set_speed(PREFERENCES.ui_framerate_non_focus, gamespeed_fps);
PREF_SAVE();
})
));
locals = []; locals = [];
var f = file_find_first(DIRECTORY + "Locale/*", fa_directory); var f = file_find_first(DIRECTORY + "Locale/*", fa_directory);
while(f != "") { while(f != "") {

View file

@ -18,11 +18,11 @@ _FILE_DROPPED = false;
window_preminimize_rect = [ window_get_x(), window_get_y(), window_get_width(), window_get_height() ]; window_preminimize_rect = [ window_get_x(), window_get_y(), window_get_width(), window_get_height() ];
if(minimized) { if(minimized) {
game_set_speed(PREFERENCES.ui_framerate, gamespeed_fps);
window_set_rectangle(window_preminimize_rect[0], window_preminimize_rect[1], window_preminimize_rect[2], window_preminimize_rect[3]); window_set_rectangle(window_preminimize_rect[0], window_preminimize_rect[1], window_preminimize_rect[2], window_preminimize_rect[3]);
minimized = false; minimized = false;
} }
game_set_speed(window_has_focus() || IS_PLAYING? PREFERENCES.ui_framerate : PREFERENCES.ui_framerate_non_focus, gamespeed_fps);
#endregion #endregion
#region fpss #region fpss

View file

@ -149,8 +149,8 @@ function __part(_node) : __particleObject() constructor {
x = _x; x = _x;
y = _y; y = _y;
drawx = x; drawx = undefined;
drawy = y; drawy = undefined;
anim_len = is_array(surf)? array_length(surf) : 1; anim_len = is_array(surf)? array_length(surf) : 1;
@ -299,9 +299,11 @@ function __part(_node) : __particleObject() constructor {
spVec[1] = point_direction(prevx, prevy, x, y); spVec[1] = point_direction(prevx, prevy, x, y);
} }
if(drawx != undefined) {
x_history[life_incr] = drawx; x_history[life_incr] = drawx;
y_history[life_incr] = drawy; y_history[life_incr] = drawy;
life_incr++; life_incr++;
}
prevx = x; prevx = x;
prevy = y; prevy = y;
@ -317,6 +319,15 @@ function __part(_node) : __particleObject() constructor {
drawrot += wig_rot.get(seed + life); drawrot += wig_rot.get(seed + life);
drawsx += wig_scy.get(seed + life); drawsx += wig_scy.get(seed + life);
drawsy += wig_scy.get(seed + life); drawsy += wig_scy.get(seed + life);
if(path != noone) {
var _lifeRat = clamp(1 - life / life_total, 0., 1.);
var _pathDiv = pathDiv.get(_lifeRat);
pathPos = path.getPointRatio(clamp(_lifeRat, 0, 0.99), pathIndex, pathPos);
drawx = pathPos.x + drawx * _pathDiv;
drawy = pathPos.y + drawy * _pathDiv;
}
} }
static draw = function(exact, surf_w, surf_h) { static draw = function(exact, surf_w, surf_h) {
@ -373,30 +384,25 @@ function __part(_node) : __particleObject() constructor {
scy = 1; scy = 1;
} }
if(life_incr) {
scx_history[life_incr - 1] = scx; scx_history[life_incr - 1] = scx;
scy_history[life_incr - 1] = scy; scy_history[life_incr - 1] = scy;
var _xx, _yy;
var s_w = (_useS? surface_get_width_safe(surface) : 1) * scx;
var s_h = (_useS? surface_get_height_safe(surface) : 1) * scy;
var _pp = point_rotate(-s_w / 2, -s_h / 2, 0, 0, rot);
_xx = drawx + _pp[0];
_yy = drawy + _pp[1];
if(path != noone) {
var _div = pathDiv.get(lifeRat);
pathPos = path.getPointRatio(clamp(lifeRat, 0, 0.99), pathIndex, pathPos);
_xx = _xx * _div + pathPos.x;
_yy = _yy * _div + pathPos.y;
} }
var _xx = drawx;
var _yy = drawy;
if(exact) { if(exact) {
_xx = round(_xx); _xx = round(_xx);
_yy = round(_yy); _yy = round(_yy);
} }
var s_w = (_useS? surface_get_width_safe(surface) : 1) * scx;
var s_h = (_useS? surface_get_height_safe(surface) : 1) * scy;
var _pp = point_rotate(-s_w / 2, -s_h / 2, 0, 0, rot);
_xx += _pp[0];
_yy += _pp[1];
var x0 = _xx - s_w * 1.5; var x0 = _xx - s_w * 1.5;
var y0 = _yy - s_h * 1.5; var y0 = _yy - s_h * 1.5;
var x1 = _xx + s_w * 1.5; var x1 = _xx + s_w * 1.5;
@ -406,8 +412,10 @@ function __part(_node) : __particleObject() constructor {
if(blend != c_white) cc = colorMultiply(blend, cc); if(blend != c_white) cc = colorMultiply(blend, cc);
alp_draw = alp * (alp_fade == noone? 1 : alp_fade.get(lifeRat)) * _color_get_alpha(cc); alp_draw = alp * (alp_fade == noone? 1 : alp_fade.get(lifeRat)) * _color_get_alpha(cc);
if(life_incr) {
blend_history[life_incr - 1] = cc; blend_history[life_incr - 1] = cc;
alp_history[life_incr - 1] = alp_draw; alp_history[life_incr - 1] = alp_draw;
}
currColor = cola(cc, alp_draw); currColor = cola(cc, alp_draw);

View file

@ -136,7 +136,7 @@ function areaBox(_onModify, _unit = noone) : widget() constructor {
var _bx = _x + _w - _bs; var _bx = _x + _w - _bs;
var _by = _y + h / 2 - _bs / 2; var _by = _y + h / 2 - _bs / 2;
unit.triggerButton.setFocusHover(active, hover); unit.triggerButton.setFocusHover(iactive, ihover);
unit.draw(_bx, _by, _bs, _bs, _m); unit.draw(_bx, _by, _bs, _bs, _m);
_w -= _bs + ui(4); _w -= _bs + ui(4);

View file

@ -2070,6 +2070,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
static _clearCacheForward = function() { static _clearCacheForward = function() {
if(!isRenderActive()) return; if(!isRenderActive()) return;
clearCache();
var arr = getNextNodesRaw(); var arr = getNextNodesRaw();
for( var i = 0, n = array_length(arr); i < n; i++ ) for( var i = 0, n = array_length(arr); i < n; i++ )
arr[i]._clearCacheForward(); arr[i]._clearCacheForward();

View file

@ -16,6 +16,7 @@
PREFERENCES.font_overwrite = ""; PREFERENCES.font_overwrite = "";
PREFERENCES.ui_framerate = 120; PREFERENCES.ui_framerate = 120;
PREFERENCES.ui_framerate_non_focus = 10;
PREFERENCES.path_resolution = 32; PREFERENCES.path_resolution = 32;
PREFERENCES.move_directory = false; PREFERENCES.move_directory = false;

View file

@ -4,19 +4,19 @@
varying vec2 v_vTexcoord; varying vec2 v_vTexcoord;
varying vec4 v_vColour; varying vec4 v_vColour;
uniform float w_curve[1024]; uniform float w_curve[512];
uniform int w_amount; uniform int w_amount;
uniform float r_curve[1024]; uniform float r_curve[512];
uniform int r_amount; uniform int r_amount;
uniform float g_curve[1024]; uniform float g_curve[512];
uniform int g_amount; uniform int g_amount;
uniform float b_curve[1024]; uniform float b_curve[512];
uniform int b_amount; uniform int b_amount;
uniform float a_curve[1024]; uniform float a_curve[512];
uniform int a_amount; uniform int a_amount;
float eval_curve_segment_t(in float _y0, in float ax0, in float ay0, in float bx1, in float by1, in float _y1, in float prog) { float eval_curve_segment_t(in float _y0, in float ax0, in float ay0, in float bx1, in float by1, in float _y1, in float prog) {
@ -73,7 +73,7 @@ float eval_curve_segment_x(in float _y0, in float ax0, in float ay0, in float bx
return eval_curve_segment_t(_y0, ax0, ay0, bx1, by1, _y1, _xt); return eval_curve_segment_t(_y0, ax0, ay0, bx1, by1, _y1, _xt);
} }
float curveEval(in float[1024] curve, in int amo, in float _x) { float curveEval(in float[512] curve, in int amo, in float _x) {
int _shf = amo - int(floor(float(amo) / 6.) * 6.); int _shf = amo - int(floor(float(amo) / 6.) * 6.);
int _segs = (amo - _shf) / 6 - 1; int _segs = (amo - _shf) / 6 - 1;