How use PLAN_WINDOW for sgdk

SGDK only sub forum

Moderator: Stef

Post Reply
Mixail
Very interested
Posts: 94
Joined: Thu Nov 18, 2010 4:47 pm

How use PLAN_WINDOW for sgdk

Post by Mixail » Tue Jul 18, 2017 7:19 am

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".

Moon-Watcher
Very interested
Posts: 115
Joined: Sun Jan 02, 2011 9:14 pm

Re: How use PLAN_WINDOW for sgdk

Post by Moon-Watcher » Tue Jul 18, 2017 7:53 am

First of all you have to define and place it anywhere on the screen

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

Re: How use PLAN_WINDOW for sgdk

Post by Stef » Tue Jul 18, 2017 8:15 am

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).

Mixail
Very interested
Posts: 94
Joined: Thu Nov 18, 2010 4:47 pm

Re: How use PLAN_WINDOW for sgdk

Post by Mixail » Tue Jul 18, 2017 1:55 pm

You can show a simple example where you would simultaneously use PLAN_A, PLAN_B and PLAN_WINDOWS

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

Re: How use PLAN_WINDOW for sgdk

Post by Stef » Tue Jul 18, 2017 2:23 pm

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 :-/

Mixail
Very interested
Posts: 94
Joined: Thu Nov 18, 2010 4:47 pm

Re: How use PLAN_WINDOW for sgdk

Post by Mixail » Tue Jul 18, 2017 2:48 pm

Ok. Many thanks.

pitcrawler
Newbie
Posts: 2
Joined: Mon Jul 24, 2017 8:24 pm

Re: How use PLAN_WINDOW for sgdk

Post by pitcrawler » 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);

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

Re: How use PLAN_WINDOW for sgdk

Post by Grind » Fri Sep 08, 2017 1:13 pm

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.

pitcrawler
Newbie
Posts: 2
Joined: Mon Jul 24, 2017 8:24 pm

Re: How use PLAN_WINDOW for sgdk

Post by pitcrawler » Fri Sep 08, 2017 1:24 pm

That explains it, thanks.
I didn't know that memory sections were set up to overlap by default.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests