2012-08-02 13:02:59 +08:00
|
|
|
/*
|
2013-06-20 14:13:12 +08:00
|
|
|
* EGLView.h
|
2012-08-02 13:02:59 +08:00
|
|
|
*
|
|
|
|
* Created on: Aug 8, 2011
|
|
|
|
* Author: laschweinski
|
|
|
|
*/
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
#ifndef EGLVIEW_H_
|
|
|
|
#define EGLVIEW_H_
|
2012-08-02 13:02:59 +08:00
|
|
|
|
2012-08-16 18:09:01 +08:00
|
|
|
#include "platform/CCCommon.h"
|
2012-08-02 13:02:59 +08:00
|
|
|
#include "cocoa/CCGeometry.h"
|
|
|
|
#include "platform/CCEGLViewProtocol.h"
|
2013-08-28 12:00:06 +08:00
|
|
|
#include "platform/third_party/linux/glfw/glfw3.h"
|
2013-07-08 10:26:53 +08:00
|
|
|
#include <SDL2/SDL.h>
|
|
|
|
#include <set>
|
2012-08-02 13:02:59 +08:00
|
|
|
|
|
|
|
bool initExtensions();
|
|
|
|
|
|
|
|
NS_CC_BEGIN
|
|
|
|
|
2013-08-28 12:00:06 +08:00
|
|
|
class CC_DLL EGLView : public EGLViewProtocol
|
|
|
|
{
|
2012-08-02 13:02:59 +08:00
|
|
|
public:
|
2013-09-13 16:46:31 +08:00
|
|
|
/**
|
|
|
|
* @js ctor
|
|
|
|
*/
|
2013-07-08 10:26:53 +08:00
|
|
|
EGLView();
|
2013-09-13 13:52:42 +08:00
|
|
|
/**
|
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2013-07-08 10:26:53 +08:00
|
|
|
virtual ~EGLView();
|
2013-08-28 12:00:06 +08:00
|
|
|
|
|
|
|
/* override functions */
|
|
|
|
virtual bool isOpenGLReady();
|
|
|
|
virtual void end();
|
|
|
|
virtual void swapBuffers();
|
2013-07-08 10:26:53 +08:00
|
|
|
virtual void setFrameSize(float width, float height);
|
2013-08-28 12:00:06 +08:00
|
|
|
virtual void setIMEKeyboardState(bool bOpen);
|
|
|
|
|
2013-08-29 11:36:16 +08:00
|
|
|
bool init(const char* viewName, float width, float height);
|
2013-08-28 12:00:06 +08:00
|
|
|
public:
|
|
|
|
|
|
|
|
//void resize(int width, int height);
|
2013-07-08 10:26:53 +08:00
|
|
|
/*
|
|
|
|
* Set zoom factor for frame. This method is for debugging big resolution (e.g.new ipad) app on desktop.
|
|
|
|
*/
|
|
|
|
void setFrameZoomFactor(float fZoomFactor);
|
|
|
|
float getFrameZoomFactor();
|
2013-08-28 12:00:06 +08:00
|
|
|
//void centerWindow();
|
2013-07-12 13:11:21 +08:00
|
|
|
|
2013-08-28 12:00:06 +08:00
|
|
|
|
|
|
|
virtual void setViewPortInPoints(float x , float y , float w , float h);
|
|
|
|
virtual void setScissorInPoints(float x , float y , float w , float h);
|
|
|
|
|
|
|
|
// static function
|
|
|
|
/**
|
|
|
|
@brief get the shared main open gl window
|
|
|
|
*/
|
|
|
|
static EGLView* getInstance();
|
|
|
|
|
2013-07-12 13:11:21 +08:00
|
|
|
/** @deprecated Use getInstance() instead */
|
|
|
|
CC_DEPRECATED_ATTRIBUTE static EGLView* sharedOpenGLView();
|
2013-08-28 12:00:06 +08:00
|
|
|
protected:
|
|
|
|
|
2012-08-02 13:02:59 +08:00
|
|
|
private:
|
2013-08-28 12:00:06 +08:00
|
|
|
bool _captured;
|
|
|
|
bool _supportTouch;
|
|
|
|
|
2013-07-08 10:26:53 +08:00
|
|
|
float _frameZoomFactor;
|
2013-08-28 12:00:06 +08:00
|
|
|
static EGLView* s_pEglView;
|
|
|
|
public:
|
|
|
|
bool windowShouldClose();
|
|
|
|
|
|
|
|
void pollEvents();
|
|
|
|
GLFWwindow* getWindow() const { return _mainWindow; }
|
|
|
|
private:
|
|
|
|
GLFWwindow* _mainWindow;
|
2012-08-02 13:02:59 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
NS_CC_END
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
#endif /* EGLVIEW_H_ */
|