Thanks Peter,
I've written a jpeg / png loader for you.
Extracted from then GDIplus jungle, and embedded in your example:
It uses night.jpg attached below.
include "win64.inc"
Window "SPACE WATER",800,600,1
'====================
'GDIPLUS IMAGE LOADER
'====================
typedef struct tagGDIStartup {
dword GdiplusVersion;
sys DebugEventCallback;
bool SuppressBackgroundThread;
bool SuppressExternalCodecs;
} GdiplusStartupInput;
typedef struct {
sys NotificationHookProc
sys NotificationUnhookProc
} GdiplusStartupOutput;
extern library "gdiplus.dll"
long GdiplusStartup( dword *token, GdiplusStartupInput*input, GdiplusStartupOutput *output)
long void GdiplusShutdown(dword*token)
long GdipLoadImageFromFile(wstring filename, sys*image)
long GdipCreateBitmapFromFile(wstring filename, sys*bitmap)
long GdipCreateHBITMAPFromBitmap(sys bitmap, sys*hbmReturn, dword backgroundColor)
long GdipDisposeImage(sys image)
end extern
Function LoadBmpPlus(string File, sys Frames) as sys
iF Frames=0 or Frames <0 Then Frames =1
static id as sys
iF id <512 Then id +=1
'iHnd(id) = LoadImage(0,File + ".bmp",0,0,0,16)'
sys hstatus,pImage,hbitmap
wstring strFileName
'
strFileName = File
hStatus = GdipLoadImageFromFile strFileName, pImage
hstatus=GdipCreateHBITMAPFromBitmap(pImage,hbitmap,0)
iHnd(id)=hBitMap
iHdc(id) = CreateCompatibleDC(sys_hdc)
SelectObject iHdc(id), iHnd(id)
GetObject iHnd(id), sizeof info, &info
BmpWidth (id) = info.bmWidth /Frames
BmpHeight(id) = info.bmHeight
BmpFrame (id) = Frames
if pImage then GdipDisposeImage pImage
Return id
End Function
sys hr,token
GdiplusStartupInput StartupInput
StartupInput.GdiplusVersion = 1
hr=GdiplusStartup token, StartupInput, byval 0
'
if hr then
print "Error initializing GDIplus: " hex hr
end if
'======
Type pType
single lifespan
single x
single y
single xv
single yv
End Type
Dim Particle(10000) as pType
sys pic,xstart, ystart, i, mx=10000
pic = LoadBmpPlus("night.jpg",0)
Sub ParticleInit()
Xstart = Width \ 10
Ystart = Height \ 10
For i = 0 To mx
Particle(i).lifespan = Rand 1,500
Particle(i).x = Xstart
Particle(i).y = Ystart
Particle(i).yv = Rand(1,4)
Particle(i).xv = Rand(1,8)
Next
End Sub
ParticleInit()
While EscKey()=0
'ClsColor (200,200,200)
SetBmp (pic,0,0,800,600,0)
For i=0 To mx
RoundBox Particle(i).x, Particle(i).y,12,10,10,10, 0,Rand(32,64),Rand(200,255)
Particle(i).x = Particle(i).x + Particle(i).xv
Particle(i).y = Particle(i).y + Particle(i).yv
Particle(i).yv = Particle(i).yv + 0.96
iF Particle(i).y >= Height
Particle(i).yv = -(Particle(i).yv * 0.46)
Particle(i).y = Height
End iF
Particle(i).LifeSpan = Particle(i).LifeSpan -1
iF Particle(i).LifeSpan <=0
Particle(i).LifeSpan = Rand(1,500)
Particle(i).x = Xstart
Particle(i).y = Ystart
Particle(i).yv = Rand(1,4)
Particle(i).xv = Rand(1,8)
End iF
Next
FlipBuffer
WaitFPS 14
Wend
GdiplusShutdown token
WinEnd