|
|
@ -16,7 +16,7 @@ VkResult render_thread(GLFWwindow* window, RenderContext* render) {
|
|
|
|
UIContextStorage ui;
|
|
|
|
UIContextStorage ui;
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t font_index;
|
|
|
|
uint32_t font_index;
|
|
|
|
uint32_t texture_index;
|
|
|
|
uint32_t background_index;
|
|
|
|
|
|
|
|
|
|
|
|
VkResult result;
|
|
|
|
VkResult result;
|
|
|
|
|
|
|
|
|
|
|
@ -32,57 +32,34 @@ VkResult render_thread(GLFWwindow* window, RenderContext* render) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
VK_RESULT(load_font("test.ttf", 16, VK_TRUE, library, render, &ui, &font_index));
|
|
|
|
VK_RESULT(load_font("test.ttf", 16, VK_TRUE, library, render, &ui, &font_index));
|
|
|
|
|
|
|
|
VK_RESULT(load_texture("background.png", render, &ui, &background_index));
|
|
|
|
|
|
|
|
|
|
|
|
VK_RESULT(load_texture("test.png", render, &ui, &texture_index));
|
|
|
|
UIDrawable rects[] = {
|
|
|
|
|
|
|
|
|
|
|
|
UIDrawable image = {
|
|
|
|
|
|
|
|
.pos = {0.0, 0.0},
|
|
|
|
|
|
|
|
.size = {100.0, 200.0},
|
|
|
|
|
|
|
|
.color = {1.0, 1.0, 1.0, 1.0},
|
|
|
|
|
|
|
|
.type = 2,
|
|
|
|
|
|
|
|
.code = 0,
|
|
|
|
|
|
|
|
.id = 0x01,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UIDrawable rect = {
|
|
|
|
|
|
|
|
.pos = {100.0, 0.0},
|
|
|
|
|
|
|
|
.size = {100.0, 200.0},
|
|
|
|
|
|
|
|
.color = {1.0, 0.0, 0.0, 1.0},
|
|
|
|
|
|
|
|
.type = 0,
|
|
|
|
|
|
|
|
.id = 0x02,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UIString string = {
|
|
|
|
|
|
|
|
.pos = {0.0, 100.0},
|
|
|
|
|
|
|
|
.color = {1.0, 1.0, 1.0, 1.0},
|
|
|
|
|
|
|
|
.size = 32.0,
|
|
|
|
|
|
|
|
.length = strlen("Hello, World!"),
|
|
|
|
|
|
|
|
.offset = 0,
|
|
|
|
|
|
|
|
.id = 0x03,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UILayerInput layers[] = {
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
.num_drawables = 1,
|
|
|
|
.pos = {0.0, 0.0},
|
|
|
|
.drawables = &image,
|
|
|
|
.size = {WINDOW_WIDTH, WINDOW_HEIGHT},
|
|
|
|
|
|
|
|
.color = {1.0, 1.0, 1.0, 1.0},
|
|
|
|
|
|
|
|
.type = 2,
|
|
|
|
|
|
|
|
.code = background_index,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
.num_strings = 1,
|
|
|
|
.pos = {150.0, 100.0},
|
|
|
|
.strings = &string,
|
|
|
|
.size = {500.0, 300.0},
|
|
|
|
.num_codes = strlen("Hello, World!"),
|
|
|
|
.color = {1.0, 1.0, 1.0, 1.0},
|
|
|
|
.codes = malloc(strlen("Hello, World!")*sizeof(uint32_t)),
|
|
|
|
|
|
|
|
.num_drawables = 1,
|
|
|
|
|
|
|
|
.drawables = &rect,
|
|
|
|
|
|
|
|
.font = font_index,
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
map_string("Hello, World!", layers[1].codes, 0, ui.fonts[0].charmap, ui.fonts[0].num_symbols);
|
|
|
|
UILayerInput layers[] = {
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
.num_drawables = sizeof(rects)/sizeof(UIDrawable),
|
|
|
|
|
|
|
|
.drawables = rects,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
UIContainerInput container_info = {
|
|
|
|
UIContainerInput container_info = {
|
|
|
|
.id = 0xDEADBEEF,
|
|
|
|
.id = 0xDEADBEEF,
|
|
|
|
.pos = {0.0, 0.0},
|
|
|
|
.pos = {0.0, 0.0},
|
|
|
|
.size = {200.0, 200.0},
|
|
|
|
.size = {WINDOW_WIDTH, WINDOW_HEIGHT},
|
|
|
|
.layer_count = sizeof(layers)/sizeof(UILayerInput),
|
|
|
|
.layer_count = sizeof(layers)/sizeof(UILayerInput),
|
|
|
|
.layers = layers,
|
|
|
|
.layers = layers,
|
|
|
|
};
|
|
|
|
};
|
|
|
|