2005-06-28 01:04:34 +02:00
|
|
|
#ifndef MESSAGES_H__
|
|
|
|
#define MESSAGES_H__
|
|
|
|
|
|
|
|
#include "MessagePasser.h"
|
|
|
|
|
2005-07-03 18:25:48 +02:00
|
|
|
// Structures in this file are passed over the DLL boundary, so some
|
|
|
|
// carefulness and/or luck is required...
|
|
|
|
|
|
|
|
class wxPoint;
|
|
|
|
|
2005-06-25 04:21:26 +02:00
|
|
|
namespace AtlasMessage
|
|
|
|
{
|
|
|
|
|
2005-07-03 18:25:48 +02:00
|
|
|
struct Position
|
|
|
|
{
|
|
|
|
Position() : x(0.f), y(0.f), z(0.f) {}
|
|
|
|
Position(float x_, float y_, float z_) : x(x_), y(y_), z(z_) {}
|
|
|
|
Position(const wxPoint& pt); // converts screen-space to world-space coords
|
|
|
|
float x, y, z; // world coordinates
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2005-06-25 04:21:26 +02:00
|
|
|
struct IMessage
|
|
|
|
{
|
2005-06-28 01:04:34 +02:00
|
|
|
virtual const char* GetType() const = 0;
|
2005-06-25 04:21:26 +02:00
|
|
|
virtual ~IMessage() {}
|
|
|
|
};
|
|
|
|
|
2005-07-03 18:25:48 +02:00
|
|
|
// High-level message types, as a limited form of type-safety to prevent e.g.
|
|
|
|
// adding input message into the command queue
|
|
|
|
struct mCommand : public IMessage {};
|
|
|
|
struct mInput : public IMessage {};
|
|
|
|
|
|
|
|
#define COMMAND(t) struct m##t : public mCommand { const char* GetType() const { return #t; }
|
|
|
|
#define INPUT(t) struct m##t : public mInput { const char* GetType() const { return #t; }
|
2005-06-28 01:04:34 +02:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2005-07-03 18:25:48 +02:00
|
|
|
COMMAND(CommandString)
|
2005-06-28 01:04:34 +02:00
|
|
|
mCommandString(const std::string& name_) : name(name_) {}
|
|
|
|
const std::string name;
|
2005-06-25 04:21:26 +02:00
|
|
|
};
|
|
|
|
|
2005-06-28 01:04:34 +02:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2005-07-03 18:25:48 +02:00
|
|
|
COMMAND(SetContext)
|
2005-06-28 01:04:34 +02:00
|
|
|
mSetContext(void* /* HDC */ hdc_, void* /* HGLRC */ hglrc_) : hdc(hdc_), hglrc(hglrc_) {};
|
2005-07-03 18:25:48 +02:00
|
|
|
const void* hdc;
|
|
|
|
const void* hglrc;
|
2005-06-25 04:21:26 +02:00
|
|
|
};
|
|
|
|
|
2005-07-03 18:25:48 +02:00
|
|
|
COMMAND(ResizeScreen)
|
2005-06-28 01:04:34 +02:00
|
|
|
mResizeScreen(int width_, int height_) : width(width_), height(height_) {}
|
2005-07-03 18:25:48 +02:00
|
|
|
const int width, height;
|
2005-06-25 04:21:26 +02:00
|
|
|
};
|
|
|
|
|
2005-06-28 01:04:34 +02:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2005-07-03 18:25:48 +02:00
|
|
|
COMMAND(GenerateMap)
|
2005-06-28 01:04:34 +02:00
|
|
|
mGenerateMap(int size_) : size(size_) {}
|
2005-07-03 18:25:48 +02:00
|
|
|
const int size; // size in number of patches
|
|
|
|
};
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
INPUT(ScrollConstant)
|
|
|
|
mScrollConstant(int dir_, float speed_) : dir(dir_), speed(speed_) {}
|
|
|
|
const int dir; // as in enum below
|
|
|
|
const float speed; // set speed 0.0f to stop scrolling
|
|
|
|
enum { FORWARDS, BACKWARDS, LEFT, RIGHT };
|
2005-06-25 04:21:26 +02:00
|
|
|
};
|
|
|
|
|
2005-06-28 01:04:34 +02:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2005-07-03 18:25:48 +02:00
|
|
|
/*
|
|
|
|
// TODO: Proper tool system
|
|
|
|
COMMAND(ToolBegin)
|
|
|
|
mToolBegin(std::string name_) : name(name_) {}
|
|
|
|
const std::string name;
|
|
|
|
};
|
|
|
|
|
|
|
|
COMMAND(ToolEnd)
|
|
|
|
mToolEnd() {}
|
|
|
|
};
|
|
|
|
*/
|
|
|
|
|
|
|
|
COMMAND(AlterElevation)
|
|
|
|
mAlterElevation(Position pos_, float amount_) : pos(pos_), amount(amount_) {}
|
|
|
|
const Position pos;
|
|
|
|
const float amount;
|
|
|
|
};
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
#undef COMMAND
|
|
|
|
#undef INPUT
|
2005-06-28 01:04:34 +02:00
|
|
|
|
2005-06-25 04:21:26 +02:00
|
|
|
}
|
2005-06-28 01:04:34 +02:00
|
|
|
|
2005-07-03 18:25:48 +02:00
|
|
|
#endif // MESSAGES_H__
|