(Final)8-Bit and 16c Backgrounds - Rotation

Learn to use DS Game Maker by Example!

(Final)8-Bit and 16c Backgrounds - Rotation

Postby Foxi4 » February 18th, 2012, 4:02 am

This is an extension for the previous Raster tutorial. It basically shows how to achieve three things:

1. How to display variables in 16c Text by use of sprintf.
2. How to display Bitmaps in 8-Bit Mode.
3. How to Rotate according to a pre-set Axis, Zoom and Scroll a Raster Layer.

Please, do post questions in case the commenting is unclear.

Cheers!

Instructions:

L/R - Rotation Left/Right
Up/Down/Left/Right - Rotation Axis manipulation
A/B/X/Y - Scrolling
Start/Select - Zoom In/Out


PS: By god, I cannot make this work in NO$GBA. I strongly suggest using either Desmume or an actual DS - on nither have I experienced any technical issues. NO$GBA shows alot of glitching for some reason which is not present on the actual hardware.
Attachments
8-Bit and 16c Text with Backgrounds.dsgm
(27.88 KiB) Downloaded 76 times
Current Projects:

FalloutDS: Postponed until proper libraries are created, 10%
Foxi_Lib: A completely revised version of NitroSprites[FINAL], NitroBackgrounds and NitroText[FINAL], 40%
Foxi4
 
Posts: 1119
Joined: December 31st, 2010, 3:25 am

Re: (Final)8-Bit and 16c Backgrounds - Rotation

Postby Buck_7 » February 18th, 2012, 9:08 pm

How do you convert the backgrounds to be rotatable? I couldn't get that part to work. I saved a bcakground as an 8 - bit bmp, then used PagFX to convert to Map and Pal.
Upcoming games I'm working on:
  • Minecraft2DS
  • Bow Man DS
  • Bird poo!
------------------------------------------------------------------------
COOL LOOK 3D portal port for DS! http://drunkencoders.com/2013/01/dstal-advance/
needMusic?needHelp?Ask.
User avatar
Buck_7
 
Posts: 1001
Joined: February 19th, 2011, 1:44 am

Re: (Final)8-Bit and 16c Backgrounds - Rotation

Postby Foxi4 » February 18th, 2012, 11:03 pm

As long as the background is converted in PAGfx to be an 8bit Bitmap, you should be able to put it in the NitroFS folder and load the .bin and .pal files as shown in the example. You need to bear in mind though that the DS doesn't have a whole lot of memory, so don't go too crazy on the size of the background - these types of Bitmaps are only used for backgrounds that require special effects or rotation, they're not meant to be maps etc. :)

If you want a more efficient background that doesn't need Mode7 effects, just rotation, then I strongly suggest making a tile-based Rotating (Affine) background - they work on a very much similar principle to normal tiled backgrounds. I just may make a tutorial on that some other time.
Current Projects:

FalloutDS: Postponed until proper libraries are created, 10%
Foxi_Lib: A completely revised version of NitroSprites[FINAL], NitroBackgrounds and NitroText[FINAL], 40%
Foxi4
 
Posts: 1119
Joined: December 31st, 2010, 3:25 am

Re: (Final)8-Bit and 16c Backgrounds - Rotation

Postby Buck_7 » February 19th, 2012, 12:00 am

By the way...Is this 8-bit? Can you send me the pagfx background converter thing?
Last edited by Buck_7 on February 24th, 2012, 10:18 pm, edited 1 time in total.
Upcoming games I'm working on:
  • Minecraft2DS
  • Bow Man DS
  • Bird poo!
------------------------------------------------------------------------
COOL LOOK 3D portal port for DS! http://drunkencoders.com/2013/01/dstal-advance/
needMusic?needHelp?Ask.
User avatar
Buck_7
 
Posts: 1001
Joined: February 19th, 2011, 1:44 am

Re: (Final)8-Bit and 16c Backgrounds - Rotation

Postby Foxi4 » February 19th, 2012, 12:36 am

Yeah, that's 8-Bit.

