gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > PAlib Adventures - Problem , question

#98307 - Erith - Mon Aug 14, 2006 4:12 pm

Hi Guys!

I'm trying to develop someting on my DS using PAlib.

I will post every problem and question in this topic, hoping you guys can help me!

Trouble:
1) I'm having some problems with graphic conversion with PAGfx, I create my sprites in CorelDraw r 13 and save in bmp, jpg, or png but when i try to convert it the application Closes suddenly. If you need I can Post the bitmap i'm trying to convert(Sprite conversion).

2) I tested stylus funcionality, by dragging arround a Sprite, but on my DS (supercard) or on any emulator I have allways the same problem.
If the sprite is dragged on the right or left bottom corner, it stiks there and i cant move it anymore..

Here The code I used:

Code:
// Includes
#include <PA9.h>       // Include for PA_Lib
#include "gfx/gioca.pal.c"
#include "gfx/gioca.c"
#include "gfx/titolo.pal.c"
#include "gfx/titolo.c"






// Function: main()
int main(int argc, char ** argv)
{

   PA_Init();    // Initializes PA_Lib
   PA_InitVBL(); // Initializes a standard VBL
   
   PA_LoadTiledBg(1, // screen
         3, // background number (0-3)
         titolo); // Background name, used by PAGfx...
   
   PA_LoadSpritePal (0,0,(void*)gioca_Pal);
   PA_CreateSprite(0,0,(void*)gioca_Sprite,OBJ_SIZE_64X32,
   1,0,96,100);   
   
   
   // Infinite loop to keep the program running
   while (1)
   {
   
   if(PA_SpriteTouched(0) && Stylus.Held==1) {
   PA_SetSpriteXY(0,0,Stylus.X-32,Stylus.Y-16);
   
   }
      PA_WaitForVBL();
   }
   
   return 0;
} // End of main()


Question:

-- Do I have Any Chance to get a sprite bigger than 64x64? (like in Bleach DS, where the sprites are very big) Thanks Guys For everything!

#98309 - retrohead - Mon Aug 14, 2006 4:24 pm

Quote:
1) I'm having some problems with graphic conversion with PAGfx, I create my sprites in CorelDraw r 13 and save in bmp, jpg, or png but when i try to convert it the application Closes suddenly. If you need I can Post the bitmap i'm trying to convert(Sprite conversion).


When you convert with PAGfx, all your files must be the same colour depth, i.e. all 256colours.

Also all your images must one of the restricted widths 8px 16px 32px 64px for sprites.

Quote:
2) I tested stylus funcionality, by dragging arround a Sprite, but on my DS (supercard) or on any emulator I have allways the same problem.
If the sprite is dragged on the right or left bottom corner, it stiks there and i cant move it anymore..


