GLViewNew.h

huangsw, 2014-08-08 10:14

Download (1.2 kB)

 
1
//
2
//  GLViewNew.h
3
//  cocos2d_libs
4
//
5
//  Created by huangshiwu on 14-7-18.
6
//
7
//
8

    
9
#ifndef GLViewNew_h
10
#define GLViewNew_h
11

    
12
#include "platform/CCGLView.h"
13
#include <gl/GL.h>
14
#include <gl/GLU.h>
15

    
16
NS_CC_BEGIN
17

    
18
class GLViewNew : public GLView
19
{
20
public:
21

    
22
        //a static method, create window and OpenGL context and also set event callbacks
23
    static GLViewNew* create(const std::string& viewName);
24
    
25
        void updateFrameSize(float width, float height);
26
    
27
        /* override functions */    
28
    void pollEvents() override;
29
    bool isOpenGLReady() override;
30
    void end() override;
31
    void swapBuffers() override;
32
    void setIMEKeyboardState(bool bOpen) override;
33
    bool windowShouldClose() override;
34
        //get the window handle
35
        HWND getWin32Window() override;
36

    
37
        friend LONG MainWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
38
    
39
private:
40
    GLViewNew();
41
    virtual ~GLViewNew();
42
    
43
    bool initWithRect(const std::string& viewName, Rect rect);
44
    
45
    bool initGlew();
46

    
47
        HWND _hWnd;
48
        HDC  _hDC;
49
        HGLRC _hRC;
50
    
51
    bool _captured;
52

    
53
    CC_DISALLOW_COPY_AND_ASSIGN(GLViewNew);
54
};
55

    
56
NS_CC_END   // end of namespace   cocos2d
57

    
58
#endif

Sign up for our newsletter to keep up with the latest developments, releases and updates for Cocos2d-x.