`// Title: Use a Memblock to create a Picture to be used as a Cursor
`// Author: RavenVegeta
`// Setup Environment
set display mode 640,480,16
set window on : set window size 640,480
set window title "DarkBasic Enhanced Demo"
sync on : sync rate 0
autocam off
hide mouse
`// Setup Time Variable
dim ptrTime(2)
`// Setup Picture Variables
dwBlack = RGB(0,0,0)
dwWhite = RGB(255,255,255)
dwHeight = 64
dwWidth = 64
dwBitPerPx = 24
dwTotalPx = dwHeight * dwWidth
dim ptrImage( dwTotalPx + 3 )
`// Populate Image Array
ptrImage(0) = dwHeight
ptrImage(1) = dwWifth
ptrImage(2) = BitPerPx
randomize timer()
`// give the Array a simple Pattern
for index = 0 to dwTotalPx - 1
bIndex = rnd(3)
if bIndex = 0
ptrImage(index+2) = dwBlack
else
ptrImage(index+2) = dwWhite
endif
next index
`// create image using a memblock
make memblock 1, dwTotalPx*4 + 12
`// create memblock from array
dwPosition = 0
`// populate header
write memblock dword 1,dwPosition,ptrImage(0) : inc dwPosition
write memblock dword 1,dwPosition,ptrImage(1) : inc dwPosition
write memblock dword 1,dwPosition,ptrImage(2) : inc dwPosition
`// populate main data
for index = 0 to dwTotalPx - 1
write memblock dword 1,dwPosition,ptrImage(index+2)
inc dwPosition,4
next index
`// create image from memblock
make image from memblock 1,1
delete memblock 1 :`// release memory
`// main loop
do
`// use image as a cursor
paste image 1,mousex(),mousey()
sync :`// update scene
loop
i was making a memblock tutorial for Rose ... not this should've worked right?
and actually this is completely baffling me to why it didn't, someone check over this and see if you can see something i've missed.
i know in the help it says 2byts per pixel, but thats for 16bit ... and i always thought that it didn't matter what bits it was as long as you wrote the pixels with the right size it would be oki
is this wrong, i mean i'm gonna go try by converting to 16bit values but seems kinda odd if thats the case, and i'm probably just missing something.
Anata aru kowagaru no watashi! http://members.lycos.co.uk/timesaga/darkbasic/gir.gif[/img]