|
|
@ -378,8 +378,9 @@ VkResult load_texture(
|
|
|
|
TextureStorage* memory) {
|
|
|
|
TextureStorage* memory) {
|
|
|
|
*index = 0xFFFFFFFF;
|
|
|
|
*index = 0xFFFFFFFF;
|
|
|
|
for(uint32_t i = 0; i < context->max_textures; i++) {
|
|
|
|
for(uint32_t i = 0; i < context->max_textures; i++) {
|
|
|
|
if(context->texture_slots[i] == 0) {
|
|
|
|
if(context->texture_slots[i] == NULL) {
|
|
|
|
context->texture_slots[i] = 1;
|
|
|
|
context->texture_slots[i] = malloc(strlen(png_path) + 1);
|
|
|
|
|
|
|
|
memcpy(context->texture_slots[i], png_path, strlen(png_path) + 1);
|
|
|
|
*index = i;
|
|
|
|
*index = i;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -593,10 +594,22 @@ VkResult load_font(
|
|
|
|
VkBool32 antialias,
|
|
|
|
VkBool32 antialias,
|
|
|
|
uint32_t* index,
|
|
|
|
uint32_t* index,
|
|
|
|
FontStorage* memory) {
|
|
|
|
FontStorage* memory) {
|
|
|
|
|
|
|
|
FT_Face face;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int error;
|
|
|
|
|
|
|
|
error = FT_New_Face(library, ttf_file, 0, &face);
|
|
|
|
|
|
|
|
if(error != FT_Err_Ok) {
|
|
|
|
|
|
|
|
return VK_ERROR_UNKNOWN;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
*index = 0xFFFFFFFF;
|
|
|
|
*index = 0xFFFFFFFF;
|
|
|
|
for(uint32_t i = 0; i < context->max_fonts; i++) {
|
|
|
|
for(uint32_t i = 0; i < context->max_fonts; i++) {
|
|
|
|
if(context->font_slots[i] == 0) {
|
|
|
|
if(context->font_slots[i] == 0) {
|
|
|
|
context->font_slots[i] = 1;
|
|
|
|
context->font_slots[i] = malloc(strlen(face->family_name) + strlen(face->style_name) + 2);
|
|
|
|
|
|
|
|
memcpy(context->font_slots[i], face->family_name, strlen(face->family_name));
|
|
|
|
|
|
|
|
context->font_slots[i][strlen(face->family_name)] = ':';
|
|
|
|
|
|
|
|
memcpy(context->font_slots[i] + strlen(face->family_name) + 1, face->style_name, strlen(face->style_name));
|
|
|
|
|
|
|
|
context->font_slots[i][strlen(face->family_name) + strlen(face->style_name) + 1] = '\0';
|
|
|
|
*index = i;
|
|
|
|
*index = i;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -605,14 +618,6 @@ VkResult load_font(
|
|
|
|
return VK_ERROR_OUT_OF_DEVICE_MEMORY;
|
|
|
|
return VK_ERROR_OUT_OF_DEVICE_MEMORY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FT_Face face;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int error;
|
|
|
|
|
|
|
|
error = FT_New_Face(library, ttf_file, 0, &face);
|
|
|
|
|
|
|
|
if(error != FT_Err_Ok) {
|
|
|
|
|
|
|
|
return VK_ERROR_UNKNOWN;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
error = FT_Set_Pixel_Sizes(face, 0, size);
|
|
|
|
error = FT_Set_Pixel_Sizes(face, 0, size);
|
|
|
|
if(error != FT_Err_Ok) {
|
|
|
|
if(error != FT_Err_Ok) {
|
|
|
|
return VK_ERROR_UNKNOWN;
|
|
|
|
return VK_ERROR_UNKNOWN;
|
|
|
|