Hi,
The idea is to have the action on a smaller sp1_Rect and text printed outside, for lifes, scores, etc
Is it possible to print outside the usual sp1_Rect defined for SP1 with a SP1 function, or do we need to use printf or a lib like fzx for example?
Better yet, what is the standard way to print score and lifes, or other messages in or out the game area?
Thank you.
SP1: Print text outside the game sp1_Rect
Re: SP1: Print text outside the game sp1_Rect
I've already replied this on https://worldofspectrum.org/forums/disc ... e-sp1-rect but probably easier to copy and paste it here too.
Yes.
If I remember correctly, the default build for SP1 is for the whole screen (which I'm almost sure you use that). So you can use all the sp1 commands for the whole screen.
They don't show up because, as you probably know, these changes are not happening in your sp1_Rect.
But you can have more than one sp1_Rect, of course, like in this snippet from one of my games:
The sp1_Rect is meant to clip your sprites and define the area you want it to update, so you can have more of them.
In the above code you can see that the misc rect is defined above the main cliprect. When I want to update the scores only in miscrect, I just draw there using the usual sp1 commands, and then invalidate that window to make it shown on screen. If you want to use additional windows, remember not to put any sprites in those areas! If you do, they will show up on screen.
Yes.
If I remember correctly, the default build for SP1 is for the whole screen (which I'm almost sure you use that). So you can use all the sp1 commands for the whole screen.
They don't show up because, as you probably know, these changes are not happening in your sp1_Rect.
But you can have more than one sp1_Rect, of course, like in this snippet from one of my games:
Code: Select all
// Clipping Rectangle for Sprites
struct sp1_Rect cliprect = {2, 2, 28, 20}; // main game part
struct sp1_Rect clipscreen = {0, 0, 32, 24}; // full screen
struct sp1_Rect specialrect = {3, 3, 2, 2};
struct sp1_Rect miscrect = {0, 2, 28, 2};
struct sp1_Rect bonusrect = {8, 18, 9, 8}; // format is y,x,w,h!
In the above code you can see that the misc rect is defined above the main cliprect. When I want to update the scores only in miscrect, I just draw there using the usual sp1 commands, and then invalidate that window to make it shown on screen. If you want to use additional windows, remember not to put any sprites in those areas! If you do, they will show up on screen.
Re: SP1: Print text outside the game sp1_Rect
Hi,
Thanks, I think I got it: sp1_UpdateNow();updates *all* the rects that were invalidate, correct?
Regards,
António
PS: I'll stop writing both here and in wos from now on and keep the thread here
Thanks, I think I got it: sp1_UpdateNow();updates *all* the rects that were invalidate, correct?
Regards,
António
PS: I'll stop writing both here and in wos from now on and keep the thread here
Re: SP1: Print text outside the game sp1_Rect
I think it is (not 100% sure).
I'm more often on wos but I try to read here every week. This question was better answered here because it's about z88dk/sp1.PS: I'll stop writing both here and in wos from now on and keep the thread here