Compare commits

...

8 Commits

Author SHA1 Message Date
KikooDX 4d8587916e categories 2021-05-28 12:48:40 +02:00
KikooDX f256805e4e events and autors base 2021-05-28 11:27:34 +02:00
KikooDX c907bc2b69 dumb down and speed up bar drawing 2021-05-28 01:07:30 +02:00
KikooDX 971ce1d541 place the placeholders 2021-05-28 01:07:30 +02:00
Masséna Fezard | Nounouille f252776afd placeholder 2021-05-28 01:07:30 +02:00
KikooDX e425f6e1af remove locales, baguette tous les jours 2021-05-28 01:07:30 +02:00
KikooDX 0cabf02e8b screenshot
This is so great owo
2021-05-27 11:13:18 +02:00
KikooDX 97ab1923a8 bar image variable color palette
Thank you Lephé!
2021-05-26 11:34:50 +02:00
17 changed files with 164 additions and 46 deletions

3
.gitignore vendored
View File

@ -10,3 +10,6 @@
# KBLE backup files
backup_*.kble
# fxlink stuff
fxlink-*.png

View File

@ -7,23 +7,24 @@ project(PcAdmin C)
include(GenerateG1A)
include(GenerateG3A)
include(Fxconv)
find_package(Gint 2.4 REQUIRED)
find_package(Gint 2.5 REQUIRED)
include_directories(include)
set(SOURCES
src/main.c
src/bar/init.c
src/bar/update.c
src/bar/draw.c
src/bar/change.c
src/events.c
src/autor.c
src/choice/init.c
src/choice/draw.c
src/bar/update.c
src/bar/init.c
src/bar/change.c
src/bar/draw.c
)
set(ASSETS
assets/background.png
assets/bar3.png
assets/icons.png
)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 B

After

Width:  |  Height:  |  Size: 125 B

View File

@ -1,10 +1,13 @@
# gint bopti_image_t
background.png:
type: bopti-image
profile: p4
name: bimg_background
bar3.png:
type: bopti-image
profile: p4
name: bimg_bar3
icons.png:
type: bopti-image
profile: p4
name: bimg_icons

Binary file not shown.

Before

Width:  |  Height:  |  Size: 530 B

After

Width:  |  Height:  |  Size: 467 B

21
include/attributes.h Normal file
View File

@ -0,0 +1,21 @@
#pragma once
struct Attributes {
unsigned int membre : 1;
unsigned int breton : 1;
unsigned int admin : 1;
unsigned int redacteur : 1;
unsigned int dev_v5 : 1;
unsigned int pointilleux : 1;
unsigned int uwu : 1;
unsigned int sangsue : 1;
unsigned int staff : 1;
unsigned int troll : 1;
unsigned int nouveau : 1;
unsigned int bot : 1;
unsigned int philosophe : 1;
unsigned int expert_bas_niveau : 1;
unsigned int organisateur : 1;
unsigned int bosseur : 1;
unsigned int branleur : 1;
} __attribute__((__packed__));

18
include/autor.h Normal file
View File

@ -0,0 +1,18 @@
#pragma once
/* Ask to the person concerned before adding their name to the list.
* Alphabetical order. */
enum Autor {
CAKEISALIE5,
DARK_STORM,
ERAGON,
FLAMINGKITE,
KIKOODX,
LEPHENIXNOIR,
MASSENA,
SHADOW15510,
TITUYA,
};
char *autor_v42_str(enum Autor autor);
char *autor_v5_str(enum Autor autor);

View File

@ -1,23 +1,21 @@
#pragma once
#include <gint/display.h>
extern bopti_image_t bimg_bar3;
extern bopti_image_t bimg_icons;
#define BAR_WIDTH 16
#define BAR_Y 48
#define BAR_HEIGHT (DHEIGHT - BAR_Y - 16)
#define BAR_BASE_FILL 0.5
#define BAR_ICON_HEIGHT 16
#define BAR_ICON_WIDTH 16
#define BAR_ICON_Y (BAR_Y - BAR_ICON_HEIGHT - 16)
#define BAR_ICON_HEIGHT 24
#define BAR_ICON_WIDTH 24
#define BAR_ICON_Y (BAR_Y - BAR_ICON_HEIGHT - 12)
struct Bar {
int id;
int x;
int y;
int height;
int limit_height;
float fill;
};

View File

