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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
/*
* Copyright (C) 2018-2019 - Vito Caputo - <vcaputo@pengaru.com>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3 as published
* by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _STAGE_H
#define _STAGE_H
#define STAGE_NODE_NAME_MAX 16
#define STAGE_LAYERS_MAX 10
typedef struct stage_t stage_t;
typedef struct stage_node_t stage_node_t;
typedef void (*stage_render_func_t)(const stage_t *stage, const stage_node_t *node, void *object, float alpha);
typedef void (*stage_free_func_t)(const stage_t *stage, const stage_node_t *node, void *object);
stage_t * stage_new(void);
void stage_clear(stage_t *stage);
stage_t * stage_free(stage_t *stage);
void stage_fit(float aspect_ratio, int width, int height, int *res_width, int *res_height);
void stage_set_alpha(stage_t *stage, float alpha);
void stage_get_alpha(stage_t *stage, float *res_alpha);
void stage_render(const stage_t *stage);
stage_node_t * stage_node_new(stage_t *stage, int layer, const char *name, void *object, stage_render_func_t render_func, stage_free_func_t free_func);
void stage_node_set_object(const stage_t *stage, stage_node_t *node, void *object);
void stage_node_get_object(const stage_t *stage, stage_node_t *node, void **res_object);
void stage_node_replace(const stage_t *stage, stage_node_t *node, const char *name, void *object, stage_render_func_t render_func, stage_free_func_t free_func);
stage_node_t * stage_node_free(stage_t *stage, stage_node_t *node);
void stage_node_set_alpha(const stage_t *stage, stage_node_t *node, float alpha);
void stage_node_set_active(const stage_t *stage, stage_node_t *node, int active);
void stage_node_set_locked(const stage_t *stage, stage_node_t *node, int locked);
void stage_node_set_layer(stage_t *stage, stage_node_t *node, int layer);
stage_node_t * stage_node_lookup_name(const stage_t *stage, const char *name);
#endif
|