tutorial: Adjust spacings, fix centering

This commit is contained in:
K. Lange 2021-09-08 11:20:08 +09:00
parent ff8714a318
commit 9d21d48ecf

View File

@ -74,8 +74,8 @@ static void redraw(void) {
int offset = 0;
if (icon) {
offset = icon->height + 20;
draw_sprite(ctx, icon, center(icon->width, width), bounds.top_height + 15);
offset = icon->height;
draw_sprite(ctx, icon, bounds.left_width + center(icon->width, width), bounds.top_height + 15);
}
for (char ** copy_str = body_text; *copy_str; ++copy_str) {
@ -272,13 +272,17 @@ void setup_buttons(void) {
_prev_button.y = ctx->height - bounds.bottom_height - BUTTON_HEIGHT - BUTTON_PADDING;
}
void resize_finish(int w, int h) {
yutani_window_resize_accept(yctx, window, w, h);
reinit_graphics_yutani(ctx, window);
static void update_size(int w, int h) {
struct decor_bounds bounds;
decor_get_bounds(NULL, &bounds);
width = w - bounds.width;
height = h - bounds.height;
}
void resize_finish(int w, int h) {
yutani_window_resize_accept(yctx, window, w, h);
reinit_graphics_yutani(ctx, window);
update_size(w, h);
setup_buttons();
redraw();
yutani_window_resize_done(yctx, window);
@ -328,6 +332,8 @@ int main(int argc, char * argv[]) {
flip(background_ctx);
yutani_flip(yctx, background);
update_size(width, height);
struct decor_bounds bounds;
decor_get_bounds(NULL, &bounds);