Start of main menu.

This commit is contained in:
Scott Duensing 2022-02-10 20:38:46 -06:00
parent cddb5c27e1
commit 029a37d87d
7 changed files with 131 additions and 3 deletions

BIN
client/assets/door.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
client/assets/dos.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
client/assets/if.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
client/assets/menu.xcf (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -85,6 +85,8 @@ static void tagListWidgetAttributeHandle(void) {
char *title;
char *filename;
RectT pos;
uint8_t hasWidth;
uint8_t hasHeight;
widgetCallback click;
void *userdata;
int32_t valueInt;
@ -120,6 +122,8 @@ static void tagListWidgetAttributeHandle(void) {
pos.y = 0;
pos.w = 0;
pos.h = 0;
hasWidth = 0;
hasHeight = 0;
click = NULL;
userdata = NULL;
hasValue = 0;
@ -185,6 +189,7 @@ static void tagListWidgetAttributeHandle(void) {
case T_HEIGHT:
pos.h = v;
hasHeight = 1;
break;
case T_INDEX:
@ -240,6 +245,7 @@ static void tagListWidgetAttributeHandle(void) {
case T_WIDTH:
pos.w = v;
hasWidth = 1;
break;
case T_X:

View file

@ -292,6 +292,8 @@ static void tableSave(void) {
}
void menuShow(void);
int main(int argc, char *argv[]) {
if (startup(argc, argv)) return 1;
@ -299,7 +301,8 @@ int main(int argc, char *argv[]) {
// Perform "first run" setup tasks or start the client?
if (hasValidSettings()) {
// We have what we need, start the client.
welcomeShow();
//welcomeShow();
menuShow();
} else {
// Run the setup.
settingsShow(checkSettings);

View file

@ -18,9 +18,116 @@
*/
#include "network.h"
#include "vesa.h"
#include "taglist.h"
#include "msgbox.h"
#include "window.h"
#include "picture.h"
#include "button.h"
#include "menu.h"
#include "hangup.h"
#include "welcome.h"
static void btnLogoffClick(WidgetT *widget);
static void btnOptionsClick(WidgetT *widget);
static void btnMsgBoxLogoff(MsgBoxButtonT button);
static void picDoorClick(WidgetT *widget);
static void setButtons(uint8_t enabled);
static WindowT *_winMenu = NULL;
static PictureT *_picDoor = NULL;
static PictureT *_picDOS = NULL;
static PictureT *_picIF = NULL;
static ButtonT *_btnOptions = NULL;
static ButtonT *_btnLogoff = NULL;
static void btnLogoffClick(WidgetT *widget) {
(void)widget;
setButtons(0);
msgBoxTwo("Cancel?", MSGBOX_ICON_QUESTION, "Cancel login?\n \nThis will disconnect you from the server.", "Okay", btnMsgBoxLogoff, "Cancel", btnMsgBoxLogoff);
}
static void btnMsgBoxLogoff(MsgBoxButtonT button) {
if (button == MSGBOX_BUTTON_ONE) {
guiDelete(D(_winMenu));
// ***TODO*** Need a way to close all other windows.
hangupShow(welcomeShow);
} else {
setButtons(1);
}
}
static void btnOptionsClick(WidgetT *widget) {
(void)widget;
// ***TODO***
msgBoxOne("Options", MSGBOX_ICON_MESSAGE, "Yeah, this doesn't do anything yet.", "Okay", NULL);
}
void menuShow(void) {
TagItemT uiMenu[] = {
T_START,
T_WINDOW, O(_winMenu),
T_TITLE, P("KangaWorld Main Menu"),
T_X, vbeDisplayWidthGet() - 360, T_Y, vbeDisplayHeightGet() - 285,
T_WIDTH, 350, T_HEIGHT, 275,
T_PICTURE, O(_picDOS),
T_FILENAME, P("dos.png"),
T_X, 18, T_Y, 18,
T_PICTURE, T_DONE,
T_PICTURE, O(_picDoor),
T_FILENAME, P("door.png"),
T_X, 18, T_Y, 77,
T_CLICK, P(picDoorClick),
T_PICTURE, T_DONE,
T_PICTURE, O(_picIF),
T_FILENAME, P("if.png"),
T_X, 18, T_Y, 136,
T_PICTURE, T_DONE,
T_BUTTON, O(_btnOptions),
T_TITLE, P("Options"),
T_X, 23, T_Y, 202,
T_CLICK, P(btnOptionsClick),
T_BUTTON, T_DONE,
T_BUTTON, O(_btnLogoff),
T_TITLE, P("Logoff"),
T_X, 245, T_Y, 202,
T_CLICK, P(btnLogoffClick),
T_BUTTON, T_DONE,
T_WINDOW, T_DONE,
T_END
};
tagListRun(uiMenu);
}
static void picDoorClick(WidgetT *widget) {
}
static void setButtons(uint8_t enabled) {
// ***TODO*** This should disable the entire dialog instead of just the buttons. Need to finish the Enable GUI code first.
widgetEnableSet(W(_btnOptions), enabled);
widgetEnableSet(W(_btnLogoff), enabled);
}