In the future there will be no such thing like libraries or 3rd party supportthat is one grim future
//====================================================================================================
// 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();
}
Typechecking a program with dependent types reduces to proving invariants.
Writing code in something like Haskell isn't necessarily harder, in fact I think it's easier if you approach it tabula rasaBullshit.
This leaves English as the most superior languageBullshit.
any :: (a -> Bool) -> [a] -> Bool
any p = or . map p
I think this is the difference between using a declarative language like Haskell where the compiler is supposed to be powerful and all knowing and using an imperative language like C where programmers are supposed to instruct the compiler because the compiler doesn't understand the programmer's high level intent.