Jump to content

ComboBoxEx SDL_Surface to hBitmap


Xandy
 Share

Recommended Posts

I have a bunch of SDL_Surfaces loaded into memory.  I want to list them in a ComboBox.

Using this code, I can load images to the combobox from file but not from existing SDL_Surface memory

CODE ISN"T MEANT TO RUN

; Create combobox pic list example
    $aControl[$iControl_id][$eControl_data] = _GUICtrlComboBoxEx_Create($gui, $data_value, $data_x, $data_y, $data_w, $data_h, $CBS_DROPDOWNLIST)
    
    ; Image List for ComboboxEx
    Local $hImage = _GUIImageList_Create($gTile_w, $gTile_h, 6)
    
    ; Fill hImage with SDL_Surfaces stored in memory: aNPC_surf[scale][type][way][frame]
    For $i = 0 To 1
        ; This works but only from file:
        ;_GUIImageList_AddBitmap($hImage, $gFolder_graphics & $gaWorld_info[$player.iWorld_cur][$eWi_filename] & "Tiles\" & $i & ".bmp")
        ; I've broken up a sprite sheet and want to insert into combobox from memory
        ;_GUIImageList_Add($hImage, $aNPC_surf[1][1][1][$i])
        _GUIImageList_Add($hImage, _GDIPlus_BitmapCreateFromMemory($aNPC_surf[1][1][1][$i]), True)
        ;_GDIPlus_BitmapCreateFromMemory($aNPC_surf[1][1][1][$i])
        
        ; Add the index number to combobox item
        _GUICtrlComboBoxEx_AddString($aControl[$eNPC_iPic_type][$eControl_data], $i, $i, $i)
    Next
    ; Set hImage list to combobox control
    _GUICtrlComboBoxEx_SetImageList($aControl[$eNPC_iPic_type][$eControl_data], $hImage)

Anyone know if I can convert from SDL_Surface to hBitmap?  Maybe I'm doing something else wrong.

 

I've seen hBitmap converted to SDL_Surface but I don't really understand it yet: 

 

My full script can be found here:

 

Edited by Xandy
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...