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"
|
|
|
|
|
|
|
|
bool initExtensions();
|
|
|
|
|
|
|
|
NS_CC_BEGIN
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
class EGLView : public EGLViewProtocol{
|
2012-08-02 13:02:59 +08:00
|
|
|
public:
|
2013-06-20 14:13:12 +08:00
|
|
|
EGLView();
|
|
|
|
virtual ~EGLView();
|
2012-08-02 13:02:59 +08:00
|
|
|
|
|
|
|
friend void keyEventHandle(int,int);
|
|
|
|
friend void mouseButtonEventHandle(int,int);
|
|
|
|
friend void mousePosEventHandle(int,int);
|
|
|
|
friend void charEventHandle(int,int);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* iPixelWidth, height: the window's size
|
|
|
|
* iWidth ,height: the point size, which may scale.
|
|
|
|
* iDepth is not the buffer depth of opengl, it indicate how may bits for a pixel
|
|
|
|
*/
|
2012-08-16 11:30:25 +08:00
|
|
|
virtual void setFrameSize(float width, float height);
|
2012-10-18 11:51:02 +08:00
|
|
|
virtual void setViewPortInPoints(float x , float y , float w , float h);
|
2012-10-24 10:03:19 +08:00
|
|
|
virtual void setScissorInPoints(float x , float y , float w , float h);
|
|
|
|
|
2012-10-18 11:51:02 +08:00
|
|
|
/*
|
|
|
|
* Set zoom factor for frame. This method is for debugging big resolution (e.g.new ipad) app on desktop.
|
|
|
|
*/
|
2012-10-19 17:39:55 +08:00
|
|
|
void setFrameZoomFactor(float fZoomFactor);
|
|
|
|
float getFrameZoomFactor();
|
2012-08-03 13:56:18 +08:00
|
|
|
virtual bool isOpenGLReady();
|
|
|
|
virtual void end();
|
|
|
|
virtual void swapBuffers();
|
|
|
|
virtual void setIMEKeyboardState(bool bOpen);
|
2012-08-02 13:02:59 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
@brief get the shared main open gl window
|
|
|
|
*/
|
2013-07-12 13:11:21 +08:00
|
|
|
static EGLView* getInstance();
|
|
|
|
|
|
|
|
/** @deprecated Use getInstance() instead */
|
|
|
|
CC_DEPRECATED_ATTRIBUTE static EGLView* sharedOpenGLView();
|
|
|
|
|
2012-08-02 13:02:59 +08:00
|
|
|
private:
|
2012-10-18 11:51:02 +08:00
|
|
|
bool initGL();
|
|
|
|
void destroyGL();
|
2012-08-02 13:02:59 +08:00
|
|
|
private:
|
|
|
|
//store current mouse point for moving, valid if and only if the mouse pressed
|
2013-06-20 14:13:12 +08:00
|
|
|
Point _mousePoint;
|
2012-08-02 13:02:59 +08:00
|
|
|
bool bIsInit;
|
2013-06-15 14:03:30 +08:00
|
|
|
float _frameZoomFactor;
|
2012-08-02 13:02:59 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
NS_CC_END
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
#endif /* EGLVIEW_H_ */
|