Scrolling only one row.

SGDK only sub forum

Moderator: Stef

Post Reply
m4x1k
Newbie
Posts: 3
Joined: Sat Mar 23, 2019 3:23 pm

Scrolling only one row.

Post by m4x1k » Thu Sep 12, 2019 9:52 pm

Hello. I’m trying to understand how’s tile scrolling works. How can I move one row to the right/left?

I made and image on plan A.
For example, VDP_setHorizontalScroll (PLAN_A, 8) works fine. It moves whole plan 8 pixels to the right. But I need to move only one row.

I set tile scrolling with VDP_setScrollingMode.
VDP_setHorizontalScrollTile (PLAN_A, 0, 8, 1, FALSE) is not working that way. Can someone explain me how can I do one row scrolling?

Can’t find any info on the forum. Only whole background scrolling.

Stef
Very interested
Posts: 2976
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Scrolling only one row.

Post by Stef » Fri Sep 13, 2019 10:21 am

You need to set the current scroll mode first using VDP_setHorizontalScrollMode(..) or something like that (on my phone currently).

m4x1k
Newbie
Posts: 3
Joined: Sat Mar 23, 2019 3:23 pm

Re: Scrolling only one row.

Post by m4x1k » Fri Sep 13, 2019 12:42 pm

Stef, hello. I do use VDP_setHorizontalScrollMode as I mentioned it in my previous post. Set it to TILE scroll.
Then I use VDP_setHorizontalScrollTile (PLAN_A, 0, 8, 1, FALSE) to scroll first row on the screen 8 pixels to the right. Is this how it supposed to work or I do something wrong? Because CodeBlocks give me an Warning about 3rd argument as it should be not int but s16*.

Grind
Very interested
Posts: 64
Joined: Fri Jun 13, 2014 1:26 pm
Location: US
Contact:

Re: Scrolling only one row.

Post by Grind » Fri Sep 13, 2019 2:54 pm

It wants an array of values to set the scroll lines to rather than a single value. If you are only scrolling one line the array only needs to have one element.

Code: Select all

s16 val[1] = { 8 };
VDP_setHorizontalScrollTile (PLAN_A, 0, val, 1, FALSE);
The 4th argument is the length of the array so you could do the whole plane in one if you want.

Code: Select all

s16 val[32] = { 8, 10, 16, 4, ... };
VDP_setHorizontalScrollTile (PLAN_A, 0, val, 32, FALSE);

m4x1k
Newbie
Posts: 3
Joined: Sat Mar 23, 2019 3:23 pm

Re: Scrolling only one row.

Post by m4x1k » Fri Sep 13, 2019 3:50 pm

Grind, thank you. :D Now I understand.
Do sgdk have some chat where I can ask some questions? I have so many of them and I just don’t want to open new tread for each one.

Stef
Very interested
Posts: 2976
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Scrolling only one row.

Post by Stef » Sat Sep 14, 2019 6:07 pm

Oh sorry I read too quickly your message :oops:
Indeed it was related to how you passed parameters.
Also there is a Discord server for SGDK, you have the link in the SGDK readme.txt file.

Post Reply