moved Video out of Engine

git-svn-id: svn://anubis/anaglym/trunk@85 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
Josh Holtrop 2009-10-14 03:45:46 +00:00
parent eafeac9bf9
commit cc83d92c18
3 changed files with 9 additions and 13 deletions

View File

@ -1,6 +1,5 @@
#include "ag.h"
#include "Video.h"
#include "Engine.h"
#include <lua.hpp>
#include <stdlib.h> /* exit() */
@ -20,7 +19,6 @@ SDL_Event Engine::userEvent;
Engine::Engine(const string & path)
{
m_video = new Video();
m_next_object_index = 1;
m_eye[0] = 0;
m_eye[1] = -1;
@ -40,17 +38,10 @@ Engine::Engine(const string & path)
/* setup redraw SDL event structure */
userEvent.type = SDL_USEREVENT;
userEvent.user.code = 0;
#if 0
/* start in windowed mode for debugging */
m_video->start(0, 0, false, false);
#else
m_video->start();
#endif
}
Engine::~Engine()
{
m_video->stop();
lua_close(m_luaState);
for (std::map<int, Object *>::iterator it = m_objects.begin();
it != m_objects.end();
@ -58,7 +49,6 @@ Engine::~Engine()
{
delete it->second;
}
delete m_video;
}
bool Engine::load(const char * program)

View File

@ -5,7 +5,7 @@
#include <string>
#include <lua.hpp>
#include <map>
#include "Video.h"
#include <SDL.h>
#include "OdeWorld/OdeWorld.h"
#include "wfobj/WFObj.hh"
@ -50,7 +50,6 @@ class Engine
~Engine();
std::string locateResource(const std::string & shortname);
Video * getVideo() { return m_video; }
bool load(const char * program);
void run();
void reportErrors(int status);
@ -84,7 +83,6 @@ class Engine
}
lua_State * m_luaState;
Video * m_video;
std::string m_program_path;
std::string m_engine_path;
OdeWorld m_world;

View File

@ -46,10 +46,18 @@ int main(int argc, char * argv[])
usage();
}
Video video;
#if 0
/* start in windowed mode for debugging */
video.start(0, 0, false, false);
#else
video.start();
#endif
g_engine = new Engine(argv[0]);
if (g_engine->load(program))
g_engine->run();
delete g_engine;
video.stop();
return 0;
}