mirror of https://git.mastrix.org/lda/Mastrix
[ADD/WIP] Work on Goda + Test out new UI code
This commit is contained in:
parent
7438eb621b
commit
fbffd544cf
|
@ -12,7 +12,7 @@ find_package(Gint 2.9 REQUIRED)
|
|||
find_package(JustUI 1.3.0 REQUIRED)
|
||||
find_package(LibImg 2.1 REQUIRED)
|
||||
|
||||
AUX_SOURCE_DIRECTORY(src SOURCES)
|
||||
AUX_SOURCE_DIRECTORY(src SOURCES)
|
||||
# Shared assets, fx-9860G-only assets and fx-CG-50-only assets
|
||||
# HOW TO DEBUG: sh-elf-objdump -d build-cg/mastrix | less
|
||||
set(ASSETS
|
||||
|
@ -26,6 +26,7 @@ set(ASSETS_cg
|
|||
assets-cg/goda_full.png
|
||||
assets-cg/goda.png
|
||||
assets-cg/cc.png
|
||||
assets-cg/mastrix-print.png
|
||||
)
|
||||
|
||||
fxconv_declare_assets(${ASSETS} ${ASSETS_fx} ${ASSETS_cg} WITH_METADATA)
|
||||
|
|
|
@ -8,4 +8,9 @@ cc.png:
|
|||
type: font
|
||||
charset: print
|
||||
grid.size: 37x48
|
||||
proportional: true
|
||||
name: curse_casual
|
||||
|
||||
mastrix-print.png:
|
||||
type: bopti-image
|
||||
name: mastrix
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 7.2 KiB |
76
src/goda.c
76
src/goda.c
|
@ -3,12 +3,34 @@
|
|||
#include <gint/defs/timeout.h>
|
||||
#include <gint/keyboard.h>
|
||||
#include <gint/display.h>
|
||||
#include <gint/gint.h>
|
||||
#include <gint/exc.h>
|
||||
|
||||
|
||||
extern img_t const goda_face;
|
||||
extern img_t const goda_full;
|
||||
extern font_t const curse_casual;
|
||||
|
||||
__attribute((noreturn)) void goda_panic(uint32_t code)
|
||||
{
|
||||
timeout_t tm;
|
||||
|
||||
dclear(C_RED);
|
||||
img_render_vram(goda_full, 0, 0);
|
||||
dupdate();
|
||||
|
||||
tm = timeout_make_ms(1000);
|
||||
while (!timeout_elapsed(&tm));
|
||||
|
||||
dclear(C_RED);
|
||||
img_render_vram(goda_full, 0, 0);
|
||||
dtext(50, 50, C_WHITE, "Congrats. You made the crash screen Goda.");
|
||||
dtext(50, 61, C_WHITE, "How do you even fucking find this any funny?");
|
||||
dupdate();
|
||||
|
||||
while (true);
|
||||
}
|
||||
|
||||
void easter_goda(void)
|
||||
{
|
||||
/* All 6 Godas */
|
||||
|
@ -16,8 +38,13 @@ void easter_goda(void)
|
|||
img_t goda_decal;
|
||||
size_t i;
|
||||
size_t ex, ey;
|
||||
size_t x;
|
||||
int x;
|
||||
timeout_t tm;
|
||||
|
||||
const char *godatxt =
|
||||
"Goda Goda Goda Goda Goda Goda Goda Goda Goda "
|
||||
"Goda Goda Goda Goda";
|
||||
int godatxtw;
|
||||
|
||||
/* Darken all 6 Godas */
|
||||
for (i = 0; i < 6; i++)
|
||||
|
@ -55,15 +82,46 @@ void easter_goda(void)
|
|||
tm = timeout_make_ms(50);
|
||||
while (!timeout_elapsed(&tm));
|
||||
|
||||
dclear(C_WHITE);
|
||||
img_render_vram(godas[5], ex, ey);
|
||||
img_render_vram(goda_full, 0, 0);
|
||||
dfont(&curse_casual);
|
||||
dtext(51, 157, C_GREEN, "Goda");
|
||||
dupdate();
|
||||
dsize(godatxt, &curse_casual, &godatxtw, NULL);
|
||||
|
||||
x = 0;
|
||||
i = 0;
|
||||
while (true)
|
||||
{
|
||||
dclear(C_WHITE);
|
||||
img_render_vram(godas[5], ex, ey);
|
||||
img_render_vram(goda_full, 0, 0);
|
||||
dfont(&curse_casual);
|
||||
dtext(51 - x, 157, C_GREEN, godatxt);
|
||||
dfont(NULL);
|
||||
if (i >= 42)
|
||||
{
|
||||
dtext(1, 1, C_RED, "How can you be *amused* by this?");
|
||||
gint_panic_set(goda_panic);
|
||||
}
|
||||
if (i >= 43)
|
||||
{
|
||||
dtext(1, 11, C_RED, "Honestly, you're just weird.");
|
||||
}
|
||||
if (i >= 69)
|
||||
{
|
||||
dtext(1, 3, C_RED, "Alright, that's it.");
|
||||
|
||||
tm = timeout_make_ms(800);
|
||||
while (!timeout_elapsed(&tm));
|
||||
|
||||
gint_panic(0);
|
||||
}
|
||||
dupdate();
|
||||
x++;
|
||||
if (x >= (godatxtw + 60))
|
||||
{
|
||||
x = -DWIDTH;
|
||||
i++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
tm = timeout_make_ms(800);
|
||||
while (!timeout_elapsed(&tm));
|
||||
|
||||
/* End with all of the Godas. */
|
||||
for (i = 0; i < 6; i++)
|
||||
|
|
|
@ -9,31 +9,6 @@
|
|||
#include <justui/jfkeys.h>
|
||||
|
||||
|
||||
typedef struct ui_state_info_t {
|
||||
int exists;
|
||||
|
||||
char *jfktext;
|
||||
|
||||
void *focus;
|
||||
void *manager;
|
||||
|
||||
void *data;
|
||||
} ui_state_info_t;
|
||||
|
||||
typedef struct ui_t {
|
||||
jscene *screen;
|
||||
jwidget *stack;
|
||||
|
||||
jfkeys *keys;
|
||||
int state, state_count, exit;
|
||||
ui_state_info_t *states;
|
||||
|
||||
void *focus;
|
||||
|
||||
int out, in;
|
||||
} ui_t;
|
||||
|
||||
|
||||
/* A value, with a function to free said value */
|
||||
typedef struct ui_session_value {
|
||||
void *val;
|
||||
|
@ -70,9 +45,6 @@ typedef struct ui_screen {
|
|||
screen_event_t on_event;
|
||||
} ui_screen_t;
|
||||
|
||||
typedef void (*ui_state_generator)(ui_t *ui, ui_state_info_t *info);
|
||||
typedef void (*ui_state_manager)(ui_t *ui, ui_state_info_t *info, jevent e);
|
||||
|
||||
extern ui_session_t * ui_create_session(void);
|
||||
extern ui_screen_t * ui_new_screen(
|
||||
screen_setup_t,
|
||||
|
@ -85,9 +57,4 @@ extern ui_screen_t * ui_set_screen(ui_session_t *, size_t);
|
|||
extern void ui_session_loop(ui_session_t *);
|
||||
extern void ui_destroy_session(ui_session_t *);
|
||||
|
||||
extern char * ui_gen_jfkeys(ui_t *ui);
|
||||
extern void ui_focus(ui_t *ui, void *widget);
|
||||
extern void ui_manage(ui_t *ui, jevent event);
|
||||
extern void ui_add_state(ui_t *ui, int pos, ui_state_generator gen, ui_state_manager manager);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include <justui/jscene.h>
|
||||
|
||||
extern void * ui_infos_init(ui_screen_t *that);
|
||||
extern void ui_infos_focus(ui_screen_t *that);
|
||||
extern void ui_infos_event(ui_screen_t *that, jevent e);
|
||||
|
||||
extern void * ui_login_init(ui_screen_t *that);
|
||||
extern void ui_login_focus(ui_screen_t *that);
|
||||
extern void ui_login_event(ui_screen_t *that, jevent e);
|
||||
#endif
|
||||
|
|
|
@ -28,8 +28,8 @@ int main(void)
|
|||
int in, out;
|
||||
usb_fxlink_header_t reply;
|
||||
|
||||
easter_goda();
|
||||
getkey();
|
||||
/*easter_goda();
|
||||
getkey();*/
|
||||
|
||||
dclear(C_WHITE);
|
||||
dtext(1, 1, C_BLACK, "Waiting for USB link...");
|
||||
|
@ -38,9 +38,14 @@ int main(void)
|
|||
usb_init(&out, &in);
|
||||
|
||||
ui = ui_create_session();
|
||||
|
||||
screen = ui_new_screen(ui_infos_init, NULL, NULL);
|
||||
ui_add_screen(ui, screen);
|
||||
|
||||
screen = ui_new_screen(ui_login_init, ui_login_focus, ui_login_event);
|
||||
|
||||
ui_add_screen(ui, screen);
|
||||
|
||||
ui_session_loop(ui);
|
||||
|
||||
end:
|
||||
|
|
102
src/ui.c
102
src/ui.c
|
@ -14,106 +14,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
char * ui_gen_jfkeys(ui_t *ui)
|
||||
{
|
||||
static char string[128];
|
||||
size_t i;
|
||||
size_t len;
|
||||
if (!ui)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
len = ui->state_count > 6 ? 6 : ui->state_count;
|
||||
memset(string, 0, 128);
|
||||
|
||||
*string = '\0';
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
char *jfktext = ui->states[i].jfktext;
|
||||
if (jfktext)
|
||||
{
|
||||
strcat(string, jfktext);
|
||||
}
|
||||
if (i != len - 1)
|
||||
{
|
||||
strcat(string, ";");
|
||||
}
|
||||
}
|
||||
return string;
|
||||
}
|
||||
void ui_focus(ui_t *ui, void *widget)
|
||||
{
|
||||
if (ui)
|
||||
{
|
||||
ui->focus = widget;
|
||||
jscene_show_and_focus(ui->screen, widget);
|
||||
}
|
||||
}
|
||||
void ui_manage(ui_t *ui, jevent e)
|
||||
{
|
||||
bool need_new = false;
|
||||
int new_state;
|
||||
int key;
|
||||
if (!ui)
|
||||
{
|
||||
return;
|
||||
}
|
||||
key = e.key.key;
|
||||
switch (key)
|
||||
{
|
||||
case KEY_F1:
|
||||
case KEY_F2:
|
||||
case KEY_F3:
|
||||
case KEY_F4:
|
||||
case KEY_F5:
|
||||
case KEY_F6:
|
||||
new_state = key - KEY_F1;
|
||||
if (ui->state != new_state && ui->states[new_state % ui->state_count].exists)
|
||||
{
|
||||
ui->state = new_state;
|
||||
need_new = true;
|
||||
}
|
||||
}
|
||||
if (need_new)
|
||||
{
|
||||
if (ui->state == 5)
|
||||
{
|
||||
ui->exit = 1;
|
||||
return;
|
||||
}
|
||||
/*jlayout_get_stack(ui->stack)->active = ui->state;*/
|
||||
ui_focus(ui, ui->states[new_state].focus);
|
||||
return;
|
||||
/* do the thing */
|
||||
}
|
||||
if (ui->states[ui->state].manager)
|
||||
{
|
||||
((ui_state_manager) (ui->states[ui->state].manager))(ui, &ui->states[ui->state], e);
|
||||
}
|
||||
}
|
||||
|
||||
void ui_add_state(ui_t *ui, int pos, ui_state_generator gen, ui_state_manager manager)
|
||||
{
|
||||
if (!ui || pos < 0 || pos >= 6)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (pos >= ui->state_count || ui->states[pos].exists)
|
||||
{
|
||||
return;
|
||||
}
|
||||
ui->states[pos].exists = 1;
|
||||
ui->states[pos].focus = NULL;
|
||||
ui->states[pos].manager = manager;
|
||||
|
||||
gen(ui, &ui->states[pos]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
ui_session_t *ui_create_session(void)
|
||||
{
|
||||
ui_session_t *ret = malloc(sizeof(ui_session_t));
|
||||
|
@ -124,7 +24,7 @@ ui_session_t *ui_create_session(void)
|
|||
/* Create a "stacked" element(only one item may appear at a time) */
|
||||
ret->stack = jwidget_create(ret->justui_screen);
|
||||
jlayout_set_stack(ret->stack);
|
||||
jwidget_set_padding(ret->stack, 0, 6, 0, 6);
|
||||
jwidget_set_padding(ret->stack, 0, 0, 0, 0);
|
||||
jwidget_set_stretch(ret->stack, 1, 1, false);
|
||||
|
||||
|
||||
|
|
|
@ -1,147 +0,0 @@
|
|||
#include <ui.h>
|
||||
|
||||
#include <gint/usb-ff-bulk.h>
|
||||
#include <gint/usb.h>
|
||||
#include <gint/defs/timeout.h>
|
||||
|
||||
#include <justui/jwidget.h>
|
||||
#include <justui/jinput.h>
|
||||
#include <justui/jlabel.h>
|
||||
#include <justui/jframe.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <matrix.h>
|
||||
#include <utils.h>
|
||||
|
||||
void ui_chat_manager(ui_t *ui, ui_state_info_t *state, jevent e)
|
||||
{
|
||||
if (!ui || !state)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (e.type == JINPUT_VALIDATED)
|
||||
{
|
||||
/* Just tests whenever we can do delegation */
|
||||
char *string = (char *) jinput_value(state->focus);
|
||||
char *delegated;
|
||||
if (matrix_delegate("a.freetards.xyz", &delegated) == DELEG_SUCCESS)
|
||||
{
|
||||
char *written;
|
||||
hashmap_t *json;
|
||||
size_t length;
|
||||
|
||||
bool password;
|
||||
dclear(C_GREEN);
|
||||
dprint(1, 1, C_WHITE, "%s", delegated);
|
||||
dupdate();
|
||||
getkey();
|
||||
|
||||
password = matrix_supports_password(delegated);
|
||||
if (password)
|
||||
{
|
||||
m_user_t *user = matrix_login(delegated, "godel", string);
|
||||
if (!user) return;
|
||||
dclear(C_RED);
|
||||
dprint(1, 1, C_WHITE, "Logged-in to %s", user->server);
|
||||
dprint(20, 11, C_WHITE, "DID: %s", user->device_id);
|
||||
dprint(20, 22, C_WHITE, "ACC: %s", user->access_token);
|
||||
dupdate();
|
||||
getkey();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void ui_chat_generator(ui_t *ui, ui_state_info_t *state)
|
||||
{
|
||||
jwidget *chat;
|
||||
jinput *input;
|
||||
jwidget *logs;
|
||||
jlabel *text;
|
||||
|
||||
if (!ui || !state)
|
||||
{
|
||||
return;
|
||||
}
|
||||
state->jfktext = "/CHAT";
|
||||
|
||||
chat = jwidget_create(ui->stack);
|
||||
jlayout_set_vbox(chat)->spacing = 3;
|
||||
jwidget_set_padding(chat, 1, 1, 1, 1);
|
||||
jwidget_set_stretch(chat, 1, 1, false);
|
||||
|
||||
logs = jwidget_create(chat);
|
||||
jwidget_set_padding(logs, 1, 1, 1, 1);
|
||||
jwidget_set_stretch(logs, 1, 1, false);
|
||||
text = jlabel_create(
|
||||
"This is a placeholder for when I'm adding rooms "
|
||||
"which won't be now, nor in the forseeable future.\n\n"
|
||||
"Anyways, LDA out.\nNah jkjk... unless?",
|
||||
logs);
|
||||
|
||||
(void) text;
|
||||
|
||||
input = jinput_create("Write a message: ", 50, chat);
|
||||
state->focus = input;
|
||||
}
|
||||
const char *fdj =
|
||||
"NOTE for future LDA: *Don't* let random \n"
|
||||
"IFA Wartburg song creep in.\n\n"
|
||||
"Like seriously. Don't.\n"
|
||||
"Oh, and funfact: FDJ stands for \n"
|
||||
"Francaise des jeux\n"
|
||||
"(Ma's Trix does not endorse gambling)\n"
|
||||
"Oh, this is also supposed to be the rooms list.\n"
|
||||
"Come back later for that.\n"
|
||||
;
|
||||
void ui_rooms_generator(ui_t *ui, ui_state_info_t *state)
|
||||
{
|
||||
jframe *room_frame;
|
||||
jlabel *text;
|
||||
if (!ui || !state)
|
||||
{
|
||||
return;
|
||||
}
|
||||
room_frame = jframe_create(ui->stack);
|
||||
jframe_set_keyboard_control(room_frame, true);
|
||||
|
||||
jwidget_set_padding(room_frame, 1, 1, 1, 1);
|
||||
jwidget_set_stretch(room_frame, 1, 1, false);
|
||||
text = jlabel_create(fdj, room_frame);
|
||||
state->focus = room_frame;
|
||||
state->jfktext = "/ROOMS";
|
||||
|
||||
(void) text;
|
||||
}
|
||||
|
||||
const char *infos =
|
||||
"= Ma's Trix\n"
|
||||
"A half decent [matrix] client.\n\n\n"
|
||||
"LICENSE: \n"
|
||||
"- TBD lol\n\n"
|
||||
|
||||
"WRITTEN BY: \n"
|
||||
"- LDA <@lda:a.freetards.xyz>\n\n"
|
||||
|
||||
"THANKS TO: \n"
|
||||
"- Lephe for writing gint, fxlink, libimg and other tools\n"
|
||||
"- Ari for offering the mastrix.org domain for free!\n"
|
||||
"- The [matrix] Foundation for providing its specification to "
|
||||
"the public...\n"
|
||||
"- Various other open-source contributors "
|
||||
"for additional software used to create Ma's Trix\n";
|
||||
void * ui_infos_init(ui_screen_t *that)
|
||||
{
|
||||
jframe *info_frame;
|
||||
jlabel *info_label;
|
||||
|
||||
info_frame = jframe_create(that->owner->stack);
|
||||
jframe_set_keyboard_control(info_frame, true);
|
||||
jwidget_set_padding(info_frame, 1, 1, 1, 1);
|
||||
jwidget_set_stretch(info_frame, 1, 1, false);
|
||||
|
||||
info_label = jlabel_create(infos, info_frame);
|
||||
|
||||
return info_frame;
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
#include <ui.h>
|
||||
|
||||
#include <gint/usb-ff-bulk.h>
|
||||
#include <gint/usb.h>
|
||||
#include <gint/defs/timeout.h>
|
||||
|
||||
#include <justui/jwidget.h>
|
||||
#include <justui/jinput.h>
|
||||
#include <justui/jlabel.h>
|
||||
#include <justui/jframe.h>
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include <matrix.h>
|
||||
#include <utils.h>
|
||||
|
||||
const char *infos =
|
||||
"= Ma's Trix\n"
|
||||
"A half decent [matrix] client.\n\n\n"
|
||||
"LICENSE: \n"
|
||||
"- TBD lol\n\n"
|
||||
|
||||
"WRITTEN BY: \n"
|
||||
"- LDA <@lda:a.freetards.xyz>\n"
|
||||
"(pssht KONTRIBUTORS, put your contacts here!)\n\n"
|
||||
|
||||
"THANKS TO: \n"
|
||||
"- Lephe for writing gint, fxlink, libimg and other tools\n"
|
||||
"- ari.lt for offering the mastrix.org domain for free!\n"
|
||||
"- The [matrix] Foundation for providing its specification to "
|
||||
"the public\n"
|
||||
"- Various other open-source contributors "
|
||||
"for additional software used to create Ma's Trix\n";
|
||||
void * ui_infos_init(ui_screen_t *that)
|
||||
{
|
||||
jframe *info_frame;
|
||||
jlabel *info_label;
|
||||
|
||||
info_frame = jframe_create(that->owner->stack);
|
||||
jframe_set_keyboard_control(info_frame, true);
|
||||
jwidget_set_padding(info_frame, 1, 1, 1, 1);
|
||||
jwidget_set_stretch(info_frame, 1, 1, false);
|
||||
|
||||
info_label = jlabel_create(infos, info_frame);
|
||||
|
||||
return info_frame;
|
||||
}
|
|
@ -0,0 +1,115 @@
|
|||
#include <ui.h>
|
||||
|
||||
#include <justui/jwidget.h>
|
||||
#include <justui/jinput.h>
|
||||
#include <justui/jlabel.h>
|
||||
#include <justui/jframe.h>
|
||||
#include <justui/jpainted.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <matrix.h>
|
||||
#include <utils.h>
|
||||
|
||||
extern const bopti_image_t mastrix;
|
||||
|
||||
void draw_mastrix(int x, int y)
|
||||
{
|
||||
dimage(x, y, &mastrix);
|
||||
}
|
||||
|
||||
void * ui_login_init(ui_screen_t *that)
|
||||
{
|
||||
jwidget *login_widget = jwidget_create(that->owner->stack);
|
||||
jinput *server, *login, *password;
|
||||
jwidget *login_content;
|
||||
jlabel *login_to_mastrix = jlabel_create(
|
||||
"Login to Matrix", login_widget
|
||||
);
|
||||
jpainted *logo;
|
||||
login_content = jwidget_create(login_widget);
|
||||
|
||||
jlayout_set_vbox(login_widget)->spacing = 3;
|
||||
jwidget_set_padding(login_widget, 0, 0, 0, 0);
|
||||
jwidget_set_stretch(login_widget, 1, 1, false);
|
||||
|
||||
jwidget_set_padding(login_to_mastrix, 1, 1, 3, 1);
|
||||
jwidget_set_stretch(login_to_mastrix, 1, 0, false);
|
||||
jwidget_set_background(login_to_mastrix, C_BLACK);
|
||||
jlabel_set_text_color(login_to_mastrix, C_WHITE);
|
||||
|
||||
jlayout_set_vbox(login_content)->spacing = 5;
|
||||
jwidget_set_padding(login_content, 0, 0, 0, 0);
|
||||
jwidget_set_stretch(login_content, 1, 1,false);
|
||||
|
||||
logo = jpainted_create(
|
||||
draw_mastrix,
|
||||
(j_arg_t) NULL, /* Clang, shut up! */
|
||||
mastrix.width, mastrix.height,
|
||||
login_content
|
||||
);
|
||||
|
||||
/* Add the actual elements */
|
||||
server = jinput_create("Server name: ", 32, login_content);
|
||||
login = jinput_create("Username: ", 32, login_content);
|
||||
password = jinput_create("Password: ", 64, login_content);
|
||||
|
||||
jwidget_set_stretch(server , 1, 0, false);
|
||||
jwidget_set_padding(server, 0, 0, 0, 6);
|
||||
jwidget_set_stretch(login , 1, 0, false);
|
||||
jwidget_set_padding(login, 0, 0, 0, 6);
|
||||
jwidget_set_stretch(password , 1, 0, false);
|
||||
jwidget_set_padding(password, 0, 0, 0, 6);
|
||||
|
||||
/* Store those so that they can be referenced later */
|
||||
utils_hashmap_add(that->data, "server", server);
|
||||
utils_hashmap_add(that->data, "login", login);
|
||||
utils_hashmap_add(that->data, "password", password);
|
||||
|
||||
utils_hashmap_add(that->data, "focusing", "server");
|
||||
|
||||
|
||||
return login_widget;
|
||||
}
|
||||
void ui_login_focus(ui_screen_t *that)
|
||||
{
|
||||
char *focus_to = utils_hashmap_get(that->data, "focusing");
|
||||
|
||||
if (!strcmp(focus_to, "server"))
|
||||
{
|
||||
void *server = utils_hashmap_get(that->data, "server");
|
||||
jscene_show_and_focus(that->owner->justui_screen, server);
|
||||
}
|
||||
else if (!strcmp(focus_to, "login"))
|
||||
{
|
||||
void *login = utils_hashmap_get(that->data, "login");
|
||||
jscene_show_and_focus(that->owner->justui_screen, login);
|
||||
}
|
||||
else if (!strcmp(focus_to, "password"))
|
||||
{
|
||||
void *password = utils_hashmap_get(that->data, "password");
|
||||
jscene_show_and_focus(that->owner->justui_screen, password);
|
||||
}
|
||||
}
|
||||
void ui_login_event(ui_screen_t *that, jevent e)
|
||||
{
|
||||
char *focus_to = utils_hashmap_get(that->data, "focusing");
|
||||
|
||||
if (e.type == JINPUT_VALIDATED)
|
||||
{
|
||||
if (!strcmp(focus_to, "server"))
|
||||
{
|
||||
utils_hashmap_add(that->data, "focusing", "login");
|
||||
ui_login_focus(that);
|
||||
return;
|
||||
}
|
||||
if (!strcmp(focus_to, "login"))
|
||||
{
|
||||
utils_hashmap_add(that->data, "focusing", "password");
|
||||
ui_login_focus(that);
|
||||
return;
|
||||
}
|
||||
/* TODO */
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue