nesdev.com
http://forums.nesdev.com/

PVsneslib - SNES Learning path
http://forums.nesdev.com/viewtopic.php?f=12&t=14819
Page 1 of 1

Author:  RedScorpion [ Mon Sep 12, 2016 3:15 am ]
Post subject:  PVsneslib - SNES Learning path

Hi guys,

iam starting to use the PVsneslib for my smart project and work with the most examples of this toolchain.

Until now, i know how it works and how i can create and use tiles, fonts and so on.

Now, i want to combine the Mode 1 function with the textfunction.

I want create a background and a text in the front, but in my current case, the emualtor shows either the background or the text.

Could you give me a hint?
Code:
#include <snes.h>

extern char snesfont;
extern char patterns, patterns_end;
extern char palette, palette_end;
extern char map, map_end;


//---------------------------------------------------------------------------------
int main(void) {
    // Initialize SNES
   consoleInit();
   consoleInitText(0, 1, &snesfont);   
   
   bgInitTileSet(0, &patterns, &palette, 0, (&patterns_end - &patterns), (&palette_end - &palette), BG_16COLORS, 0x4000);
   bgInitMapSet(0, &map, (&map_end - &map),SC_32x32, 0x0000);
   setMode(BG_MODE2,0);  bgSetDisable(1); bgSetDisable(2);
   
   consoleSetTextCol(RGB15(31,31,31),  RGB15(31,31,31));
   consoleDrawText(10,10,"Hello World !");
   
   // Wait for nothing :P
      
   while(1) {
      WaitForVBlank();
   }
   return 0;
}


My data.asm

Quote:
.include "hdr.asm"

.section ".rodata1" superfree

snesfont:
.incbin "pvsneslibfont.pic"

.ends

.section ".rodata2" superfree
patterns:
.incbin "Back.pic"
patterns_end:

map:
.incbin "Back.map"
map_end:

palette:
.incbin "Back.pal"
palette_end

.ends


With this code, the rom shows the background. No textmessages.

Thanks in advance

red

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/