Audio3DSample.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #ifndef AUDIO3DSAMPLE_H_
  2. #define AUDIO3DSAMPLE_H_
  3. #include "gameplay.h"
  4. #include "Sample.h"
  5. #include "FirstPersonCamera.h"
  6. using namespace gameplay;
  7. /**
  8. * Sample 3D audio within multiple sources and a listener bound to Nodes.
  9. */
  10. class Audio3DSample: public Sample
  11. {
  12. public:
  13. Audio3DSample();
  14. void touchEvent(Touch::TouchEvent evt, int x, int y, unsigned int contactIndex);
  15. void keyEvent(Keyboard::KeyEvent evt, int key);
  16. bool mouseEvent(Mouse::MouseEvent evt, int x, int y, int wheelDelta);
  17. void gamepadEvent(Gamepad::GamepadEvent evt, Gamepad* gamepad);
  18. protected:
  19. void initialize();
  20. void finalize();
  21. void update(float elapsedTime);
  22. void render(float elapsedTime);
  23. private:
  24. bool drawScene(Node* node);
  25. void addSound(const std::string& file);
  26. void drawDebugText(int x = 0, int y = 0);
  27. void drawVector3(const char* str, const Vector3& vector, int x, int y);
  28. void loadGrid(Scene* scene);
  29. private:
  30. FirstPersonCamera _fpCamera;
  31. std::map<std::string, Node*> _audioNodes;
  32. Font* _font;
  33. Scene* _scene;
  34. Node* _cubeNode;
  35. Gamepad* _gamepad;
  36. unsigned int _moveFlags;
  37. int _prevX;
  38. int _prevY;
  39. bool _buttonPressed;
  40. };
  41. #endif