TapestryEngine

A 2D Platformer Game Engine
Log | Files | Refs

9ee496c4f10e7d2c14c999ca8e8234e7bd1f1c77.svn-base (990B)


      1 #include "Context.h"
      2 
      3 bool ContextManager::LogContext(Context* con, char* name)
      4 {
      5 	mContexts.push_back(con);
      6 	mNames.push_back(name);
      7 	return false;
      8 }
      9 
     10 bool ContextManager::LoadContext(char* ContextName)
     11 {
     12 	for (int i = 0; i < (int)mNames.size(); i++)
     13 	{
     14 		if (!strcmp(ContextName, mNames.at(i)))
     15 		{
     16 			mContexts.at(i)->Load(mGameDataPath);
     17 			mActiveContext = mContexts.at(i);
     18 			return true;
     19 		}
     20 	}
     21 	gCons->ConsPrintf("Unable to load context; No context matching name %s was found\n", ContextName);
     22 	return false;
     23 }
     24 
     25 bool ContextManager::ContextUpdate()
     26 {
     27 	return mActiveContext->Update();
     28 }
     29 
     30 bool ContextManager::EventProcess(Event eve)
     31 {
     32 	return false;
     33 }
     34 
     35 bool GameOver::Update()
     36 {
     37 	SDL_RenderCopy(mRen, mSplash, NULL, NULL);
     38 
     39 	return true;
     40 }
     41 
     42 bool GameOver::EventProcess(Event eve)
     43 {
     44 	switch (*eve.GetEventType())
     45 	{
     46 	case KEY_DOWN:
     47 		switch (eve.GetEventData()->i)
     48 		{
     49 		case SDL_SCANCODE_R:
     50 			//reload level;
     51 			break;
     52 		}
     53 		break;
     54 	default:
     55 
     56 		return false;
     57 	}
     58 
     59 	return false;
     60 }
     61