From cc2fce4c8c0440313aed28c14dfbf492f85482c8 Mon Sep 17 00:00:00 2001 From: hyzboy Date: Tue, 27 Nov 2018 21:05:43 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E5=8E=9F=E6=9C=AC=E7=9A=84?= =?UTF-8?q?=E8=8C=83=E4=BE=8B=E4=B8=BAEnumRenderDevice?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/CMakeLists.txt | 3 +- example/EnumRenderDevice/CMakeLists.txt | 3 ++ example/EnumRenderDevice/main.cpp | 71 +++++++++++++++++++++++++ 3 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 example/EnumRenderDevice/CMakeLists.txt create mode 100644 example/EnumRenderDevice/main.cpp diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index 0b60fbf1..7912cc8d 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -1 +1,2 @@ -add_subdirectory(NullWindow) +add_subdirectory(EnumRenderDevice) +add_subdirectory(NullWindow) diff --git a/example/EnumRenderDevice/CMakeLists.txt b/example/EnumRenderDevice/CMakeLists.txt new file mode 100644 index 00000000..14c7de37 --- /dev/null +++ b/example/EnumRenderDevice/CMakeLists.txt @@ -0,0 +1,3 @@ +add_executable(EnumRenderDevice main.cpp) + +target_link_libraries(EnumRenderDevice PRIVATE MathGeoLib glfw GL ULRE.RenderDevice) diff --git a/example/EnumRenderDevice/main.cpp b/example/EnumRenderDevice/main.cpp new file mode 100644 index 00000000..936a68fe --- /dev/null +++ b/example/EnumRenderDevice/main.cpp @@ -0,0 +1,71 @@ +#include +#include +#include + +using namespace hgl; + +void put(const struct VideoMode *vm) +{ + std::cout<<"\t"<width<<"x"<height<<","<bit<<"bits,"<freq<<"hz"; +} + +void put(const struct Display *disp) +{ + const int inch=sqrt((disp->width*disp->width)+(disp->height*disp->height))*0.03937008; + + std::cout<<"["<name.c_str()<<"]["<width<<"x"<height<<" mm,"<x<<","<y<<"]"<GetCurVideoMode()); + std::cout< &vml=disp->GetVideoModeList(); + + for(int i=0;iInit()) + { + std::cerr<<"Init RenderDevice(GLFW) failed."<GetName(); + + std::cout<<"RenderDevice: "< disp_list; + + device->GetDisplayList(disp_list); + + const int count=disp_list.GetCount(); + + std::cout<<"Device have "<