#168891 - iainprice - Mon Jun 01, 2009 7:56 pm
Can you draw text over an image on a screen?
I am using mode 5:
videoSetModeSub(MODE_5_2D);
Do I need similar to this:
consoleInit(0, 1, BgType_Text4bpp, BgSize_T_256x256, 31, 0, 0, 0);
as:
consoleDemoInit();
is not happy
which settings do I need please?
Thanks.
#168916 - SteveH - Tue Jun 02, 2009 2:20 pm
What type of text are you after?
As my graphical console replacement was wrote using MODE_5_2D to test everything.
If your only after putting up simple scores, etc then you can role your own text ourput code, or use one of the two consoles available (mine, or the one that comes with libnds).
Out of the 3 options I think the best one would be to use mine, mind you it uses a 16-bit bitmap (at the moment), and background 3 (I think its possible to change the order the backgrounds are drawn). The reason I'm saying this is that you can use a custom font (some are provided) and there is a font editor available but it's for DOS16 (wrote in pascal), I've got a bmp2bmf converter wrote, but it needs a couple of minor issues fixed before I release it as it's rather limited at the moment.
My post on the forums is here and you can visit my blog for more information / screen shots here
Edit - I forgot to actually answer your question:
And according to the libnds docs what you have put is nearly correct:
consoleInit(NULL, 1, BgType_Text4bpp, BgSize_T_256x256, 31, 0, false, false); // Assuming your using the sub screen.
Just make sure that your map base and tile base are set to the correct values so that you don't overwrite any of your screen.
#168948 - iainprice - Thu Jun 04, 2009 7:43 pm
Am still having issues... I hate layers and memory blocks.....
vramSetBankA(VRAM_A_TEXTURE);
vramSetBankB(VRAM_B_TEXTURE_SLOT1);
vramSetBankC(VRAM_C_SUB_BG);
vramSetBankD(VRAM_D_TEXTURE_SLOT2);
vramSetBankE(VRAM_E_MAIN_BG);
vramSetBankF(VRAM_F_MAIN_SPRITE);
videoSetMode(MODE_5_2D | MODE_0_3D);
videoSetModeSub(MODE_5_2D);
consoleInit(NULL, 1, BgType_Text8bpp, BgSize_T_256x256, 31, 0, false, false);
//layer, type, size, offset, 0forbmp 1fortile
bg3 = bgInit(3, BgType_Bmp8, BgSize_B8_256x256, 0,0);
bg2s = bgInitSub(2, BgType_Bmp8, BgSize_B8_256x256, 3,0);
bg3s = bgInitSub(3, BgType_Bmp8, BgSize_B8_256x256, 6,0);
printf("Test");
bgSetPriority(bg0s, 3);
bgSetPriority(bg1s, 2);
bgSetPriority(bg2s, 1);
bgSetPriority(bg3s, 0);
any ideas? how do i shuffle things?
#168955 - SteveH - Fri Jun 05, 2009 12:03 pm
Err I don't think you can mix MODE_5_2D & MODE_0_3D... as they give different output options - you can only have MODE_X_2D or MODE_x_3D AFAIK...
And that's as far as my 3D knowledge goes XD
#168956 - sverx - Fri Jun 05, 2009 2:06 pm
right! I didn't notice that
Code: |
videoSetMode(MODE_5_2D | MODE_0_3D); |
before... maybe you meant to
Code: |
videoSetMode(MODE_5_3D); |
?
#168959 - iainprice - Fri Jun 05, 2009 5:30 pm
The 2d and 3d means I can have srites on a 3d screen, anyway, the main screen works fine, it's the sub screen where I want to display a graphic and then use a font over the top, either custom or standard, don't mind....
Any suggetsions for layers/memory to make sub screen work?
Thanks
#168983 - sverx - Mon Jun 08, 2009 9:09 am
iainprice wrote: |
Any suggetsions for layers/memory to make sub screen work? |
128 KB (VRAM bank C) should be enough for console output and a 256x256 8 bit BMP... maybe you're just assigning wrong offsets... check 'where' the consoleInit locates the maps and the tiles in the VRAM.
#169028 - iainprice - Tue Jun 09, 2009 10:50 pm
Can anyone just give me a snippet that displays an image on the bottom screen in mode 5 and then puts console text over top? I'll piece it togther into mine later :) Thanks.
#169216 - iainprice - Tue Jun 23, 2009 9:23 pm
Still having problems....
image displayed.
text displayed.
band of rubbish across screen about 2/3 way down and some palette corruption.... any ideas?
[code]
vramSetBankA(VRAM_A_TEXTURE);
vramSetBankB(VRAM_B_TEXTURE_SLOT1);
vramSetBankC(VRAM_C_SUB_BG);
vramSetBankD(VRAM_D_TEXTURE_SLOT2);
vramSetBankE(VRAM_E_MAIN_BG);
vramSetBankF(VRAM_F_MAIN_SPRITE);
vramSetBankG(VRAM_G_LCD);
videoSetMode(MODE_5_2D | MODE_0_3D);
videoSetModeSub(MODE_5_2D);
bg3 = bgInit(3, BgType_Bmp8, BgSize_B8_256x256, 0,0);
bg2s = bgInitSub(2, BgType_Bmp8, BgSize_B8_256x256, 3,0);
bg3s = bgInitSub(3, BgType_Bmp8, BgSize_B8_256x256, 6,0);
dmaCopy(titleBitmap, bgGetGfxPtr(bg3), 256*192);
dmaCopy(mainmenuBitmap, bgGetGfxPtr(bg3s), 256*192);
consoleInit(0,1, BgType_Text4bpp, BgSize_T_256x256, 31,0, false, true);
[/code]
#169217 - SteveH - Tue Jun 23, 2009 9:26 pm
That band of rubbish is the console's tile set - I take it it's a blue-ish lines approx 3-4 pixels in height?
You just need to move the console map and tile base around, I can not give the exact numbers to use as it will be different for each user.
#169218 - iainprice - Tue Jun 23, 2009 9:59 pm
Do you mean 0x60000 etc on the vram?
#169219 - SteveH - Tue Jun 23, 2009 10:36 pm
iainprice wrote: |
Do you mean 0x60000 etc on the vram? |
No I mean that you will have to play around with the 31,0 in the following line:
Code: |
consoleInit(0,1, BgType_Text4bpp, BgSize_T_256x256, 31,0, false, true); |
#169220 - iainprice - Tue Jun 23, 2009 10:54 pm
Thanks, will try......
#169470 - silent_code - Tue Jul 14, 2009 3:37 pm
I don't know whether or not this is still an issue, so I'll try to help anyway. :^)
This is the console setup I use in the currently unreleased version of my VSD (you can download an older version from my web page):
Code: |
PrintConsole *pConsole = consoleInit(NULL, 0, BgType_Text8bpp, BgSize_T_256x256, 0, 1, false, false); |
I use a custom font, so you will have to flip the appropriate flag in that call.
This is the background configuration I use to display regular 8x8 8bpp (the default font is 4bpp color, don't forget to set that in the console and background setup) color text in front of an 8bpp color image, with VRAM bank C assigned to the sub-engine's backgrounds (nothing fancy):
Code: |
videoSetModeSub(MODE_5_2D);
bgs0id = bgInitSub(0, BgType_Text8bpp, BgSize_T_256x256, 0, 1);
bgs3id = bgInitSub(3, BgType_Bmp8, BgSize_B8_256x256, 2, 0); |
If you do not need access to BG0 via the identifier, you don't need to set it up, the console initialization should do it for you.
I hope that helps.
Regards,
Rob
PS: Even though the last VSD release was meant to be the final one, I am preparing a new one with a few fixes, some new features and most importantly, compatibility with the new libnds and toolchain. I should be able to release it this week, as all I'm doing now is to clean up the code and reorganize it slightly.
_________________
July 5th 08: "Volumetric Shadow Demo" 1.6.0 (final) source released
June 5th 08: "Zombie NDS" WIP released!
It's all on my page, just click WWW below.