diff --git a/source/gui/gbutton.cpp b/source/gui/gbutton.cpp new file mode 100644 index 000000000..b2461647b --- /dev/null +++ b/source/gui/gbutton.cpp @@ -0,0 +1,115 @@ +/*========================================================================= + + gbutton.cpp + + Author: PKG + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2000 Climax Development Ltd + +===========================================================================*/ + + +/*---------------------------------------------------------------------- + Includes + -------- */ + +#include "gui\gbutton.h" + +#ifndef __PAD_PADS_H__ +#include "pad\pads.h" +#endif + + +/* Std Lib + ------- */ + +/* Data + ---- */ + +/*---------------------------------------------------------------------- + Tyepdefs && Defines + ------------------- */ + +/*---------------------------------------------------------------------- + Structure defintions + -------------------- */ + +/*---------------------------------------------------------------------- + Function Prototypes + ------------------- */ + +/*---------------------------------------------------------------------- + Vars + ---- */ + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CGUIButton::setButtonTarget(int *_target) +{ + m_target=_target; +} + + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CGUIButton::setButtonData(int *_data) +{ + m_data=_data; +} + + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CGUIButton::think(int _frames) +{ + ASSERT(m_target); + ASSERT(m_data); + + if(isSelected()) + { + int pad; + + pad=PadGetRepeat(0); + if(pad&PAD_CROSS) + { + int *data; + int tmp; + GUI_DBGMSG("*C*L*I*C*K"); + data=m_data; + tmp=*data; + do + { + tmp=*data; + data++; + if(*m_target==tmp) + { + break; + } + } + while(tmp<*data); + if(tmp>*data) + { + data=m_data; + } + *m_target=*data; + } + } +} + +/*=========================================================================== + end */ \ No newline at end of file diff --git a/source/gui/gbutton.h b/source/gui/gbutton.h new file mode 100644 index 000000000..c11c4a051 --- /dev/null +++ b/source/gui/gbutton.h @@ -0,0 +1,65 @@ +/*========================================================================= + + gbutton.h + + Author: PKG + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2000 Climax Development Ltd + +===========================================================================*/ + +#ifndef __GUI_GBUTTON_H__ +#define __GUI_GBUTTON_H__ + +/*---------------------------------------------------------------------- + Includes + -------- */ + +#ifndef __GUI_GUI_H__ +#include "gui\gui.h" +#endif + + +/* Std Lib + ------- */ + +/*---------------------------------------------------------------------- + Tyepdefs && Defines + ------------------- */ + +/*---------------------------------------------------------------------- + Structure defintions + -------------------- */ + +class CGUIButton : public CGUIObject +{ +public: + virtual void setButtonTarget(int *_target); + virtual void setButtonData(int *_data); + + virtual void think(int _frames); + + +private: + int *m_target; + int *m_data; +}; + + +/*---------------------------------------------------------------------- + Globals + ------- */ + +/*---------------------------------------------------------------------- + Functions + --------- */ + +/*---------------------------------------------------------------------- */ + +#endif /* __GUI_GBUTTON_H__ */ + +/*=========================================================================== + end */ diff --git a/users/paul/spongebob project/spongebob project.dsp b/users/paul/spongebob project/spongebob project.dsp index 3168785b1..e5429ae30 100644 --- a/users/paul/spongebob project/spongebob project.dsp +++ b/users/paul/spongebob project/spongebob project.dsp @@ -441,6 +441,14 @@ SOURCE=..\..\..\source\utils\utils.h # PROP Default_Filter "" # Begin Source File +SOURCE=..\..\..\source\gui\gbutton.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\gui\gbutton.h +# End Source File +# Begin Source File + SOURCE=..\..\..\source\gui\gframe.cpp # End Source File # Begin Source File