SCREEN _NEWIMAGE(600, 800, 32)
_DISPLAY
DIM mimage AS _MEM
DIM tilemapbackground AS LONG
'...load images with _LOADIMAGE
'...draw tilemapbackground with _PUTIMAGE
mimage = _MEMIMAGE(tilemapbackground)
'...
CLS
_MEMPUT mimage, mimage.OFFSET + 1, _WIDTH(0) * _HEIGHT(0) * 4 AS _UNSIGNED _BYTE
_DISPLAY
SCREEN _NEWIMAGE(600, 800, 32)
_DISPLAY
DIM mimage AS _MEM
DIM tilemapbackground AS LONG
'...load images with _LOADIMAGE
'...draw tilemapbackground with _PUTIMAGE
mimage = _MEMIMAGE(tilemapbackground)
'...
CLS
_MEMPUT mimage, mimage.OFFSET + 1, _WIDTH(0) * _HEIGHT(0) * 4 AS _UNSIGNED _BYTE
_DISPLAY
Why not simply staying with _PUTIMAGE? With the following syntax:
_PUTIMAGE (dx1, dy1), sourceHandle&, destHandle&, (sx1, sy1)-(sx2, sy2) 'portion of source to the top-left corner of the destination page
you may copy any cutout of the source image (sx1, sy1)-(sx2, sy2) to any desired startposition on the destination (dx1, dy1).
This code contains many bugs. For example, the MEMPUT command should store data in memory for mimage. But at the beginning of the program is SCREEN NEWIMAGE, so the data is stored in a virtual (unvisible) screen. Another mystery to me is why you are trying to save 4 * _Unsigned _byte. I don't see anywhere decomposition of colors on alpha, red, green and blue. Why isn't the type for RGBA32 used correct unsigned long? Why is the _Display command on the second line when no action has been taken on the screen? How do you use the memput command to insert data when program has not previously generated or retrieved any image data with the MEMGET command?
Hi,
I try to draw a (prefabricated) background tilemap on the screen, using the _MEMIMAGE and _MEMPUT commands. But sadly it doesn't work and don't know what I'm doing wrong...the background is just black.
It looks like this:
Thanks!
^^^^. You’re not putting a single value on the tile set background; you’re wanting to copy the tile set background onto the visible screen
If they’re different sizes, you’re better off just sticking to _PUTIMAGE to get the job done, since one screen needs to scale to fit the other.