2017-02-03 23:19:25 +00:00
|
|
|
|
2017-02-10 23:36:53 +00:00
|
|
|
struct KeyBindings native
|
|
|
|
{
|
|
|
|
native static String NameKeys(int k1, int k2);
|
|
|
|
|
|
|
|
native int, int GetKeysForCommand(String cmd);
|
|
|
|
native void SetBind(int key, String cmd);
|
|
|
|
native void UnbindACommand (String str);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct OptionValues native
|
|
|
|
{
|
|
|
|
native static int GetCount(Name group);
|
|
|
|
native static String GetText(Name group, int index);
|
|
|
|
native static double GetValue(Name group, int index);
|
|
|
|
native static String GetTextValue(Name group, int index);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct JoystickConfig native
|
|
|
|
{
|
|
|
|
enum EJoyAxis
|
|
|
|
{
|
|
|
|
JOYAXIS_None = -1,
|
|
|
|
JOYAXIS_Yaw,
|
|
|
|
JOYAXIS_Pitch,
|
|
|
|
JOYAXIS_Forward,
|
|
|
|
JOYAXIS_Side,
|
|
|
|
JOYAXIS_Up,
|
|
|
|
// JOYAXIS_Roll, // Ha ha. No roll for you.
|
|
|
|
NUM_JOYAXIS,
|
|
|
|
};
|
|
|
|
|
|
|
|
native float GetSensitivity();
|
|
|
|
native void SetSensitivity(float scale);
|
|
|
|
|
|
|
|
native float GetAxisScale(int axis);
|
|
|
|
native void SetAxisScale(int axis, float scale);
|
|
|
|
|
|
|
|
native float GetAxisDeadZone(int axis);
|
|
|
|
native void SetAxisDeadZone(int axis, float zone);
|
|
|
|
|
|
|
|
native int GetAxisMap(int axis);
|
|
|
|
native void SetAxisMap(int axis, int gameaxis);
|
|
|
|
}
|
|
|
|
|
2017-02-03 23:19:25 +00:00
|
|
|
class Menu : Object native
|
|
|
|
{
|
2017-02-10 10:44:46 +00:00
|
|
|
enum EMenuKey
|
|
|
|
{
|
|
|
|
MKEY_Up,
|
|
|
|
MKEY_Down,
|
|
|
|
MKEY_Left,
|
|
|
|
MKEY_Right,
|
|
|
|
MKEY_PageUp,
|
|
|
|
MKEY_PageDown,
|
|
|
|
MKEY_Enter,
|
|
|
|
MKEY_Back,
|
|
|
|
MKEY_Clear,
|
|
|
|
NUM_MKEYS,
|
|
|
|
|
|
|
|
// These are not buttons but events sent from other menus
|
|
|
|
|
|
|
|
MKEY_Input,
|
|
|
|
MKEY_Abort,
|
|
|
|
MKEY_MBYes,
|
|
|
|
MKEY_MBNo,
|
|
|
|
}
|
|
|
|
|
|
|
|
enum EMenuMouse
|
|
|
|
{
|
|
|
|
MOUSE_Click,
|
|
|
|
MOUSE_Move,
|
|
|
|
MOUSE_Release
|
|
|
|
};
|
|
|
|
|
2017-02-12 17:38:23 +00:00
|
|
|
enum EMenuState
|
|
|
|
{
|
|
|
|
Off, // Menu is closed
|
|
|
|
On, // Menu is opened
|
|
|
|
WaitKey, // Menu is opened and waiting for a key in the controls menu
|
|
|
|
OnNoPause, // Menu is opened but does not pause the game
|
|
|
|
};
|
|
|
|
|
|
|
|
native Menu mParentMenu;
|
|
|
|
|
|
|
|
void Init(Menu parent)
|
|
|
|
{
|
|
|
|
mParentMenu = parent;
|
|
|
|
}
|
|
|
|
|
2017-02-11 15:11:48 +00:00
|
|
|
native static int MenuTime();
|
2017-02-10 23:36:53 +00:00
|
|
|
native static void SetVideoMode();
|
|
|
|
native static Menu GetCurrentMenu();
|
|
|
|
native static JoystickConfig GetCurrentJoystickConfig();
|
|
|
|
native static void SetMenu(Name mnu, int param = 0);
|
|
|
|
native static void StartMessage(String msg, int mode = 0, Name command = 'none');
|
|
|
|
|
2017-02-12 17:38:23 +00:00
|
|
|
virtual bool TranslateKeyboardEvents() { return true; }
|
2017-02-11 15:11:48 +00:00
|
|
|
virtual void SetFocus(MenuItemBase fc) {}
|
|
|
|
virtual bool CheckFocus(MenuItemBase fc) { return false; }
|
|
|
|
virtual void ReleaseFocus() {}
|
2017-02-12 19:20:47 +00:00
|
|
|
virtual void ResetColor() {}
|
2017-02-12 17:38:23 +00:00
|
|
|
|
|
|
|
native virtual bool Responder(InputEvent ev);
|
2017-02-09 19:18:53 +00:00
|
|
|
native virtual bool MenuEvent (int mkey, bool fromcontroller);
|
2017-02-10 10:44:46 +00:00
|
|
|
native virtual bool MouseEvent(int type, int mx, int my);
|
2017-02-10 12:20:19 +00:00
|
|
|
native virtual void Drawer();
|
2017-02-12 17:38:23 +00:00
|
|
|
native void Close();
|
|
|
|
native MenuItemBase GetItem(Name n);
|
|
|
|
native void ActivateMenu();
|
2017-02-09 19:18:53 +00:00
|
|
|
|
2017-02-10 23:36:53 +00:00
|
|
|
static void MenuSound(Sound snd)
|
2017-02-09 19:18:53 +00:00
|
|
|
{
|
|
|
|
S_Sound (snd, CHAN_VOICE | CHAN_UI, snd_menuvolume, ATTN_NONE);
|
|
|
|
}
|
|
|
|
|
2017-02-10 23:36:53 +00:00
|
|
|
static void DrawConText (int color, int x, int y, String str)
|
|
|
|
{
|
|
|
|
screen.DrawText (ConFont, color, x, y, str, DTA_CellX, 8 * CleanXfac_1, DTA_CellY, 8 * CleanYfac_1);
|
|
|
|
}
|
|
|
|
|
2017-02-09 19:18:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class MenuDescriptor : Object native
|
|
|
|
{
|
|
|
|
native Name mMenuName;
|
|
|
|
native String mNetgameMessage;
|
|
|
|
native Class<Menu> mClass;
|
2017-02-12 19:20:47 +00:00
|
|
|
|
|
|
|
native static MenuDescriptor GetDescriptor(Name n);
|
2017-02-09 19:18:53 +00:00
|
|
|
}
|
|
|
|
|
2017-02-11 15:11:48 +00:00
|
|
|
class ListMenuDescriptor : MenuDescriptor native
|
|
|
|
{
|
|
|
|
native Array<ListMenuItem> mItems;
|
|
|
|
native int mSelectedItem;
|
|
|
|
native int mSelectOfsX;
|
|
|
|
native int mSelectOfsY;
|
|
|
|
native TextureID mSelector;
|
|
|
|
native int mDisplayTop;
|
|
|
|
native int mXpos, mYpos;
|
|
|
|
native int mWLeft, mWRight;
|
|
|
|
native int mLinespacing; // needs to be stored for dynamically created menus
|
|
|
|
native int mAutoselect; // this can only be set by internal menu creation functions
|
|
|
|
native Font mFont;
|
|
|
|
native int mFontColor;
|
|
|
|
native int mFontColor2;
|
|
|
|
native bool mCenter;
|
|
|
|
|
|
|
|
void Reset()
|
|
|
|
{
|
|
|
|
// Reset the default settings (ignore all other values in the struct)
|
|
|
|
mSelectOfsX = 0;
|
|
|
|
mSelectOfsY = 0;
|
|
|
|
mSelector.SetInvalid();
|
|
|
|
mDisplayTop = 0;
|
|
|
|
mXpos = 0;
|
|
|
|
mYpos = 0;
|
|
|
|
mLinespacing = 0;
|
|
|
|
mNetgameMessage = "";
|
|
|
|
mFont = NULL;
|
|
|
|
mFontColor = Font.CR_UNTRANSLATED;
|
|
|
|
mFontColor2 = Font.CR_UNTRANSLATED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-02-03 23:19:25 +00:00
|
|
|
struct FOptionMenuSettings
|
|
|
|
{
|
|
|
|
int mTitleColor;
|
|
|
|
int mFontColor;
|
|
|
|
int mFontColorValue;
|
|
|
|
int mFontColorMore;
|
|
|
|
int mFontColorHeader;
|
|
|
|
int mFontColorHighlight;
|
|
|
|
int mFontColorSelection;
|
|
|
|
int mLinespacing;
|
|
|
|
}
|
2017-02-09 19:18:53 +00:00
|
|
|
|
|
|
|
class OptionMenuDescriptor : MenuDescriptor native
|
|
|
|
{
|
|
|
|
native Array<OptionMenuItem> mItems;
|
|
|
|
native String mTitle;
|
|
|
|
native int mSelectedItem;
|
|
|
|
native int mDrawTop;
|
|
|
|
native int mScrollTop;
|
|
|
|
native int mScrollPos;
|
|
|
|
native int mIndent;
|
|
|
|
native int mPosition;
|
|
|
|
native bool mDontDim;
|
|
|
|
|
2017-02-12 19:20:47 +00:00
|
|
|
native void CalcIndent();
|
2017-02-09 19:18:53 +00:00
|
|
|
//native OptionMenuItem GetItem(Name iname);
|
|
|
|
void Reset()
|
|
|
|
{
|
|
|
|
// Reset the default settings (ignore all other values in the struct)
|
|
|
|
mPosition = 0;
|
|
|
|
mScrollTop = 0;
|
|
|
|
mIndent = 0;
|
|
|
|
mDontDim = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class OptionMenu : Menu native
|
|
|
|
{
|
2017-02-12 19:20:47 +00:00
|
|
|
native OptionMenuDescriptor mDesc;
|
2017-02-09 19:18:53 +00:00
|
|
|
native bool CanScrollUp;
|
|
|
|
native bool CanScrollDown;
|
|
|
|
native int VisBottom;
|
|
|
|
native OptionMenuItem mFocusControl;
|
2017-02-12 19:20:47 +00:00
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//=============================================================================
|
|
|
|
|
2017-02-12 20:56:01 +00:00
|
|
|
virtual void Init(Menu parent, OptionMenuDescriptor desc)
|
2017-02-12 19:20:47 +00:00
|
|
|
{
|
|
|
|
mParentMenu = parent;
|
|
|
|
mDesc = desc;
|
|
|
|
if (mDesc != NULL && mDesc.mSelectedItem == -1) mDesc.mSelectedItem = FirstSelectable();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//=============================================================================
|
|
|
|
|
|
|
|
int FirstSelectable()
|
|
|
|
{
|
|
|
|
if (mDesc != NULL)
|
|
|
|
{
|
|
|
|
// Go down to the first selectable item
|
|
|
|
int i = -1;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
while (i < mDesc.mItems.Size() && !mDesc.mItems[i].Selectable());
|
|
|
|
if (i>=0 && i < mDesc.mItems.Size()) return i;
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2017-02-10 23:36:53 +00:00
|
|
|
|
2017-02-11 15:11:48 +00:00
|
|
|
override void SetFocus(MenuItemBase fc)
|
2017-02-10 23:36:53 +00:00
|
|
|
{
|
2017-02-11 15:11:48 +00:00
|
|
|
mFocusControl = OptionMenuItem(fc);
|
2017-02-10 23:36:53 +00:00
|
|
|
}
|
2017-02-12 19:20:47 +00:00
|
|
|
|
2017-02-11 15:11:48 +00:00
|
|
|
override bool CheckFocus(MenuItemBase fc)
|
2017-02-10 23:36:53 +00:00
|
|
|
{
|
|
|
|
return mFocusControl == fc;
|
|
|
|
}
|
2017-02-12 19:20:47 +00:00
|
|
|
|
2017-02-11 15:11:48 +00:00
|
|
|
override void ReleaseFocus()
|
2017-02-10 23:36:53 +00:00
|
|
|
{
|
2017-02-11 15:11:48 +00:00
|
|
|
mFocusControl = NULL;
|
2017-02-10 23:36:53 +00:00
|
|
|
}
|
|
|
|
|
2017-02-12 19:20:47 +00:00
|
|
|
|
2017-02-09 19:18:53 +00:00
|
|
|
}
|
|
|
|
|