Sprite Candy Memory Image to Texture?
Blitz3D Forums/Blitz3D Userlibs/Sprite Candy Memory Image to Texture?
| ||
I'm a new user to Sprite Candy and while I like a lot of it, I have some 2d images in memory that I converted to a texture using HUD_LoadMemoryResource() but for some reason, even if I specify mode 4 and declare black as transparent, it's treating black as solid black when I display the layer, blocking out everything behind. These are runtime images that I can't simply load in from the disk but disk images seem to have no problems with transparency. Second problem I'm having is this: None of the object commands such as scaling and originpoint seem to work as the manual describes. For example, I have used HUD_LoadImageResource to load a picture, successfully so as it displays fine on a layer but when I try to use any command like HUD_SetObjectOrigin or HUD_SetObjectScale on that image it simply says "the specified object does not exist." Here's actual code - I don't get an error on line 1 so wonder why line 2 doesn't work? CampaignBG#=HUD_LoadImageResource("graphics\bg1.jpg",4) HUD_SetObjectScale(CampaignBG,0.5,0.5) ; have tried 'CampaignBG' both with and without the '#' sign and get the same error regardless Anyone out there know what I'm doing wrong on these two issues? Thanks in advance if you do. Last edited 2011 |
| ||
First problem, I had to do this: LightningHandle=HUD_LoadMemoryResource (LightningTex,4,0,0,0) HUD_SetLayerTexture(AltLightningAlgLayer, LightningHandle) Transparency worked, but it was too slow to be used real time, so I am going to try something different. Second problem: I think the command you are trying to use 'set object scale' is to be used on an image. In order to have an 'image', first you need a texture, a layer and finally an image, like this: ;load image onto texture CampaignBG#=HUD_LoadImageResource("graphics\bg1.jpg",4) ;!rewrite as: Global CampaignBGTexture#=HUD_LoadImageResource("graphics\bg1.jpg",4) ;make a layer to put it on Global CampaignBGLayer=HUD_CreateLayer(Hud1,CampaignBGTexture) ;make the actual image Global CampaignBGImage=HUD_CreateImage(CampaignBGLayer,CenterX,CenterY) ;then scale it HUD_SetObjectScale(CampaignBGImage,0.5,0.5) Hope this helps! |