更新windows支持,现vs2017已可编译通过

This commit is contained in:
hyzboy 2018-11-30 17:25:58 +08:00
parent 4fb13ced34
commit 623ca91c55
8 changed files with 22 additions and 17 deletions

View File

@ -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)

View File

@ -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(); //切换当前窗口到前台

View File

@ -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();

View File

@ -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(); //切换当前窗口到前台

View File

@ -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的渲染设备

View File

@ -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: //被实际操作系统接口层所调用的函数,在不了解的情况下请不要使用

View File

@ -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);

View File

@ -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;
}