|
|
|
@ -16,7 +16,7 @@ VkResult render_thread(GLFWwindow* window, RenderContext* render) {
|
|
|
|
|
UIContextStorage ui;
|
|
|
|
|
|
|
|
|
|
uint32_t font_index;
|
|
|
|
|
uint32_t texture_index;
|
|
|
|
|
uint32_t background_index;
|
|
|
|
|
|
|
|
|
|
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_texture("background.png", render, &ui, &background_index));
|
|
|
|
|
|
|
|
|
|
VK_RESULT(load_texture("test.png", render, &ui, &texture_index));
|
|
|
|
|
|
|
|
|
|
UIDrawable image = {
|
|
|
|
|
UIDrawable rects[] = {
|
|
|
|
|
{
|
|
|
|
|
.pos = {0.0, 0.0},
|
|
|
|
|
.size = {100.0, 200.0},
|
|
|
|
|
.size = {WINDOW_WIDTH, WINDOW_HEIGHT},
|
|
|
|
|
.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},
|
|
|
|
|
.code = background_index,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
.pos = {150.0, 100.0},
|
|
|
|
|
.size = {500.0, 300.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,
|
|
|
|
|
.drawables = &image,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
.num_strings = 1,
|
|
|
|
|
.strings = &string,
|
|
|
|
|
.num_codes = strlen("Hello, World!"),
|
|
|
|
|
.codes = malloc(strlen("Hello, World!")*sizeof(uint32_t)),
|
|
|
|
|
.num_drawables = 1,
|
|
|
|
|
.drawables = &rect,
|
|
|
|
|
.font = font_index,
|
|
|
|
|
.num_drawables = sizeof(rects)/sizeof(UIDrawable),
|
|
|
|
|
.drawables = rects,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
map_string("Hello, World!", layers[1].codes, 0, ui.fonts[0].charmap, ui.fonts[0].num_symbols);
|
|
|
|
|
|
|
|
|
|
UIContainerInput container_info = {
|
|
|
|
|
.id = 0xDEADBEEF,
|
|
|
|
|
.pos = {0.0, 0.0},
|
|
|
|
|
.size = {200.0, 200.0},
|
|
|
|
|
.size = {WINDOW_WIDTH, WINDOW_HEIGHT},
|
|
|
|
|
.layer_count = sizeof(layers)/sizeof(UILayerInput),
|
|
|
|
|
.layers = layers,
|
|
|
|
|
};
|
|
|
|
|