When i run this, it says that enum eGameModes has been defined twice?
heres my code:
game_functions.cpp
#include "DarkGDK.h"
#include "game_functions.h"
#define FLOOR 1
#define PLAYER_GUN 1
#define ALIEN_HIVEBRAIN 2
#define ALIEN_MUTANT 3
#define ALIEN_PSIONIC 4
void GameSetup()
{
dbSetDir("media");
dbMakeVector4(FLOOR);
dbLoadObject("ak47\\H-AK47-Static.x", PLAYER_GUN);
dbLoadObject("Alien Hivebrain\\H-Alien Hivebrain-Idle.x", ALIEN_HIVEBRAIN);
dbLoadObject("Alien Mutant\\H-Alien Mutant-Static.x", ALIEN_MUTANT);
dbLoadObject("Alien Psionic\\H-Alien Psionic-Idle.x", ALIEN_PSIONIC);
dbLockObjectOn(PLAYER_GUN);
}
void GameMenu()
{
}
void GameStart()
{
}
void GamePlaying()
{
while(true)
{
dbPositionObject(PLAYER_GUN, dbCameraPositionX(), dbCameraPositionY(), dbCameraPositionZ());
dbControlCameraUsingArrowKeys(0, 2, 3);
if(dbEscapeKey())
break;
}
}
void GameEnd()
{
}
void GameCleanup()
{
dbDeleteVector4(FLOOR);
dbDeleteObject(PLAYER_GUN);
dbDeleteObject(ALIEN_HIVEBRAIN);
dbDeleteObject(ALIEN_MUTANT);
dbDeleteObject(ALIEN_PSIONIC);
}
game_functions.h:
#pragma once
#ifndef _game_functions_h_
#define _game_functions_h_
void GameSetup();
void GameMenu();
void GameStart();
void GamePlaying();
void GameEnd();
void GameCleanup();
enum eGameModes {
eGameSetup,
eGameMenu,
eGameStart,
eGamePlaying,
eGameEnd,
eGameCleanup
};
void GameMain(int modes)
{
switch(modes)
{
case eGameSetup:
GameSetup();
modes = eGameMenu;
case eGameMenu:
GameMenu();
modes = eGameStart;
case eGameStart:
GameStart();
modes = eGamePlaying;
case eGamePlaying:
GamePlaying();
modes = eGameEnd;
case eGameEnd:
GameEnd();
modes = eGameCleanup;
case eGameCleanup:
GameCleanup();
}
}
#endif
main.cpp:
#include "DarkGDK.h"
#include "game_functions.h"
void DarkGDK(void)
{
dbSyncOn();
dbSyncRate(60);
eGameModes g_eGameModes = eGameSetup;
while(LoopGDK())
{
GameMain(g_eGameModes);
dbSync ();
}
return;
}