VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Joystick Controller (joystick)

Table of Contents

The Joystick Controller demonstrates the following

Creating Joystick Controller

This example will install a new controller that is installed by creating a new scenario using the Joystick.sms from the developer examples. Once a new scenario is created on this SMS, you can create the Joystick Example entity. This entity will create the new joystick controller. The new joystick controller will, via the joystick.sysdef file, create a new function group for the joystick called "Example Joystick". If you configure this example joystick control using the Joystick configuration page, once you play the scenario and enable the new joystick controls on the entity, you will see output in the back-end console in response to your mapped joystick changes.

Since this example is loaded as a plugin, it can be used in conjunction with the released VR-Forces application.

How to Run the Example

Usage

In the Launcher, click the Plug-ins button to bring up the Plug-ins Selection dialog. Enable the joystick plugin.

To view the new behavior:

  1. When creating a new scenario you will also need to use the Joystick simulation model set from the developer examples simulation model sets.
  2. Create the Joystick Example entity to show the new Joystick Example function group and function.
  3. This shows how to implement a button and axis function.

Classes

MyJoystickControllerComponenetThis subclass of DtControllerComponent prints out a message when the function group and function are enabled and used.

Plugin Entry Points

/*******************************************************************************
** Copyright (c) 2017 MAK Technologies, Inc.
** All rights reserved.
*******************************************************************************/
#include "vrfcgf/cgf.h"
extern "C" {
{
info.pluginName = "Joystick Controller";
info.pluginVersion = "1.00";
info.pluginCreator = "MAK Technologies";
info.pluginCreatorEmail = "sales@mak.com";
info.pluginContactWebPage = "www.mak.com";
info.pluginContactMailingAddress = "10 Fawcett Street, Suite 204, Cambridge, MA 02138 USA";
info.pluginContactPhone = "(617) 876 8085";
}
DT_VRF_DLL_PLUGIN bool DtInitializeVrfPlugin(DtCgf* cgf)
{
//Register the creation function for our derived controller with the
//DtSimComponentFactory.
return true;
}
}


/*******************************************************************************
** Copyright (c) 2017 MAK Technologies, Inc.
** All rights reserved.
*******************************************************************************/
//constructor
: DtControllerComponent(name, owner, simServices, desc, parentRegistry),
DtJoystickControllerInterface(owner, simServices, desc)
{
}
//destructor
{
}
// This returns a string from compTypes.h, and identifies the
// type of component
{
}
{
}
{
}
void MyJoystickControllerComponenet::calcAndSetPortValues(const DtString& functionGroup, const DtString& function, double value, bool repeat)
{
objectConsoleWarn() << "Received " << functionGroup << " and " << function << " with value " << value << std::endl;
}
{
return new MyJoystickControllerComponenet(name, owner, simServices, desc,
parentRegistry);
}

Document ID: Generated on Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)