Graphic tutorials?

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
MiKA-
Posts: 6
Joined: Sat Mar 04, 2006 12:06 am

Graphic tutorials?

Post by MiKA- »

Hi,

I started coding to PSP near the christmas by first borrowing some C-programming books from my library, and then I read all Yealdarb's programming tutorials, so I know a little bit of coding now.

But for now, I'd like to see some graphical samples, like making a bouncing ball or box to the screen (Just like the one in the msgdialog-sample of PSP-SDK, but without those dialogs)

Also, I'd like to know how could I make those text lines which I printed with "pspDebugScreenPrintf" command to bounce/scroll over the scree?


Thanks already for all your answers, hopefully somebody knows where to find graphical samples and how to make that text bounce/scroll :)


Cheers,
Mika-
Koba
Posts: 59
Joined: Thu Sep 29, 2005 10:57 am

Post by Koba »

basically for things like moving text, you cannot use printf, you woulld need to use the function that Brad gives you in one of his tutorials, its

Code: Select all

printTextScreen(x, y, char, color);
to make that text move around, just put it in a for loop,

Code: Select all

for(;;) {
make an x and y integer

Code: Select all

int x = 10;
int y = 50;
then make a char

Code: Select all

char thistext[50];
now put text into the char

Code: Select all

sprintf(thistext, "Bouncing text test");
then print your text

Code: Select all

printTextScreen(x, y, thistext, black);
(make sure you have a rgb color for that command, hence i used black) then simply add one to x and y everytime it loops

Code: Select all

x++;
y++;
then of course close your for loop and what not, i'm not going to walk you through bounding it off the walls as you can probably figure it out from there, if not there are plenty of animation tutorials on the web. hope this kinda helps.
MiKA-
Posts: 6
Joined: Sat Mar 04, 2006 12:06 am

Post by MiKA- »

Koba wrote:basically for things like moving text, you cannot use printf, you woulld need to use the function that Brad gives you in one of his tutorials
Actually, that helped a lot, thanks! :)

EDIT:
Koba wrote:if not there are plenty of animation tutorials on the web
Could you give me a link to those animation tutorials, I was trying to google them but I got nothing :( Thanks already if you can!
sg57
Posts: 144
Joined: Fri Oct 14, 2005 2:26 pm

Post by sg57 »

Simply make an array of Image pointers and blit the first one, then just increase the array element number by 1 and the next image will blit, making an animation if timed right to not go too fast or slow.

animation with 3 images

Code: Select all

Image* array[3];
array[0] = loadImage("image.png");
array[1] = loadImage("image2.png");
array[2] = loadImage("image3.png");
  
// ALL THE OTHER IMAGE BLITTING OPERATIONS GO HERE //

int x = 0;
int i;

while(1) {
    blitAlphaImageToScreen(0, 0, 480, 272, array[x], 0, 0);
    for&#40;i=0; i<10; i++&#41; x++;
&#125;
That should work, but I did leave out some basic Image Loading functions, so just place them in there as I am tired right now and dont have the energy to.
Post Reply