diff --git a/CMakeLists.txt b/CMakeLists.txt index 69a5295f..da64d248 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,15 @@ check_system_version() set_compiler_param() set_output_directory() +IF(WIN32) + add_subdirectory(3rdpty/glfw) + include_directories(3rdpty/glfw/include) + + SET(OPENGL_LIB opengl32) +ELSE() + SET(OPENGL_LIB GL) +ENDIF() + include_directories(3rdpty/MathGeoLib/src) include_directories(3rdpty/GLEWCore/inc) include_directories(inc) @@ -27,6 +36,6 @@ SET(ULRE ULRE.RenderDevice MathGeoLib GLEWCore glfw - GL) + ${OPENGL_LIB}) add_subdirectory(example) diff --git a/example/DirectGLRender/main.cpp b/example/DirectGLRender/main.cpp index b50141de..a8612991 100644 --- a/example/DirectGLRender/main.cpp +++ b/example/DirectGLRender/main.cpp @@ -111,7 +111,7 @@ int main(void) RenderSetup rs; - RenderWindow *win=device->CreateWindow(screen_width,screen_height,&ws,&rs); + RenderWindow *win=device->Create(screen_width,screen_height,&ws,&rs); win->MakeToCurrent(); //切换当前窗口到前台 diff --git a/example/NullWindow/main.cpp b/example/NullWindow/main.cpp index 93a3f097..d82f47db 100644 --- a/example/NullWindow/main.cpp +++ b/example/NullWindow/main.cpp @@ -27,7 +27,7 @@ int main(void) RenderSetup rs; - RenderWindow *win=device->CreateWindow(1280,720,&ws,&rs); + RenderWindow *win=device->Create(1280,720,&ws,&rs); win->Show(); diff --git a/example/OutputGLInfo/main.cpp b/example/OutputGLInfo/main.cpp index e5c3128d..c3a8037c 100644 --- a/example/OutputGLInfo/main.cpp +++ b/example/OutputGLInfo/main.cpp @@ -63,7 +63,7 @@ int main(int argc,char **argv) else rs.opengl.core=false; - RenderWindow *win=device->CreateWindow(1280,720,&ws,&rs); + RenderWindow *win=device->Create(1280,720,&ws,&rs); win->MakeToCurrent(); //切换当前窗口到前台 diff --git a/inc/hgl/render/RenderDevice.h b/inc/hgl/render/RenderDevice.h index ee5df5fd..f752dd74 100644 --- a/inc/hgl/render/RenderDevice.h +++ b/inc/hgl/render/RenderDevice.h @@ -127,8 +127,8 @@ namespace hgl public: - virtual RenderWindow *CreateWindow(int,int,const WindowSetup *,const RenderSetup *)=0; ///<创建一个窗口渲染设备 - virtual RenderWindow *CreateFullscreen(const Display *,const VideoMode *,const RenderSetup *)=0; ///<创建一个全屏渲染设备 + virtual RenderWindow *Create(int,int,const WindowSetup *,const RenderSetup *)=0; ///<创建一个窗口渲染设备 + virtual RenderWindow *Create(const Display *,const VideoMode *,const RenderSetup *)=0; ///<创建一个全屏渲染设备 };//class RenderDevice RenderDevice *CreateRenderDeviceGLFW(); ///<创建一个基于GLFW的渲染设备 diff --git a/inc/hgl/render/RenderWindow.h b/inc/hgl/render/RenderWindow.h index 490919b0..5917c8df 100644 --- a/inc/hgl/render/RenderWindow.h +++ b/inc/hgl/render/RenderWindow.h @@ -12,7 +12,7 @@ namespace hgl { protected: - OSString caption; + UTF8String caption; bool full_screen; int width,height; @@ -34,8 +34,8 @@ namespace hgl virtual void Show()=0; ///<显示窗口 virtual void Hide()=0; ///<隐藏窗口 - virtual const OSString &GetCaption()const{return caption;} - virtual void SetCaption(const OSString &)=0; + virtual const UTF8String &GetCaption()const{return caption;} + virtual void SetCaption(const UTF8String &)=0; public: //被实际操作系统接口层所调用的函数,在不了解的情况下请不要使用 diff --git a/src/RenderDevice/GLFW/RenderDeviceGLFW.cpp b/src/RenderDevice/GLFW/RenderDeviceGLFW.cpp index 2f10ce17..ec0a081a 100644 --- a/src/RenderDevice/GLFW/RenderDeviceGLFW.cpp +++ b/src/RenderDevice/GLFW/RenderDeviceGLFW.cpp @@ -178,7 +178,7 @@ namespace hgl public: - RenderWindow *CreateWindow(int width,int height,const WindowSetup *ws,const RenderSetup *rs) override + RenderWindow *Create(int width,int height,const WindowSetup *ws,const RenderSetup *rs) override { SetGLFWWindowHint(rs); @@ -199,7 +199,7 @@ namespace hgl return(CreateRenderWindowGLFW(win,false)); } - RenderWindow *CreateFullscreen(const Display *disp,const VideoMode *vm,const RenderSetup *rs) override + RenderWindow *Create(const Display *disp,const VideoMode *vm,const RenderSetup *rs) override { SetGLFWWindowHint(rs); diff --git a/src/RenderDevice/GLFW/RenderWindowGLFW.cpp b/src/RenderDevice/GLFW/RenderWindowGLFW.cpp index 0dede751..c3647994 100644 --- a/src/RenderDevice/GLFW/RenderWindowGLFW.cpp +++ b/src/RenderDevice/GLFW/RenderWindowGLFW.cpp @@ -28,13 +28,9 @@ namespace hgl void Show()override{glfwShowWindow(glfw_win);} void Hide()override{glfwHideWindow(glfw_win);} - void SetCaption(const OSString &name) override + void SetCaption(const UTF8String &name) override { -#if HGL_OS == HGL_OS_Windows - glfwSetWindowTitle(glfw_win,to_u8(name)); -#else - glfwSetWindowTitle(glfw_win,name); -#endif// + glfwSetWindowTitle(glfw_win,name.c_str()); this->caption=name; }