PAGfx should be bundled with the standard PAlib installation, it's in the "tools" directory. Seeing that their website is dead, I took the liberty of uploading the toolchain. Here:

http://www.mediafire.com/?zue6zau68kzjzi4

All you have to do is put your 8-bit graphic into the Backgrounds tab and convert it to an 8-Bit Bitmap. The result should be a .bin and a .pal file. :)
Current Projects:

FalloutDS: Postponed until proper libraries are created, 10%
Foxi_Lib: A completely revised version of NitroSprites[FINAL], NitroBackgrounds and NitroText[FINAL], 40%
Foxi4
 
Posts: 1119
Joined: December 31st, 2010, 3:25 am

Re: (Final)8-Bit and 16c Backgrounds - Rotation

Postby Buck_7 » February 19th, 2012, 12:47 am

Thanks! It works now!!
Upcoming games I'm working on:
  • Minecraft2DS
  • Bow Man DS
  • Bird poo!
------------------------------------------------------------------------
COOL LOOK 3D portal port for DS! http://drunkencoders.com/2013/01/dstal-advance/
needMusic?needHelp?Ask.
User avatar
Buck_7
 
Posts: 1001
Joined: February 19th, 2011, 1:44 am

Re: (Final)8-Bit and 16c Backgrounds - Rotation

Postby Buck_7 » February 19th, 2012, 1:28 am

Does this only work with 256x192 backgrounds?
Upcoming games I'm working on:
  • Minecraft2DS
  • Bow Man DS
  • Bird poo!
------------------------------------------------------------------------
COOL LOOK 3D portal port for DS! http://drunkencoders.com/2013/01/dstal-advance/
needMusic?needHelp?Ask.
User avatar
Buck_7
 
Posts: 1001
Joined: February 19th, 2011, 1:44 am

Re: (Final)8-Bit and 16c Backgrounds - Rotation

Postby Foxi4 » February 19th, 2012, 2:48 am

Buck_7 wrote:Does this only work with 256x192 backgrounds?


Theoretically it should work with bigger backgrounds aswell, but I personally haven't tried yet. I barely use PAlib nowadays. Why? Are there any issues?
Current Projects:

FalloutDS: Postponed until proper libraries are created, 10%
Foxi_Lib: A completely revised version of NitroSprites[FINAL], NitroBackgrounds and NitroText[FINAL], 40%
Foxi4
 
Posts: 1119
Joined: December 31st, 2010, 3:25 am

Re: (Final)8-Bit and 16c Backgrounds - Rotation

Postby YoshiInAVoid » February 19th, 2012, 5:09 pm

Should be a multiple of 256 I imagine. EG: 512x512 if you want a bigger than 256x192 background.
Sorry, Jack, YoshiInAVoid's back!

I'm the original; I'll take your breath away! This fall, YoshiInAVoid rules! Did you miss me, Andy? I sure missed you!

Keep an eye out for me.
YoshiInAVoid
 
Posts: 1985
Joined: December 30th, 2010, 11:53 am
Location: England

Re: (Final)8-Bit and 16c Backgrounds - Rotation

Postby Foxi4 » February 19th, 2012, 6:28 pm

YoshiInAVoid wrote:Should be a multiple of 256 I imagine. EG: 512x512 if you want a bigger than 256x192 background.


I thought so too, but on the otherhand, these are not tiled graphics, so they don't really share the same limitations. I just might test displaying other sizes of bitmaps when I relog on my "dev" computer. ;)
Current Projects:

FalloutDS: Postponed until proper libraries are created, 10%
Foxi_Lib: A completely revised version of NitroSprites[FINAL], NitroBackgrounds and NitroText[FINAL], 40%
Foxi4
 
Posts: 1119
Joined: December 31st, 2010, 3:25 am

Re: (Final)8-Bit and 16c Backgrounds - Rotation

Postby YoshiInAVoid » February 19th, 2012, 8:52 pm

I've never really tried non-tiled backgrounds before so I'm a complete noob at them :) I must get round to looking at the starwars text demo again! That was totally awsome! Wait... I think it used mode7, did it?

