Пример #1
0
/** Init function
 */
orxSTATUS orxFASTCALL Init()
{
  orxINPUT_TYPE   eType;
  orxENUM         eID;
  orxINPUT_MODE   eMode;
  const orxSTRING zInputNextConfig;
  const orxSTRING zInputPreviousConfig;

  /* Gets binding names */
  orxInput_GetBinding("NextConfig", 0, &eType, &eID, &eMode);
  zInputNextConfig = orxInput_GetBindingName(eType, eID, eMode);

  orxInput_GetBinding("PreviousConfig", 0, &eType, &eID, &eMode);
  zInputPreviousConfig = orxInput_GetBindingName(eType, eID, eMode);

  /* Displays a small hint in console */
  orxLOG("\n- '%s' will switch to the next config settings"
         "\n- '%s' will switch to the previous config settings"
         "\n* Config files are used with inheritance to provide all the combinations"
         "\n* All the tests use the same minimalist code (creating 1 object & 1 viewport)",
         zInputNextConfig, zInputPreviousConfig);

  /* Loads default configuration */
  return LoadConfig();
}
Пример #2
0
/** Inits the tutorial
 */
orxSTATUS orxFASTCALL Init()
{
  orxCLOCK       *pstClock;
  orxINPUT_TYPE   eType;
  orxENUM         eID;
  orxINPUT_MODE   eMode;
  const orxSTRING zInputCameraLeft;
  const orxSTRING zInputCameraRight;
  const orxSTRING zInputCameraUp;
  const orxSTRING zInputCameraDown;
  const orxSTRING zInputCameraRotateLeft;
  const orxSTRING zInputCameraRotateRight;
  const orxSTRING zInputCameraZoomIn;
  const orxSTRING zInputCameraZoomOut;
  const orxSTRING zInputViewportLeft;
  const orxSTRING zInputViewportRight;
  const orxSTRING zInputViewportUp;
  const orxSTRING zInputViewportDown;
  const orxSTRING zInputViewportScaleUp;
  const orxSTRING zInputViewportScaleDown;

  /* Gets input binding names */
  orxInput_GetBinding("CameraLeft", 0, &eType, &eID, &eMode);
  zInputCameraLeft = orxInput_GetBindingName(eType, eID, eMode);

  orxInput_GetBinding("CameraRight", 0, &eType, &eID, &eMode);
  zInputCameraRight = orxInput_GetBindingName(eType, eID, eMode);

  orxInput_GetBinding("CameraUp", 0, &eType, &eID, &eMode);
  zInputCameraUp = orxInput_GetBindingName(eType, eID, eMode);

  orxInput_GetBinding("CameraDown", 0, &eType, &eID, &eMode);
  zInputCameraDown = orxInput_GetBindingName(eType, eID, eMode);

  orxInput_GetBinding("CameraRotateLeft", 0, &eType, &eID, &eMode);
  zInputCameraRotateLeft = orxInput_GetBindingName(eType, eID, eMode);

  orxInput_GetBinding("CameraRotateRight", 0, &eType, &eID, &eMode);
  zInputCameraRotateRight = orxInput_GetBindingName(eType, eID, eMode);

  orxInput_GetBinding("CameraZoomIn", 0, &eType, &eID, &eMode);
  zInputCameraZoomIn = orxInput_GetBindingName(eType, eID, eMode);

  orxInput_GetBinding("CameraZoomOut", 0, &eType, &eID, &eMode);
  zInputCameraZoomOut = orxInput_GetBindingName(eType, eID, eMode);

  orxInput_GetBinding("ViewportLeft", 0, &eType, &eID, &eMode);
  zInputViewportLeft = orxInput_GetBindingName(eType, eID, eMode);

  orxInput_GetBinding("ViewportRight", 0, &eType, &eID, &eMode);
  zInputViewportRight = orxInput_GetBindingName(eType, eID, eMode);

  orxInput_GetBinding("ViewportUp", 0, &eType, &eID, &eMode);
  zInputViewportUp = orxInput_GetBindingName(eType, eID, eMode);

  orxInput_GetBinding("ViewportDown", 0, &eType, &eID, &eMode);
  zInputViewportDown = orxInput_GetBindingName(eType, eID, eMode);

  orxInput_GetBinding("ViewportScaleUp", 0, &eType, &eID, &eMode);
  zInputViewportScaleUp = orxInput_GetBindingName(eType, eID, eMode);

  orxInput_GetBinding("ViewportScaleDown", 0, &eType, &eID, &eMode);
  zInputViewportScaleDown = orxInput_GetBindingName(eType, eID, eMode);

  /* Displays a small hint in console */
  orxLOG("\n* Worskpaces 1 & 4 display camera 1 content"
         "\n* Workspace 2 displays camera 2 (by default it's twice as close as the other cameras)"
         "\n* Workspace 3 displays camera 3"
         "\n- Soldier will be positioned (in the world) so as to be always displayed under the mouse"
         "\n- '%s', '%s', '%s' & '%s' control camera 1 positioning"
         "\n- '%s' & '%s' control camera 1 rotation"
         "\n- '%s' & '%s' control camera 1 zoom"
         "\n- '%s', '%s', '%s' & '%s' control viewport 1 positioning"
         "\n- '%s' & '%s' control viewport 1 size",
         zInputCameraUp, zInputCameraLeft, zInputCameraDown, zInputCameraRight,
         zInputCameraRotateLeft, zInputCameraRotateRight,
         zInputCameraZoomIn, zInputCameraZoomOut,
         zInputViewportUp, zInputViewportLeft, zInputViewportDown, zInputViewportRight,
         zInputViewportScaleUp, zInputViewportScaleDown);

  /* Creates all viewports */
  orxViewport_CreateFromConfig("Viewport4");
  orxViewport_CreateFromConfig("Viewport3");
  orxViewport_CreateFromConfig("Viewport2");
  pstViewport = orxViewport_CreateFromConfig("Viewport1");

  /* Creates objects */
  orxObject_CreateFromConfig("Box");
  pstSoldier = orxObject_CreateFromConfig("Soldier");

  /* Gets the main clock */
  pstClock = orxClock_FindFirst(orx2F(-1.0f), orxCLOCK_TYPE_CORE);

  /* Registers our update callback */
  orxClock_Register(pstClock, Update, orxNULL, orxMODULE_ID_MAIN, orxCLOCK_PRIORITY_NORMAL);

  /* Done! */
  return orxSTATUS_SUCCESS;
}