empty text works
This commit is contained in:
@@ -8,7 +8,6 @@ var tilemap = use('tilemap')
|
||||
var geometry = use('geometry')
|
||||
var res = use('resources')
|
||||
|
||||
|
||||
var video = arg[0]
|
||||
var graphics = use('graphics', arg[0])
|
||||
|
||||
@@ -228,6 +227,8 @@ function translate_draw_commands(commands) {
|
||||
|
||||
if (!text_mesh) break
|
||||
|
||||
if (text_mesh.xy.length == 0) break
|
||||
|
||||
// Transform XY coordinates using camera matrix
|
||||
var camera_params = [camera.a, camera.c, camera.e, camera.f]
|
||||
var transformed_xy = geometry.transform_xy_blob(text_mesh.xy, camera_params)
|
||||
|
||||
@@ -206,10 +206,8 @@ function create_image(path){
|
||||
|
||||
// Check if it's an untagged animation (multiple frames, no tags)
|
||||
// This happens when ASE has no tags but multiple frames
|
||||
if(raw.frames && Array.isArray(raw.frames) && raw.loop != null) {
|
||||
log.console(`[Graphics] Loading untagged ASE animation with ${raw.frames.length} frames`)
|
||||
if(raw.frames && Array.isArray(raw.frames) && raw.loop != null)
|
||||
return makeAnim(wrapFrames(raw.frames), !!raw.loop);
|
||||
}
|
||||
|
||||
// Multiple named animations from ASE (with tags)
|
||||
def anims = {};
|
||||
|
||||
@@ -233,7 +233,7 @@ HMM_Vec2 measure_text(const char *text, font *f, float letterSpacing, float wrap
|
||||
/* pos given in screen coordinates */
|
||||
struct text_vert *renderText(const char *text, HMM_Vec2 pos, font *f, colorf color, float wrap) {
|
||||
text_vert *buffer = NULL;
|
||||
|
||||
|
||||
HMM_Vec2 cursor = pos;
|
||||
float lineHeight = f->ascent - f->descent;
|
||||
float lineWidth = 0;
|
||||
|
||||
@@ -296,6 +296,8 @@ JSValue quads_to_mesh(JSContext *js, text_vert *buffer)
|
||||
{
|
||||
size_t verts = arrlen(buffer);
|
||||
|
||||
JSValue ret = JS_NewObject(js);
|
||||
|
||||
// Allocate flat arrays for xy, uv, and color data
|
||||
size_t xy_size = verts * 2 * sizeof(float);
|
||||
size_t uv_size = verts * 2 * sizeof(float);
|
||||
@@ -333,8 +335,6 @@ JSValue quads_to_mesh(JSContext *js, text_vert *buffer)
|
||||
indices[i+5] = v+1;
|
||||
}
|
||||
|
||||
JSValue ret = JS_NewObject(js);
|
||||
|
||||
// Create blobs for geometry data
|
||||
JS_SetPropertyStr(js, ret, "xy", js_new_blob_stoned_copy(js, xy_data, xy_size));
|
||||
JS_SetPropertyStr(js, ret, "xy_stride", JS_NewInt32(js, 2 * sizeof(float)));
|
||||
|
||||
Reference in New Issue
Block a user