mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
- hooked up the menu code so that it can receive events.
Nothing pretty yet but a start is made.
This commit is contained in:
parent
2740913c60
commit
5f9b57519a
11 changed files with 76 additions and 38 deletions
|
@ -27,6 +27,7 @@
|
|||
#include "v_draw.h"
|
||||
#include "imgui.h"
|
||||
#include "stats.h"
|
||||
#include "menu.h"
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
# include "glsurface.h"
|
||||
|
@ -10067,6 +10068,7 @@ void videoNextPage(void)
|
|||
|
||||
// Draw the console plus debug output on top of everything else.
|
||||
DrawFullscreenBlends();
|
||||
M_Drawer();
|
||||
FStat::PrintStat();
|
||||
C_DrawConsole();
|
||||
GLInterface.Draw2D(&twod);
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "c_console.h"
|
||||
#include "d_gui.h"
|
||||
#include "inputstate.h"
|
||||
#include "menu.h"
|
||||
|
||||
int eventhead;
|
||||
int eventtail;
|
||||
|
@ -150,10 +151,8 @@ void D_ProcessEvents (void)
|
|||
(void)0;//UpdateJoystickMenu(I_UpdateDeviceList());
|
||||
if (C_Responder (ev))
|
||||
continue; // console ate the event
|
||||
#if 0
|
||||
if (M_Responder (ev))
|
||||
continue; // menu ate the event
|
||||
#endif
|
||||
G_Responder (ev);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "i_specialpaths.h"
|
||||
#include "z_music.h"
|
||||
#include "statistics.h"
|
||||
#include "menu.h"
|
||||
#ifndef NETCODE_DISABLE
|
||||
#include "enet.h"
|
||||
#endif
|
||||
|
@ -381,6 +382,7 @@ int CONFIG_Init()
|
|||
buttonMap.SetGameAliases();
|
||||
Mus_Init();
|
||||
InitStatistics();
|
||||
M_Init();
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -502,28 +502,29 @@ bool FListMenuItemSelectable::MouseEvent(int type, int x, int y)
|
|||
//
|
||||
//=============================================================================
|
||||
|
||||
FListMenuItemText::FListMenuItemText(int x, int y, int height, int hotkey, const char *text, FFont *font, EColorRange color, EColorRange color2, FName child, int param)
|
||||
FListMenuItemText::FListMenuItemText(int x, int y, int height, int hotkey, const FString &text, FFont *font, EColorRange color, EColorRange color2, FName child, int param)
|
||||
: FListMenuItemSelectable(x, y, height, child, param)
|
||||
{
|
||||
mText = text;
|
||||
/*
|
||||
mFont = font;
|
||||
mColor = color;
|
||||
mColorSelected = color2;
|
||||
*/
|
||||
mFont = NewSmallFont;
|
||||
mColor = CR_RED;
|
||||
mColorSelected = CR_GOLD;
|
||||
mHotkey = hotkey;
|
||||
}
|
||||
|
||||
FListMenuItemText::~FListMenuItemText()
|
||||
{
|
||||
if (mText != NULL)
|
||||
{
|
||||
delete [] mText;
|
||||
}
|
||||
}
|
||||
|
||||
void FListMenuItemText::Drawer(bool selected)
|
||||
{
|
||||
const char *text = mText;
|
||||
if (text != NULL)
|
||||
if (mText.Len())
|
||||
{
|
||||
if (*text == '$') text = GStrings(text+1);
|
||||
DrawText(&twod, mFont, selected ? mColorSelected : mColor, mXpos, mYpos, text, DTA_Clean, true, TAG_DONE);
|
||||
|
@ -533,7 +534,7 @@ void FListMenuItemText::Drawer(bool selected)
|
|||
int FListMenuItemText::GetWidth()
|
||||
{
|
||||
const char *text = mText;
|
||||
if (text != NULL)
|
||||
if (mText.Len())
|
||||
{
|
||||
if (*text == '$') text = GStrings(text+1);
|
||||
return mFont->StringWidth(text);
|
||||
|
|
|
@ -296,6 +296,7 @@ void M_StartControlPanel (bool makeSound)
|
|||
}
|
||||
|
||||
C_HideConsole (); // [RH] Make sure console goes bye bye.
|
||||
GUICapture |= 1;
|
||||
menuactive = MENU_On;
|
||||
// Pause sound effects before we play the menu switch sound.
|
||||
// That way, it won't be paused.
|
||||
|
@ -416,9 +417,9 @@ void M_SetMenu(FName menu, int param)
|
|||
}
|
||||
else
|
||||
{
|
||||
const PClass *cls = ld->mClass == NULL? RUNTIME_CLASS(DListMenu) : ld->mClass;
|
||||
//const PClass *cls = ld->mClass == NULL? RUNTIME_CLASS(DListMenu) : ld->mClass;
|
||||
|
||||
DListMenu *newmenu = (DListMenu *)cls->CreateNew();
|
||||
DListMenu* newmenu = new DListMenu;
|
||||
newmenu->Init(DMenu::CurrentMenu, ld);
|
||||
M_ActivateMenu(newmenu);
|
||||
}
|
||||
|
@ -426,9 +427,9 @@ void M_SetMenu(FName menu, int param)
|
|||
else if ((*desc)->mType == MDESC_OptionsMenu)
|
||||
{
|
||||
FOptionMenuDescriptor *ld = static_cast<FOptionMenuDescriptor*>(*desc);
|
||||
const PClass *cls = ld->mClass == NULL? RUNTIME_CLASS(DOptionMenu) : ld->mClass;
|
||||
//const PClass *cls = ld->mClass == NULL? RUNTIME_CLASS(DOptionMenu) : ld->mClass;
|
||||
|
||||
DOptionMenu *newmenu = (DOptionMenu *)cls->CreateNew();
|
||||
DOptionMenu *newmenu = new DOptionMenu;
|
||||
newmenu->Init(DMenu::CurrentMenu, ld);
|
||||
M_ActivateMenu(newmenu);
|
||||
}
|
||||
|
@ -649,6 +650,7 @@ bool M_Responder (event_t *ev)
|
|||
void M_Ticker (void)
|
||||
{
|
||||
DMenu::MenuTime++;
|
||||
if (DMenu::MenuTime & 3) return;
|
||||
if (DMenu::CurrentMenu != NULL && menuactive != MENU_Off)
|
||||
{
|
||||
DMenu::CurrentMenu->Ticker();
|
||||
|
@ -685,7 +687,7 @@ void M_Ticker (void)
|
|||
|
||||
void M_Drawer (void)
|
||||
{
|
||||
PalEntry fade = 0;// x70000000;
|
||||
PalEntry fade = 0x70000000;
|
||||
#if 0
|
||||
player_t *player = &players[consoleplayer];
|
||||
AActor *camera = player->camera;
|
||||
|
@ -701,9 +703,9 @@ void M_Drawer (void)
|
|||
#endif
|
||||
|
||||
|
||||
if (DMenu::CurrentMenu != NULL && menuactive != MENU_Off && fade)
|
||||
if (DMenu::CurrentMenu != NULL && menuactive != MENU_Off)
|
||||
{
|
||||
if (DMenu::CurrentMenu->DimAllowed()) twod.AddColorOnlyQuad(0, 0, screen->GetWidth(), screen->GetHeight(), fade);
|
||||
if (DMenu::CurrentMenu->DimAllowed() && fade) twod.AddColorOnlyQuad(0, 0, screen->GetWidth(), screen->GetHeight(), fade);
|
||||
DMenu::CurrentMenu->Drawer();
|
||||
}
|
||||
}
|
||||
|
@ -723,6 +725,7 @@ void M_ClearMenus ()
|
|||
DMenu::CurrentMenu = NULL;
|
||||
}
|
||||
menuactive = MENU_Off;
|
||||
GUICapture &= ~1;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
@ -733,6 +736,7 @@ void M_ClearMenus ()
|
|||
|
||||
void M_Init (void)
|
||||
{
|
||||
timerSetCallback(M_Ticker);
|
||||
M_ParseMenuDefs();
|
||||
M_CreateMenus();
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ struct FMenuDescriptor
|
|||
FName mMenuName;
|
||||
FString mNetgameMessage;
|
||||
int mType;
|
||||
const PClass *mClass;
|
||||
FName mClass;
|
||||
|
||||
virtual ~FMenuDescriptor() {}
|
||||
};
|
||||
|
@ -399,12 +399,12 @@ public:
|
|||
|
||||
class FListMenuItemText : public FListMenuItemSelectable
|
||||
{
|
||||
const char *mText;
|
||||
FString mText;
|
||||
FFont *mFont;
|
||||
EColorRange mColor;
|
||||
EColorRange mColorSelected;
|
||||
public:
|
||||
FListMenuItemText(int x, int y, int height, int hotkey, const char *text, FFont *font, EColorRange color, EColorRange color2, FName child, int param = 0);
|
||||
FListMenuItemText(int x, int y, int height, int hotkey, const FString &text, FFont *font, EColorRange color, EColorRange color2, FName child, int param = 0);
|
||||
~FListMenuItemText();
|
||||
void Drawer(bool selected);
|
||||
int GetWidth();
|
||||
|
@ -430,8 +430,8 @@ class DListMenu : public DMenu
|
|||
DECLARE_CLASS(DListMenu, DMenu)
|
||||
|
||||
protected:
|
||||
FListMenuDescriptor *mDesc;
|
||||
FListMenuItem *mFocusControl;
|
||||
FListMenuDescriptor *mDesc = nullptr;
|
||||
FListMenuItem *mFocusControl = nullptr;
|
||||
|
||||
public:
|
||||
DListMenu(DMenu *parent = NULL, FListMenuDescriptor *desc = NULL);
|
||||
|
@ -467,7 +467,7 @@ class FOptionMenuItem : public FListMenuItem
|
|||
{
|
||||
protected:
|
||||
FString mLabel;
|
||||
bool mCentered;
|
||||
bool mCentered = false;
|
||||
|
||||
void drawLabel(int indent, int y, EColorRange color, bool grayed = false);
|
||||
public:
|
||||
|
|
|
@ -241,12 +241,7 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc)
|
|||
else if (sc.Compare("Class"))
|
||||
{
|
||||
sc.MustGetString();
|
||||
const PClass *cls = PClass::FindClass(sc.String);
|
||||
if (cls == NULL || !cls->IsDescendantOf(RUNTIME_CLASS(DListMenu)))
|
||||
{
|
||||
sc.ScriptError("Unknown menu class '%s'", sc.String);
|
||||
}
|
||||
desc->mClass = cls;
|
||||
desc->mClass = sc.String;
|
||||
}
|
||||
else if (sc.Compare("Selector"))
|
||||
{
|
||||
|
@ -428,8 +423,8 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc)
|
|||
|
||||
static bool CheckCompatible(FMenuDescriptor *newd, FMenuDescriptor *oldd)
|
||||
{
|
||||
if (oldd->mClass == NULL) return true;
|
||||
return oldd->mClass == newd->mClass;
|
||||
/*if (oldd->mClass == NULL)*/ return true;
|
||||
//return oldd->mClass == newd->mClass;
|
||||
}
|
||||
|
||||
static bool ReplaceMenu(FScanner &sc, FMenuDescriptor *desc)
|
||||
|
@ -629,12 +624,7 @@ static void ParseOptionMenuBody(FScanner &sc, FOptionMenuDescriptor *desc)
|
|||
else if (sc.Compare("Class"))
|
||||
{
|
||||
sc.MustGetString();
|
||||
const PClass *cls = PClass::FindClass(sc.String);
|
||||
if (cls == NULL || !cls->IsDescendantOf(RUNTIME_CLASS(DOptionMenu)))
|
||||
{
|
||||
sc.ScriptError("Unknown menu class '%s'", sc.String);
|
||||
}
|
||||
desc->mClass = cls;
|
||||
desc->mClass = sc.String;
|
||||
}
|
||||
else if (sc.Compare("Title"))
|
||||
{
|
||||
|
|
|
@ -203,7 +203,7 @@ void DMessageBoxMenu::Drawer ()
|
|||
|
||||
if (messageSelection >= 0)
|
||||
{
|
||||
if ((DMenu::MenuTime%8) < 6)
|
||||
if (((DMenu::MenuTime>>2)%8) < 6)
|
||||
{
|
||||
DrawText(&twod, ConFont, OptionSettings.mFontColorSelection,
|
||||
(150 - 160) * CleanXfac + screen->GetWidth() / 2,
|
||||
|
|
|
@ -444,7 +444,7 @@ void DOptionMenu::Drawer ()
|
|||
int cur_indent = mDesc->mItems[i]->Draw(mDesc, y, indent, isSelected);
|
||||
if (cur_indent >= 0 && isSelected && mDesc->mItems[i]->Selectable())
|
||||
{
|
||||
if (((DMenu::MenuTime%8) < 6) || DMenu::CurrentMenu != this)
|
||||
if ((((DMenu::MenuTime>>2)%8) < 6) || DMenu::CurrentMenu != this)
|
||||
{
|
||||
M_DrawConText(OptionSettings.mFontColorSelection, cur_indent + 3 * CleanXfac_1, y+fontheight-9*CleanYfac_1, "\xd");
|
||||
}
|
||||
|
|
40
wadsrc/static/demolition/menudef.txt
Normal file
40
wadsrc/static/demolition/menudef.txt
Normal file
|
@ -0,0 +1,40 @@
|
|||
//-------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Text only variant of the main menu for Doom, Strife and Chex Quest to be used with localized content.
|
||||
//
|
||||
//-------------------------------------------------------------------------------------------
|
||||
|
||||
LISTMENU "MainMenu"
|
||||
{
|
||||
linespacing 15
|
||||
TextItem "$MNU_NEWGAME", "n", "PlayerclassMenu"
|
||||
TextItem "$MNU_LOADGAME", "l", "LoadGameMenu"
|
||||
TextItem "$MNU_OPTIONS", "o", "OptionsMenu"
|
||||
TextItem "$MNU_HELP", "h", "HelpMenu"
|
||||
TextItem "$MNU_CREDITS", "c", "CreditsMenu"
|
||||
TextItem "$MNU_QUITGAME", "q", "QuitMenu"
|
||||
}
|
||||
|
||||
LISTMENU "MainMenu_Blood"
|
||||
{
|
||||
linespacing 15
|
||||
TextItem "$MNU_NEWGAME", "n", "PlayerclassMenu"
|
||||
TextItem "$MNU_MULTIPLAYER", "m", "MultiMenu"
|
||||
TextItem "$MNU_OPTIONS", "o", "OptionsMenu"
|
||||
TextItem "$MNU_LOADGAME", "l", "LoadGameMenu"
|
||||
TextItem "$MNU_HELP", "h", "HelpMenu"
|
||||
TextItem "$MNU_CREDITS", "c", "CreditsMenu"
|
||||
TextItem "$MNU_QUITGAME", "q", "QuitMenu"
|
||||
}
|
||||
|
||||
LISTMENU "MainMenu_SW"
|
||||
{
|
||||
linespacing 15
|
||||
TextItem "$MNU_NEWGAME", "n", "PlayerclassMenu"
|
||||
TextItem "$MNU_LOADGAME", "l", "LoadGameMenu"
|
||||
TextItem "$MNU_SAVEGAME", "s", "SaveGameMenu"
|
||||
TextItem "$MNU_OPTIONS", "o", "OptionsMenu"
|
||||
TextItem "$MNU_COOLSTUFF", "h", "HelpMenu"
|
||||
TextItem "$MNU_QUITGAME", "q", "QuitMenu"
|
||||
}
|
||||
|
0
wadsrc/static/language.txt
Normal file
0
wadsrc/static/language.txt
Normal file
Loading…
Reference in a new issue