2009-11-11 18:39:43 -07:00
|
|
|
// Just show some position data
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <climits>
|
|
|
|
#include <integers.h>
|
|
|
|
#include <vector>
|
|
|
|
#include <ctime>
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
#include <DFTypes.h>
|
2010-05-23 15:06:10 -06:00
|
|
|
#include <DFContextManager.h>
|
|
|
|
#include <DFContext.h>
|
2010-04-04 16:48:19 -06:00
|
|
|
#include <modules/Position.h>
|
2009-11-11 18:39:43 -07:00
|
|
|
|
|
|
|
int main (void)
|
|
|
|
{
|
2010-04-04 16:48:19 -06:00
|
|
|
DFHack::Position * Position = 0;
|
2010-05-23 15:06:10 -06:00
|
|
|
DFHack::ContextManager DFMgr("Memory.xml");
|
|
|
|
DFHack::Context * DF;
|
2010-03-26 06:01:46 -06:00
|
|
|
try
|
2009-11-11 18:39:43 -07:00
|
|
|
{
|
2010-05-23 15:06:10 -06:00
|
|
|
DF = DFMgr.getSingleContext();
|
|
|
|
DF->Attach();
|
|
|
|
Position = DF->getPosition();
|
2010-03-26 06:01:46 -06:00
|
|
|
}
|
|
|
|
catch (exception& e)
|
|
|
|
{
|
|
|
|
cerr << e.what() << endl;
|
|
|
|
#ifndef LINUX_BUILD
|
|
|
|
cin.ignore();
|
|
|
|
#endif
|
|
|
|
return 1;
|
|
|
|
}
|
2010-04-04 16:48:19 -06:00
|
|
|
if (Position)
|
2010-03-26 06:01:46 -06:00
|
|
|
{
|
|
|
|
int32_t x,y,z;
|
2010-04-02 19:52:46 -06:00
|
|
|
int32_t width,height;
|
|
|
|
|
2010-04-04 16:48:19 -06:00
|
|
|
if(Position->getViewCoords(x,y,z))
|
2010-03-26 06:01:46 -06:00
|
|
|
cout << "view coords: " << x << "/" << y << "/" << z << endl;
|
2010-04-04 16:48:19 -06:00
|
|
|
if(Position->getCursorCoords(x,y,z))
|
2010-03-26 06:01:46 -06:00
|
|
|
cout << "cursor coords: " << x << "/" << y << "/" << z << endl;
|
2010-04-04 16:48:19 -06:00
|
|
|
if(Position->getWindowSize(width,height))
|
2010-04-02 19:52:46 -06:00
|
|
|
cout << "window size : " << width << " " << height << endl;
|
2009-11-17 20:35:43 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-03-26 06:01:46 -06:00
|
|
|
cerr << "cursor and window parameters are unsupported on your version of DF" << endl;
|
|
|
|
}
|
|
|
|
|
2010-05-23 15:06:10 -06:00
|
|
|
if(!DF->Detach())
|
2010-03-26 06:01:46 -06:00
|
|
|
{
|
|
|
|
cerr << "Can't detach from DF" << endl;
|
2009-11-11 18:39:43 -07:00
|
|
|
}
|
2010-03-26 06:01:46 -06:00
|
|
|
|
2009-11-11 18:39:43 -07:00
|
|
|
#ifndef LINUX_BUILD
|
2010-03-26 06:01:46 -06:00
|
|
|
cout << "Done. Press any key to continue" << endl;
|
|
|
|
cin.ignore();
|
2009-11-11 18:39:43 -07:00
|
|
|
#endif
|
|
|
|
return 0;
|
2009-12-13 14:03:19 -07:00
|
|
|
}
|