-- Tutorial Messages are an ability like any other, except it can only be displayed once. Subsequent calls are ignored, the ability is removed from the game as soon as it is added -- This allows to add event triggered messages ingame. Messages are either text, or images (I don't have an image sample, but rules/classic.txt has a few examples that might help) -- only tested on Windows, although I made sure the PSP version compiles. Hopefully I also made the necessary for it to work in the touch version (touching the screen should be enough to close the tuto message) -- Room for improvement: possibility to choose a title in text mode, possibility to have some messages depending on others (e.g.: don't show message X until message Y has been shown), improve some of the abilities and triggers to give more flexibility, add events outside of game, to allow tuto messages in deck creator, etc...
51 lines
1.4 KiB
C++
51 lines
1.4 KiB
C++
#ifndef _ICONBUTTON_H
|
|
#define _ICONBUTTON_H
|
|
|
|
#include <string>
|
|
#include <JGui.h>
|
|
|
|
using std::string;
|
|
|
|
class IconButtonsController: public JGuiController, public JGuiListener
|
|
{
|
|
public:
|
|
float mX;
|
|
float mY;
|
|
IconButtonsController(float x, float y);
|
|
void SetColor(PIXEL_TYPE color);
|
|
};
|
|
|
|
class IconButton: public JGuiObject
|
|
{
|
|
private:
|
|
PIXEL_TYPE mColor;
|
|
IconButtonsController * mParent;
|
|
bool mHasFocus;
|
|
int mFontId;
|
|
string mText;
|
|
float mScale, mCurrentScale, mTargetScale;
|
|
float mX, mY;
|
|
float mTextRelativeX, mTextRelativeY;
|
|
JTexture * mTex;
|
|
JQuad * mQuad;
|
|
|
|
public:
|
|
IconButton(int id, IconButtonsController * parent, string texture, float x, float y, float scale, int fontId, string text, float textRelativeX, float textRelativeY, bool hasFocus = false);
|
|
IconButton(int id, IconButtonsController * parent, JQuad * quad, float x, float y, float scale, int fontId, string text, float textRelativeX, float textRelativeY, bool hasFocus = false);
|
|
void init(IconButtonsController * parent, JQuad * quad, float x, float y, float scale, int fontId, string text, float textRelativeX, float textRelativeY, bool hasFocus);
|
|
~IconButton();
|
|
ostream& toString(ostream& out) const;
|
|
|
|
bool hasFocus();
|
|
|
|
virtual void Render();
|
|
virtual void Update(float dt);
|
|
|
|
virtual void Entering();
|
|
virtual bool Leaving(JButton key);
|
|
virtual bool ButtonPressed();
|
|
void SetColor(PIXEL_TYPE color);
|
|
};
|
|
|
|
#endif
|