-
Notifications
You must be signed in to change notification settings - Fork 1
Create a new project
The simulator provides easy to use RSTTab class to code input controls like buttons, sliders etc... Example projects are included in the distribution under /projects/
To get started extend a EmptyTab class from RSTTab. The RSTTab class is extended from the wxPanel class. Create EmptyTab.h and include the RSTTab class.
#include <Tabs/RSTTab.h>
All RST related include files like in '/librst/'. Include other class files from RST which will give access to the robot, links and other objects in our scene.
#include <Tools/World.h>
#include <Tools/Robot.h>
#include <Tools/Link.h>
#include <Tools/Object.h>
#include <Tools/Constants.h>
Declare the EmptyTab class. This also includes the wxWidgets declaration primitives for your class.
class EmptyTab : public RSTTab
{
public:
EmptyTab(){};
EmptyTab(wxWindow * parent, wxWindowID id = -1,
const wxPoint & pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize,
long style = wxTAB_TRAVERSAL);
virtual ~EmptyTab(){}
void RSTStateChange();
DECLARE_DYNAMIC_CLASS(EmptyTab)
DECLARE_EVENT_TABLE()
};
Create the EmptyTab.cpp file for defining your class. First include the RSTApp and tell RST to include your Tab class into RST. #include <Tabs/AllTabs.h> #include <RSTApp.h>
void RSTApp::AddTab() {
ADD_TAB(EmptyTab,wxT("Empty Tab"));
}
Then define your constructor and rest of your class.
BEGIN_EVENT_TABLE(EmptyTab, wxPanel)
END_EVENT_TABLE ()
IMPLEMENT_DYNAMIC_CLASS(EmptyTab, RSTTab)
EmptyTab::EmptyTab(wxWindow *parent, const wxWindowID id,
const wxPoint& pos, const wxSize& size, long style) : RSTTab(parent, id, pos, size, style) {
}
// All tabs get a message for certain changes in RST (in case they want to do something)
void EmptyTab::RSTStateChange() {
}
New project can be compiled with CMake. Create a CMakeLists.txt file. Include the librst folder. Include the path to the rst static library.
include_directories(../../librst ../../)
set (CMAKE_CXX_FLAGS "-L../../librst")
Include all files in the CMake for compiling and compile with wxWidgets and the static librst.
set ( SRC EmptyTab )
set (wxWidgets_USE_LIBS base core gl)
find_package (wxWidgets)
if (wxWidgets_FOUND)
include (${wxWidgets_USE_FILE})
add_executable (EmptyTab ${SRC})
target_link_libraries (EmptyTab rst ${wxWidgets_LIBRARIES})
else (wxWidgets_FOUND)
message ("wxWidgets not found!")
endif (wxWidgets_FOUND)
Since the project links with librst statically, you will have to recompile librst everytime a change is made in RST. If the functionality of your project is changed, compile the project with
cmake .
make