aboutsummaryrefslogtreecommitdiff
path: root/include/saffron_widget.h
blob: 446155542ec4f9215bd46bd2992f7c3df9320e7b (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
#ifndef SAFFRON_WIDGET_H
#define SAFFRON_WIDGET_H

#include <SDL3/SDL.h>

typedef enum{
	SAFFRON_SIZE_FIXED,
	SAFFRON_SIZE_STRETCH,
	SAFFRON_SIZE_SCALE // scale but keep aspect ratio. this must be set on BOTH size modes (width AND height) to work
} SaffronSizeMode;

typedef struct SaffronWidget {
	int x, y, w, h;
	void (*draw)(struct SaffronWidget *self, SDL_Renderer *renderer);
	void (*on_click)(struct SaffronWidget *self);
	struct SaffronWidget* parent;
	struct SaffronWidget** children;
	int child_count;
	SaffronSizeMode width_mode;
	SaffronSizeMode height_mode;
	bool pixel_perfect; // Do we scale dynamically (SaffronSizeMode, etc) or use raw x, y, w, h values? If this is true, the SaffronSizeModes from earlier will be ignored
} SaffronWidget;

#endif