Page 1 of 1

How use PLAN_WINDOW for sgdk

Posted: Tue Jul 18, 2017 7:19 am
by Mixail
How use PLAN_WINDOW for sgdk?

VDP_drawTextBG (PLAN_WINDOW, "AAAAAA", 1, 1); - Does not work. Black screen.

VDP_drawTextBG (PLAN_B, "AAAAAA", 1, 1); Working. Displays an inscription "AAAAAA".

Re: How use PLAN_WINDOW for sgdk

Posted: Tue Jul 18, 2017 7:53 am
by Moon-Watcher
First of all you have to define and place it anywhere on the screen

Re: How use PLAN_WINDOW for sgdk

Posted: Tue Jul 18, 2017 8:15 am
by Stef
Indeed, you need to setup it first using these methods :

Code: Select all

void VDP_setWindowHPos(u16 right, u16 pos);
void VDP_setWindowVPos(u16 down, u16 pos);
Also you need to be sure to allocate enough VRAM for the window tilemap (you can relocate tilemap).

Re: How use PLAN_WINDOW for sgdk

Posted: Tue Jul 18, 2017 1:55 pm
by Mixail
You can show a simple example where you would simultaneously use PLAN_A, PLAN_B and PLAN_WINDOWS

Re: How use PLAN_WINDOW for sgdk

Posted: Tue Jul 18, 2017 2:23 pm
by Stef
PLAN_A and WINDOW are the same plan. See the window as a "fixed part" of the plan A with its own tilemap.
If you were expecting a third window plan, sorry but it is not the case :-/

Re: How use PLAN_WINDOW for sgdk

Posted: Tue Jul 18, 2017 2:48 pm
by Mixail
Ok. Many thanks.

Re: How use PLAN_WINDOW for sgdk

Posted: Fri Sep 08, 2017 1:03 pm
by pitcrawler
I found out something interesting with the window plane in SGDK when I was trying to get it to work.

I was trying to use the window plane to make a HUD at the bottom of my game screen. I spent an age trying to get it to work, looking through all the examples and tutorials I could find.

Tried one thing. Didn't work. Changed it a little. Still didn't work. For some unknown reason I just kept getting garbled tiles in the window plane.

Then I read somewhere that the game Quackshot used the window plane as a HUD in the same way. So I fired up an emulator, loaded Quackshot and checked the VDP registers. Whereas SGDK has the window plane address as 0xB000 by default, Quackshot had it set at 0xD000.

So at the beginning of my game, I added the following line:

Code: Select all

VDP_setWindowAddress(0xD000); 
Adding that line solved my window plane problems and didn't affect anything else. I'm not sure why it worked but it did.

Then the two lines I used to make setup the window plane along the bottom of the (NTSC) screen were:

Code: Select all

VDP_setWindowHPos(0, 0);
VDP_setWindowVPos(1, 27);

Re: How use PLAN_WINDOW for sgdk

Posted: Fri Sep 08, 2017 1:13 pm
by Grind
That happened because SGDK uses 0xB800 and 0xBC00 for the sprite list and horizontal scroll table by default, clobbering the bottom half of the PLAN_WINDOW.

If you are only using 64x32 plane size instead of 64x64 setting the window plane to 0xD000 should be fine. If you are using the default 64x64 size you are clobbering the bottom half of PLAN_B with PLAN_WINDOW now.

Re: How use PLAN_WINDOW for sgdk

Posted: Fri Sep 08, 2017 1:24 pm
by pitcrawler
That explains it, thanks.
I didn't know that memory sections were set up to overlap by default.

Re: How use PLAN_WINDOW for sgdk

Posted: Tue Jun 19, 2018 11:41 pm
by Cristiano Sword
pitcrawler wrote:
Fri Sep 08, 2017 1:03 pm
I found out something interesting with the window plane in SGDK when I was trying to get it to work.

I was trying to use the window plane to make a HUD at the bottom of my game screen. I spent an age trying to get it to work, looking through all the examples and tutorials I could find.

Tried one thing. Didn't work. Changed it a little. Still didn't work. For some unknown reason I just kept getting garbled tiles in the window plane.

Then I read somewhere that the game Quackshot used the window plane as a HUD in the same way. So I fired up an emulator, loaded Quackshot and checked the VDP registers. Whereas SGDK has the window plane address as 0xB000 by default, Quackshot had it set at 0xD000.

So at the beginning of my game, I added the following line:

Code: Select all

VDP_setWindowAddress(0xD000); 
Adding that line solved my window plane problems and didn't affect anything else. I'm not sure why it worked but it did.

Then the two lines I used to make setup the window plane along the bottom of the (NTSC) screen were:

Code: Select all

VDP_setWindowHPos(0, 0);
VDP_setWindowVPos(1, 27);
Hello guy,
I'm having a problem in the window plane, pq msm using VDP_setWindowAddress (0xD000);
still a lot of sprites are created in vram, and I can not clean with vdp_clearsprites, how can I solve it, I already tried several things and nothing :(