/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2005 The OGRE Team
Also see acknowledgements in Readme.html
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place - Suite 330, Boston, MA 02111-1307, USA, or go to
http://www.gnu.org/copyleft/lesser.txt.
-----------------------------------------------------------------------------
*/
#include "OgreD3D9RenderWindow.h"
#include "OgreLogManager.h"
#include "OgreViewport.h"
#include "OgreException.h"
#include "OgreD3D9RenderSystem.h"
#include "OgreRenderSystem.h"
#include "OgreBitwise.h"
#include "OgreImageCodec.h"
#include "OgreStringConverter.h"
#include "OgreNoMemoryMacros.h"
#include <d3d9.h>
#include "OgreMemoryMacros.h"
#include "OgreRoot.h"
namespace Ogre
{
// Window procedure callback
// This is a static member, so applies to all windows but we store the
// D3D9RenderWindow instance in the window data GetWindowLog/SetWindowLog
LRESULT D3D9RenderWindow::WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
if (uMsg == WM_CREATE)
{
// copy D3D9RenderWindow* from createwindow param to userdata slot
SetWindowLong(hWnd, GWL_USERDATA,
(LONG)(((LPCREATESTRUCT)lParam)->lpCreateParams));
return 0;
}
D3D9RenderWindow* win =
(D3D9RenderWindow*)GetWindowLong(hWnd, GWL_USERDATA);
if (!win)
return DefWindowProc(hWnd, uMsg, wParam, lParam);
if(win->post(RenderWindowEventW32(hWnd,uMsg, wParam, lParam)))//添加
return 0;
switch( uMsg )
{
case WM_ACTIVATE:
win->mActive = (LOWORD(wParam) != WA_INACTIVE);
break;
case WM_ENTERSIZEMOVE:
win->mSizing = true;
break;
case WM_EXITSIZEMOVE:
win->windowMovedOrResized();
win->mSizing = false;
break;
case WM_MOVE:
case WM_SIZE:
if (!win->mSizing)
win->windowMovedOrResized();
break;
case WM_GETMINMAXINFO:
// Prevent the window from going smaller than some minimu size
((MINMAXINFO*)lParam)->ptMinTrackSize.x = 100;
((MINMAXINFO*)lParam)->ptMinTrackSize.y = 100;
break;
case WM_CLOSE:
win->destroy(); // cleanup and call DestroyWindow
win->mClosed = true;
return 0;
}
return DefWindowProc( hWnd, uMsg, wParam, lParam );
}
D3D9RenderWindow::D3D9RenderWindow(HINSTANCE instance, D3D9Driver *driver, LPDIRECT3DDEVICE9 deviceIfSwapChain):
mInstance(instance),
mDriver(driver)
{
mIsFullScreen = false;
mIsSwapChain = (deviceIfSwapChain != NULL);
mIsExternal = false;
mHWnd = 0;
mActive = false;
mSizing = false;
mClosed = false;
mDisplayFrequency = 0;
}
D3D9RenderWindow::~D3D9RenderWindow()
{
destroy();
}
bool D3D9RenderWindow::_checkMultiSampleQuality(D3DMULTISAMPLE_TYPE type, DWORD *outQuality, D3DFORMAT format, UINT adapterNum, D3DDEVTYPE deviceType, BOOL fullScreen)
{
LPDIRECT3D9 pD3D = mDriver->getD3D();
if (SUCCEEDED(pD3D->CheckDeviceMultiSampleType(
adapterNum,
deviceType, format,
fullScreen, type, outQuality)))
return true;
else
return false;
}
void D3D9RenderWindow::create(const String& name, unsigned int width, unsigned int height,
bool fullScreen, const NameValuePairList *miscParams)
{
HINSTANCE hInst = mInstance;
D3D9Driver* driver = mDriver;
HWND parentHWnd = 0;
HWND externalHandle = 0;
mFSAAType = D3DMULTISAMPLE_NONE;
mFSAAQuality = 0;
mVSync = false;
String title = name;
unsigned int colourDepth = 32;
int left = -1; // Defaults to screen center
int top = -1; // Defaults to screen center
bool depthBuffer = true;
String border = "";
bool outerSize = false;
mUseNVPerfHUD = false;
if(miscParams)
{
// Get variable-length params
NameValuePairList::const_iterator opt;
// left (x)
opt = miscParams->find("left");
if(opt != miscParams->end())
left = StringConverter::parseInt(opt->second);
// top (y)
opt = miscParams->find("top");
if(opt != miscParams->end())
top = StringConverter::parseInt(opt->second);
// Window title
opt = miscParams->find("title");
if(opt != miscParams->end())
title = opt->second;
// parentWindowHandle -> parentHWnd
opt = miscParams->find("parentWindowHandle");
if(opt != miscParams->end())
parentHWnd = (HWND)StringConverter::parseUnsignedInt(opt->second);
// externalWindowHandle -> externalHandle
opt = miscParams->find("externalWindowHandle");
if(opt != miscParams->end())
externalHandle = (HWND)StringConverter::parseUnsignedInt(opt->second);
// vsync [parseBool]
opt = miscParams->find("vsync");
if(opt != miscParams->end())
mVSync = StringConverter::parseBool(opt->second);
// displayFrequency
opt = miscParams->find("displayFrequency");
if(opt != miscParams->end())
mDisplayFrequency = StringConverter::parseUnsignedInt(opt->second);
// colourDepth
opt = miscParams->find("colourDepth");
if(opt != miscParams->end())
colourDepth = StringConverter::parseUnsignedInt(opt->second);
// depthBuffer [parseBool]
opt = miscParams->find("depthBuffer");
if(opt != miscParams->end())
depthBuffer = StringConverter::parseBool(opt->second);
// FSAA type
opt = miscParams->find("FSAA");
if(opt != miscParams->end())
mFSAAType = (D3DMULTISAMPLE_TYPE)StringConverter::parseUnsignedInt(opt->second);
// FSAA quality
opt = miscParams->find("FSAAQuality");
if(opt != miscParams->end())
mFSAAQuality = StringConverter::parseUnsignedInt(opt->second);
// window border style
opt = miscParams->find("border");
if(opt != miscParams->end())
border = opt->second;
// set outer dimensions?
opt = miscParams->find("outerDimensions");
if(opt != miscParams->end())
outerSize = StringConverter::parseBool(opt->second);
// NV perf HUD?
opt = miscParams->find("useNVPerfHUD");
if(opt != miscParams->end())
mUseNVPerfHUD = StringConverter::parseBool(opt->second);
}
// Destroy current window if any
if( mHWnd )
destroy();
if (!externalHandle)
{
DWORD dwStyle = WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
RECT rc;
mWidth = width;
mHeight = height;
mTop = top;
mLeft = left;
if (!fullScreen)
{
if (parentHWnd)
{
dwStyle |= WS_CHILD;
}
else
{
if (border == "none")
dwStyle |= WS_POPUP;
else if (border == "fixed")
dwStyle |= WS_OVERLAPPED | WS_BORDER | WS_CAPTION |
WS_SYSMENU | WS_MINIMIZEBOX;
else
dwStyle |= WS_OVERLAPPEDWINDOW;
}
if (!outerSize)
{
// Calculate window dimensions required
// to get the requested client area
SetRect(&rc, 0, 0, mWidth, mHeight);
AdjustWindowRect(&rc, dwStyle, false);
mWidth = rc.right - rc.left;
mHeight = rc.bottom - rc.top;
// Clamp width and height to the desktop dimensions
int screenw = GetSystemMetrics(SM_CXSCREEN);
int screenh = GetSystemMetrics(SM_CYSCREEN);
if ((int)mWidth > screenw)
mWidth = screenw;
if ((int)mHeight > screenh)
mHeight = screenh;
if (mLef
没有合适的资源?快使用搜索试试~ 我知道了~
Ogre1_2_5CI.zip_ OGRE _Ogre1_2_5CI_ogre_ogre SDK_vc ogre
共340个文件
h:211个
lib:33个
dll:16个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 88 浏览量
2022-09-19
13:31:59
上传
评论
收藏 12.95MB ZIP 举报
温馨提示
OGRE中文解决例子 环境 :VC 8.0 ,OGRE SDK.
资源详情
资源评论
资源推荐
收起资源包目录
Ogre1_2_5CI.zip_ OGRE _Ogre1_2_5CI_ogre_ogre SDK_vc ogre (340个子文件)
Makefile.am 483B
resources.cfg 1KB
resources.cfg 1KB
resources.cfg 1KB
OgreD3D9RenderWindow.cpp 27KB
OgreWin32GLSupport.cpp 18KB
OgreWin32Window.cpp 14KB
OgreCEGUITexture.cpp 8KB
ChineseInput.cpp 7KB
CEGUIChineseInputDependencyW32.cpp 5KB
CEGUIChineseInput.cpp 4KB
CEGUIChineseInputWR.cpp 1KB
CEGUIChineseInputDependency.cpp 866B
Thumbs.db 20KB
CEGUIBase_d.dll 4.09MB
CEGUIBase.dll 1.53MB
CEGUILua_d.dll 1.48MB
CEGUILua.dll 472KB
CEGUIFalagardWRBase_d.dll 304KB
CEGUIExpatParser_d.dll 260KB
CEGUIFalagardWRBase.dll 120KB
CEGUITinyXMLParser_d.dll 120KB
CEGUIExpatParser.dll 116KB
CEGUIXercesParser_d.dll 84KB
CEGUISILLYImageCodec_d.dll 56KB
CEGUITinyXMLParser.dll 52KB
CEGUITGAImageCodec_d.dll 52KB
CEGUIXercesParser.dll 22KB
CEGUISILLYImageCodec.dll 10KB
CEGUITGAImageCodec.dll 9KB
FairChar-30.font 1KB
Commonwealth-10.font 165B
DejaVuSans-10.font 164B
Iconified-12.font 160B
simfang-12.font 158B
simhei.font 153B
fkp-16.font 153B
CEGUIString.h 149KB
CEGUIWindow.h 110KB
CEGUIMultiColumnList.h 45KB
CEGUIFont.h 35KB
CEGUIWindowProperties.h 30KB
CEGUISystem.h 29KB
CEGUICombobox.h 28KB
CEGUIListHeader.h 27KB
CEGUIFalagard_xmlHandler.h 23KB
CEGUIFalDimensions.h 23KB
CEGUIScrollablePane.h 22KB
CEGUIListbox.h 22KB
CEGUIFrameWindow.h 22KB
CEGUIMultiLineEditbox.h 20KB
CEGUIImageset.h 20KB
CEGUIEditbox.h 19KB
CEGUIScrollbar.h 19KB
CEGUIImage.h 17KB
CEGUIItemListBase.h 17KB
CEGUIDragContainer.h 17KB
CEGUITabControl.h 16KB
CEGUIListHeaderSegment.h 15KB
CEGUIWindowFactoryManager.h 15KB
CEGUISpinner.h 15KB
CEGUITooltip.h 14KB
CEGUIWindowManager.h 14KB
CEGUIListboxItem.h 13KB
CEGUIRenderer.h 12KB
ExampleFrameListener.h 12KB
CEGUIInputEvent.h 12KB
CEGUISlider.h 12KB
CEGUIFalWidgetLookFeel.h 12KB
CEGUICoordConverter.h 11KB
OgreRenderWindow.h 10KB
CEGUIScrollablePaneProperties.h 10KB
CEGUIItemListbox.h 10KB
CEGUIFrameWindowProperties.h 10KB
CEGUIScheme.h 10KB
CEGUIMultiColumnListProperties.h 10KB
CEGUIEventSet.h 10KB
CEGUIThumb.h 10KB
OISKeyboard.h 10KB
CEGUIXMLAttributes.h 10KB
CEGUIFalComponentBase.h 10KB
CEGUIEditboxProperties.h 9KB
CEGUIFalSectionSpecification.h 9KB
CEGUIScrolledContainer.h 9KB
CEGUIFalImagerySection.h 9KB
CEGUIMouseCursor.h 9KB
CEGUILua.h 9KB
CEGUIFalWidgetLookManager.h 8KB
CEGUIItemEntry.h 8KB
CEGUIScriptModule.h 8KB
CEGUIComboboxProperties.h 8KB
CEGUIPopupMenu.h 8KB
CEGUIFalEnums.h 8KB
CEGUIFalTextComponent.h 8KB
CEGUIScheme_xmlHandler.h 8KB
CEGUIFontManager.h 8KB
CEGUIGUILayout_xmlHandler.h 8KB
CEGUIcolour.h 8KB
CEGUIMenuItem.h 8KB
CEGUIImagesetManager.h 8KB
共 340 条
- 1
- 2
- 3
- 4
APei
- 粉丝: 63
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0