Gameboy Development Forum

Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)

You are not logged in.

Ads

#1 2014-09-10 04:18:15

danthai
New member
From: Brighton, UK
Registered: 2014-09-07
Posts: 6

Positioning Text with Sprites in Background

Hi,

Hopefully someone will reply with a nugget of wisdom.

I've built myself a nice sprite border around the screen and inside this border I want to type some text. However, when it tries to apply text inside the border, any Sprites behind and beneath the text is removed. Can anyone advice me on what methods I should be using?

Background with border :

http://www.pldm.co.uk/gb/border.png

Background with border and text :

http://www.pldm.co.uk/gb/border_text.png

Here's my code :

Code:

/* This array states that tile number 1 will be displayed */
unsigned char bgTiles[] = {1};

int drawMainBorder();
int showTitleScreen();
int drawTitle();

int showTitleScreen() {

    drawTitle();
    drawMainBorder();

}

int drawTitle() {
    gotogxy(4, 12);      
    gprintf("TEST COPY HERE!");
}

int drawMainBorder() {
   
   int x = 0;
   int y = 0;
  
   set_bkg_data(1, 2, bricks);
     
   for(y = 0; y < 18; y++) {
      set_bkg_tiles(0, y, 1, 1, bgTiles);
      set_bkg_tiles(19, y, 1, 1, bgTiles);
   }
     
   for(x = 0; x < 20; x++) {
      set_bkg_tiles(x, 0, 1, 1, bgTiles);
      set_bkg_tiles(x, 17, 1, 1, bgTiles);
    }  
  
   SHOW_BKG;
  
   return 0;
}

Alternatively if I call drawMainBorder() before drawTitle() I'm left with this :

http://www.pldm.co.uk/gb/just_text.png

Therefore, I'm assuming that I'm using the wrong print method (gprintf). Any ideas? Thanks in advance.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson