axmol/cocos2dx/platform/linux/CCEGLView.h

85 lines
1.8 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"
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"
#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:
/**
* @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);
bool init(const char* viewName, float width, float height);
2013-08-28 12:00:06 +08:00
public:
//void resize(int width, int height);
/*
* 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-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:
2012-08-02 13:02:59 +08:00
private:
2013-08-28 12:00:06 +08:00
bool _captured;
bool _supportTouch;
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_ */