2012-01-21 21:57:41 +01:00
|
|
|
|
|
|
|
// Buttons
|
|
|
|
|
|
|
|
#ifndef __GUI_HPP
|
|
|
|
#define __GUI_HPP
|
|
|
|
|
|
|
|
#include <ogc/pad.h>
|
2012-08-05 15:48:15 +02:00
|
|
|
#include "wiiuse/wpad.h"
|
2018-07-27 00:24:00 +02:00
|
|
|
#include "wupc/wupc.h"
|
2012-01-21 21:57:41 +01:00
|
|
|
|
|
|
|
#include "video.hpp"
|
|
|
|
#include "FreeTypeGX.h"
|
|
|
|
#include "text.hpp"
|
2012-08-05 15:48:15 +02:00
|
|
|
#include "music/gui_sound.h"
|
|
|
|
#include "wstringEx/wstringEx.hpp"
|
2012-01-21 21:57:41 +01:00
|
|
|
|
|
|
|
struct SButtonTextureSet
|
|
|
|
{
|
2012-12-28 15:19:40 +01:00
|
|
|
TexData left;
|
|
|
|
TexData right;
|
|
|
|
TexData center;
|
|
|
|
TexData leftSel;
|
|
|
|
TexData rightSel;
|
|
|
|
TexData centerSel;
|
2012-01-21 21:57:41 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class CButtonsMgr
|
|
|
|
{
|
|
|
|
public:
|
2012-11-11 19:28:03 +01:00
|
|
|
bool init();
|
2012-01-21 21:57:41 +01:00
|
|
|
void setRumble(bool enabled) { m_rumbleEnabled = enabled; }
|
|
|
|
void reserve(u32 capacity) { m_elts.reserve(capacity); }
|
2012-09-13 16:54:17 +02:00
|
|
|
s16 addButton(SFont font, const wstringEx &text, int x, int y, u32 width, u32 height, const CColor &color,
|
2012-11-03 20:16:03 +01:00
|
|
|
const SButtonTextureSet &texSet, GuiSound *clickSound = NULL, GuiSound *hoverSound = NULL);
|
2016-07-22 01:40:12 +02:00
|
|
|
s16 addLabel(SFont font, const wstringEx &text, int x, int y, u32 width, u32 height, const CColor &color,
|
|
|
|
s16 style, const TexData &bg = _noTexture);
|
2012-09-13 16:54:17 +02:00
|
|
|
s16 addPicButton(const u8 *pngNormal, const u8 *pngSelected, int x, int y, u32 width, u32 height,
|
2012-11-03 20:16:03 +01:00
|
|
|
GuiSound *clickSound = NULL, GuiSound *hoverSound = NULL);
|
2012-12-28 15:19:40 +01:00
|
|
|
s16 addPicButton(TexData &texNormal, TexData &texSelected, int x, int y, u32 width, u32 height,
|
2012-11-03 20:16:03 +01:00
|
|
|
GuiSound *clickSound = NULL, GuiSound *hoverSound = NULL);
|
2012-09-13 16:54:17 +02:00
|
|
|
s16 addProgressBar(int x, int y, u32 width, u32 height, SButtonTextureSet &texSet);
|
|
|
|
void setText(s16 id, const wstringEx &text, bool unwrap = false);
|
|
|
|
void setText(s16 id, const wstringEx &text, u32 startline, bool unwrap = false);
|
2012-12-28 15:19:40 +01:00
|
|
|
void setBtnTexture(s16 id, TexData &texNormal, TexData &texSelected);
|
2012-11-30 21:54:02 +01:00
|
|
|
void freeBtnTexture(s16 id);
|
2012-12-28 15:19:40 +01:00
|
|
|
void setTexture(s16 id ,TexData &bg);
|
|
|
|
void setTexture(s16 id, TexData &bg, int width, int height);
|
2019-10-07 19:15:41 +02:00
|
|
|
void setTexture(s16 id, TexData &bg, int x_pos, int y_pos, int width, int height);
|
2012-09-13 16:54:17 +02:00
|
|
|
void setProgress(s16 id, float f, bool instant = false);
|
|
|
|
void reset(s16 id, bool instant = false);
|
|
|
|
void moveBy(s16 id, int x, int y, bool instant = false);
|
-updating wiiflow lite to beta 4.3.0
-fixed using categories to hide GC disc 2's. Apparently this has never really worked right for some time or ever.
-fixed deleting the cached cover texture file for plugin games. Delete cover for plugins only deletes the cached texture file (.wfc)
-fixed favorites and adultonly (parental lock) for plugin games. Apparently I may have broke this a few revisions back.
-favorites and adultonly for plugin games now have their own domains in gamecfg1- [FAVORITES_PLUGINS] and [ADULTONLY_PLUGINS]. just makes it more organized.
-only wii, GC, channels are added to [PLAYCOUNT] and [LAST_PLAYED] in gamecfg1.
-now loading gamecfg1 at startup and leaving it loaded till exit. no more loading it and unloading all the time.
-fixed scrolling for game_info synopsis, credits, and help text.
-made source menu buttons wider for wiiflow default. old 80x80, now 100x80. looks better.
-display music info now defaults to off
-screensaver_disabled now defaults to yes
-show GC view button is now on by default no matter what. the only way it is disabled is if you edit wiiflow.ini manually. this is how all the view buttons work.
-removed hiding homebrew button but if wiiflow locked it won't work or in sourceflow it won't show.
-dump_list is now under [GENERAL] instead of each view. Also only works for Wii, GC, and channels.
-sorting only works for Wii, GC, and Channels now. disabled for sourceflow, plugins, homebrew, and combined view.
-now if no games are found a message is shown with the current path so you can see where wiiflow is looking. (except for plugins)
-removed auto create emuNAND for emuNAND view if gamelist is empty. just go to settings>NAND settings if you want to extract or disable it.
-now when no games are found all buttons at bottom are still accessible allowing you to change the view or go to settings and change current partition or path and even extract your NAND to create a EmuNAND. Or go to Home Menu and Install a Wii or GC game.
-removed auto extract NAND to emuNAND when launching a Wii game with EmuNAND save. Now a message is diplayed saying 'emuNAND for saves not found - using real NAND'.
-made the speed at which cover titles fade in/out almost instantly.
-removed update button from Home Menu. online update code is still there but not used and probably won't be used any more as there just isn't a need for it now.
-removed ftp button from Home Menu and all code for the FTP server. I just use WiiXplorer's FTP server. it seems to work better for me.
-disabled keep USB Alive thread for now. i think there's a possibilty it might be the cause of my SD/USB files getting corrupted.
-removed Btn B and - combo to switch partitions. didn't seem useful anymore.
-redid nand emulation settings menu. looks like this now:
pg1
Select EmuNAND
EmuNAND Enulation
Select SaveNAND
SaveNAND Emulation
pg2
Extract Saves All
Missing
Extract NAND
Select Saves Partition
-no longer blocking Select Plugin menu and View icons when using source menu combined view
-now Select Plugins Menu is like switching to plugin view but you get to choose the plugins first
-now [PLUGIN] partition= is the default partition for all plugins. to change individual plugins add 'romPartition=x' to the plugin ini. x is the partition number 0 thru 8 with SD being 0. this is how my usbloadergx plugin mod works.
2016-10-05 01:44:13 +02:00
|
|
|
void getTotalHeight(s16 id, int &height);
|
2012-09-13 16:54:17 +02:00
|
|
|
void getDimensions(s16 id, int &x, int &y, u32 &width, u32 &height);
|
|
|
|
void hide(s16 id, int dx, int dy, float scaleX, float scaleY, bool instant = false);
|
|
|
|
void hide(s16 id, bool instant = false);
|
|
|
|
void show(s16 id, bool instant = false);
|
2012-01-21 21:57:41 +01:00
|
|
|
void mouse(int chan, int x, int y);
|
2012-09-15 21:14:08 +02:00
|
|
|
void setMouse(bool enable);
|
2012-01-21 21:57:41 +01:00
|
|
|
void up(void);
|
|
|
|
void down(void);
|
|
|
|
void draw(void);
|
|
|
|
void tick(void);
|
|
|
|
void noClick(bool noclick = false);
|
2012-04-08 16:48:50 +02:00
|
|
|
void noHover(bool nohover = false);
|
2012-09-13 16:54:17 +02:00
|
|
|
void click(s16 id = -1);
|
|
|
|
bool selected(s16 button = -1);
|
2019-10-22 00:44:34 +02:00
|
|
|
void setSelected(s16 button);
|
2018-07-27 00:24:00 +02:00
|
|
|
void setRumble(int, bool wii = false, bool gc = false, bool wupc = false);
|
2012-09-13 16:54:17 +02:00
|
|
|
void deselect(void){ for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--) m_selected[chan] = -1; }
|
2012-01-21 21:57:41 +01:00
|
|
|
void stopSounds(void);
|
|
|
|
void setSoundVolume(int vol);
|
|
|
|
private:
|
|
|
|
struct SHideParam
|
|
|
|
{
|
|
|
|
int dx;
|
|
|
|
int dy;
|
|
|
|
float scaleX;
|
|
|
|
float scaleY;
|
|
|
|
public:
|
|
|
|
SHideParam(void) : dx(0), dy(0), scaleX(1.f), scaleY(1.f) { }
|
|
|
|
};
|
|
|
|
enum EltType {
|
|
|
|
GUIELT_BUTTON,
|
|
|
|
GUIELT_LABEL,
|
|
|
|
GUIELT_PROGRESS
|
|
|
|
};
|
|
|
|
struct SElement
|
|
|
|
{
|
|
|
|
SHideParam hideParam;
|
|
|
|
EltType t;
|
|
|
|
bool visible;
|
2019-10-20 01:45:51 +02:00
|
|
|
int x;// x & y center of element (x + (width/2))
|
2012-01-21 21:57:41 +01:00
|
|
|
int y;
|
|
|
|
int w;
|
|
|
|
int h;
|
2019-10-20 01:45:51 +02:00
|
|
|
Vector3D pos;// actual current position (x,y,z) as it moves from hide x,y to targetpos or vice versa
|
|
|
|
Vector3D targetPos;// position to move to (x,y,z) usually hide position or x,y of element
|
2012-01-21 21:57:41 +01:00
|
|
|
u8 alpha;
|
|
|
|
u8 targetAlpha;
|
|
|
|
float scaleX;
|
|
|
|
float scaleY;
|
|
|
|
float targetScaleX;
|
|
|
|
float targetScaleY;
|
2019-10-20 01:45:51 +02:00
|
|
|
int moveByX;// keeps track of how much element has moved so when reset function is called x and y can be reset.
|
2012-01-21 21:57:41 +01:00
|
|
|
int moveByY;
|
|
|
|
public:
|
|
|
|
virtual ~SElement(void) { }
|
|
|
|
virtual void tick(void);
|
|
|
|
protected:
|
|
|
|
SElement(void) { }
|
|
|
|
};
|
|
|
|
struct SButton : public SElement
|
|
|
|
{
|
|
|
|
SFont font;
|
|
|
|
SButtonTextureSet tex;
|
2012-09-16 14:42:08 +02:00
|
|
|
CText text;
|
2012-01-21 21:57:41 +01:00
|
|
|
CColor textColor;
|
|
|
|
float click;
|
2012-11-03 20:16:03 +01:00
|
|
|
GuiSound *clickSound;
|
|
|
|
GuiSound *hoverSound;
|
2012-01-21 21:57:41 +01:00
|
|
|
public:
|
|
|
|
SButton(void) { t = GUIELT_BUTTON; }
|
|
|
|
virtual void tick(void);
|
|
|
|
};
|
|
|
|
struct SLabel : public SElement
|
|
|
|
{
|
|
|
|
SFont font;
|
|
|
|
CText text;
|
|
|
|
CColor textColor;
|
|
|
|
u16 textStyle;
|
2012-12-28 15:19:40 +01:00
|
|
|
TexData texBg;
|
2012-01-21 21:57:41 +01:00
|
|
|
public:
|
|
|
|
SLabel(void) { t = GUIELT_LABEL; }
|
|
|
|
virtual void tick(void);
|
|
|
|
};
|
|
|
|
struct SProgressBar : public SElement
|
|
|
|
{
|
|
|
|
SButtonTextureSet tex;
|
|
|
|
float val;
|
|
|
|
float targetVal;
|
|
|
|
public:
|
|
|
|
SProgressBar(void) { t = GUIELT_PROGRESS; }
|
|
|
|
virtual void tick(void);
|
|
|
|
};
|
|
|
|
private:
|
2012-11-03 20:16:03 +01:00
|
|
|
vector<SElement*> m_elts;
|
2012-09-13 16:54:17 +02:00
|
|
|
s32 m_selected[WPAD_MAX_WIIMOTES];
|
2012-01-21 21:57:41 +01:00
|
|
|
bool m_rumbleEnabled;
|
|
|
|
u8 m_rumble[WPAD_MAX_WIIMOTES];
|
|
|
|
bool wii_rumble[WPAD_MAX_WIIMOTES];
|
|
|
|
bool gc_rumble[WPAD_MAX_WIIMOTES];
|
2018-07-27 00:24:00 +02:00
|
|
|
bool wupc_rumble[WPAD_MAX_WIIMOTES];
|
2012-11-03 20:16:03 +01:00
|
|
|
GuiSound *m_sndHover;
|
|
|
|
GuiSound *m_sndClick;
|
2012-01-21 21:57:41 +01:00
|
|
|
u8 m_soundVolume;
|
|
|
|
bool m_noclick;
|
2012-04-08 16:48:50 +02:00
|
|
|
bool m_nohover;
|
2012-09-15 21:14:08 +02:00
|
|
|
bool m_mouse;
|
2012-01-21 21:57:41 +01:00
|
|
|
private:
|
2012-09-16 14:42:08 +02:00
|
|
|
void _drawBtn(SButton &b, bool selected, bool click);
|
2012-01-21 21:57:41 +01:00
|
|
|
void _drawLbl(SLabel &b);
|
|
|
|
void _drawPBar(const SProgressBar &b);
|
2012-12-28 15:19:40 +01:00
|
|
|
static TexData _noTexture;
|
2012-01-21 21:57:41 +01:00
|
|
|
};
|
|
|
|
|
2012-12-21 20:51:22 +01:00
|
|
|
extern CButtonsMgr m_btnMgr;
|
|
|
|
|
2012-01-21 21:57:41 +01:00
|
|
|
#endif // !defined(__GUI_HPP)
|