RetroArch/gfx/video_layout/component.c

169 lines
4.8 KiB
C
Raw Normal View History

2019-04-01 20:44:11 +01:00
#include <stdlib.h>
#include <string.h>
#include <string/stdstring.h>
#include "component.h"
2019-04-01 20:44:11 +01:00
void component_init(component_t *comp, comp_type_t type)
{
comp->type = type;
comp->bounds = make_bounds();
2019-04-01 20:44:11 +01:00
comp->render_bounds = make_bounds_unit();
comp->orientation = VIDEO_LAYOUT_ROT0;
comp->color = make_color_white();
2019-04-01 20:44:11 +01:00
comp->enabled_state = -1;
switch (comp->type)
{
2019-10-14 00:31:44 +02:00
case VIDEO_LAYOUT_C_UNKNOWN:
break;
case VIDEO_LAYOUT_C_SCREEN:
comp->attr.screen.index = 0;
break;
case VIDEO_LAYOUT_C_RECT:
break;
case VIDEO_LAYOUT_C_DISK:
break;
case VIDEO_LAYOUT_C_IMAGE:
comp->attr.image.file = NULL;
comp->attr.image.alpha_file = NULL;
comp->attr.image.image_idx = 0;
comp->attr.image.alpha_idx = 0;
comp->attr.image.loaded = false;
2019-10-14 00:31:44 +02:00
break;
case VIDEO_LAYOUT_C_TEXT:
comp->attr.text.string = NULL;
comp->attr.text.align = VIDEO_LAYOUT_TEXT_ALIGN_CENTER;
2019-10-14 00:31:44 +02:00
break;
case VIDEO_LAYOUT_C_COUNTER:
comp->attr.counter.digits = 2;
2019-10-14 00:31:44 +02:00
comp->attr.counter.max_state = 999;
comp->attr.counter.align = VIDEO_LAYOUT_TEXT_ALIGN_CENTER;
2019-10-14 00:31:44 +02:00
break;
case VIDEO_LAYOUT_C_DOTMATRIX_X1:
break;
case VIDEO_LAYOUT_C_DOTMATRIX_H5:
break;
case VIDEO_LAYOUT_C_DOTMATRIX_H8:
break;
case VIDEO_LAYOUT_C_LED_7:
break;
case VIDEO_LAYOUT_C_LED_8_GTS1:
break;
case VIDEO_LAYOUT_C_LED_14:
break;
case VIDEO_LAYOUT_C_LED_14_SC:
break;
case VIDEO_LAYOUT_C_LED_16:
break;
case VIDEO_LAYOUT_C_LED_16_SC:
break;
case VIDEO_LAYOUT_C_REEL:
break;
2019-04-01 20:44:11 +01:00
}
}
void component_copy(component_t *comp, const component_t *src)
{
comp->type = src->type;
comp->bounds = src->bounds;
2019-04-01 20:44:11 +01:00
comp->render_bounds = src->render_bounds;
comp->orientation = src->orientation;
comp->color = src->color;
2019-04-01 20:44:11 +01:00
comp->enabled_state = src->enabled_state;
switch (comp->type)
{
2019-10-14 00:31:44 +02:00
case VIDEO_LAYOUT_C_UNKNOWN:
break;
case VIDEO_LAYOUT_C_SCREEN:
comp->attr.screen.index = src->attr.screen.index;
2019-10-14 00:31:44 +02:00
break;
case VIDEO_LAYOUT_C_RECT:
break;
case VIDEO_LAYOUT_C_DISK:
break;
case VIDEO_LAYOUT_C_IMAGE:
comp->attr.image.file = string_init(src->attr.image.file);
comp->attr.image.alpha_file = string_init(src->attr.image.alpha_file);
comp->attr.image.image_idx = src->attr.image.image_idx;
comp->attr.image.alpha_idx = src->attr.image.alpha_idx;
comp->attr.image.loaded = src->attr.image.loaded;
2019-10-14 00:31:44 +02:00
break;
case VIDEO_LAYOUT_C_TEXT:
comp->attr.text.string = string_init(src->attr.text.string);
comp->attr.text.align = src->attr.text.align;
2019-10-14 00:31:44 +02:00
break;
case VIDEO_LAYOUT_C_COUNTER:
comp->attr.counter.digits = src->attr.counter.digits;
2019-10-14 00:31:44 +02:00
comp->attr.counter.max_state = src->attr.counter.max_state;
comp->attr.counter.align = src->attr.counter.align;
break;
case VIDEO_LAYOUT_C_DOTMATRIX_X1:
break;
case VIDEO_LAYOUT_C_DOTMATRIX_H5:
break;
case VIDEO_LAYOUT_C_DOTMATRIX_H8:
break;
case VIDEO_LAYOUT_C_LED_7:
break;
case VIDEO_LAYOUT_C_LED_8_GTS1:
break;
case VIDEO_LAYOUT_C_LED_14:
break;
case VIDEO_LAYOUT_C_LED_14_SC:
break;
case VIDEO_LAYOUT_C_LED_16:
break;
case VIDEO_LAYOUT_C_LED_16_SC:
break;
case VIDEO_LAYOUT_C_REEL:
break;
2019-04-01 20:44:11 +01:00
}
}
void component_deinit(component_t *comp)
{
switch (comp->type)
{
2019-10-14 00:31:44 +02:00
case VIDEO_LAYOUT_C_UNKNOWN:
break;
case VIDEO_LAYOUT_C_SCREEN:
break;
case VIDEO_LAYOUT_C_RECT:
break;
case VIDEO_LAYOUT_C_DISK:
break;
case VIDEO_LAYOUT_C_IMAGE:
free(comp->attr.image.file);
free(comp->attr.image.alpha_file);
break;
case VIDEO_LAYOUT_C_TEXT:
free(comp->attr.text.string);
break;
case VIDEO_LAYOUT_C_COUNTER:
break;
case VIDEO_LAYOUT_C_DOTMATRIX_X1:
break;
case VIDEO_LAYOUT_C_DOTMATRIX_H5:
break;
case VIDEO_LAYOUT_C_DOTMATRIX_H8:
break;
case VIDEO_LAYOUT_C_LED_7:
break;
case VIDEO_LAYOUT_C_LED_8_GTS1:
break;
case VIDEO_LAYOUT_C_LED_14:
break;
case VIDEO_LAYOUT_C_LED_14_SC:
break;
case VIDEO_LAYOUT_C_LED_16:
break;
case VIDEO_LAYOUT_C_LED_16_SC:
break;
case VIDEO_LAYOUT_C_REEL:
break;
2019-04-01 20:44:11 +01:00
}
}