This commit is contained in:
parent
72afd3de6c
commit
68b6716e0d
8 changed files with 117 additions and 52 deletions
|
@ -71,7 +71,8 @@ gui_src := gui \
|
||||||
gbutton \
|
gbutton \
|
||||||
gframe \
|
gframe \
|
||||||
greadout \
|
greadout \
|
||||||
gtextbox
|
gtextbox \
|
||||||
|
gtextent
|
||||||
|
|
||||||
locale_src := textdbase
|
locale_src := textdbase
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ class CGUIToggleButton : public CGUIObject
|
||||||
public:
|
public:
|
||||||
virtual void init(CGUIObject *_parent,GUIId _id=noId);
|
virtual void init(CGUIObject *_parent,GUIId _id=noId);
|
||||||
|
|
||||||
virtual void setButtonTarget(int *_target);
|
void setButtonTarget(int *_target);
|
||||||
|
|
||||||
virtual void think(int _frames);
|
virtual void think(int _frames);
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ class CGUICycleButton : public CGUIToggleButton
|
||||||
public:
|
public:
|
||||||
virtual void init(CGUIObject *_parent,GUIId _id=noId);
|
virtual void init(CGUIObject *_parent,GUIId _id=noId);
|
||||||
|
|
||||||
virtual void setButtonData(int *_data);
|
void setButtonData(int *_data);
|
||||||
|
|
||||||
virtual void think(int _frames);
|
virtual void think(int _frames);
|
||||||
|
|
||||||
|
@ -85,8 +85,8 @@ public:
|
||||||
|
|
||||||
virtual void init(CGUIObject *_parent,GUIId _id=noId);
|
virtual void init(CGUIObject *_parent,GUIId _id=noId);
|
||||||
|
|
||||||
virtual void setButtonRange(int _min,int _max);
|
void setButtonRange(int _min,int _max);
|
||||||
virtual void setScrollSpeed(int _scrollSpeed);
|
void setScrollSpeed(int _scrollSpeed);
|
||||||
|
|
||||||
virtual void think(int _frames);
|
virtual void think(int _frames);
|
||||||
|
|
||||||
|
|
|
@ -111,6 +111,32 @@ int CGUIGroupFrame::isSelectable()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Function:
|
||||||
|
Purpose:
|
||||||
|
Params:
|
||||||
|
Returns:
|
||||||
|
---------------------------------------------------------------------- */
|
||||||
|
int CGUIGroupFrame::isUnselectable()
|
||||||
|
{
|
||||||
|
CGUIObject *pGUI;
|
||||||
|
int unselectable=false;
|
||||||
|
|
||||||
|
pGUI=getChild();
|
||||||
|
while(pGUI)
|
||||||
|
{
|
||||||
|
if(pGUI->isUnselectable())
|
||||||
|
{
|
||||||
|
unselectable=true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
pGUI=pGUI->getNext();
|
||||||
|
}
|
||||||
|
|
||||||
|
return unselectable;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -141,21 +167,23 @@ void CGUIControlFrame::think(int _frames)
|
||||||
ASSERT(pGUI);
|
ASSERT(pGUI);
|
||||||
pGUI=pGUI->getNext();
|
pGUI=pGUI->getNext();
|
||||||
}
|
}
|
||||||
pGUI->unselect();
|
if(pGUI->isUnselectable())
|
||||||
|
|
||||||
// Find next selectable object and select it
|
|
||||||
do
|
|
||||||
{
|
{
|
||||||
pGUI=pGUI->getNext();
|
pGUI->unselect();
|
||||||
if(!pGUI)pGUI=getChild();
|
|
||||||
|
// Find next selectable object and select it
|
||||||
|
do
|
||||||
|
{
|
||||||
|
pGUI=pGUI->getNext();
|
||||||
|
if(!pGUI)pGUI=getChild();
|
||||||
|
}
|
||||||
|
while(!pGUI->isSelectable());
|
||||||
|
pGUI->select();
|
||||||
}
|
}
|
||||||
while(!pGUI->isSelectable());
|
|
||||||
pGUI->select();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(pad&PAD_UP)
|
else if(pad&PAD_UP)
|
||||||
{
|
{
|
||||||
/////////////////////
|
|
||||||
CGUIObject *pGUI,*prevGUI;
|
CGUIObject *pGUI,*prevGUI;
|
||||||
|
|
||||||
pGUI=getChild();
|
pGUI=getChild();
|
||||||
|
@ -172,24 +200,26 @@ void CGUIControlFrame::think(int _frames)
|
||||||
}
|
}
|
||||||
pGUI=pGUI->getNext();
|
pGUI=pGUI->getNext();
|
||||||
}
|
}
|
||||||
pGUI->unselect();
|
if(pGUI->isUnselectable())
|
||||||
|
|
||||||
// Find previous selectable object and select it
|
|
||||||
if(!prevGUI)
|
|
||||||
{
|
{
|
||||||
do
|
pGUI->unselect();
|
||||||
|
|
||||||
|
// Find previous selectable object and select it
|
||||||
|
if(!prevGUI)
|
||||||
{
|
{
|
||||||
if(pGUI->isSelectable())
|
do
|
||||||
{
|
{
|
||||||
prevGUI=pGUI;
|
if(pGUI->isSelectable())
|
||||||
|
{
|
||||||
|
prevGUI=pGUI;
|
||||||
|
}
|
||||||
|
pGUI=pGUI->getNext();
|
||||||
}
|
}
|
||||||
pGUI=pGUI->getNext();
|
while(pGUI);
|
||||||
}
|
}
|
||||||
while(pGUI);
|
prevGUI->select();
|
||||||
}
|
}
|
||||||
prevGUI->select();
|
|
||||||
}
|
}
|
||||||
/////////////////////
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ public:
|
||||||
virtual void clearFlags(GUI_FLAGS _flags);
|
virtual void clearFlags(GUI_FLAGS _flags);
|
||||||
|
|
||||||
virtual int isSelectable();
|
virtual int isSelectable();
|
||||||
|
virtual int isUnselectable();
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -77,8 +77,6 @@ void CGUITextBox::init(CGUIObject *_parent,GUIId _id)
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
void CGUITextBox::setText(unsigned int _textId)
|
void CGUITextBox::setText(unsigned int _textId)
|
||||||
{
|
{
|
||||||
FontBank *fb;
|
|
||||||
|
|
||||||
m_textId=_textId;
|
m_textId=_textId;
|
||||||
recalc();
|
recalc();
|
||||||
}
|
}
|
||||||
|
@ -92,8 +90,6 @@ void CGUITextBox::setText(unsigned int _textId)
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
void CGUITextBox::render()
|
void CGUITextBox::render()
|
||||||
{
|
{
|
||||||
FontBank *fb;
|
|
||||||
|
|
||||||
if(!isHidden())
|
if(!isHidden())
|
||||||
{
|
{
|
||||||
getFontBank()->print((getW()-(BORDERWIDTH*2))/2,m_textY,m_textId);
|
getFontBank()->print((getW()-(BORDERWIDTH*2))/2,m_textY,m_textId);
|
||||||
|
|
|
@ -112,8 +112,9 @@ void CGUIObject::shutdown()
|
||||||
if(m_child)m_child->shutdown(); m_child=NULL;
|
if(m_child)m_child->shutdown(); m_child=NULL;
|
||||||
if(m_next)m_next->shutdown(); m_next=NULL;
|
if(m_next)m_next->shutdown(); m_next=NULL;
|
||||||
m_parent=NULL;
|
m_parent=NULL;
|
||||||
|
m_this=NULL;
|
||||||
|
|
||||||
// Is this actually safe? Not *really* (PKG)
|
// Is this actually safe? Possibly not.. (PKG)
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,6 +304,18 @@ void CGUIObjectWithFont::clearFlags(GUI_FLAGS _flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Function:
|
||||||
|
Purpose:
|
||||||
|
Params:
|
||||||
|
Returns:
|
||||||
|
---------------------------------------------------------------------- */
|
||||||
|
void CGUIObjectWithFont::setOt(int _ot)
|
||||||
|
{
|
||||||
|
CGUIObject::setOt(_ot);
|
||||||
|
getFontBank()->setOt(_ot);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
/*----------------------------------------------------------------------
|
||||||
Function:
|
Function:
|
||||||
|
@ -320,7 +333,6 @@ void CGUIObjectWithFont::recalc()
|
||||||
w=getW()-(BORDERWIDTH*2);
|
w=getW()-(BORDERWIDTH*2);
|
||||||
h=getH()-(BORDERHEIGHT*2);
|
h=getH()-(BORDERHEIGHT*2);
|
||||||
getFontBank()->setPrintArea(x,y,w,h);
|
getFontBank()->setPrintArea(x,y,w,h);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -372,4 +384,4 @@ void CGUIObjectWithSpriteBank::setSpriteBank(FileEquate _fe)
|
||||||
|
|
||||||
|
|
||||||
/*===========================================================================
|
/*===========================================================================
|
||||||
end */
|
end */
|
||||||
|
|
|
@ -91,9 +91,15 @@ public:
|
||||||
CGUIObject *getChild() {return m_child;}
|
CGUIObject *getChild() {return m_child;}
|
||||||
CGUIObject *getNext() {return m_next;}
|
CGUIObject *getNext() {return m_next;}
|
||||||
virtual int isSelectable() {return false;}
|
virtual int isSelectable() {return false;}
|
||||||
|
virtual int isUnselectable() {return true;}
|
||||||
|
|
||||||
|
void setOt(int _ot) {m_ot=_ot;}
|
||||||
|
int getOt() {return m_ot;}
|
||||||
|
|
||||||
|
// PKG - Do we really need ids!?
|
||||||
int getId() {return m_id;}
|
int getId() {return m_id;}
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void recalc();
|
virtual void recalc();
|
||||||
|
|
||||||
|
@ -107,9 +113,6 @@ protected:
|
||||||
int getParentX() {if(m_parent)return m_parent->getX()+m_parent->getParentX();else return 0;}
|
int getParentX() {if(m_parent)return m_parent->getX()+m_parent->getParentX();else return 0;}
|
||||||
int getParentY() {if(m_parent)return m_parent->getY()+m_parent->getParentY();else return 0;}
|
int getParentY() {if(m_parent)return m_parent->getY()+m_parent->getParentY();else return 0;}
|
||||||
|
|
||||||
void setOt(int _ot) {m_ot=_ot;}
|
|
||||||
int getOt() {return m_ot;}
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GUIId m_id;
|
GUIId m_id;
|
||||||
|
@ -133,6 +136,8 @@ public:
|
||||||
virtual void setFlags(GUI_FLAGS _flags);
|
virtual void setFlags(GUI_FLAGS _flags);
|
||||||
virtual void clearFlags(GUI_FLAGS _flags);
|
virtual void clearFlags(GUI_FLAGS _flags);
|
||||||
|
|
||||||
|
void setOt(int _ot);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
enum
|
enum
|
||||||
|
|
|
@ -66,6 +66,10 @@
|
||||||
#include "gui\gbutton.h"
|
#include "gui\gbutton.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __GUI_GTEXTENT_H__
|
||||||
|
#include "gui\gtextent.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __LOCALE_TEXTDBASE_H__
|
#ifndef __LOCALE_TEXTDBASE_H__
|
||||||
#include "locale\textdbase.h"
|
#include "locale\textdbase.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -126,6 +130,7 @@ int musicStatus=false;
|
||||||
int sfxStatus=false;
|
int sfxStatus=false;
|
||||||
int readyToExit=false;
|
int readyToExit=false;
|
||||||
int musicVol=0;
|
int musicVol=0;
|
||||||
|
char textEntry[16+1]="SOME TEXT";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -141,9 +146,13 @@ void CPaulScene::init()
|
||||||
CGUISpriteReadout *sr;
|
CGUISpriteReadout *sr;
|
||||||
CGUIBarReadout *br;
|
CGUIBarReadout *br;
|
||||||
CGUISliderButton *sl;
|
CGUISliderButton *sl;
|
||||||
|
CGUITextEntry *te;
|
||||||
|
|
||||||
s_fontBank.initialise(&standardFont);
|
s_fontBank.initialise(&standardFont);
|
||||||
|
|
||||||
|
int mem=MainRam.TotalRam-MainRam.RamUsed;
|
||||||
|
PAUL_DBGMSG("initial mem free=%d",mem);
|
||||||
|
|
||||||
baseGUIObject=new ("Uber GUI object") CGUIControlFrame();
|
baseGUIObject=new ("Uber GUI object") CGUIControlFrame();
|
||||||
baseGUIObject->init(NULL);
|
baseGUIObject->init(NULL);
|
||||||
baseGUIObject->setObjectXYWH(32,32,512-64,256-64);
|
baseGUIObject->setObjectXYWH(32,32,512-64,256-64);
|
||||||
|
@ -180,35 +189,46 @@ void CPaulScene::init()
|
||||||
sr->setReadoutTarget(&sfxStatus);
|
sr->setReadoutTarget(&sfxStatus);
|
||||||
sr->setReadoutData(onOffSpriteReadouts);
|
sr->setReadoutData(onOffSpriteReadouts);
|
||||||
|
|
||||||
fr=new ("frame") CGUIGroupFrame();
|
fr=new ("frame") CGUIGroupFrame();
|
||||||
fr->init(baseGUIObject);
|
fr->init(baseGUIObject);
|
||||||
fr->setObjectXYWH(10,90,448-20,30);
|
fr->setObjectXYWH(10,90,448-20,30);
|
||||||
sl=new("sliderbutton") CGUISliderButton();
|
sl=new("sliderbutton") CGUISliderButton();
|
||||||
sl->init(fr);
|
sl->init(fr);
|
||||||
sl->setButtonTarget(&musicVol);
|
sl->setButtonTarget(&musicVol);
|
||||||
sl->setButtonRange(0,255);
|
sl->setButtonRange(0,255);
|
||||||
br=new ("spritereadout") CGUIBarReadout();
|
br=new ("spritereadout") CGUIBarReadout();
|
||||||
br->init(fr);
|
br->init(fr);
|
||||||
br->setObjectXYWH(0,0,448-20,30);
|
br->setObjectXYWH(0,0,448-20,30);
|
||||||
br->setReadoutTarget(&musicVol);
|
br->setReadoutTarget(&musicVol);
|
||||||
br->setReadoutRange(0,255);
|
br->setReadoutRange(0,255);
|
||||||
|
|
||||||
fr=new ("frame") CGUIGroupFrame();
|
fr=new ("frame") CGUIGroupFrame();
|
||||||
fr->init(baseGUIObject);
|
fr->init(baseGUIObject);
|
||||||
fr->setObjectXYWH(10,155,448-20,30);
|
fr->setObjectXYWH(10,155,200,30);
|
||||||
tb=new ("textbox") CGUITextBox();
|
tb=new ("textbox") CGUITextBox();
|
||||||
tb->init(fr);
|
tb->init(fr);
|
||||||
tb->setObjectXYWH(0,0,428,30);
|
tb->setObjectXYWH(0,0,200,30);
|
||||||
tb->setText(STR__PAULS_TEST__EXIT);
|
tb->setText(STR__PAULS_TEST__EXIT);
|
||||||
tg=new ("togglebutton") CGUIToggleButton();
|
tg=new ("togglebutton") CGUIToggleButton();
|
||||||
tg->init(fr);
|
tg->init(fr);
|
||||||
tg->setButtonTarget(&readyToExit);
|
tg->setButtonTarget(&readyToExit);
|
||||||
|
|
||||||
// Heh.. this'll actually work =)
|
fr=new ("frame") CGUIGroupFrame();
|
||||||
// baseGUIObject->shutdown();
|
fr->init(baseGUIObject);
|
||||||
|
fr->setObjectXYWH(220,155,200,30);
|
||||||
|
te=new ("textentry") CGUITextEntry();
|
||||||
|
te->init(fr);
|
||||||
|
te->setObjectXYWH(0,0,200,30);
|
||||||
|
te->setTextDetails(textEntry,16);
|
||||||
|
|
||||||
baseGUIObject->select();
|
baseGUIObject->select();
|
||||||
|
|
||||||
|
// Heh.. this'll actually work =)
|
||||||
|
//ASSERT(0);
|
||||||
|
// baseGUIObject->shutdown();
|
||||||
|
// baseGUIObject=0;
|
||||||
|
|
||||||
|
PAUL_DBGMSG("change=%d",mem-(MainRam.TotalRam-MainRam.RamUsed));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue