aboutsummaryrefslogtreecommitdiff
path: root/include/mgui/image.h
blob: d9ed0250b641c8d92e5a7791ab4d8ee8af036974 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#ifndef MGUI_IMAGE_H
#define MGUI_IMAGE_H

#include "widget.h"
#include <mgl/graphics/sprite.h>

typedef struct mgui_async_image mgui_async_image;

typedef struct {
    mgui_widget widget;
    mgl_sprite sprite;
    mgui_async_image *async_image;
    mgl_vec2i max_size;
} mgui_image;

/* If |filepath| is not a valid image then the image will be a broken-icon type */
mgui_image* mgui_image_create(const char *filepath);
void mgui_image_destroy(mgui_image *image);
mgui_widget* mgui_image_to_widget(mgui_image *list);
mgui_image* mgui_widget_to_image(mgui_widget *widget);

void mgui_image_set_position(mgui_image *self, mgl_vec2i position);
void mgui_image_calculate_size(mgui_image *self, mgl_vec2i max_size);
void mgui_image_on_event(mgui_image *self, mgl_window *window, mgl_event *event);
void mgui_image_draw(mgui_image *self, mgl_window *window);

#endif /* MGUI_IMAGE_H */