moved Video out of Engine
git-svn-id: svn://anubis/anaglym/trunk@85 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
parent
eafeac9bf9
commit
cc83d92c18
10
Engine.cc
10
Engine.cc
@ -1,6 +1,5 @@
|
|||||||
|
|
||||||
#include "ag.h"
|
#include "ag.h"
|
||||||
#include "Video.h"
|
|
||||||
#include "Engine.h"
|
#include "Engine.h"
|
||||||
#include <lua.hpp>
|
#include <lua.hpp>
|
||||||
#include <stdlib.h> /* exit() */
|
#include <stdlib.h> /* exit() */
|
||||||
@ -20,7 +19,6 @@ SDL_Event Engine::userEvent;
|
|||||||
|
|
||||||
Engine::Engine(const string & path)
|
Engine::Engine(const string & path)
|
||||||
{
|
{
|
||||||
m_video = new Video();
|
|
||||||
m_next_object_index = 1;
|
m_next_object_index = 1;
|
||||||
m_eye[0] = 0;
|
m_eye[0] = 0;
|
||||||
m_eye[1] = -1;
|
m_eye[1] = -1;
|
||||||
@ -40,17 +38,10 @@ Engine::Engine(const string & path)
|
|||||||
/* setup redraw SDL event structure */
|
/* setup redraw SDL event structure */
|
||||||
userEvent.type = SDL_USEREVENT;
|
userEvent.type = SDL_USEREVENT;
|
||||||
userEvent.user.code = 0;
|
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()
|
Engine::~Engine()
|
||||||
{
|
{
|
||||||
m_video->stop();
|
|
||||||
lua_close(m_luaState);
|
lua_close(m_luaState);
|
||||||
for (std::map<int, Object *>::iterator it = m_objects.begin();
|
for (std::map<int, Object *>::iterator it = m_objects.begin();
|
||||||
it != m_objects.end();
|
it != m_objects.end();
|
||||||
@ -58,7 +49,6 @@ Engine::~Engine()
|
|||||||
{
|
{
|
||||||
delete it->second;
|
delete it->second;
|
||||||
}
|
}
|
||||||
delete m_video;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Engine::load(const char * program)
|
bool Engine::load(const char * program)
|
||||||
|
4
Engine.h
4
Engine.h
@ -5,7 +5,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <lua.hpp>
|
#include <lua.hpp>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include "Video.h"
|
#include <SDL.h>
|
||||||
#include "OdeWorld/OdeWorld.h"
|
#include "OdeWorld/OdeWorld.h"
|
||||||
#include "wfobj/WFObj.hh"
|
#include "wfobj/WFObj.hh"
|
||||||
|
|
||||||
@ -50,7 +50,6 @@ class Engine
|
|||||||
~Engine();
|
~Engine();
|
||||||
|
|
||||||
std::string locateResource(const std::string & shortname);
|
std::string locateResource(const std::string & shortname);
|
||||||
Video * getVideo() { return m_video; }
|
|
||||||
bool load(const char * program);
|
bool load(const char * program);
|
||||||
void run();
|
void run();
|
||||||
void reportErrors(int status);
|
void reportErrors(int status);
|
||||||
@ -84,7 +83,6 @@ class Engine
|
|||||||
}
|
}
|
||||||
|
|
||||||
lua_State * m_luaState;
|
lua_State * m_luaState;
|
||||||
Video * m_video;
|
|
||||||
std::string m_program_path;
|
std::string m_program_path;
|
||||||
std::string m_engine_path;
|
std::string m_engine_path;
|
||||||
OdeWorld m_world;
|
OdeWorld m_world;
|
||||||
|
@ -46,10 +46,18 @@ int main(int argc, char * argv[])
|
|||||||
usage();
|
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]);
|
g_engine = new Engine(argv[0]);
|
||||||
if (g_engine->load(program))
|
if (g_engine->load(program))
|
||||||
g_engine->run();
|
g_engine->run();
|
||||||
delete g_engine;
|
delete g_engine;
|
||||||
|
video.stop();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user