J :
* Clean carriage returns.
This commit is contained in:
+112
-116
@@ -1,116 +1,112 @@
|
|||||||
//-------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// JGE++ is a hardware accelerated 2D game SDK for PSP/Windows.
|
// JGE++ is a hardware accelerated 2D game SDK for PSP/Windows.
|
||||||
//
|
//
|
||||||
// Licensed under the BSD license, see LICENSE in JGE root for details.
|
// Licensed under the BSD license, see LICENSE in JGE root for details.
|
||||||
//
|
//
|
||||||
// Copyright (c) 2007 James Hui (a.k.a. Dr.Watson) <jhkhui@gmail.com>
|
// Copyright (c) 2007 James Hui (a.k.a. Dr.Watson) <jhkhui@gmail.com>
|
||||||
//
|
//
|
||||||
//-------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
#ifndef _JGUI_H
|
#ifndef _JGUI_H
|
||||||
#define _JGUI_H
|
#define _JGUI_H
|
||||||
|
|
||||||
#include "JGE.h"
|
#include "JGE.h"
|
||||||
#include "JSprite.h"
|
#include "JSprite.h"
|
||||||
|
|
||||||
#define MAX_GUIOBJECT 64
|
#define MAX_GUIOBJECT 64
|
||||||
|
|
||||||
#define JGUI_STYLE_LEFTRIGHT 0x01
|
#define JGUI_STYLE_LEFTRIGHT 0x01
|
||||||
#define JGUI_STYLE_UPDOWN 0x02
|
#define JGUI_STYLE_UPDOWN 0x02
|
||||||
#define JGUI_STYLE_WRAPPING 0x04
|
#define JGUI_STYLE_WRAPPING 0x04
|
||||||
|
|
||||||
#define JGUI_INITIAL_DELAY 0.4
|
#define JGUI_INITIAL_DELAY 0.4
|
||||||
#define JGUI_REPEAT_DELAY 0.2
|
#define JGUI_REPEAT_DELAY 0.2
|
||||||
|
|
||||||
class JGuiListener
|
class JGuiListener
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~JGuiListener() {}
|
virtual ~JGuiListener() {}
|
||||||
virtual void ButtonPressed(int controllerId, int controlId) = 0;
|
virtual void ButtonPressed(int controllerId, int controlId) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class JGuiObject
|
class JGuiObject
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
static JGE* mEngine;
|
static JGE* mEngine;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int mId;
|
int mId;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
JGuiObject(int id);
|
JGuiObject(int id);
|
||||||
virtual ~JGuiObject();
|
virtual ~JGuiObject();
|
||||||
|
|
||||||
virtual void Render() = 0;
|
virtual void Render() = 0;
|
||||||
virtual void Update(float dt);
|
virtual void Update(float dt);
|
||||||
|
|
||||||
virtual void Entering(); // when focus is transferring to this obj
|
virtual void Entering(); // when focus is transferring to this obj
|
||||||
virtual bool Leaving(u32 key); // when focus is transferring away from this obj, true to go ahead
|
virtual bool Leaving(u32 key); // when focus is transferring away from this obj, true to go ahead
|
||||||
virtual bool ButtonPressed(); // action button pressed, return false to ignore
|
virtual bool ButtonPressed(); // action button pressed, return false to ignore
|
||||||
|
|
||||||
int GetId();
|
int GetId();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class JGuiController
|
class JGuiController
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
static JGE* mEngine;
|
static JGE* mEngine;
|
||||||
|
|
||||||
int mId;
|
int mId;
|
||||||
bool mActive;
|
bool mActive;
|
||||||
|
|
||||||
|
|
||||||
u32 mActionButton;
|
u32 mActionButton;
|
||||||
int mCurr;
|
int mCurr;
|
||||||
int mStyle;
|
int mStyle;
|
||||||
|
|
||||||
JSprite* mCursor;
|
JSprite* mCursor;
|
||||||
bool mShowCursor;
|
bool mShowCursor;
|
||||||
int mCursorX;
|
int mCursorX;
|
||||||
int mCursorY;
|
int mCursorY;
|
||||||
|
|
||||||
int mBgX;
|
int mBgX;
|
||||||
int mBgY;
|
int mBgY;
|
||||||
const JTexture* mBg;
|
const JTexture* mBg;
|
||||||
PIXEL_TYPE mShadingColor;
|
PIXEL_TYPE mShadingColor;
|
||||||
Rect* mShadingBg;
|
Rect* mShadingBg;
|
||||||
|
|
||||||
JGuiListener* mListener;
|
JGuiListener* mListener;
|
||||||
u32 mLastKey;
|
//int mKeyHoldTime;
|
||||||
//int mKeyHoldTime;
|
|
||||||
float mKeyRepeatDelay;
|
public:
|
||||||
|
JGuiObject* mObjects[MAX_GUIOBJECT];
|
||||||
bool KeyRepeated(u32 key, float dt);
|
int mCount;
|
||||||
|
|
||||||
public:
|
JGuiController(int id, JGuiListener* listener);
|
||||||
JGuiObject* mObjects[MAX_GUIOBJECT];
|
~JGuiController();
|
||||||
int mCount;
|
|
||||||
|
virtual void Render();
|
||||||
JGuiController(int id, JGuiListener* listener);
|
virtual void Update(float dt);
|
||||||
~JGuiController();
|
|
||||||
|
void Add(JGuiObject* ctrl);
|
||||||
virtual void Render();
|
void Remove(int id);
|
||||||
virtual void Update(float dt);
|
void Remove(JGuiObject* ctrl);
|
||||||
|
|
||||||
void Add(JGuiObject* ctrl);
|
void SetActionButton(u32 button);
|
||||||
void Remove(int id);
|
void SetStyle(int style);
|
||||||
void Remove(JGuiObject* ctrl);
|
void SetCursor(JSprite* cursor);
|
||||||
|
|
||||||
void SetActionButton(u32 button);
|
bool IsActive();
|
||||||
void SetStyle(int style);
|
void SetActive(bool flag);
|
||||||
void SetCursor(JSprite* cursor);
|
|
||||||
|
//void SetImageBackground(const JTexture* tex, int x, int y);
|
||||||
bool IsActive();
|
//void SetShadingBackground(int x, int y, int width, int height, PIXEL_TYPE color);
|
||||||
void SetActive(bool flag);
|
};
|
||||||
|
|
||||||
//void SetImageBackground(const JTexture* tex, int x, int y);
|
|
||||||
//void SetShadingBackground(int x, int y, int width, int height, PIXEL_TYPE color);
|
#endif
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
Reference in New Issue
Block a user