communication between form class and other c++ classes

  • Thread starter Thread starter maketakunai
  • Start date Start date
M

maketakunai

Guest
trying to port a console rpg game to windows forms. it generates a lot of text output via cout of course. and i wanted to redirect that to a CombatLog TextBox on the window CoEAForm

CoEA.h

namespace CoEA {

public ref class CoEAForm : public System::Windows::Forms::Form{

//code and designer code

public: void coutCombatLog(System::String ^ text) {
CombatLog->AppendText(text);
}
};

}

battle.h

#include "CoEAForm.h"

namespace CoEA

{

class Battle

{

void checkWinner();

};


}

battle.cpp

#include "battle.h"

void checkWinner ()

{

if (enemyParty->getTotalHP() <= 0) {


coutCombatLog("Player party wins !");

return 1;

//more code

}

compiler flags coutCombatLog as unidentified

problem is to get these 2 classes to communicate







i tried making coutCombatLog static and attempted to inherit CoEAForm

Continue reading...
 
Back
Top