|
Forum Index : Microcontroller and PC projects : CMM2: Sprite vs Blit
| Author | Message | ||||
| William33 Newbie Joined: 27/07/2020 Location: GermanyPosts: 9 |
Hi, maybe someone can point out what am I doing wrong here ... ' sprite vs blit ' just a test cls page write 2 cls load png "knight.png",0,0,1 load bmp "grass.bmp",32,0 sprite loadpng 1, "knight.png" page write 1 cls for x= 0 to mm.hres step 32 for y=0 to mm.vres step 32 blit 32,0,x,y,32,32,2 next next blit 0,0,200,200,32,32,2,&b100 sprite show 1,100,100,1,0 page copy 1 to 0 do loop until inkey$<>"" The above code works fine - result is as follows: Apart from that the RGB (10,10,10) - darker pixels of the image - is also blitted transparent. Anyway, if I am commenting the BLIT line out, the sprite isn't transparent anymore: So, what am i doing wrong here? By the way, it doesn't matter which mode I use. |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10582 |
Can't really tell anything without the png file. The obvious answer is that it has a non-transparent black background. |
||||
| William33 Newbie Joined: 27/07/2020 Location: GermanyPosts: 9 |
Okay, here's the png file attached to this message. I zipped it because in the preview it really seemed to have a black background ... knight.png.zip |
||||
| William33 Newbie Joined: 27/07/2020 Location: GermanyPosts: 9 |
Well, if I don't do a page copy, i.e. I add a "page write 0" then the sprite is displayed correctly. So isn't it possible to show a (transparent) sprite on page 1 and copy the page to page 0? Edited 2020-09-29 23:03 by William33 |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10582 |
It is a firmware bug that a software bug in your code found. Try this: for x= 0 to mm.hres-1 step 32 for y=0 to mm.vres-1 step 32 blit 32,0,x,y,32,32,2,0 next next In your original code the last blit was off-screen. The firmware tests for this and returns without doing anything. However, at this point it has overridden the read page address and didn't restore it. Will be fixed in V5.05.06b15 when posted. Edited 2020-09-29 23:23 by matherp |
||||
| William33 Newbie Joined: 27/07/2020 Location: GermanyPosts: 9 |
Ok, thanks, this does the trick. And of course thanks for the upcoming fix. ![]() Edited 2020-09-29 23:32 by William33 |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |