本文整理汇总了C++中OnResize函数的典型用法代码示例。如果您正苦于以下问题:C++ OnResize函数的具体用法?C++ OnResize怎么用?C++ OnResize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OnResize函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GetBarStyle
void CEGControlBar::OnSize(UINT nType, int cx, int cy)
{
CControlBar::OnSize(nType, cx, cy);
DWORD dwStyle = GetBarStyle();
if ( (dwStyle & CBRS_LEFT ) == CBRS_LEFT ) {
m_dragRect.SetRect( cx - SPLITTER_SIZE, 0, cx, cy);
} else if ( (dwStyle & CBRS_RIGHT ) == CBRS_RIGHT ) {
m_dragRect.SetRect( 0, 0, SPLITTER_SIZE, cy);
} else if ( (dwStyle & CBRS_TOP ) == CBRS_TOP ) {
m_dragRect.SetRect( 0, cy - SPLITTER_SIZE, cx, cy);
} else {
m_dragRect.SetRect( 0, 0, cx, SPLITTER_SIZE);
}
CRect rc;
GetInsideRect( rc );
OnResize ( rc );
}
开发者ID:AnthonyNystrom,项目名称:GenXSource,代码行数:19,代码来源:EGCtrlBar.cpp
示例2: SetWindowPos
void D3D11App::SwitchResolution()
{
SettingsData lSettings = *Settings->GetData();
mcWidth = lSettings.mWidth;
mcHeight = lSettings.mHeight;
BOOL lpIsFullscreen = (BOOL)lSettings.mIsFullscreen;
mDirect3D->GetSwapChain()->GetFullscreenState(&mIsFullscreen, nullptr);
// Resize window and set window position at center of screen
if (!mIsFullscreen)
{
SetWindowPos(mhMainWnd, HWND_TOP,
static_cast<int>((GetSystemMetrics(SM_CXSCREEN)*0.5) - (mcWidth*0.5)),
static_cast<int>((GetSystemMetrics(SM_CYSCREEN)*0.5) - (mcHeight*0.5)),
mcWidth, mcHeight, SWP_FRAMECHANGED);
}
OnResize();
}
开发者ID:Gnidleif,项目名称:3D_Project,代码行数:19,代码来源:D3D11App.cpp
示例3: CMGControl
//---------------------------------------------------------------------------//
// Constructor
//
//---------------------------------------------------------------------------//
CMGFXFilters::CMGFXFilters(CMGControl *pParent, CMGEffect *pEffect) : CMGControl(pParent, 0,0,0,0)
{
m_Align = MGALIGN_CLIENT;
m_FilterVars = NULL;
m_PanelSup = NEW CMGPanel(this, 0,0,0,118, MGALIGN_TOP);
m_PanelInf = NEW CMGPanel(this, 0,0,0,0, MGALIGN_CLIENT);
m_LBFilters = NEW CMGListBox(m_PanelSup, 1,0,294,81, MGALIGN_NONE, true);
m_LBFilters->m_OnSelectItem = boost::bind(&CMGFXFilters::OnSelectFilter,this,_1);
for (size_t i = 0; i < g_pAppMain->FilterList().size(); i++)
m_LBFilters->Add(g_pAppMain->FilterList()[i]);
// Filter slots
for (int i = 0; i < MAX_FILTERS; i++)
m_FXFilter[i] = NEW CMGFXFilter(m_PanelSup, this, pEffect, 1+59*i, 82, i);
OnResize();
}
开发者ID:EQ4,项目名称:neonv2,代码行数:23,代码来源:MGFXFilters.cpp
示例4: switch
LRESULT D3DWnd::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_PAINT:
{
OnRender();
}
break;
case WM_SIZE:
{
OnResize(LOWORD(lParam),HIWORD(lParam));
}
break;
default:
break;
}
return WindowWnd::OnSysMessage(uMsg,wParam,lParam);
}
开发者ID:yearling,项目名称:YYUI,代码行数:19,代码来源:D2DWnd.cpp
示例5: Resize
void Resize(UPixelScalar width, UPixelScalar height) {
AssertNoneLocked();
AssertThread();
#ifndef USE_GDI
if (width == GetWidth() && height == GetHeight())
return;
size = { width, height };
Invalidate();
OnResize(size);
#else /* USE_GDI */
::SetWindowPos(hWnd, nullptr, 0, 0, width, height,
SWP_NOMOVE | SWP_NOZORDER |
SWP_NOACTIVATE | SWP_NOOWNERZORDER);
// XXX store new size?
#endif
}
开发者ID:Adrien81,项目名称:XCSoar,代码行数:19,代码来源:Window.hpp
示例6: switch
int View3D::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg) {
case WM_MOUSEMOVE:
OnMouseMove(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
return 0;
case WM_LBUTTONUP:
OnLButtonUp(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
return 0;
case WM_LBUTTONDOWN:
OnLButtonDown(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
return 0;
case WM_RBUTTONUP:
OnRButtonUp(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
return 0;
case WM_RBUTTONDOWN:
OnRButtonDown(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
return 0;
// case WM_MOUSEWHEEL:
// OnMouseWheel(GET_WHEEL_DELTA_WPARAM(wParam));
// return 0;
case WM_SIZE:
OnResize(LOWORD(lParam), HIWORD(lParam));
return 0;
// case WM_PAINT:
// RenderScene();
// return 0;
case WM_DESTROY:
Destroy();
return 0;
}
return (int)DefWindowProc(hWnd, uMsg, wParam, lParam);
}
开发者ID:olegp,项目名称:v3d,代码行数:42,代码来源:View3D.cpp
示例7: if
void HexEditorCtrl::OnMouseRight( wxMouseEvent& event ){
if(event.GetEventObject() == hex_ctrl)
LastRightClickAt = hex_ctrl->PixelCoordToInternalPosition( event.GetPosition() )/2;
else if(event.GetEventObject() == text_ctrl)
LastRightClickAt = text_ctrl->PixelCoordToInternalPosition( event.GetPosition() );
else if( event.GetEventObject() == offset_ctrl)
{
//m_static_offset->SetLabel( offset_ctrl->hex_offset==true ? _("Offset: DEC") : _("Offset: HEX"));
//event.Skip(true);
offset_ctrl->OnMouseRight( event );
int x,y;
DoGetSize(&x,&y);
wxSizeEvent mevent(wxSize(x,y));
OnResize(mevent);
return;//to avoid ShowContextMenu
}
else
std::cout << "Right click captured without ctrl!\n";
ShowContextMenu( event );
}
开发者ID:sustmi,项目名称:sus107-dt,代码行数:20,代码来源:HexEditorCtrl.cpp
示例8: glEnable
void LoadingObjDemo::Initialize()
{
glEnable(GL_DEPTH_TEST);
glClearColor(0.4f, 0.7f, 0.2f, 1.0f);
PrintUniformInfo();
program.Initialize();
program.AddShaderFile(ShaderType::Vertex, "Assets/Shaders/Vertex/uniforms.vert");
program.AddShaderFile(ShaderType::Fragment, "Assets/Shaders/Fragment/uniforms.frag");
program.Build();
input->addBinding(GLFW_KEY_LEFT, [this](InputInfo info){
camera->MoveLeft();
program.UpdateUniformBlock("TransformBlock");
});
input->addBinding(GLFW_KEY_RIGHT, [this](InputInfo info) {
camera->MoveRight();
program.UpdateUniformBlock("TransformBlock");
});
input->addBinding(GLFW_KEY_UP, [this](InputInfo info) {
camera->MoveForward();
program.UpdateUniformBlock("TransformBlock");
});
input->addBinding(GLFW_KEY_DOWN, [this](InputInfo info) {
camera->MoveBack();
program.UpdateUniformBlock("TransformBlock");
});
UniformBufferBlock uniformBufferBlock("TransformBlock", {
{ "TransformBlock.projection",&camera->GetProjection()[0][0],sizeof(mat4) },
{ "TransformBlock.view",&camera->GetView()[0][0],sizeof(mat4) },
});
program.AddUniformBlock(uniformBufferBlock);
InitializeObj("Assets/Models/Obj/monkey.obj");
OnResize(width, height);
}
开发者ID:DarriusWrightGD,项目名称:GraphicsProgramming,代码行数:41,代码来源:LoadingObjDemo.cpp
示例9: BuildUi
void LobbyState::SetServerData(ServerData data)
{
mServerData = data;
if(mDatabase->GetPublicIp() == data.publicIp)
mClient->ConnectToServer(data.localIp);
else
mClient->ConnectToServer(data.publicIp);
mClient->SetServerData(mServerData);
float chatWidth = 600;
float chatHeight = 250;
mClient->GetChat()->SetDimensions(GLib::GetClientWidth()/2-chatWidth/2, GLib::GetClientHeight() - chatHeight - 100, chatWidth, chatHeight);
mIsHost = mClient->GetName() == mServerData.host ? true : false;
// [NOTE][HACK]
BuildUi();
OnResize(GLib::GetClientWidth(), GLib::GetClientHeight());
}
开发者ID:simplerr,项目名称:Project-Warlock,代码行数:21,代码来源:LobbyState.cpp
示例10: OnResize
bool Window::FilterEvent(const Event& event)
{
// Notify the input object
myInput.OnEvent(event);
// Notify resize events to the derived class
if (event.Type == Event::Resized)
OnResize();
// Don't forward to the user MouseMove events generated by SetCursorPosition
if ((event.Type == Event::MouseMoved) &&
(event.MouseMove.X == mySetCursorPosX) &&
(event.MouseMove.Y == mySetCursorPosY))
{
mySetCursorPosX = 0xFFFF;
mySetCursorPosY = 0xFFFF;
return false;
}
return true;
}
开发者ID:vidjogamer,项目名称:ProjectTemplate,代码行数:21,代码来源:Window.cpp
示例11: TFormMachine
//---------------------------------------------------------------------------
__fastcall TFormTriplet::TFormTriplet(TComponent* Owner,
TFormSimStagecraftMain * const formParent)
: TFormMachine(Owner,formParent),
mTriplet(boost::shared_ptr<Triplet>(new Triplet))
{
//Control
//Connect
mSocket220_1 = boost::shared_ptr<Socket220Control>(
new Socket220Control(this,mTriplet->mSocket220_1,ImageSocket220_1));
mSocket220_2 = boost::shared_ptr<Socket220Control>(
new Socket220Control(this,mTriplet->mSocket220_2,ImageSocket220_2));
mSocket220_3 = boost::shared_ptr<Socket220Control>(
new Socket220Control(this,mTriplet->mSocket220_3,ImageSocket220_3));
mPlug220 = boost::shared_ptr<Plug220Control>(
new Plug220Control(this,mTriplet->mPlug,ImagePlug220));
CreateWatermark(ImageView,ImageWatermark);
OnResize(0);
}
开发者ID:RLED,项目名称:ProjectRichelBilderbeek,代码行数:22,代码来源:UnitFormTriplet.cpp
示例12: while
void Window::Update(void)
{
XEvent event;
// Obtenemos y procesamos los eventos de ventana
long mascaraWindow = EnterWindowMask | LeaveWindowMask | FocusChangeMask | ResizeRedirectMask ;
while (XCheckMaskEvent(Small::Window::Instance().dpy, mascaraWindow, &event))
{
switch(event.type)
{
case FocusIn:
OnFocusIn();
break;
case FocusOut:
OnFocusOut();
break;
case ConfigureNotify:
OnResize(event.xconfigure.width, event.xconfigure.height);
break;
};
};
};
开发者ID:libercv,项目名称:smallengine,代码行数:22,代码来源:linuxwindow.cpp
示例13: sizeof
void cMainWindow::LoadWindowPosition()
{
int iShowCmd = 0;
int iX = 0;
int iY = 0;
int iWidth = 0;
int iHeight = 0;
iShowCmd = SW_SHOWNORMAL;
iWidth = 1080;
iHeight = 720;
/*if (settings.GetWindowStateAndPosition(TEXT("Window"), TEXT("Show"), iShowCmd, iX, iY, iWidth, iHeight))*/ {
// Get a handle to the monitor
const POINT position = { iX, iY };
HMONITOR hMonitor = ::MonitorFromPoint(position, MONITOR_DEFAULTTONEAREST);
// Get the monitor info
MONITORINFO monInfo;
monInfo.cbSize = sizeof(MONITORINFO);
if (::GetMonitorInfo(hMonitor, &monInfo) == 0) {
LOG<<TEXT("cMainWindow::LoadWindowPosition GetMonitorInfo FAILED, returning")<<std::endl;
return;
}
// Adjust for work area
iX += monInfo.rcWork.left - monInfo.rcMonitor.left;
iY += monInfo.rcWork.top - monInfo.rcMonitor.top;
// Ensure top left point is on screen
const POINT point = { iX, iY };
if (::PtInRect(&monInfo.rcWork, point) == FALSE ) {
iX = monInfo.rcWork.left;
iY = monInfo.rcWork.top;
}
::SetWindowPos(hwndWindow, NULL, iX, iY, iWidth, iHeight, iShowCmd);
}
OnResize(iWidth, iHeight);
}
开发者ID:pilkch,项目名称:diesel,代码行数:38,代码来源:win32mmapplication.cpp
示例14: switch
LRESULT CALLBACK SystemWindow::LocalWndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
switch(msg)
{
case WM_SIZE:
OnResize(static_cast<u32>(LOWORD(lparam)), static_cast<u32>(HIWORD(lparam)), static_cast<window::WINDOW_RESIZE_STATE>(wparam));
break;
case WM_MOVE:
OnMove(static_cast<u32>(LOWORD(lparam)), static_cast<u32>(HIWORD(lparam)));
break;
case WM_CLOSE:
OnClose();
break;
case WM_DESTROY:
OnDestroy();
break;
default:
//We don't handle the message so let the Default Window Proc handle it
return DefWindowProcW(hwnd, msg, wparam, lparam);
}
return 0;
}
开发者ID:chongtianfeiyu,项目名称:Landan,代码行数:23,代码来源:SystemWindow.cpp
示例15: while
void EmuWindow_SDL2::PollEvents() {
SDL_Event event;
// SDL_PollEvent returns 0 when there are no more events in the event queue
while (SDL_PollEvent(&event)) {
switch (event.type) {
case SDL_WINDOWEVENT:
switch (event.window.event) {
case SDL_WINDOWEVENT_SIZE_CHANGED:
case SDL_WINDOWEVENT_RESIZED:
case SDL_WINDOWEVENT_MAXIMIZED:
case SDL_WINDOWEVENT_RESTORED:
case SDL_WINDOWEVENT_MINIMIZED:
OnResize();
break;
case SDL_WINDOWEVENT_CLOSE:
is_open = false;
break;
}
break;
case SDL_KEYDOWN:
case SDL_KEYUP:
OnKeyEvent(static_cast<int>(event.key.keysym.scancode), event.key.state);
break;
case SDL_MOUSEMOTION:
OnMouseMotion(event.motion.x, event.motion.y);
break;
case SDL_MOUSEBUTTONDOWN:
case SDL_MOUSEBUTTONUP:
OnMouseButton(event.button.button, event.button.state, event.button.x, event.button.y);
break;
case SDL_QUIT:
is_open = false;
break;
}
}
}
开发者ID:JamePeng,项目名称:citra,代码行数:37,代码来源:emu_window_sdl2.cpp
示例16: switch
//.........这里部分代码省略.........
OnKeyDown(Event->key.keysym.sym,Event->key.keysym.mod,Event->key.keysym.unicode);
break;
}
case SDL_KEYUP: {
OnKeyUp(Event->key.keysym.sym,Event->key.keysym.mod,Event->key.keysym.unicode);
break;
}
case SDL_MOUSEMOTION: {
OnMouseMove(Event->motion.x,Event->motion.y,Event->motion.xrel,Event->motion.yrel,(Event->motion.state&SDL_BUTTON(SDL_BUTTON_LEFT))!=0,(Event->motion.state&SDL_BUTTON(SDL_BUTTON_RIGHT))!=0,(Event->motion.state&SDL_BUTTON(SDL_BUTTON_MIDDLE))!=0);
break;
}
case SDL_MOUSEBUTTONDOWN: {
switch(Event->button.button) {
case SDL_BUTTON_LEFT: {
OnLButtonDown(Event->button.x,Event->button.y);
break;
}
case SDL_BUTTON_RIGHT: {
OnRButtonDown(Event->button.x,Event->button.y);
break;
}
case SDL_BUTTON_MIDDLE: {
OnMButtonDown(Event->button.x,Event->button.y);
break;
}
}
break;
}
case SDL_MOUSEBUTTONUP: {
switch(Event->button.button) {
case SDL_BUTTON_LEFT: {
OnLButtonUp(Event->button.x,Event->button.y);
break;
}
case SDL_BUTTON_RIGHT: {
OnRButtonUp(Event->button.x,Event->button.y);
break;
}
case SDL_BUTTON_MIDDLE: {
OnMButtonUp(Event->button.x,Event->button.y);
break;
}
}
break;
}
case SDL_JOYAXISMOTION: {
OnJoyAxis(Event->jaxis.which,Event->jaxis.axis,Event->jaxis.value);
break;
}
case SDL_JOYBALLMOTION: {
OnJoyBall(Event->jball.which,Event->jball.ball,Event->jball.xrel,Event->jball.yrel);
break;
}
case SDL_JOYHATMOTION: {
OnJoyHat(Event->jhat.which,Event->jhat.hat,Event->jhat.value);
break;
}
case SDL_JOYBUTTONDOWN: {
OnJoyButtonDown(Event->jbutton.which,Event->jbutton.button);
break;
}
case SDL_JOYBUTTONUP: {
OnJoyButtonUp(Event->jbutton.which,Event->jbutton.button);
break;
}
case SDL_QUIT: {
OnExit();
break;
}
case SDL_SYSWMEVENT: {
//Ignore
break;
}
case SDL_VIDEORESIZE: {
OnResize(Event->resize.w,Event->resize.h);
break;
}
case SDL_VIDEOEXPOSE: {
OnExpose();
break;
}
default: {
OnUser(Event->user.type,Event->user.code,Event->user.data1,Event->user.data2);
break;
}
}
}
开发者ID:wadaahmad,项目名称:picture-puzzle,代码行数:101,代码来源:CEvent.cpp
示例17: wxFrame
//.........这里部分代码省略.........
p1label = new wxStaticText(scroll_pane, wxID_ANY, wxT("Punkt 1:"));
p1xedit = new wxTextCtrl(scroll_pane, ID_CUT_TRI_EDIT);
p1yedit = new wxTextCtrl(scroll_pane, ID_CUT_TRI_EDIT);
p1zedit = new wxTextCtrl(scroll_pane, ID_CUT_TRI_EDIT);
p2label = new wxStaticText(scroll_pane, wxID_ANY, wxT("Punkt 2:"));
p2xedit = new wxTextCtrl(scroll_pane, ID_CUT_TRI_EDIT);
p2yedit = new wxTextCtrl(scroll_pane, ID_CUT_TRI_EDIT);
p2zedit = new wxTextCtrl(scroll_pane, ID_CUT_TRI_EDIT);
p3label = new wxStaticText(scroll_pane, wxID_ANY, wxT("Punkt 3:"));
p3xedit = new wxTextCtrl(scroll_pane, ID_CUT_TRI_EDIT);
p3yedit = new wxTextCtrl(scroll_pane, ID_CUT_TRI_EDIT);
p3zedit = new wxTextCtrl(scroll_pane, ID_CUT_TRI_EDIT);
optionslbl = new wxStaticText(scroll_pane, wxID_ANY, wxT("Optionen:"));
widthHeightlbl = new wxStaticText(scroll_pane, wxID_ANY,
wxT("Breite/Höhe:"));
imgWidthEdit = new wxSpinCtrl(scroll_pane, ID_CUT_TRI_EDIT);
imgHeightEdit = new wxSpinCtrl(scroll_pane, ID_CUT_TRI_EDIT);
mmperpixellabel = new wxStaticText(scroll_pane, wxID_ANY,
wxT("Maßstab (mm/px):"));
mmperpixeledit = new wxTextCtrl(scroll_pane, ID_CUT_TRI_EDIT);
threadcountlbl = new wxStaticText(scroll_pane, wxID_ANY,
wxT("CPU-Threads:"));
core_count = thread::hardware_concurrency();
threadcountedit = new wxSpinCtrl(scroll_pane, wxID_ANY);
calcbt = new wxButton(scroll_pane, ID_RENDER_CUT_BT, wxT("Analysieren"));
export_img_bt = new wxButton(scroll_pane, ID_EXPORT_CUT_IMG_BT,
wxT("Export (.png)..."));
export_csv_bt = new wxButton(scroll_pane, ID_EXPORT_CUT_CSV_BT,
wxT("Export (.csv)..."));
scalelbl = new wxStaticText(scroll_pane, wxID_ANY, wxT("Temperaturskala:"));
scalemodelbl = new wxStaticText(scroll_pane, wxID_ANY, wxT("Modus/ΔT:"));
scalemodecb = new wxComboBox(scroll_pane, ID_COLORSCALE_PROP, wxT(""),
wxDefaultPosition, wxDefaultSize, 0, NULL,
wxCB_READONLY | wxCB_DROPDOWN);
scalemodecb->Insert(wxT("Vertikal"), 0);
scalemodecb->Insert(wxT("Horizontal"), 0);
scalemodecb->Insert(wxT("Kein"), 0);
scalefontpropslbl = new wxStaticText(scroll_pane, wxID_ANY,
wxT("Schriftgröße/Farbe:"));
scalefontsizeedit = new wxSpinCtrl(scroll_pane, ID_COLORSCALE_PROP);
scalefontcolorbt = new wxButton(scroll_pane, ID_COLORSCALE_COLORBT,
wxT("Text"));
scalestepedit = new wxSpinCtrl(scroll_pane, ID_COLORSCALE_PROP);
//Initialisieren der Temperaturverteilung
value_img = new float[1];
//Initialisieren Grafik zur Temperaturverteilung
image = new wxImage(100, 100, true);
canvas->setImage(image);
canvas->setValueImg(value_img);
//getrennte Initialisierung für wxMSW erforderlich
p1xedit->SetValue(wxT("0.0"));
p1yedit->SetValue(wxT("0.0"));
p1zedit->SetValue(wxT("0.0"));
p2xedit->SetValue(wxT("1.0"));
p2yedit->SetValue(wxT("0.0"));
p2zedit->SetValue(wxT("0.0"));
p3xedit->SetValue(wxT("0.0"));
p3yedit->SetValue(wxT("1.0"));
p3zedit->SetValue(wxT("0.0"));
imgWidthEdit->SetRange(1, 100000000);
imgWidthEdit->SetValue(800);
imgHeightEdit->SetRange(1, 100000000);
imgHeightEdit->SetValue(600);
threadcountedit->SetRange(1, 1000);
threadcountedit->SetValue(core_count);
mmperpixeledit->SetValue(wxT("15.0"));
scalemodecb->Select(GUIColorScalePanel::SCM_HORIZONTAL);
scalestepedit->SetRange(1, 1000);
scalestepedit->SetValue(12);
scalefontsizeedit->SetRange(1, 1000);
scalefontsizeedit->SetValue(12);
scalefontcolorbt->SetForegroundColour(
canvas->getScalePanel()->getTextColor());
//update der Oberfläche auslösen
p1xedit->SetValue(p1xedit->GetValue());
//Neupositionierung der Oberflächenkomponenten für wxMSW
wxSizeEvent evt;
OnResize(evt);
}
开发者ID:vroland,项目名称:SimpleAnalyzer,代码行数:101,代码来源:GUICutRenderWindow.cpp
示例18: OnResize
void GCamera::FarthestPlane(float farthest)
{
mFarthest = farthest;
OnResize(mClientWidth, mClientHeight);
}
开发者ID:shuhuai,项目名称:DeferredShadingD3D12,代码行数:5,代码来源:CameraManager.cpp
示例19: defined
//.........这里部分代码省略.........
0, // no software device
createDeviceFlags,
0, 0, // default feature level array
D3D11_SDK_VERSION,
&md3dDevice,
&featureLevel,
&md3dImmediateContext);
if( FAILED(hr) )
{
MessageBox(0, L"D3D11CreateDevice Failed.", 0, 0);
return false;
}
if( featureLevel != D3D_FEATURE_LEVEL_11_0 )
{
MessageBox(0, L"Direct3D Feature Level 11 unsupported.", 0, 0);
return false;
}
// Check 4X MSAA quality support for our back buffer format.
// All Direct3D 11 capable devices support 4X MSAA for all render
// target formats, so we only need to check quality support.
HR(md3dDevice->CheckMultisampleQualityLevels(
DXGI_FORMAT_R8G8B8A8_UNORM, 4, &m4xMsaaQuality));
assert( m4xMsaaQuality > 0 );
// Fill out a DXGI_SWAP_CHAIN_DESC to describe our swap chain.
DXGI_SWAP_CHAIN_DESC sd;
ZeroMemory(&sd, sizeof(DXGI_SWAP_CHAIN_DESC));
sd.BufferDesc.Width = mClientWidth;
sd.BufferDesc.Height = mClientHeight;
sd.Windowed = true;
sd.BufferDesc.RefreshRate.Numerator = m_MonitorNumerator;
sd.BufferDesc.RefreshRate.Denominator = m_MonitorDenumerator;
sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
sd.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
sd.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
// Use 4X MSAA?
if( mEnable4xMsaa )
{
sd.SampleDesc.Count = 4;
sd.SampleDesc.Quality = m4xMsaaQuality-1;
}
// No MSAA
else
{
sd.SampleDesc.Count = 1;
sd.SampleDesc.Quality = 0;
}
sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
sd.BufferCount = 1;
sd.OutputWindow = mhMainWnd;
sd.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
sd.Flags = 0;
// To correctly create the swap chain, we must use the IDXGIFactory that was
// used to create the device. If we tried to use a different IDXGIFactory instance
// (by calling CreateDXGIFactory), we get an error: "IDXGIFactory::CreateSwapChain:
// This function is being called with a device from a different IDXGIFactory."
IDXGIDevice* dxgiDevice = 0;
HR(md3dDevice->QueryInterface(__uuidof(IDXGIDevice), (void**)&dxgiDevice));
IDXGIAdapter* dxgiAdapter = 0;
HR(dxgiDevice->GetParent(__uuidof(IDXGIAdapter), (void**)&dxgiAdapter));
IDXGIFactory* dxgiFactory = 0;
HR(dxgiAdapter->GetParent(__uuidof(IDXGIFactory), (void**)&dxgiFactory));
HR(dxgiFactory->CreateSwapChain(md3dDevice, &sd, &mSwapChain));
//Disable Alt-Enter Sequence
dxgiFactory->MakeWindowAssociation(mhMainWnd, DXGI_MWA_NO_ALT_ENTER);
ReleaseCOM(dxgiDevice);
ReleaseCOM(dxgiAdapter);
ReleaseCOM(dxgiFactory);
// The remaining steps that need to be carried out for d3d creation
// also need to be executed every time the window is resized. So
// just call the OnResize method here to avoid code duplication.
OnResize();
if (mFullScreen){ mSwapChain->SetFullscreenState(true, NULL); }
return true;
}
开发者ID:JustinMorritt,项目名称:Motherboard-Meltdown,代码行数:101,代码来源:d3dApp.cpp
示例20: SetCursor
LRESULT D3DApp::MsgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
if (msg == WM_SETCURSOR && LOWORD(lParam) == HTCLIENT && !mCursorOn)
{
SetCursor(NULL);
return TRUE;
}
switch( msg )
{
// WM_ACTIVATE is sent when the window is activated or deactivated.
// We pause the game when the window is deactivated and unpause it
// when it becomes active.
case WM_ACTIVATE:
if( LOWORD(wParam) == WA_INACTIVE )
{
mAppPaused = true;
mTimer.Stop();
}
else
{
mAppPaused = false;
mTimer.Start();
}
return 0;
// WM_SIZE is sent when the user resizes the window.
case WM_SIZE:
// Save the new client area dimensions.
mClientWidth = LOWORD(lParam);
mClientHeight = HIWORD(lParam);
if( md3dDevice )
{
if( wParam == SIZE_MINIMIZED )
{
if (mFullScreen)mSwapChain->SetFullscreenState(false, NULL);
mAppPaused = true;
mMinimized = true;
mMaximized = false;
}
else if( wParam == SIZE_MAXIMIZED )
{
if (mFullScreen)mSwapChain->SetFullscreenState(true, NULL);
mAppPaused = false;
mMinimized = false;
mMaximized = true;
OnResize();
}
else if( wParam == SIZE_RESTORED )
{
// Restoring from minimized state?
if( mMinimized )
{
if(mFullScreen)mSwapChain->SetFullscreenState(true, NULL);
mAppPaused = false;
mMinimized = false;
OnResize();
}
// Restoring from maximized state?
else if( mMaximized )
{
mAppPaused = false;
mMaximized = false;
OnResize();
}
else if( mResizing )
{
// If user is dragging the resize bars, we do not resize
// the buffers here because as the user continuously
// drags the resize bars, a stream of WM_SIZE messages are
// sent to the window, and it would be pointless (and slow)
// to resize for each WM_SIZE message received from dragging
// the resize bars. So instead, we reset after the user is
// done resizing the window and releases the resize bars, which
// sends a WM_EXITSIZEMOVE message.
}
else // API call such as SetWindowPos or mSwapChain->SetFullscreenState.
{
OnResize();
}
}
}
return 0;
// WM_EXITSIZEMOVE is sent when the user grabs the resize bars.
case WM_ENTERSIZEMOVE:
mAppPaused = true;
mResizing = true;
mTimer.Stop();
return 0;
// WM_EXITSIZEMOVE is sent when the user releases the resize bars.
// Here we reset everything based on the new window dimensions.
case WM_EXITSIZEMOVE:
mAppPaused = false;
mResizing = false;
mTimer.Start();
//.........这里部分代码省略.........
开发者ID:JustinMorritt,项目名称:Motherboard-Meltdown,代码行数:101,代码来源:d3dApp.cpp
注:本文中的OnResize函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论