Spawning a custom window, natively
Posted: Wed Dec 21, 2022 10:40 am
Howdy!
Aim: Obtain the ability to load bmp images, on demand, within the game.
Cheers,
The_Cowboy
Minor progress
Seems like UTexture::Import hasn't been implemented yet?
Aim: Obtain the ability to load bmp images, on demand, within the game.
- Attempt 1: Load bmp images via FWindowsBitmap
Then pray for an API opening for import. Maybe there is one (not quite sure)
Code: Select all
FWindowsBitmap TestBitmap; UBOOL bResult = TestBitmap.LoadFile(*FilePath);
in which case I need to know the buffer.Code: Select all
const TCHAR* Import( const TCHAR* Buffer, const TCHAR* BufferEnd, const TCHAR* FileType );
Few hints that BITMAPINFO and BITMAPFILEHEADER is what I be needing. Sees like where they are stored, HBITMAP, is hidden?Code: Select all
WINDOW_API HBITMAP LoadFileToBitmap( const TCHAR* Filename, INT& SizeX, INT& SizeY ) { guard(LoadFileToBitmap); TArray<BYTE> Bitmap; if( appLoadFileToArray(Bitmap,Filename) ) { HDC hDC = GetDC(NULL); BITMAPFILEHEADER* BH = (BITMAPFILEHEADER*)&Bitmap(0); BITMAPINFO* BI = (BITMAPINFO*)(&Bitmap(0) + sizeof(BITMAPFILEHEADER)); void* RawData = &Bitmap(0) + BH->bfOffBits; SizeX = BI->bmiHeader.biWidth; SizeY = BI->bmiHeader.biHeight; HBITMAP hBitmap = CreateDIBitmap( hDC, &BI->bmiHeader, CBM_INIT, RawData, BI, DIB_RGB_COLORS ); ReleaseDC( NULL, hDC ); return hBitmap; } return NULL; unguard; }
- Attempt 2: Try to simulate the splash screen, in the beginning, before the complete game loads up.
Code: Select all
// An operating system window. class WINDOW_API WWindow : #if WIN_OBJ public UObject, #endif
The thing that is stopping me isdefined in Window.hCode: Select all
#define WIN_OBJ 0
Cheers,
The_Cowboy
Automatically merged
Attempt 1 seems rendered (literally!) fruitless.MSVC wrote: Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: unsigned short const * __thiscall UTexture::Import(unsigned short const *,unsigned short const *,unsigned short const *)" (__imp_?Import@UTexture@@QAEPBGPBG00@Z) referenced in function __catch$?execSpitIpFromChatString@ACDDiscordActor@@QAEXAAUFFrame@@QAX@Z$1 ChatDiamond G:\SteamLibrary\UnrealTournamentGOTY\ChatDiamond\UTNativeEssentials\UTNativeLightHouse\ChatDiamond\ChatDiamondNative.obj 1