I have no idea sorry :(
*EDIT* IDEA - Perhaps stop the sprite moving into the area that it gets stuck. You could output some debug text to the screen showing the x and y position of the sprite then take a note of where it gets stuck. You can then stop the styus working when it reaches the rim of tat area, just an idea for a quick fix.

Quote:
-- Do I have Any Chance to get a sprite bigger than 64x64? (like in Bleach DS, where the sprites are very big) Thanks Guys For everything!


The only way i found for doing this was by using multipla sprites for creating the large sprite.

For example:
To create a 128x128 sprite you need to use 4* 64x64 sprites.

I did see a method for using a 128x128 sprite

1. Create your sprite 128x128
2. PAGfx the sprite
3. Load and create the sprite as 64x64
4. Use double size to make the sprrites canvas 128x128.

The above method didn't work for me and all i ended up with were blank sprites. I resorted to my first suggestion.

#98343 - omaremad - Mon Aug 14, 2006 8:10 pm

I think the graphics have to be palletted in photoshop/gimp etc...

#98405 - Lynx - Tue Aug 15, 2006 1:22 am

If you test out a lot of the PAlib released homebrew, you will see the exact same thing with the sprites sticking to the bottom of the screen.. So, it's either a PAlib issue or tutorials not explaining the proper way to handle sprites so they don't get stuck at the bottom of the screen.
_________________
NDS Homebrew Roms & Reviews

#98654 - Erith - Wed Aug 16, 2006 7:56 pm

Thanks Guys For Everything!

Now another problem...

if i add in my previsious code

Code:
u8 prova;
(also just declaring a variable)

I get an error from the compiler !!!

Code:
 void value not ignored as it ought to be


I tryed to put the variable before and next to the main function...

What can i do?

I got one more problem:

I want that a sprite disappear if i put it on another...
then i wrote ths code:

Code:
if(PA_SpriteTouched(1)&& preso==1 && Stylus.Released==1){PA_DeleteSprite(0,0);


But so, nothing happens if I put it on the second and if I delete from the code
Code:
Stylus.Released==1

The sprite disappears suddenly when I comes on the other sprite's corner...


Sorry for my bad English.

#98805 - Erith - Thu Aug 17, 2006 6:28 pm

Ok, i solved that problem, but now i have another one!


Code:
// Includes
#include <PA9.h>       // Include for PA_Lib
#include "gfx/gioca.pal.c"
#include "gfx/gioca.c"
#include "gfx/titolo.pal.c"
#include "gfx/titolo.c"
#include "gfx/cartaccia.pal.c"
#include "gfx/cartaccia.c"
#include "gfx/cestino.pal.c"
#include "gfx/cestino.c"


u8 preso=0;
u8 cestix;
u8 cesty;
s16 nposx;
s16 nposy;


// Function: main()
int main(int argc, char ** argv)
{
   
   PA_Init();    // Initializes PA_Lib
   PA_InitVBL(); // Initializes a standard VBL
   
   PA_LoadTiledBg(1, // screen
         3, // background number (0-3)
         titolo); // Background name, used by PAGfx...
   
   PA_LoadSpritePal (0,0,(void*)cartaccia_Pal);
   PA_CreateSprite(0,0,(void*)cartaccia_Sprite,OBJ_SIZE_32X32,
   1,0,150,100);   
   PA_LoadSpritePal (0,1,(void*)cestino_Pal);
   PA_CreateSprite(0,1,(void*)cestino_Sprite,OBJ_SIZE_64X64,
   1,1,10,10);
   // Infinite loop to keep the program running
   
   while (1)
   {
   PA_InitRand();
   nposx=PA_RandMinMax (-1, 1);
   nposy=PA_RandMinMax (-1, 1);
   PA_SetSpriteX(0,1,cestix=cestix+nposx);
   PA_SetSpriteY(0,1,cesty=cesty+nposy);
   if(PA_SpriteTouched(0) && Stylus.Held==1) {
   PA_SetSpriteXY(0,0,Stylus.X-16,Stylus.Y-16); preso=1; cestix=PA_GetSpriteX(0,1); cesty=PA_GetSpriteY(0,1);
   }
   
   if(Stylus.Released && PA_StylusInZone(cestix, cesty, cestix+64, cesty+64)){PA_DeleteSprite(0,0);}
   
   
      PA_WaitForVBL();
   }
   
   return 0;
} // End of main()


I want that the trash moves randomly but it moves always diagonally.

Here the nds compiled file.

http://www.uppo.it/storage/57ce0aa7a162ee1ab4d863cf563b1164.nds

Please Help me!

#98829 - dustin - Thu Aug 17, 2006 9:10 pm

Have you tried it on hardware and not in an emulator because I have found that some emulators don't like PA_Rand and always give the same number.
_________________
www.thrivepresents.com
palib.dustin.info

#98857 - Erith - Fri Aug 18, 2006 1:36 am

Yeah Dustin that's right, if I put it into the supercard and in the ds works good.
Tnx.

#98905 - Erith - Fri Aug 18, 2006 12:14 pm

Let's go on a higher level.

3d... How To?

I'm a 3d modeler and with my 3d program I can export:

3ds
stl
xml
direct 3d
dxf
fbx
quickdraw3d
uzr
vrml
obj


What can I do to see my model on my NDS?

I saw a bin file on the toon_shading example on the devikit examples (not pa_lib) and it seems like that it's the 3d model...

I've tried it and this one works on my ds but all the palib 3d eamples and some devkit nds 3d examples (on devkitPro\examples\nds\Graphics\3D)
expecially the Nehe tutorials don't work on the ds or emu...

Please Help!

#99011 - Sausage Boy - Sat Aug 19, 2006 1:24 am

What 3d program are you using? I believe tciny is working on an exporter for Maya. There are no good exportion and conversion tools for DS 3d yet, you'll either have to write your own or wait and see.
_________________
"no offense, but this is the gayest game ever"

#99341 - Erith - Sun Aug 20, 2006 9:26 pm

I'm using C4d.
I would write a PHP program that can convert for example VRML in the DS format (i mean a HRF (human readable format) ) so I can include as file dot Cpp this one... Here an example tha shows how a vrml2 works:

Code:
#VRML V2.0 utf8

#Created by CINEMA 4D

DEF Platonico Transform {
  children [
    Shape {
      appearance Appearance {
        material Material {
        }
      }
      geometry DEF FACESET_Platonico IndexedFaceSet {
        ccw FALSE
        solid FALSE
        coord Coordinate {
          point [ -80.901703 50 0,-80.901703 -50 0,-50 0 80.901703,50 0 80.901703,80.901703 50 0,
            80.901703 -50 0,50 0 -80.901703,-50 0 -80.901703,0 80.901703 50,0 80.901703 -50,
            0 -80.901703 -50,0 -80.901703 50
          ]
        }
        texCoord TextureCoordinate {
          point [ 0.5 0,1 1,1 1,
            0 1,0.5 0,0 1,0.5 0,1 1,
            0.5 0,0 1,1 1,0 1,0.5 0,
            1 1,0.5 0,1 1,0 1,1 1,
            0 1,0.5 0,1 1,0 1,0.5 0,
            0 1,1 1,0 1,1 1,0.5 0,
            1 1,0.5 0,1 1,0 1
          ]
        }
        coordIndex [ 9,8,0,-1,8,2,0,-1,8,3,2,-1,8,4,3,-1,
          8,9,4,-1,4,9,6,-1,6,9,7,-1,9,0,7,-1,
          11,10,1,-1,2,11,1,-1,2,3,11,-1,3,5,11,-1,
          5,10,11,-1,5,6,10,-1,6,7,10,-1,7,1,10,-1,
          1,7,0,-1,2,1,0,-1,4,5,3,-1,4,6,5,-1
        ]
        texCoordIndex [ 25,24,0,-1,23,7,0,-1,23,10,6,-1,23,13,8,-1,
          23,26,12,-1,11,26,19,-1,18,26,22,-1,25,1,22,-1,
          31,28,4,-1,5,30,4,-1,5,10,29,-1,9,15,29,-1,
          16,28,29,-1,16,17,27,-1,18,20,27,-1,21,2,27,-1,
          3,20,0,-1,5,2,0,-1,11,15,8,-1,11,17,14,-1
        ]
      }
    }
  ]
}
DEF Timer TimeSensor {
  startTime 0
  stopTime 0
  cycleInterval 3
  loop TRUE
}


I think is pretty easy (ok i think XML is better) and the last one Timer time sensor is for animation... but it doesn't work with bones... it works only with PLA (point level animation) easier to calculate for the hardware but the file will be bigger!

That's my 2 cents... Any Idea?