EDIT: 8bit text on a mode7 screen:
Code: Select all
// This example shows how to use 8 bit backgrounds,
// on which you can draw with the stylus or show text in different sizes, colors, or rotations

// Includes
#include <PA9.h>       // Include for PA_Lib



char starwarstext[20][100] = {
   "Star Wars Text Demo",
   "",
   "Brought to you",
   "by Mollusk,",
   "who got bored one",
   "thursday evening...",
   "",
   "Works pretty well ;)",
   "",
   "But it's completely",
   "USELESS !!!",
   ".",
   "..",
   "...",
   "THE END !"
};



// Function: main()
int main()
{
   PA_Init();    // Initializes PA_Lib
   
   // Let's put some colors... in the background palettes
   PA_SetBgPalCol(0, 1, PA_RGB(31, 31, 31));
   PA_SetBgPalCol(1, 1, PA_RGB(31, 31, 31));
   
   // Init an 8bit bg...
   PA_InitBig8bitBg(0, 3); // A big one ^^
   PA_Init8bitBg(1, 3);

   s16 i;
   
   PA_CenterSmartText(1, 10, 60, 245, 100, "Star Wars Text Demo", 1, 4, 0);
   
   // Infinite loop to keep the program running
   while (1)
   {
   
      PA_InitMode7(3); // Init Mode7 style for the star wars effect
   
      // Values that look good...
      PA_Mode7Height(32000);
      PA_Mode7MoveLeftRight(-128);
      PA_Mode7MoveForwardBack(150);
   
      for (i = 0; i < 15; i++)   PA_CenterSmartText(0, 20, 16+i*16, 235, 36+i*16, starwarstext[i], 1, 4, 1); // Draw the whole text
   
      for(i = 0 ; (i < 2048); i++) { // Scroll it star wars style
         if((i%5)==0) PA_Mode7MoveForwardBack(-1);
         PA_WaitForVBL();
      }
   
      PA_WaitFor(Stylus.Newpress); // Finished...
   
      PA_DeInitMode7();    // Reset Mode7
      PA_Clear8bitBg(0); // Erase screen
      

   
   }
   
   return 0;
} // End of main()

Source: C:\devkitPro\PAlib\examples\Text\8bit\StarWarsText\source
Sorry, Jack, YoshiInAVoid's back!

I'm the original; I'll take your breath away! This fall, YoshiInAVoid rules! Did you miss me, Andy? I sure missed you!

Keep an eye out for me.
YoshiInAVoid
 
Posts: 1985
Joined: December 30th, 2010, 11:53 am
Location: England

Re: (Final)8-Bit and 16c Backgrounds - Rotation

Postby Foxi4 » February 19th, 2012, 9:01 pm

Yup, those are Mode7 effects alright. Otherwise known as Nintendo Magic. ;P
Current Projects:

FalloutDS: Postponed until proper libraries are created, 10%
Foxi_Lib: A completely revised version of NitroSprites[FINAL], NitroBackgrounds and NitroText[FINAL], 40%
Foxi4
 
Posts: 1119
Joined: December 31st, 2010, 3:25 am

Re: (Final)8-Bit and 16c Backgrounds - Rotation

Postby Buck_7 » February 19th, 2012, 9:02 pm

How is that usable in DSGM 5? Or do you just use Programmers Notepad?
Upcoming games I'm working on:
  • Minecraft2DS
  • Bow Man DS
  • Bird poo!
------------------------------------------------------------------------
COOL LOOK 3D portal port for DS! http://drunkencoders.com/2013/01/dstal-advance/
needMusic?needHelp?Ask.
User avatar
Buck_7
 
Posts: 1001
Joined: February 19th, 2011, 1:44 am

Re: (Final)8-Bit and 16c Backgrounds - Rotation

Postby YoshiInAVoid » February 19th, 2012, 9:42 pm

Yup, DSGM doesn't support 3D, everyone knows that! You gotta "Hand Code" it with Programmer's Notepad.
Sorry, Jack, YoshiInAVoid's back!

