mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2025-01-12 07:16:49 +01:00
- [Font load] Remove duplicate font_add calls.
This commit is contained in:
parent
ccaee3ae36
commit
69d7cd73de
10 changed files with 77 additions and 17 deletions
|
@ -535,6 +535,7 @@
|
|||
{"name":"sh_draw_surface_part_tiled","order":1,"path":"shaders/sh_draw_surface_part_tiled/sh_draw_surface_part_tiled.yy",},
|
||||
{"name":"o_dialog_add_node","order":1,"path":"objects/o_dialog_add_node/o_dialog_add_node.yy",},
|
||||
{"name":"s_node_path_reverse","order":8,"path":"sprites/s_node_path_reverse/s_node_path_reverse.yy",},
|
||||
{"name":"sh_draw_texture","order":6,"path":"shaders/sh_draw_texture/sh_draw_texture.yy",},
|
||||
{"name":"fd_rectangle_get_pressure_width","order":18,"path":"scripts/fd_rectangle_get_pressure_width/fd_rectangle_get_pressure_width.yy",},
|
||||
{"name":"sh_blend_normal","order":1,"path":"shaders/sh_blend_normal/sh_blend_normal.yy",},
|
||||
{"name":"node_feedback_output","order":2,"path":"scripts/node_feedback_output/node_feedback_output.yy",},
|
||||
|
|
|
@ -1116,6 +1116,7 @@
|
|||
{"id":{"name":"o_dialog_add_node","path":"objects/o_dialog_add_node/o_dialog_add_node.yy",},},
|
||||
{"id":{"name":"s_node_curve_eval","path":"sprites/s_node_curve_eval/s_node_curve_eval.yy",},},
|
||||
{"id":{"name":"s_node_path_reverse","path":"sprites/s_node_path_reverse/s_node_path_reverse.yy",},},
|
||||
{"id":{"name":"sh_draw_texture","path":"shaders/sh_draw_texture/sh_draw_texture.yy",},},
|
||||
{"id":{"name":"fd_rectangle_get_pressure_width","path":"scripts/fd_rectangle_get_pressure_width/fd_rectangle_get_pressure_width.yy",},},
|
||||
{"id":{"name":"s_node_strandSim_render","path":"sprites/s_node_strandSim_render/s_node_strandSim_render.yy",},},
|
||||
{"id":{"name":"sh_blend_normal","path":"shaders/sh_blend_normal/sh_blend_normal.yy",},},
|
||||
|
|
|
@ -49,7 +49,7 @@ if !ready exit;
|
|||
tb_search.font = f_p1;
|
||||
tb_search.active = sFOCUS;
|
||||
tb_search.hover = sHOVER;
|
||||
tb_search.draw(dialog_x + dialog_w - ui(padding - 8), dialog_y + ui(title_height) / 2, ui(200), ui(28), search_text, mouse_ui,, fa_right, fa_center);
|
||||
tb_search.draw(dialog_x + dialog_w - ui(padding - 8), dialog_y + ui(title_height) / 2, ui(200), ui(28), search_text, mouse_ui, fa_right, fa_center);
|
||||
draw_sprite_ui_uniform(THEME.search, 0, dialog_x + dialog_w - ui(padding + 208), dialog_y + ui(title_height) / 2, 1, COLORS._main_text_sub);
|
||||
|
||||
if(page_current == 0) {
|
||||
|
|
|
@ -1,7 +1,35 @@
|
|||
globalvar FONT_ISLOADED, f_h1, f_h3, f_h5, f_p0, f_p0b, f_p1, f_p2, f_p3, f_code;
|
||||
globalvar FONT_ISLOADED, FONT_CACHE;
|
||||
globalvar f_h1, f_h3, f_h5, f_p0, f_p0b, f_p1, f_p2, f_p3, f_code;
|
||||
|
||||
FONT_CACHE = {};
|
||||
FONT_ISLOADED = false;
|
||||
|
||||
function _font_add(path, size) {
|
||||
var font_cache_dir = DIRECTORY + "font_cache";
|
||||
directory_verify(font_cache_dir);
|
||||
|
||||
var _key = $"{filename_name_only(path)}_{size}";
|
||||
if(struct_has(FONT_CACHE, _key) && font_exists(FONT_CACHE[$ _key])) {
|
||||
//print($"Add font {_key}: restore from cache");
|
||||
return FONT_CACHE[$ _key];
|
||||
}
|
||||
|
||||
var _t = current_time;
|
||||
var _f = font_add(path, size, false, false, 0, 0);
|
||||
//font_enable_sdf(_f, true);
|
||||
//font_sdf_spread(_f, 8);
|
||||
//font_enable_effects(_f, true, {
|
||||
// outlineEnable: true,
|
||||
// outlineDistance: 0.1,
|
||||
// outlineColour: c_white
|
||||
//});
|
||||
|
||||
FONT_CACHE[$ _key] = _f;
|
||||
//print($"Add font {_key}: {current_time - _t} ms");
|
||||
|
||||
return _f;
|
||||
}
|
||||
|
||||
function _font_path(rel) {
|
||||
rel = string_replace_all(rel, "./", "");
|
||||
|
||||
|
@ -26,8 +54,7 @@ function _font_load_from_struct(str, def) {
|
|||
}
|
||||
|
||||
font_add_enable_aa(THEME_VALUE.font_aa);
|
||||
var _font = font_add(path, str.size * UI_SCALE, false, false, 0, 0);
|
||||
//font_enable_sdf(_font, true);
|
||||
var _font = _font_add(path, str.size * UI_SCALE);
|
||||
|
||||
return _font;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ FONT_SPRITES = ds_map_create();
|
|||
function loadFontSprite(path) {
|
||||
if(ds_map_exists(FONT_SPRITES, path)) return;
|
||||
|
||||
var f = font_add(path, 32, false, false, 32, 255);
|
||||
var f = _font_add(path, 32);
|
||||
draw_set_text(f, fa_left, fa_top, c_white);
|
||||
var name = "ABCabc123";
|
||||
var ww = string_width(name);
|
||||
|
|
|
@ -61,7 +61,7 @@ function Node_Text(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
|
|||
font_delete(font);
|
||||
|
||||
font_add_enable_aa(_aa);
|
||||
font = font_add(_path, _size, false, false, 0, 0);
|
||||
font = _font_add(_path, _size);
|
||||
}
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
||||
|
|
|
@ -116,17 +116,10 @@ function surface_save_safe(surface, path) {
|
|||
surface_reset_shader();
|
||||
surface_save(s, path);
|
||||
return;
|
||||
case surface_r8unorm :
|
||||
s = surface_create(w, h, surface_rgba8unorm);
|
||||
break;
|
||||
case surface_r16float :
|
||||
s = surface_create(w, h, surface_rgba16float);
|
||||
break;
|
||||
case surface_r32float :
|
||||
s = surface_create(w, h, surface_rgba32float);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
case surface_r8unorm : s = surface_create(w, h, surface_rgba8unorm); break;
|
||||
case surface_r16float : s = surface_create(w, h, surface_rgba16float); break;
|
||||
case surface_r32float : s = surface_create(w, h, surface_rgba32float); break;
|
||||
default: return;
|
||||
}
|
||||
|
||||
surface_set_shader(s, sh_draw_single_channel);
|
||||
|
|
9
shaders/sh_draw_texture/sh_draw_texture.fsh
Normal file
9
shaders/sh_draw_texture/sh_draw_texture.fsh
Normal file
|
@ -0,0 +1,9 @@
|
|||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
uniform sampler2D texture;
|
||||
|
||||
void main() {
|
||||
gl_FragColor = texture2D( texture, v_vTexcoord );
|
||||
//gl_FragColor = vec4(1.);
|
||||
}
|
19
shaders/sh_draw_texture/sh_draw_texture.vsh
Normal file
19
shaders/sh_draw_texture/sh_draw_texture.vsh
Normal file
|
@ -0,0 +1,19 @@
|
|||
//
|
||||
// Simple passthrough vertex shader
|
||||
//
|
||||
attribute vec3 in_Position; // (x,y,z)
|
||||
//attribute vec3 in_Normal; // (x,y,z) unused in this shader.
|
||||
attribute vec4 in_Colour; // (r,g,b,a)
|
||||
attribute vec2 in_TextureCoord; // (u,v)
|
||||
|
||||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z, 1.0);
|
||||
gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos;
|
||||
|
||||
v_vColour = in_Colour;
|
||||
v_vTexcoord = in_TextureCoord;
|
||||
}
|
10
shaders/sh_draw_texture/sh_draw_texture.yy
Normal file
10
shaders/sh_draw_texture/sh_draw_texture.yy
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"resourceType": "GMShader",
|
||||
"resourceVersion": "1.0",
|
||||
"name": "sh_draw_texture",
|
||||
"parent": {
|
||||
"name": "misc",
|
||||
"path": "folders/shader/misc.yy",
|
||||
},
|
||||
"type": 1,
|
||||
}
|
Loading…
Reference in a new issue