1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 16:49:55 +00:00
openmw-tes3mp/game/main.cpp

78 lines
1.6 KiB
C++
Raw Normal View History

#include <iostream>
#include "esm_store/cell_store.hpp"
#include "bsa/bsa_archive.hpp"
2010-06-03 19:51:59 +00:00
#include "ogre/renderer.hpp"
#include "tools/fileops.hpp"
#include "mwrender/cell.hpp"
#include "mwrender/mwscene.hpp"
#include "mwinput/inputmanager.hpp"
using namespace std;
2010-06-03 19:51:59 +00:00
void maintest()
{
2010-06-03 19:51:59 +00:00
const char* esmFile = "data/Morrowind.esm";
const char* bsaFile = "data/Morrowind.bsa";
const char* plugCfg = "plugins.cfg";
cout << "Hello, fellow traveler!\n";
cout << "Initializing OGRE\n";
2010-06-03 19:51:59 +00:00
Render::OgreRenderer ogre;
ogre.configure(!isFile("ogre.cfg"), plugCfg, false);
cout << "Adding " << bsaFile << endl;
addBSA(bsaFile);
cout << "Loading ESM " << esmFile << "\n";
ESM::ESMReader esm;
2010-05-17 18:59:15 +00:00
ESMS::ESMStore store;
ESMS::CellStore cell;
2010-06-06 10:52:21 +00:00
// This parses the ESM file and loads a sample cell
esm.open(esmFile);
2010-05-17 18:59:15 +00:00
store.load(esm);
cell.loadInt("Beshara", store, esm);
2010-06-06 10:52:21 +00:00
// Create the window
2010-06-03 19:51:59 +00:00
ogre.createWindow("OpenMW");
cout << "\nSetting up cell rendering\n";
// Sets up camera, scene manager etc
MWRender::MWScene scene(ogre);
// This connects the cell data with the rendering scene.
MWRender::CellRender rend(cell, scene);
// Load the cell and insert it into the renderer
rend.show();
2010-06-06 10:52:21 +00:00
cout << "Setting up input system\n";
// Sets up the input system
MWInput::MWInputManager input(ogre);
cout << "\nStart! Press Q/ESC or close window to exit.\n";
// Start the main rendering loop
ogre.start();
cout << "\nThat's all for now!\n";
}
int main(/*int argc, char**argv*/)
{
try { maintest(); }
catch(exception &e)
{
cout << "\nERROR: " << e.what() << endl;
return 1;
}
return 0;
}