float	display_gl_text_add_va(display_gl_text_t* texts, float x, float y, int32 rgba, char* format, va_list args) {
	char*	buffer = malloc(MAX_TEXT_LEN);
	vsnprintf(buffer, MAX_TEXT_LEN, format, args);
	texts->texts[texts->text_count % MAX_TEXT].text = buffer;
	texts->texts[texts->text_count % MAX_TEXT].rgba = rgba;
	texts->texts[texts->text_count % MAX_TEXT].position.x = x;
	texts->texts[texts->text_count % MAX_TEXT].position.y = y;
	texts->text_count++;
	return stb_easy_font_height(buffer) + y + 1;
}
示例#2
0
void display_print_ring_buffer(t_display* display, float x, float y, t_ring_buffer* buffer)
{
	int32 count = buffer->write_index;
	int32 index = buffer->read_index;
	if (count > buffer->size)
		count = buffer->size;
	if (count <= 0)
		return;
	int mul = 200 / count;
	int color = 0xffffffff;
	while (count--)
	{
		int alpha = (0xff - (count * mul)) << 24 | 0xffffff;
		display_text_add(display->texts, x, y, color & alpha, buffer->data[index % buffer->size]);
		index++;
		y += stb_easy_font_height();
	}

}
JNIEXPORT jint JNICALL Java_org_lwjgl_stb_STBEasyFont_nstb_1easy_1font_1height(JNIEnv *__env, jclass clazz, jlong textAddress) {
	char *text = (char *)(intptr_t)textAddress;
	UNUSED_PARAMS(__env, clazz)
	return (jint)stb_easy_font_height(text);
}