Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

It's official: Go sucks, ABSTRACT BULLSHITE FTW

Name: Anonymous 2014-06-29 18:17

Name: Anonymous 2014-07-01 22:31

>>48

Main is as clean as it can be with a state manager that will manage the entire game. I am trying to keep the code as simple as i can so that everyone will understand it.

//====================================================================================================
// Includes
//====================================================================================================

#include <SGE.h>
#include "BaseState.h"
#include "GameStates.h"
#include "FrontEnd.h"
#include "GamePlay.h"
#include "Raknet.h"

using namespace SGE;

//====================================================================================================
// Globals
//====================================================================================================

bool gQuit = false;
BaseState* gCurrentState = NULL;
GameState::Type gNextState = GameState::FrontEnd;
SGE_Cursor gCursor;
Raknet gRaknet;

void SGE_Initialize()
{
gCursor.Load("cursor.png");
}

void SGE_Terminate()
{

}

bool SGE_Update(float deltaTime)
{
// Update Cursor Position
gCursor.Update(deltaTime);

// check if we need to change state
if (gNextState != GameState::Invalid)
{
if(gCurrentState != NULL)
{
gCurrentState->Unload();
delete gCurrentState;
}
//switch states
switch(gNextState)
{
case GameState::FrontEnd:
gCurrentState = new FrontEnd(gRaknet);
break;
case GameState::Gameplay:
gCurrentState = new GamePlay(gRaknet);
break;
}

// enter the new state
if(gCurrentState != NULL)
{
gCurrentState->Load();
}
}
// update current state
gNextState = static_cast<GameState::Type>(gCurrentState->Update(deltaTime));

if (gNextState == GameState::Quit)
{
gRaknet.Disconnect();
gQuit = true;
}

return gQuit;
}

void SGE_Render()
{
gCurrentState->Render();
gCursor.Render();
}


Well as i said not much to see yet. But stay tuned for updates and show your support to keep me motivated

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List