From: Saul L. <ti...@us...> - 2002-01-20 01:27:09
|
Update of /cvsroot/planeshift/planeshift/src/client/gui In directory usw-pr-cvs1:/tmp/cvs-serv32538/src/client/gui Modified Files: Makefile.am psddsktop.cpp psddsktop.h Log Message: skill and spell button work now Index: Makefile.am =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/client/gui/Makefile.am,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Makefile.am 2002/01/19 03:15:17 1.10 --- Makefile.am 2002/01/20 01:27:05 1.11 *************** *** 17,21 **** psdcpath.cpp psdcpath.h psdmmenu.cpp psdmmenu.h psdmngr.cpp \ psdmngr.h psdsplsh.cpp psdsplsh.h psdcskil.cpp psdcskil.h \ ! psddsktop.h psddsktop.cpp psgwchat.cpp psgwchat.h psgui_la_LIBADD = base/libguibase.la --- 17,22 ---- psdcpath.cpp psdcpath.h psdmmenu.cpp psdmmenu.h psdmngr.cpp \ psdmngr.h psdsplsh.cpp psdsplsh.h psdcskil.cpp psdcskil.h \ ! psddsktop.h psddsktop.cpp psgwchat.cpp psgwchat.h \ ! psgwspell.cpp psgwspell.h psgwskill.cpp psgwskill.h psgui_la_LIBADD = base/libguibase.la Index: psddsktop.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/client/gui/psddsktop.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** psddsktop.cpp 2002/01/19 20:44:07 1.5 --- psddsktop.cpp 2002/01/20 01:27:05 1.6 *************** *** 47,52 **** bool psdDsktop::Initialize() { ! ExpandComponentsArray(14); ! int yloc, xloc; yloc = 5; --- 47,53 ---- bool psdDsktop::Initialize() { ! ExpandComponentsArray(10); ! spellWin = NULL; ! skillWin = NULL; int yloc, xloc; yloc = 5; *************** *** 68,77 **** tmp = AddButton(xloc+2*5+63,yloc+5+40, 63, 63 , ! "magic.gif", "magic.gif", psdDsktop::tester); if(!tmp) return false; pcStatusBar->AddComp(tmp); tmp = AddButton(xloc+3*5+2*63,yloc+5+40, 63, 63, ! "skill.gif", "skill.gif", psdDsktop::tester); if(!tmp) return false; pcStatusBar->AddComp(tmp); --- 69,78 ---- tmp = AddButton(xloc+2*5+63,yloc+5+40, 63, 63 , ! "magic.gif", "magic.gif", psdDsktop::OpenSpell); if(!tmp) return false; pcStatusBar->AddComp(tmp); tmp = AddButton(xloc+3*5+2*63,yloc+5+40, 63, 63, ! "skill.gif", "skill.gif", psdDsktop::OpenSkill); if(!tmp) return false; pcStatusBar->AddComp(tmp); *************** *** 83,86 **** --- 84,129 ---- } + void psdDsktop::OpenSpell(psDialog *dia, int in) + { + psdDsktop *dia1 = (psdDsktop*)dia; + dia1->HideSkill(); + dia1->AddSpellWindow(10,20,600, 400, + "spellbg.gif", psdDsktop::tester, 0); + + } + + void psdDsktop::OpenSkill(psDialog *dia, int in) + { + psdDsktop *dia1 = (psdDsktop*)dia; + dia1->HideSpell(); + dia1->AddSkillWindow(10,20,600, 400, + "skillbg.gif", psdDsktop::tester, 0); + + } + + void psdDsktop::CloseSpell(psDialog *dia, int in) + { + psdDsktop *dia1 = (psdDsktop*)dia; + dia1->HideSpell(); + + } + + void psdDsktop::CloseSkill(psDialog *dia, int in) + { + psdDsktop *dia1 = (psdDsktop*)dia; + dia1->HideSkill(); + + } + + void psdDsktop::HideSpell() + { + if(spellWin) spellWin->Hide(); + } + + void psdDsktop::HideSkill() + { + if(skillWin) skillWin->Hide(); + } + void psdDsktop::tester(psDialog *, int ) { *************** *** 91,95 **** if(pcStatusBar) pcStatusBar->HandleMouseMove(ix,iy); if(chatBar) chatBar->HandleMouseMove(ix,iy); ! return true; } --- 134,140 ---- if(pcStatusBar) pcStatusBar->HandleMouseMove(ix,iy); if(chatBar) chatBar->HandleMouseMove(ix,iy); ! if(spellWin && !spellWin->IsInvis()) spellWin->HandleMouseMove(ix,iy); ! if(skillWin && !skillWin->IsInvis()) skillWin->HandleMouseMove(ix,iy); ! return false; } *************** *** 125,128 **** --- 170,174 ---- psText* tmp2 = AddText(ix+10,iy+10,iwidth-30,iheight-40, "Welcome To Planeshift-AtomicBlue."); + if(!tmp2) return NULL; caster->AddComp(tmp2); caster->SetTextBox(tmp2); *************** *** 130,133 **** --- 176,180 ---- psTextInput* tmp3 = AddTextInput( ix+10,iy+iheight-15,iwidth-20); + if(!tmp3) return NULL; tmp3->SetFocused(true); caster->AddComp(tmp3); *************** *** 138,165 **** } ! /** No descriptions */ ! void psdDsktop::CleanArray() { - int total =0; - for(int i = 0; i < totalComp; ++i) - if(compList[i]){ total++;} ! psComponent** temp = new psComponent*[total]; ! int j=0; ! for(int i=0; i < totalComp; ++i) { ! if(!compList) continue; ! else temp[j++] = compList[i]; ! } ! if(compList) ! delete [] compList; ! compList = new psComponent*[total]; ! compList = temp; ! totalCompArray = total; ! totalComp = total; } --- 185,271 ---- } ! bool psdDsktop::AddSkillWindow(int ix, int iy, int iwidth, int iheight, ! const char* bg, ! void (*action)(psDialog* idialog, int iID), ! uint8 alpha ! ) { ! if(skillWin) ! { ! skillWin->Show(); ! return true; ! } ! if((totalComp + 1) > totalCompArray) ! ExpandComponentsArray(totalCompArray + ! COMPONENT_EXPANSION_SIZE); ! ! csSimplePixmap *plane = NULL; ! // load other necessary images ! if(bg) ! if(!(plane = dmanager->CreateSprite(bg))) ! return false; ! ! compList[totalComp] = new psSkillWindow(this, totalComp, 5); ! psSkillWindow* caster = (psSkillWindow*)compList[totalComp]; ! if(!(caster->Initialize(ix + x, iy + y, iwidth, iheight, ! plane,action,alpha))) { ! delete compList[totalComp]; ! compList[totalComp] = NULL; ! return false; ! } ! totalComp++; ! skillWin = caster; ! psButton* tmp = AddButton(ix+iwidth-66,iy+iheight-59,48,48, ! NULL,NULL, psdDsktop::CloseSkill); ! if(!tmp) return false; ! skillWin->AddComp(tmp); ! ! return true; } + bool psdDsktop::AddSpellWindow(int ix, int iy, int iwidth, int iheight, + const char* bg, + void (*action)(psDialog* idialog, int iID), + uint8 alpha + ) + { + if(spellWin) + { + spellWin->Show(); + return true; + } + + if((totalComp + 1) > totalCompArray) + ExpandComponentsArray(totalCompArray + + COMPONENT_EXPANSION_SIZE); + + csSimplePixmap *plane = NULL; + // load other necessary images + if(bg) + if(!(plane = dmanager->CreateSprite(bg))) + return false; + + compList[totalComp] = new psSpellWindow(this, totalComp, 5); + psSpellWindow* caster = (psSpellWindow*)compList[totalComp]; + if(!(caster->Initialize(ix + x, iy + y, iwidth, iheight, + plane,action,alpha))) + { + delete compList[totalComp]; + compList[totalComp] = NULL; + return false; + } + spellWin = caster; + totalComp++; + + psButton* tmp = AddButton(ix+iwidth-66,iy+iheight-59,48,48, + NULL,NULL, psdDsktop::CloseSpell); + if(!tmp) return false; + spellWin->AddComp(tmp); + return true; + } Index: psddsktop.h =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/client/gui/psddsktop.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** psddsktop.h 2002/01/19 20:44:07 1.5 --- psddsktop.h 2002/01/20 01:27:05 1.6 *************** *** 48,53 **** #include "psgwchat.h" ! ! class psDialog; --- 48,54 ---- #include "psgwchat.h" ! #include "psgwskill.h" ! #include "psgwinv.h" ! #include "psgwspell.h" class psDialog; *************** *** 57,60 **** --- 58,62 ---- + class psdDsktop : public psDialog *************** *** 77,81 **** void (*action)(psDialog* idialog, int iID), uint8 alpha=0); ! virtual void AddChatLine(const char *line) { --- 79,93 ---- void (*action)(psDialog* idialog, int iID), uint8 alpha=0); ! ! bool AddSkillWindow(int ix, int iy, int iwidth, int iheight, ! const char* bg , ! void (*action)(psDialog* idialog, int iID), ! uint8 alpha=0); ! ! bool AddSpellWindow(int ix, int iy, int iwidth, int iheight, ! const char* bg , ! void (*action)(psDialog* idialog, int iID), ! uint8 alpha=0); ! virtual void AddChatLine(const char *line) { *************** *** 84,94 **** }; protected: void CleanArray(); psDragPlane* pcStatusBar; ! psChatWindow* chatBar; ! ! }; --- 96,114 ---- }; + static void OpenSpell(psDialog *, int); + static void CloseSpell(psDialog *dia, int in); + void HideSpell(); + + static void OpenSkill(psDialog *, int); + static void CloseSkill(psDialog *dia, int in); + void HideSkill(); + protected: void CleanArray(); psDragPlane* pcStatusBar; ! psChatWindow* chatBar; ! psSkillWindow* skillWin; ! psSpellWindow* spellWin; }; |