@ -1,23 +1,13 @@
#pragma once
#include "locale.h"
#include <gint/display.h>
#ifdef LANG_FR
#define CHOICE_YES "OUI"
#define CHOICE_NO "NON"
#define CHOICE_OK "OK"
#endif
#ifdef LANG_EN
#define CHOICE_YES "YES"
#define CHOICE_NO "NO"
#define CHOICE_OK "OK"
#endif
#define BUTTON_WIDTH 52
#define BUTTON_HEIGHT 32
#define BUTTON_Y (DHEIGHT - BUTTON_HEIGHT * 1.7)
#define BUTTON_HEIGHT 24
#define BUTTON_Y (DHEIGHT - BUTTON_HEIGHT - 12)
struct Choice {
int cursor;

10
include/event.h Normal file
View File

@ -0,0 +1,10 @@
#pragma once
#include "autor.h"
enum EventType { EV_YESNO, EV_OK };
struct Event {
enum Autor autor;
enum EventType type;
char *text;
};

View File

@ -1,4 +0,0 @@
#pragma once
/* #define LANG_FR */
#define LANG_EN

49
src/autor.c Normal file
View File

@ -0,0 +1,49 @@
#include "autor.h"
char *
autor_v42_str(enum Autor autor)
{
switch (autor) {
case CAKEISALIE5:
return "Cakeisalie5";
case DARK_STORM:
return "Dark storm";
case ERAGON:
return "Eragon";
case FLAMINGKITE:
return "FlamingKite";
case KIKOODX:
return "Kikoodx";
case LEPHENIXNOIR:
return "Lephenixnoir";
case MASSENA:
return "Massena";
case SHADOW15510:
return "Shadow15510";
case TITUYA:
return "Tituya";
default:
return "<undefined>";
}
}
char *
autor_v5_str(enum Autor autor)
{
switch (autor) {
case DARK_STORM:
return "Dark Storm";
case KIKOODX:
return "KikooDX";
case SHADOW15510:
return "Sha-chan";
case CAKEISALIE5:
case ERAGON:
case FLAMINGKITE:
case LEPHENIXNOIR:
case MASSENA:
case TITUYA:
default:
return autor_v42_str(autor);
}
}

View File

@ -1,28 +1,24 @@
#include "bar.h"
#include <gint/display.h>
extern bopti_image_t *vimg_bar3;
void
bar_draw(struct Bar bar)
{
const int height = bar.fill * (float)bar.height;
const int low_y = bar.y + bar.height;
const int high_y = bar.y - bar.limit_height + bar.height - height;
int i;
const int high_y = bar.y + bar.height - height;
/* draw borders */
drect_border(bar.x, bar.y - 1, bar.x + BAR_WIDTH - 1, low_y + 1,
C_WHITE, 1, C_BLACK);
/* borders */
drect(bar.x, bar.y - bar.limit_height, bar.x + BAR_WIDTH - 1,
low_y + bar.limit_height - 1, C_BLACK);
/* draw lower limit */
dsubimage(bar.x, low_y, &bimg_bar3, 0, bar.limit_height + 1,
bimg_bar3.width, bar.limit_height, DIMAGE_NOCLIP);
/* draw higher limit */
dsubimage(bar.x, high_y, &bimg_bar3, 0, 0, bimg_bar3.width,
bar.limit_height, DIMAGE_NOCLIP);
/* draw fill */
for (i = high_y + bar.limit_height; i < low_y; i += 1)
dsubimage(bar.x, i, &bimg_bar3, 0, bar.limit_height,
bimg_bar3.width, 1, DIMAGE_NOCLIP);
drect(bar.x + 1, high_y, bar.x + BAR_WIDTH - 2, low_y, C_RGB(31, 8, 5));
/* draw icons */
dsubimage(bar.x, BAR_ICON_Y, &bimg_icons, BAR_ICON_WIDTH * bar.id, 0,
BAR_ICON_WIDTH, BAR_ICON_HEIGHT, DIMAGE_NOCLIP);
dsubimage(bar.x + (BAR_WIDTH - BAR_ICON_WIDTH) / 2, BAR_ICON_Y,
&bimg_icons, BAR_ICON_WIDTH * bar.id, 0, BAR_ICON_WIDTH,
BAR_ICON_HEIGHT, DIMAGE_NOCLIP);
}

View File

@ -1,10 +1,13 @@
#include "bar.h"
#include <gint/display.h>
#include <gint/std/stdlib.h>
#include <gint/std/string.h>
struct Bar
bar_init(enum BarID bar_id)
{
int x = 0;
switch (bar_id) {
case BAR_CASH:
x = BAR_WIDTH;
@ -27,7 +30,6 @@ bar_init(enum BarID bar_id)
.x = x,
.y = BAR_Y,
.height = BAR_HEIGHT,
.limit_height = bimg_bar3.height / 2,
.fill = BAR_BASE_FILL,
};
}

20
src/events.c Normal file
View File

@ -0,0 +1,20 @@
#include "autor.h"
#include "event.h"
const struct Event events[] = {
{
.autor = MASSENA,
.type = EV_OK,
.text = "oh no",
},
{
.autor = KIKOODX,
.type = EV_OK,
.text = "J'suis pas venu ici pour souffrir OK ? ;_;",
},
{
.autor = LEPHENIXNOIR,
.type = EV_YESNO,
.text = "Suis-je mort ?",
},
};

View File

@ -2,18 +2,24 @@
#include "choice.h"
#include <gint/display.h>
#include <gint/keyboard.h>
#include <gint/usb-ff-bulk.h>
static struct Bar bars[BAR_TOTAL];
static struct Choice choice;
static void main_draw(void);
extern color_t *vcol_bar3;
int
main(void)
{
int i;
key_event_t key_ev;
usb_interface_t const *interfaces[] = {&usb_ff_bulk, NULL};
/* init */
usb_open(interfaces, GINT_CALL_NULL);
for (i = 0; i < BAR_TOTAL; i += 1)
bars[i] = bar_init(i);
choice = choice_init();
@ -23,7 +29,12 @@ main(void)
bar_change(&bars[BAR_SUN], 69.42);
main_draw();
getkey();
key_ev = getkey();
if (key_ev.key == KEY_OPTN && usb_is_open())
usb_fxlink_screenshot(1);
/* deinit */
usb_close();
return 1;
}
@ -35,7 +46,7 @@ main_draw(void)
int i;
/* draw background */
dimage(0, 0, &bimg_background);
dimage(-2, 0, &bimg_background);
/* draw bars */
for (i = 0; i < BAR_TOTAL; i += 1)