pcadmin/src/bar/init.c

36 lines
529 B
C
Raw Normal View History

2021-04-16 11:08:47 +02:00
#include "bar.h"
2021-05-24 11:07:56 +02:00
#include <gint/display.h>
#include <gint/std/stdlib.h>
#include <gint/std/string.h>
2021-04-16 11:08:47 +02:00
struct Bar
2021-05-24 11:07:56 +02:00
bar_init(enum BarID bar_id)
2021-04-16 11:08:47 +02:00
{
2021-05-24 11:07:56 +02:00
int x = 0;
2021-05-24 11:07:56 +02:00
switch (bar_id) {
case BAR_CASH:
x = BAR_WIDTH;
break;
case BAR_HUMAN:
x = BAR_WIDTH * 3;
break;
case BAR_SMILE:
x = DWIDTH - BAR_WIDTH * 4;
break;
case BAR_SUN:
x = DWIDTH - BAR_WIDTH * 2;
break;
default:
break;
}
2021-04-16 11:08:47 +02:00
return (struct Bar){
2021-05-26 00:29:23 +02:00
.id = bar_id,
2021-04-16 11:08:47 +02:00
.x = x,
.y = BAR_Y,
.height = BAR_HEIGHT,
.fill = BAR_BASE_FILL,
};
}