I'm the original; I'll take your breath away! This fall, YoshiInAVoid rules! Did you miss me, Andy? I sure missed you!

Keep an eye out for me.
YoshiInAVoid
 
Posts: 1985
Joined: December 30th, 2010, 11:53 am
Location: England

Re: (Final)8-Bit and 16c Backgrounds - Rotation

Postby Foxi4 » February 19th, 2012, 9:44 pm

Mode7 in not 3D though and I can't see why it could not be initialized in DSGM5 - you can manage it using the exact same commands you'd use in a non-DSGM project, 'tis all PAlib.
Current Projects:

FalloutDS: Postponed until proper libraries are created, 10%
Foxi_Lib: A completely revised version of NitroSprites[FINAL], NitroBackgrounds and NitroText[FINAL], 40%
Foxi4
 
Posts: 1119
Joined: December 31st, 2010, 3:25 am

Re: (Final)8-Bit and 16c Backgrounds - Rotation

Postby YoshiInAVoid » February 19th, 2012, 9:45 pm

Well I know it doesn't work in DSGM 4.9b <. And I doubt that DSGM 5 > would support it.
Sorry, Jack, YoshiInAVoid's back!

I'm the original; I'll take your breath away! This fall, YoshiInAVoid rules! Did you miss me, Andy? I sure missed you!

Keep an eye out for me.
YoshiInAVoid
 
Posts: 1985
Joined: December 30th, 2010, 11:53 am
Location: England

Re: (Final)8-Bit and 16c Backgrounds - Rotation

Postby Foxi4 » February 19th, 2012, 10:06 pm

I'll check it out and post results if I get it working as I'm on my Dev Station right now. ;)
Current Projects:

FalloutDS: Postponed until proper libraries are created, 10%
Foxi_Lib: A completely revised version of NitroSprites[FINAL], NitroBackgrounds and NitroText[FINAL], 40%
Foxi4
 
Posts: 1119
Joined: December 31st, 2010, 3:25 am

Re: (Final)8-Bit and 16c Backgrounds - Rotation

Postby Foxi4 » February 20th, 2012, 12:06 am

Mollusk was right - Mode7 in PAlib is pretty damn useless. It works though.

Start/Select - Height modifier
A/B/X/Y - Scrolling speed
L/R - Angle

Again, glitching in NO$GBA - Desmume is recommended. There are also X/Z parameters but I can't find the correct "depth" to actually find my background so I left that out lol.
Attachments
Mode7.dsgm
(17.39 KiB) Downloaded 48 times
Current Projects:

FalloutDS: Postponed until proper libraries are created, 10%
Foxi_Lib: A completely revised version of NitroSprites[FINAL], NitroBackgrounds and NitroText[FINAL], 40%
Foxi4
 
Posts: 1119
Joined: December 31st, 2010, 3:25 am

Re: (Final)8-Bit and 16c Backgrounds - Rotation

Postby Commodore » February 20th, 2012, 12:22 am

Foxi, can't you "technically" do this for sprites too?
"Every puzzle has an answer." - Professor Layton
_______________________________________________________________________
December 17, 2012 - MegaMan 25th Anniversary
_______________________________________________________________________
Member of Memefefe's Squad
User avatar
Commodore
 
Posts: 557
Joined: August 10th, 2011, 4:39 pm

Re: (Final)8-Bit and 16c Backgrounds - Rotation

Postby Buck_7 » February 20th, 2012, 12:26 am

Woah, that's so cool! The possibilities!
Upcoming games I'm working on:
  • Minecraft2DS
  • Bow Man DS
  • Bird poo!
------------------------------------------------------------------------
COOL LOOK 3D portal port for DS! http://drunkencoders.com/2013/01/dstal-advance/
needMusic?needHelp?Ask.
User avatar
Buck_7
 
Posts: 1001
Joined: February 19th, 2011, 1:44 am

Next

Return to Tutorials & Examples

Who is online

Users browsing this forum: No registered users and 0 guests