本文整理汇总了C++中GetObject函数的典型用法代码示例。如果您正苦于以下问题:C++ GetObject函数的具体用法?C++ GetObject怎么用?C++ GetObject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetObject函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GetObject
bool GameFactory::DestroyInstance(NetworkID id)
{
FactoryObject reference = GetObject(id);
DestroyInstance(reference);
return true;
}
开发者ID:TheMw3Wolv,项目名称:Vault-Tec-Multiplayer-Mod,代码行数:6,代码来源:GameFactory.cpp
示例2: SaveBmp
//把HBITMAP保存成位图
BOOL SaveBmp(HBITMAP hBitmap, LPCWSTR FileName)
{
HDC hDC;
//当前分辨率下每象素所占字节数
int iBits;
//位图中每象素所占字节数
WORD wBitCount;
//定义调色板大小, 位图中像素字节大小 ,位图文件大小 , 写入文件字节数
DWORD dwPaletteSize=0, dwBmBitsSize=0, dwDIBSize=0, dwWritten=0;
//位图属性结构
BITMAP Bitmap;
//位图文件头结构
BITMAPFILEHEADER bmfHdr;
//位图信息头结构
BITMAPINFOHEADER bi;
//指向位图信息头结构
LPBITMAPINFOHEADER lpbi;
//定义文件,分配内存句柄,调色板句柄
HANDLE fh, hDib, hPal,hOldPal=NULL;
//计算位图文件每个像素所占字节数
hDC = CreateDC( _T( "DISPLAY" ), NULL, NULL, NULL);
iBits = GetDeviceCaps(hDC, BITSPIXEL) * GetDeviceCaps(hDC, PLANES);
DeleteDC(hDC);
if (iBits <= 1) wBitCount = 1;
else if (iBits <= 4) wBitCount = 4;
else if (iBits <= 8) wBitCount = 8;
else wBitCount = 24;
GetObject(hBitmap, sizeof(Bitmap), (LPSTR)&Bitmap);
bi.biSize = sizeof(BITMAPINFOHEADER);
bi.biWidth = Bitmap.bmWidth;
bi.biHeight = Bitmap.bmHeight;
bi.biPlanes = 1;
bi.biBitCount = wBitCount;
bi.biCompression = BI_RGB;
bi.biSizeImage = 0;
bi.biXPelsPerMeter = 0;
bi.biYPelsPerMeter = 0;
bi.biClrImportant = 0;
bi.biClrUsed = 0;
dwBmBitsSize = ((Bitmap.bmWidth * wBitCount + 31) / 32) * 4 * Bitmap.bmHeight;
//为位图内容分配内存
hDib = GlobalAlloc(GHND,dwBmBitsSize + dwPaletteSize + sizeof(BITMAPINFOHEADER));
lpbi = (LPBITMAPINFOHEADER)GlobalLock(hDib);
*lpbi = bi;
// 处理调色板
hPal = GetStockObject(DEFAULT_PALETTE);
if (hPal)
{
hDC = ::GetDC(NULL);
hOldPal = ::SelectPalette(hDC, (HPALETTE)hPal, FALSE);
RealizePalette(hDC);
}
// 获取该调色板下新的像素值
GetDIBits(hDC, hBitmap, 0, (UINT) Bitmap.bmHeight, (LPSTR)lpbi + sizeof(BITMAPINFOHEADER)
+dwPaletteSize, (BITMAPINFO *)lpbi, DIB_RGB_COLORS);
//恢复调色板
if (hOldPal)
{
::SelectPalette(hDC, (HPALETTE)hOldPal, TRUE);
RealizePalette(hDC);
::ReleaseDC(NULL, hDC);
}
//创建位图文件
fh = CreateFile( FileName, GENERIC_WRITE,0, NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL );
if (fh == INVALID_HANDLE_VALUE) return FALSE;
// 设置位图文件头
bmfHdr.bfType = 0x4D42; // "BM"
dwDIBSize = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + dwPaletteSize + dwBmBitsSize;
bmfHdr.bfSize = dwDIBSize;
bmfHdr.bfReserved1 = 0;
bmfHdr.bfReserved2 = 0;
bmfHdr.bfOffBits = (DWORD)sizeof(BITMAPFILEHEADER) + (DWORD)sizeof(BITMAPINFOHEADER) + dwPaletteSize;
// 写入位图文件头
WriteFile(fh, (LPSTR)&bmfHdr, sizeof(BITMAPFILEHEADER), &dwWritten, NULL);
// 写入位图文件其余内容
WriteFile(fh, (LPSTR)lpbi, dwDIBSize, &dwWritten, NULL);
//清除
GlobalUnlock(hDib);
GlobalFree(hDib);
CloseHandle(fh);
return TRUE;
}
开发者ID:Roger8,项目名称:win32-screencapture,代码行数:91,代码来源:GetPicApp.cpp
示例3: GetObject
int CxSkinButton::GetBitmapWidth (HBITMAP hBitmap)
{ BITMAP bm; GetObject(hBitmap,sizeof(BITMAP),(PSTR)&bm); return bm.bmWidth;}
开发者ID:BackupTheBerlios,项目名称:nextemf,代码行数:2,代码来源:xSkinButton.cpp
示例4: UE_LOG
const FFieldNetCache* FObjectReplicator::ReadField( const FClassNetCache* ClassCache, FInBunch& Bunch ) const
{
if ( Connection->InternalAck )
{
// Replays use checksum rather than index
uint32 Checksum = 0;
Bunch << Checksum;
if ( Bunch.IsError() )
{
UE_LOG(LogNet, Error, TEXT("ReadField: Error reading checksum: %s"), *GetObject()->GetFullName());
return NULL;
}
if ( Checksum == 0 )
{
return NULL; // We're done
}
const FFieldNetCache * FieldNetCache = ClassCache->GetFromChecksum( Checksum );
if ( FieldNetCache == NULL )
{
UE_LOG(LogNet, Error, TEXT("ReadField: GetFromChecksum failed: %s"), *GetObject()->GetFullName());
Bunch.SetError();
return NULL;
}
return FieldNetCache;
}
const int32 RepIndex = Bunch.ReadInt( ClassCache->GetMaxIndex() + 1 );
if ( Bunch.IsError() )
{
UE_LOG(LogRep, Error, TEXT("ReadField: Error reading RepIndex: %s"), *GetObject()->GetFullName());
return NULL;
}
if ( RepIndex == ClassCache->GetMaxIndex() )
{
return NULL; // We're done
}
if ( RepIndex > ClassCache->GetMaxIndex() )
{
// We shouldn't be receiving this bunch of this object has no properties or RPC functions to process
UE_LOG(LogRep, Error, TEXT("ReadField: RepIndex too large: %s"), *GetObject()->GetFullName());
Bunch.SetError();
return NULL;
}
const FFieldNetCache * FieldNetCache = ClassCache->GetFromIndex( RepIndex );
if ( FieldNetCache == NULL )
{
UE_LOG(LogNet, Error, TEXT("ReadField: GetFromIndex failed: %s"), *GetObject()->GetFullName());
Bunch.SetError();
return NULL;
}
return FieldNetCache;
}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:63,代码来源:DataReplication.cpp
示例5: GetObject
void FObjectReplicator::ReplicateCustomDeltaProperties( FOutBunch & Bunch, FReplicationFlags RepFlags, bool & bContentBlockWritten )
{
if ( LifetimeCustomDeltaProperties.Num() == 0 )
{
// No custom properties
return;
}
UObject* Object = GetObject();
check( Object );
check( OwningChannel );
UNetConnection * OwningChannelConnection = OwningChannel->Connection;
// Initialize a map of which conditions are valid
bool ConditionMap[COND_Max];
const bool bIsInitial = RepFlags.bNetInitial ? true : false;
const bool bIsOwner = RepFlags.bNetOwner ? true : false;
const bool bIsSimulated = RepFlags.bNetSimulated ? true : false;
const bool bIsPhysics = RepFlags.bRepPhysics ? true : false;
ConditionMap[COND_None] = true;
ConditionMap[COND_InitialOnly] = bIsInitial;
ConditionMap[COND_OwnerOnly] = bIsOwner;
ConditionMap[COND_SkipOwner] = !bIsOwner;
ConditionMap[COND_SimulatedOnly] = bIsSimulated;
ConditionMap[COND_AutonomousOnly] = !bIsSimulated;
ConditionMap[COND_SimulatedOrPhysics] = bIsSimulated || bIsPhysics;
ConditionMap[COND_InitialOrOwner] = bIsInitial || bIsOwner;
ConditionMap[COND_Custom] = true;
// Replicate those properties.
for ( int32 i = 0; i < LifetimeCustomDeltaProperties.Num(); i++ )
{
// Get info.
const int32 RetireIndex = LifetimeCustomDeltaProperties[i];
FPropertyRetirement & Retire = Retirement[RetireIndex];
FRepRecord * Rep = &ObjectClass->ClassReps[RetireIndex];
UProperty * It = Rep->Property;
int32 Index = Rep->Index;
if (LifetimeCustomDeltaPropertyConditions.IsValidIndex(i))
{
// Check the replication condition here
ELifetimeCondition RepCondition = LifetimeCustomDeltaPropertyConditions[i];
check(RepCondition >= 0 && RepCondition < COND_Max);
if (!ConditionMap[RepCondition])
{
// We didn't pass the condition so don't replicate us
continue;
}
}
const int32 BitsWrittenBeforeThis = Bunch.GetNumBits();
// If this is a dynamic array, we do the delta here
TSharedPtr<INetDeltaBaseState> & OldState = RecentCustomDeltaState.FindOrAdd( RetireIndex );
TSharedPtr<INetDeltaBaseState> NewState;
// Update Retirement records with this new state so we can handle packet drops.
// LastNext will be pointer to the last "Next" pointer in the list (so pointer to a pointer)
FPropertyRetirement ** LastNext = UpdateAckedRetirements( Retire, OwningChannelConnection->OutAckPacketId );
check( LastNext != NULL );
check( *LastNext == NULL );
ValidateRetirementHistory( Retire );
FNetBitWriter TempBitWriter( OwningChannel->Connection->PackageMap, 0 );
//-----------------------------------------
// Do delta serialization on dynamic properties
//-----------------------------------------
const bool WroteSomething = SerializeCustomDeltaProperty( OwningChannelConnection, (void*)Object, It, Index, TempBitWriter, NewState, OldState );
if ( !WroteSomething )
{
continue;
}
*LastNext = new FPropertyRetirement();
// Remember what the old state was at this point in time. If we get a nak, we will need to revert back to this.
(*LastNext)->DynamicState = OldState;
// Save NewState into the RecentCustomDeltaState array (old state is a reference into our RecentCustomDeltaState map)
OldState = NewState;
// Write header, and data to send to the actual bunch
RepLayout->WritePropertyHeader( Object, ObjectClass, OwningChannel, It, Bunch, Index, bContentBlockWritten );
const int NumStartingBits = Bunch.GetNumBits();
// Send property.
Bunch.SerializeBits( TempBitWriter.GetData(), TempBitWriter.GetNumBits() );
//.........这里部分代码省略.........
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:101,代码来源:DataReplication.cpp
示例6: Object
EquivalenceScope::Object EquivalenceScope::GetObject(ASTContext &C, const Expr *E, VarDecl *Var, uint64_t Offset) {
return Object(E, Offset, GetObject(C, Var));
}
开发者ID:ben-brewer-codethink,项目名称:flang,代码行数:3,代码来源:SemaEquivalence.cpp
示例7: GetObject
cCustomBinaryData::cDataAndPos*cCustomBinaryData::GetDataByID(int e_iID)
{
return GetObject(e_iID);
}
开发者ID:fatmingwang,项目名称:FM79979,代码行数:4,代码来源:CustomBinaryData.cpp
示例8: SetFovAngle
void CameraProperties::SetFovAngle( Float pAngle)
{
Cast<Camera>(GetObject())->SetFovAngle(pAngle);
FirePropertyChanged(&mFovAngle);
}
开发者ID:SebastienLussier,项目名称:Gamedesk,代码行数:5,代码来源:CameraProperties.cpp
示例9: switch
/*!
\brief This function is responsible for drawing player, foods, background playing field and shows all the text in the game.
As it prescribe management in our game.
For control of the game and drawing the background playing field meets the code.
\code
switch (message)
{
case WM_CREATE:
hBitmap = (HBITMAP)LoadImage(hInst, L"1.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
break;
case WM_KEYDOWN:
switch (wParam)
{
//Repeat game
case 'O':
pause= !pause;
break;
case 'P':
if(GameOver == 1)
{
GameOver=0;
ship.health = 20;
RECT r = {0,0,700,500};
for (int i=0;i<ASTEROID_COUNT;i++)
{
asteroids[i] = CreateAsteroid(r);
}
}
break;
}
case WM_MOUSEMOVE:
//Passing the coordinates of the mouse cursor.
xPos = GET_X_LPARAM(lParam);
targetx=xPos;
yPos = GET_Y_LPARAM(lParam);
targety=yPos;
break;
InvalidateRect(hWnd,NULL,1);
break;
\endcode
This part of the code responsible for drawing player and foods. Drawing in WinApi performed using brushes and pens. With feathers, we draw the contours of our
player and foods. With a brush paints we figure our color.
\code
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
RECT rect;
BITMAP bitmap;
HDC hdcMem;
HGDIOBJ oldBitmap;
GetClientRect(hWnd, &rect);
width=rect.right;
height=rect.bottom;
backbuffDC = CreateCompatibleDC(hdc);
backbuffer = CreateCompatibleBitmap( hdc, width, height);
savedDC = SaveDC(backbuffDC);
SelectObject( backbuffDC, backbuffer );
// Draw HERE
//clear window
hBrush = CreateSolidBrush(RGB(255,0,255));
FillRect(backbuffDC,&rect,hBrush);
DeleteObject(hBrush);
hdcMem = CreateCompatibleDC(hdc);//!
oldBitmap = SelectObject(hdcMem, hBitmap);//!
//draw background
GetObject(hBitmap, sizeof(bitmap), &bitmap);//!
BitBlt(backbuffDC, 0, 0, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, SRCCOPY);//!
//draw ball
//Rectangle(backbuffDC,0, 0, 785, 663);
//draw asteroids
//Drawing food
for (int i=0;i<ASTEROID_COUNT;i++)
{
hPen = CreatePen(PS_SOLID, 1, RGB(asteroids[i].dY, asteroids[i].dX, asteroids[i].dX+40));
hOldPen = (HPEN)SelectObject(backbuffDC, hPen);
Ellipse(backbuffDC,asteroids[i].X-asteroids[i].r, asteroids[i].Y-asteroids[i].r,asteroids[i].X+asteroids[i].r,asteroids[i].Y+asteroids[i].r);
SelectObject(backbuffDC, hOldPen);
DeleteObject(hPen);
hPen = CreatePen(PS_SOLID, asteroids[i].r, RGB(asteroids[i].dY, asteroids[i].dX, asteroids[i].dX+40));
hOldPen = (HPEN)SelectObject(backbuffDC, hPen);
Ellipse(backbuffDC, asteroids[i].X - (asteroids[i].r/1.9), asteroids[i].Y - (asteroids[i].r/1.9),asteroids[i].X + (asteroids[i].r/1.9), asteroids[i].Y + (asteroids[i].r/1.9));
Ellipse(backbuffDC, asteroids[i].X - (asteroids[i].r/2.1), asteroids[i].Y - (asteroids[i].r/2.1),asteroids[i].X + (asteroids[i].r/2.1), asteroids[i].Y + (asteroids[i].r/2.1));
SelectObject(backbuffDC, hOldPen);
DeleteObject(hPen);
}
//.........这里部分代码省略.........
开发者ID:StudProject,项目名称:NemchenkoAleks,代码行数:101,代码来源:22.cpp
示例10: serviceBmpFilterResizeBitmap
static INT_PTR serviceBmpFilterResizeBitmap(WPARAM wParam,LPARAM lParam)
{
BITMAP bminfo;
int width, height;
int xOrig, yOrig, widthOrig, heightOrig;
ResizeBitmap *info = (ResizeBitmap *) wParam;
if (info == NULL || info->size != sizeof(ResizeBitmap)
|| info->hBmp == NULL
|| info->max_width < 0 || info->max_height < 0
|| (info->fit & ~RESIZEBITMAP_FLAG_DONT_GROW) < RESIZEBITMAP_STRETCH
|| (info->fit & ~RESIZEBITMAP_FLAG_DONT_GROW) > RESIZEBITMAP_MAKE_SQUARE)
return 0;
// Well, lets do it
// Calc final size
GetObject(info->hBmp, sizeof(bminfo), &bminfo);
width = info->max_width == 0 ? bminfo.bmWidth : info->max_width;
height = info->max_height == 0 ? bminfo.bmHeight : info->max_height;
xOrig = 0;
yOrig = 0;
widthOrig = bminfo.bmWidth;
heightOrig = bminfo.bmHeight;
if (widthOrig == 0 || heightOrig == 0)
return 0;
switch(info->fit & ~RESIZEBITMAP_FLAG_DONT_GROW)
{
case RESIZEBITMAP_STRETCH:
{
// Do nothing
break;
}
case RESIZEBITMAP_KEEP_PROPORTIONS:
{
if (height * widthOrig / heightOrig <= width)
{
if (info->fit & RESIZEBITMAP_FLAG_DONT_GROW)
height = min(height, bminfo.bmHeight);
width = height * widthOrig / heightOrig;
}
else
{
if (info->fit & RESIZEBITMAP_FLAG_DONT_GROW)
width = min(width, bminfo.bmWidth);
height = width * heightOrig / widthOrig;
}
break;
}
case RESIZEBITMAP_MAKE_SQUARE:
{
if (info->fit & RESIZEBITMAP_FLAG_DONT_GROW)
{
width = min(width, bminfo.bmWidth);
height = min(height, bminfo.bmHeight);
}
width = height = min(width, height);
// Do not break. Use crop calcs to make size
}
case RESIZEBITMAP_CROP:
{
if (heightOrig * width / height >= widthOrig)
{
heightOrig = widthOrig * height / width;
yOrig = (bminfo.bmHeight - heightOrig) / 2;
}
else
{
widthOrig = heightOrig * width / height;
xOrig = (bminfo.bmWidth - widthOrig) / 2;
}
break;
}
}
if ((width == bminfo.bmWidth && height == bminfo.bmHeight)
|| ((info->fit & RESIZEBITMAP_FLAG_DONT_GROW)
&& !(info->fit & RESIZEBITMAP_MAKE_SQUARE)
&& width > bminfo.bmWidth && height > bminfo.bmHeight))
{
// Do nothing
return (INT_PTR)info->hBmp;
}
else
{
FIBITMAP *dib = FreeImage_CreateDIBFromHBITMAP(info->hBmp);
if (dib == NULL)
return NULL;
FIBITMAP *dib_tmp;
if (xOrig > 0 || yOrig > 0)
dib_tmp = FreeImage_Copy(dib, xOrig, yOrig, xOrig + widthOrig, yOrig + heightOrig);
else
//.........这里部分代码省略.........
开发者ID:Seldom,项目名称:miranda-ng,代码行数:101,代码来源:main.cpp
示例11: if
void CInfoPanel::LoaderThread()
{
m_news.clear();
CHttpSocket sock;
cvs::string xml;
CXmlTree tree;
size_t len;
if(!sock.create("http://march-hare.com"))
{
xml="<?xml version=\"1.0\" encoding=\"windows-1252\"?>\n<messages>\n<message><subject>Need assistance? Click here for our professional support options!</subject><author>"March Hare Support" <[email protected]></author><url>http://store.march-hare.com/s.nl?sc=2&category=2</url></message>\n</messages>";
len=xml.length();
}
else if(!sock.request("GET","/cvspro/prods-pre.asp?register=advert"))
{
xml="<?xml version=\"1.0\" encoding=\"windows-1252\"?>\n<messages>\n<message><subject>Need help NOW? Click here for our professional support options!</subject><author>"March Hare Support" <[email protected]></author><url>http://store.march-hare.com/s.nl?sc=2&category=2</url></message>\n</messages>";
len=xml.length();
}
if(sock.responseCode()!=200)
{
xml="<?xml version=\"1.0\" encoding=\"windows-1252\"?>\n<messages>\n<message><subject>Need help? Need integration? Need training? Click here for our professional support options!</subject><author>"March Hare Support" <[email protected]></author><url>http://store.march-hare.com/s.nl?sc=2&category=2</url></message>\n</messages>";
len=xml.length();
}
else
{
cvs::string xml = sock.responseData(len);
}
if(!tree.ParseXmlFromMemory(xml.c_str()))
return;
CXmlNodePtr node = tree.GetRoot();
if(strcmp(node->GetName(),"messages"))
return;
if(!node->GetChild("message"))
return;
do
{
news_t n;
n.subject = node->GetNodeValue("subject");
n.author = node->GetNodeValue("author");
n.url = node->GetNodeValue("url");
m_news.push_back(n);
} while(node->GetSibling("message"));
if(!m_hItemFont)
{
HFONT hFont = (HFONT)SendMessage(m_hListWnd,WM_GETFONT,0,0);
if(!hFont) hFont=GetStockFont(DEFAULT_GUI_FONT);
LOGFONT lf = {0};
GetObject(hFont,sizeof(lf),&lf);
lf.lfUnderline=true;
m_hItemFont = CreateFontIndirect(&lf);
}
ListView_DeleteAllItems(m_hListWnd);
ListView_DeleteColumn(m_hListWnd,1);
LVCOLUMN lvc={0};
lvc.mask=LVCF_WIDTH|LVCF_TEXT;
lvc.cx=500;
lvc.pszText=_T("Title");
ListView_InsertColumn(m_hListWnd,0,&lvc);
lvc.mask=LVCF_WIDTH|LVCF_TEXT;
lvc.cx=300;
lvc.pszText=_T("Author");
ListView_InsertColumn(m_hListWnd,1,&lvc);
for(size_t n=0; n<m_news.size(); n++)
{
LVITEM lvi = {0};
cvs::wide wnews(m_news[n].subject.c_str());
cvs::wide wauth(m_news[n].author.c_str());
lvi.mask=LVIF_TEXT|LVIF_PARAM;
lvi.iItem=(int)n;
lvi.pszText=(LPWSTR)(const wchar_t*)wnews;
lvi.lParam=(LPARAM)&m_news[n];
int iItem = ListView_InsertItem(m_hListWnd,&lvi);
ListView_SetItemText(m_hListWnd,iItem,1,(LPWSTR)(const wchar_t*)wauth);
}
m_bLoaded = true;
}
开发者ID:acml,项目名称:cvsnt,代码行数:81,代码来源:InfoPanel.cpp
示例12: StartSplashScreenThread
/**
* Splash screen thread entry function
*/
uint32 WINAPI StartSplashScreenThread( LPVOID unused )
{
WNDCLASS wc;
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = (WNDPROC) SplashScreenWindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(FWindowsPlatformMisc::GetAppIcon()));
if(wc.hIcon == NULL)
{
wc.hIcon = LoadIcon((HINSTANCE) NULL, IDI_APPLICATION);
}
wc.hCursor = LoadCursor((HINSTANCE) NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = TEXT("SplashScreenClass");
if(!RegisterClass(&wc))
{
return 0;
}
// Load splash screen image, display it and handle all window's messages
GSplashScreenBitmap = (HBITMAP) LoadImage(hInstance, (LPCTSTR)*GSplashScreenFileName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
if(GSplashScreenBitmap)
{
BITMAP bm;
GetObject(GSplashScreenBitmap, sizeof(bm), &bm);
const int32 BorderWidth = GetSystemMetrics(SM_CXBORDER);
const int32 BorderHeight = GetSystemMetrics(SM_CYBORDER);
const int32 WindowWidth = bm.bmWidth + BorderWidth;
const int32 WindowHeight = bm.bmHeight + BorderHeight;
int32 ScreenPosX = (GetSystemMetrics(SM_CXSCREEN) - WindowWidth) / 2;
int32 ScreenPosY = (GetSystemMetrics(SM_CYSCREEN) - WindowHeight) / 2;
const bool bAllowFading = true;
// Force the editor splash screen to show up in the taskbar and alt-tab lists
uint32 dwWindowStyle = (GIsEditor ? WS_EX_APPWINDOW : 0) | WS_EX_TOOLWINDOW;
if( bAllowFading )
{
dwWindowStyle |= WS_EX_LAYERED;
}
GSplashScreenWnd = CreateWindowEx(
dwWindowStyle,
wc.lpszClassName,
TEXT("SplashScreen"),
WS_BORDER|WS_POPUP,
ScreenPosX,
ScreenPosY,
WindowWidth,
WindowHeight,
(HWND) NULL,
(HMENU) NULL,
hInstance,
(LPVOID) NULL);
if( bAllowFading )
{
// Set window to fully transparent to start out
SetLayeredWindowAttributes( GSplashScreenWnd, 0, 0, LWA_ALPHA );
}
// Setup font
{
HFONT SystemFontHandle = ( HFONT )GetStockObject( DEFAULT_GUI_FONT );
// Create small font
{
LOGFONT MyFont;
FMemory::Memzero( &MyFont, sizeof( MyFont ) );
GetObject( SystemFontHandle, sizeof( MyFont ), &MyFont );
MyFont.lfHeight = 10;
// MyFont.lfQuality = ANTIALIASED_QUALITY;
GSplashScreenSmallTextFontHandle = CreateFontIndirect( &MyFont );
if( GSplashScreenSmallTextFontHandle == NULL )
{
// Couldn't create font, so just use a system font
GSplashScreenSmallTextFontHandle = SystemFontHandle;
}
}
// Create normal font
{
LOGFONT MyFont;
FMemory::Memzero( &MyFont, sizeof( MyFont ) );
GetObject( SystemFontHandle, sizeof( MyFont ), &MyFont );
MyFont.lfHeight = 12;
// MyFont.lfQuality = ANTIALIASED_QUALITY;
GSplashScreenNormalTextFontHandle = CreateFontIndirect( &MyFont );
if( GSplashScreenNormalTextFontHandle == NULL )
//.........这里部分代码省略.........
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:101,代码来源:WindowsPlatformSplash.cpp
示例13: WindowProc
LRESULT CALLBACK WindowProc(HWND _hwnd,
UINT _msg,
WPARAM _wparam,
LPARAM _lparam)
{
// This is the main message handler of the system.
PAINTSTRUCT ps; // Used in WM_PAINT.
HDC hdc; // Handle to a device context.
// What is the message?
switch (_msg)
{
case WM_CREATE:
{
_iNumThreads = std::thread::hardware_concurrency();
// Do initialization stuff here.
// Return Success.
return (0);
}
break;
case WM_PAINT:
{
// Simply validate the window.
hdc = BeginPaint(_hwnd, &ps);
if (!bitmapsToDraw.empty())
{
//Starting coordinates
int x = 0;
int y = 0;
//Used to nicely arrange the images
int _iNum = int(ceil(sqrt(bitmapsToDraw.size())));
int _iWidth = (1000 / _iNum);
int _iHeight = _iWidth;
//Drawing the images
for (unsigned int i = 0; i < bitmapsToDraw.size(); i++)
{
BITMAP bitmap;
GetObject(bitmapsToDraw[i], sizeof(BITMAP), &bitmap);
HDC hdcMem = CreateCompatibleDC(hdc);
HBITMAP oldBitmap = static_cast<HBITMAP>(SelectObject(hdcMem, bitmapsToDraw[i]));
SetStretchBltMode(hdc, _iStretchColor);
StretchBlt(hdc, x, y, _iWidth, _iHeight, hdcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, SRCCOPY);
SelectObject(hdcMem, oldBitmap);
DeleteDC(hdcMem);
x += _iWidth;
//Adding new row
if (x >= 1000)
{
y += _iWidth;
x = 0;
}
}
}
EndPaint(_hwnd, &ps);
// Return Success.
return (0);
}
break;
case WM_COMMAND:
{
switch (LOWORD(_wparam))
{
case ID_FILE_LOADIMAGES:
{
LoadBitmaps();
InvalidateRect(_hwnd, NULL, TRUE);
break;
}
case ID_FILE_LOADSOUNDS:
{
LoadSounds();
break;
}
case ID_COLORTYPE_HALFTONE:
{
_iStretchColor = HALFTONE;
InvalidateRect(_hwnd, NULL, TRUE);
break;
}
case ID_COLORTYPE_BLACKONWHITE:
{
_iStretchColor = BLACKONWHITE;
InvalidateRect(_hwnd, NULL, TRUE);
break;
}
case ID_COLORTYPE_COLORONCOLOR:
{
_iStretchColor = COLORONCOLOR;
InvalidateRect(_hwnd, NULL, TRUE);
break;
}
case ID_COLORTYPE_WHITEONBLACK:
{
_iStretchColor = STRETCH_ORSCANS;
InvalidateRect(_hwnd, NULL, TRUE);
break;
}
case ID_EXIT:
{
//.........这里部分代码省略.........
开发者ID:JoshuaTanner,项目名称:Multi-threaded-Parallel-Loader-C-,代码行数:101,代码来源:main.cpp
示例14: PanUpDown
void CameraProperties::PanUpDown(Float pMovement)
{
Cast<Camera>(GetObject())->PanUpDown(pMovement);
FirePropertyChanged(&mPosition);
}
开发者ID:SebastienLussier,项目名称:Gamedesk,代码行数:5,代码来源:CameraProperties.cpp
示例15: GetFovAngle
Float CameraProperties::GetFovAngle() const
{
return Cast<Camera>(GetObject())->GetFovAngle();
}
开发者ID:SebastienLussier,项目名称:Gamedesk,代码行数:4,代码来源:CameraProperties.cpp
示例16: CreateBitmapInfoStruct
PBITMAPINFO CreateBitmapInfoStruct(HWND hwnd, HBITMAP hBmp)
{
BITMAP bmp;
PBITMAPINFO pbmi;
WORD cClrBits;
// Retrieve the bitmap color format, width, and height.
if (!GetObject(hBmp, sizeof(BITMAP), (LPSTR)&bmp))
errhandler("GetObject", hwnd);
// Convert the color format to a count of bits.
cClrBits = (WORD)(bmp.bmPlanes * bmp.bmBitsPixel);
if (cClrBits == 1)
cClrBits = 1;
else if (cClrBits <= 4)
cClrBits = 4;
else if (cClrBits <= 8)
cClrBits = 8;
else if (cClrBits <= 16)
cClrBits = 16;
else if (cClrBits <= 24)
cClrBits = 24;
else cClrBits = 32;
// Allocate memory for the BITMAPINFO structure. (This structure
// contains a BITMAPINFOHEADER structure and an array of RGBQUAD
// data structures.)
if (cClrBits < 24)
pbmi = (PBITMAPINFO)LocalAlloc(LPTR,
sizeof(BITMAPINFOHEADER) +
sizeof(RGBQUAD) * (1 << cClrBits));
// There is no RGBQUAD array for these formats: 24-bit-per-pixel or 32-bit-per-pixel
else
pbmi = (PBITMAPINFO)LocalAlloc(LPTR, sizeof(BITMAPINFOHEADER));
// Initialize the fields in the BITMAPINFO structure.
pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
pbmi->bmiHeader.biWidth = bmp.bmWidth;
pbmi->bmiHeader.biHeight = bmp.bmHeight;
pbmi->bmiHeader.biPlanes = bmp.bmPlanes;
pbmi->bmiHeader.biBitCount = bmp.bmBitsPixel;
if (cClrBits < 24)
pbmi->bmiHeader.biClrUsed = (1 << cClrBits);
// If the bitmap is not compressed, set the BI_RGB flag.
pbmi->bmiHeader.biCompression = BI_RGB;
// Compute the number of bytes in the array of color
// indices and store the result in biSizeImage.
// The width must be DWORD aligned unless the bitmap is RLE
// compressed.
pbmi->bmiHeader.biSizeImage = ((pbmi->bmiHeader.biWidth * cClrBits + 31) & ~31) / 8
* pbmi->bmiHeader.biHeight;
// Set biClrImportant to 0, indicating that all of the
// device colors are important.
pbmi->bmiHeader.biClrImportant = 0;
return pbmi;
}
开发者ID:jakwuh,项目名称:bsu,代码行数:62,代码来源:bitmap.cpp
示例17: SetNearView
void CameraProperties::SetNearView(Float pNearView)
{
Cast<Camera>(GetObject())->SetNearView(pNearView);
FirePropertyChanged(&mNearView);
}
开发者ID:SebastienLussier,项目名称:Gamedesk,代码行数:5,代码来源:CameraProperties.cpp
示例18: GetNearView
Float CameraProperties::GetNearView() const
{
return Cast<Camera>(GetObject())->GetNearView();
}
开发者ID:SebastienLussier,项目名称:Gamedesk,代码行数:4,代码来源:CameraProperties.cpp
示例19: LookAt
void CameraProperties::LookAt( const Vector3f& pLookAtPos )
{
Cast<Camera>(GetObject())->LookAt( pLookAtPos );
}
开发者ID:SebastienLussier,项目名称:Gamedesk,代码行数:4,代码来源:CameraProperties.cpp
示例20: Pitch
void CameraProperties::Pitch(Float pAngle)
{
Cast<Camera>(GetObject())->Pitch(pAngle);
}
开发者ID:SebastienLussier,项目名称:Gamedesk,代码行数:4,代码来源:CameraProperties.cpp
注:本文中的GetObject函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论