Cocos2dRenderer.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * cocos2d-x http://www.cocos2d-x.org
  3. *
  4. * Copyright (c) 2010-2014 - cocos2d-x community
  5. *
  6. * Portions Copyright (c) Microsoft Open Technologies, Inc.
  7. * All Rights Reserved
  8. *
  9. * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
  10. * You may obtain a copy of the License at
  11. *
  12. * http://www.apache.org/licenses/LICENSE-2.0
  13. *
  14. * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
  15. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. * See the License for the specific language governing permissions and limitations under the License.
  17. */
  18. #pragma once
  19. #include <agile.h>
  20. class AppDelegate;
  21. class Cocos2dRenderer
  22. {
  23. public:
  24. Cocos2dRenderer(int width, int height, float dpi,
  25. Windows::Graphics::Display::DisplayOrientations orientation,
  26. Windows::UI::Core::CoreDispatcher^ dispatcher, Windows::UI::Xaml::Controls::Panel^ panel);
  27. ~Cocos2dRenderer();
  28. void Draw(GLsizei width, GLsizei height, float dpi, Windows::Graphics::Display::DisplayOrientations orientation);
  29. void QueuePointerEvent(cocos2d::PointerEventType type, Windows::UI::Core::PointerEventArgs^ args);
  30. void QueueKeyboardEvent(cocos2d::WinRTKeyboardEventType type, Windows::UI::Core::KeyEventArgs^ args);
  31. void QueueBackButtonEvent();
  32. void Pause();
  33. void Resume();
  34. void DeviceLost();
  35. bool AppShouldExit();
  36. private:
  37. int m_width;
  38. int m_height;
  39. float m_dpi;
  40. // The AppDelegate for the Cocos2D app
  41. AppDelegate* m_app;
  42. Platform::Agile<Windows::UI::Core::CoreDispatcher> m_dispatcher;
  43. Platform::Agile<Windows::UI::Xaml::Controls::Panel> m_panel;
  44. Windows::Graphics::Display::DisplayOrientations m_orientation;
  45. };