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>
|
|
|
|
#include <DFHackAPI.h>
|
2010-04-04 16:48:19 -06:00
|
|
|
#include <modules/Position.h>
|
2009-11-11 18:39:43 -07:00
|
|
|
|
|
|
|
int main (void)
|
|
|
|
{
|
|
|
|
DFHack::API DF("Memory.xml");
|
2010-04-04 16:48:19 -06:00
|
|
|
DFHack::Position * Position = 0;
|
2010-03-26 06:01:46 -06:00
|
|
|
try
|
2009-11-11 18:39:43 -07:00
|
|
|
{
|
2010-03-26 06:01:46 -06:00
|
|
|
DF.Attach();
|
2010-04-04 16:48:19 -06:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!DF.Detach())
|
|
|
|
{
|
|
|
|
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
|
|
|
}
|