I tried making masks so when i use them a special function is executed, it compiles however does not print any text, so i assume the functions is not executing properly.
Also if someone knows a better way to do this, please say it! :P
here is the main.cpp:
Code: Select all
//main.cpp
#include <iostream>
#include "mask.h"
int main()
{
Player Link;
Link.UseMask();
std::cin.get();
std::cin.get();
return 0;
}
Code: Select all
//mask.h
#include <iostream>
using namespace std;
void mNormal()
{
cout << "Normal";
}
void mDecu()
{
cout << "DECCU!!";
}
void mGoron()
{
cout << "GROONEN!!?";
}
void mZora()
{
cout << "zorraen!";
}
void mMajora()
{
cout << "Majjorra";
}
enum masks{NORMAL=0,DECU=1,GORON=2,ZORA=3,BAJS=4,MAJORA=5};
struct mask
{
string name;
void (*Use)();
};
class Player
{
private:
int mask_wearing;
mask Maskz[20];
public:
void UseMask()
{
Maskz[mask_wearing].Use;
}
Player()
{
mask_wearing = ZORA;
Maskz[NORMAL].name = "NONE";
Maskz[NORMAL].Use = &mNormal;
Maskz[DECU].name = "Deccu mask";
Maskz[DECU].Use = &mDecu;
Maskz[GORON].name = "Goron mask";
Maskz[GORON].Use = &mGoron;
Maskz[ZORA].name = "Zora mask";
Maskz[ZORA].Use = &mZora;
Maskz[MAJORA].name = "Majoras mask";
Maskz[MAJORA].Use = &mMajora;
}
};