完成null windows范例
This commit is contained in:
parent
f521af3702
commit
2d68ac7735
@ -1,34 +1,10 @@
|
|||||||
#include<hgl/render/RenderDevice.h>
|
#include<hgl/render/RenderDevice.h>
|
||||||
|
#include<hgl/render/RenderWindow.h>
|
||||||
#include<iostream>
|
#include<iostream>
|
||||||
#include<math.h>
|
#include<GLFW/glfw3.h>
|
||||||
|
|
||||||
using namespace hgl;
|
using namespace hgl;
|
||||||
|
|
||||||
void put(const struct VideoMode *vm)
|
|
||||||
{
|
|
||||||
std::cout<<"\t"<<vm->width<<"x"<<vm->height<<","<<vm->bit<<"bits,"<<vm->freq<<"hz";
|
|
||||||
}
|
|
||||||
|
|
||||||
void put(const struct Display *disp)
|
|
||||||
{
|
|
||||||
const int inch=sqrt((disp->width*disp->width)+(disp->height*disp->height))*0.03937008;
|
|
||||||
|
|
||||||
std::cout<<"["<<disp->name.c_str()<<"]["<<disp->width<<"x"<<disp->height<<" mm,"<<inch<<" inch][offset "<<disp->x<<","<<disp->y<<"]"<<std::endl;
|
|
||||||
|
|
||||||
std::cout<<"\tcurrent video mode: ";
|
|
||||||
put(disp->GetCurVideoMode());
|
|
||||||
std::cout<<std::endl;
|
|
||||||
|
|
||||||
const ObjectList<VideoMode> &vml=disp->GetVideoModeList();
|
|
||||||
|
|
||||||
for(int i=0;i<vml.GetCount();i++)
|
|
||||||
{
|
|
||||||
std::cout<<"\t"<<i<<" : ";
|
|
||||||
put(vml[i]);
|
|
||||||
std::cout<<std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
RenderDevice *device=CreateRenderDeviceGLFW();
|
RenderDevice *device=CreateRenderDeviceGLFW();
|
||||||
@ -45,27 +21,30 @@ int main(void)
|
|||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
WindowSetup ws;
|
||||||
const UTF8String device_name=device->GetName();
|
|
||||||
|
|
||||||
std::cout<<"RenderDevice: "<<device_name.c_str()<<std::endl;
|
ws.Name=U8_TEXT("Null Window");
|
||||||
|
|
||||||
|
RenderSetup rs;
|
||||||
|
|
||||||
|
RenderWindow *win=device->Create(1280,720,&ws,&rs);
|
||||||
|
|
||||||
|
win->Show();
|
||||||
|
|
||||||
|
glClearColor(0,0,0,1);
|
||||||
|
|
||||||
|
while(win->IsOpen())
|
||||||
|
{
|
||||||
|
win->MakeToCurrent();
|
||||||
|
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
|
win->SwapBuffer();
|
||||||
|
win->PollEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Display *> disp_list;
|
delete win;
|
||||||
|
delete device;
|
||||||
device->GetDisplayList(disp_list);
|
|
||||||
|
|
||||||
const int count=disp_list.GetCount();
|
|
||||||
|
|
||||||
std::cout<<"Device have "<<count<<" display."<<std::endl;
|
|
||||||
|
|
||||||
for(int i=0;i<count;i++)
|
|
||||||
{
|
|
||||||
std::cout<<"Display "<<i<<" ";
|
|
||||||
put(GetObject(disp_list,i));
|
|
||||||
|
|
||||||
std::cout<<std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -43,17 +43,17 @@ namespace hgl
|
|||||||
|
|
||||||
// OSString IconFilename; ///<图标文件名称
|
// OSString IconFilename; ///<图标文件名称
|
||||||
// OSString CursorFilename; ///<光标文件名称
|
// OSString CursorFilename; ///<光标文件名称
|
||||||
bool Edge; ///<是否显示边框
|
bool Edge =true; ///<是否显示边框
|
||||||
|
|
||||||
bool SysMenu; ///<是否显示系统菜单
|
bool SysMenu =true; ///<是否显示系统菜单
|
||||||
bool Right; ///<窗口是否使用靠右风格
|
bool Right =false; ///<窗口是否使用靠右风格
|
||||||
|
|
||||||
bool Resize; ///<窗口大小是否可调整
|
bool Resize =false; ///<窗口大小是否可调整
|
||||||
bool Minimize; ///<窗口是否可以最小化
|
bool Minimize =false; ///<窗口是否可以最小化
|
||||||
bool Maximize; ///<窗口是否可以最大化
|
bool Maximize =false; ///<窗口是否可以最大化
|
||||||
|
|
||||||
bool TopMost; ///<永远在最上面
|
bool TopMost =false; ///<永远在最上面
|
||||||
bool AppTaskBar; ///<程序项在任务栏显示
|
bool AppTaskBar =true; ///<程序项在任务栏显示
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user