axmol/cocos/2d/platform/linux/CCEGLView.h

86 lines
1.9 KiB
C
Raw Normal View History

2012-08-02 13:02:59 +08:00
/*
* EGLView.h
2012-08-02 13:02:59 +08:00
*
* Created on: Aug 8, 2011
* Author: laschweinski
*/
#ifndef EGLVIEW_H_
#define EGLVIEW_H_
2012-08-02 13:02:59 +08:00
#include "platform/CCCommon.h"
#include "CCGeometry.h"
2012-08-02 13:02:59 +08:00
#include "platform/CCEGLViewProtocol.h"
2013-10-22 18:01:56 +08:00
#include "glfw3.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:
/**
* @js ctor
*/
EGLView();
/**
* @js NA
* @lua NA
*/
virtual ~EGLView();
2013-08-28 12:00:06 +08:00
/* override functions */
virtual bool isOpenGLReady();
virtual void end();
virtual void swapBuffers();
virtual void setFrameSize(float width, float height);
2013-08-28 12:00:06 +08:00
virtual void setIMEKeyboardState(bool bOpen);
/*
*frameZoomFactor for frame. This method is for debugging big resolution (e.g.new ipad) app on desktop.
*/
bool init(const char* viewName, float width, float height, float frameZoomFactor = 1.0f);
2013-08-28 12:00:06 +08:00
public:
//void resize(int width, int height);
float getFrameZoomFactor();
2013-08-28 12:00:06 +08:00
//void centerWindow();
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();
/** @deprecated Use getInstance() instead */
CC_DEPRECATED_ATTRIBUTE static EGLView* sharedOpenGLView();
2013-08-28 12:00:06 +08:00
protected:
/*
* Set zoom factor for frame. This method is for debugging big resolution (e.g.new ipad) app on desktop.
*/
void setFrameZoomFactor(float fZoomFactor);
2012-08-02 13:02:59 +08:00
private:
2013-08-28 12:00:06 +08:00
bool _captured;
bool _supportTouch;
int _frameBufferSize[2];
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
#endif /* EGLVIEW_H_ */