MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / LoadBackgroundImage

Method LoadBackgroundImage

Descent3/newui.cpp:878–900  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

876void NewUIWindow::OnDestroy() { bm_DestroyChunkedBitmap(&m_Chunk); }
877
878void NewUIWindow::LoadBackgroundImage(const char *image_name) {
879 UIBitmapItem back_bm;
880
881 bm_DestroyChunkedBitmap(&m_Chunk);
882 memset(&m_Chunk, 0, sizeof(m_Chunk));
883
884 if (image_name) {
885 int bm_handle = bm_AllocLoadFileBitmap(IGNORE_TABLE(image_name), 0);
886
887 if (bm_handle <= BAD_BITMAP_HANDLE) {
888 Error("Unable to load image %s for background.", image_name);
889 }
890
891 // takes a large static bitmap and breaks it into smaller managable bitmaps
892 if (!bm_CreateChunkedBitmap(bm_handle, &m_Chunk)) {
893 Error("Failed to chunk background bitmap %s.", image_name);
894 }
895
896 back_bm.set_chunked_bitmap(&m_Chunk);
897 UIWindow::SetBackItem(&back_bm);
898 bm_FreeBitmap(bm_handle);
899 }
900}
901
902///////////////////////////////////////////////////////////////////////////////
903// NewUIGameWindow implementation.

Callers 2

MultiGameOptionsMenuFunction · 0.80

Calls 6

bm_DestroyChunkedBitmapFunction · 0.85
bm_AllocLoadFileBitmapFunction · 0.85
ErrorFunction · 0.85
bm_CreateChunkedBitmapFunction · 0.85
bm_FreeBitmapFunction · 0.85
set_chunked_bitmapMethod · 0.80

Tested by

no test coverage detected