Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 01:58 15 Nov 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : CMM2: Sprite vs Blit

Author Message
William33
Newbie

Joined: 27/07/2020
Location: Germany
Posts: 9
Posted: 09:37am 29 Sep 2020
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 10582
Posted: 10:10am 29 Sep 2020
Copy link to clipboard 
Print this post

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: Germany
Posts: 9
Posted: 11:30am 29 Sep 2020
Copy link to clipboard 
Print this post

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: Germany
Posts: 9
Posted: 01:02pm 29 Sep 2020
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 10582
Posted: 01:17pm 29 Sep 2020
Copy link to clipboard 
Print this post

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: Germany
Posts: 9
Posted: 01:30pm 29 Sep 2020
Copy link to clipboard 
Print this post

Ok, thanks, this does the trick. And of course thanks for the upcoming fix.  
Edited 2020-09-29 23:32 by William33
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025